Make sure to hold the DPC lock until the DPC list has been emptied

This fixes a crash in Lord of the rings: The fellowship of the ring
This commit is contained in:
ergo720 2023-03-10 17:20:07 +01:00 committed by RadWolfie
parent 8d92992a6b
commit 639f42c318
1 changed files with 1 additions and 2 deletions

View File

@ -462,7 +462,7 @@ void ExecuteDpcQueue()
// Set DpcRoutineActive to support KeIsExecutingDpc:
g_DpcData.IsDpcActive.test_and_set();
KeGetCurrentPrcb()->DpcRoutineActive = TRUE; // Experimental
LeaveCriticalSection(&(g_DpcData.Lock));
EmuLog(LOG_LEVEL::DEBUG, "Global DpcQueue, calling DPC object 0x%.8X at 0x%.8X", pkdpc, pkdpc->DeferredRoutine);
// Call the Deferred Procedure :
@ -472,7 +472,6 @@ void ExecuteDpcQueue()
pkdpc->SystemArgument1,
pkdpc->SystemArgument2);
EnterCriticalSection(&(g_DpcData.Lock));
KeGetCurrentPrcb()->DpcRoutineActive = FALSE; // Experimental
g_DpcData.IsDpcActive.clear();
}