/KiSignalSynchronizationObject.c Secret
Created
February 14, 2015 16:29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VOID KiSignalSynchronizationObject(PKPRCB Prcb, PDISPATCHER_HEADER SyncObject) | |
{ | |
PKWAIT_BLOCK WaitBlock,WaitBlockNext; | |
PLIST_ENTRY WaitListHead,WaitEntry; | |
/*the wait list head is in the DISPATCHER_HEADER structure*/ | |
WaitListHead = &SyncObject->WaitListHead; | |
WaitEntry = WaitListHead->Flink; | |
WaitBlock = CONTAINING_RECORD(WaitEntry,KWAIT_BLOCK,WaitListEntry); | |
WaitBlockNext = NULL; | |
/*Check if the wait list is empty*/ | |
while(WaitListHead != WaitEntry) | |
{ | |
/* | |
We will unlink and deal with a KWAIT_BLOCK structure update the WaitEntry to point to the next LIST_ENTRY | |
and also get a pointer to the KWAIT_BLOCK. | |
*/ | |
WaitEntry = WaitEntry->Flink; | |
WaitBlockNext = CONTAINING_RECORD(WaitEntry,KWAIT_BLOCK,WaitListEntry); | |
/*Unlink the current the wait block from the wait list*/ | |
WaitBlock->WaitListEntry.Blink->Flink = WaitBlock->WaitListEntry.Flink; | |
WaitBlock->WaitListEntry.Flink->Blink = WaitBlock->WaitListEntry.Blink; | |
if(WaitBlock->WaitType == WaitAny) | |
{ | |
if( KiTryUnwaitThread(Prcb,(NTSTATUS)WaitBlock->WaitKey,NULL,WaitBlock) ) | |
{ | |
/*break if the synchronization object became non-signaled*/ | |
if(--SyncObject->SignalState == 0) | |
break; | |
} | |
} | |
/*loc_45652E*/ | |
else | |
{ | |
KiTryUnwaitThread(Prcb,STATUS_KERNEL_APC,NULL,WaitBlock); | |
} | |
WaitBlock = WaitBlockNext; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment