-#define KEBUGCHECKWITHTF(a,b,c,d,e,f) \
- DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f)
+/* The following macro satisfies the wait of a mutant dispatcher object */
+#define KiSatisfyMutantWait(Object, Thread) \
+{ \
+ /* Decrease the Signal State */ \
+ (Object)->Header.SignalState--; \
+ \
+ /* Check if it's now non-signaled */ \
+ if (!(Object)->Header.SignalState) \
+ { \
+ /* Set the Owner Thread */ \
+ (Object)->OwnerThread = Thread; \
+ \
+ /* Disable APCs if needed */ \
+ Thread->KernelApcDisable -= (Object)->ApcDisable; \
+ \
+ /* Check if it's abandoned */ \
+ if ((Object)->Abandoned) \
+ { \
+ /* Unabandon it */ \
+ (Object)->Abandoned = FALSE; \
+ \
+ /* Return Status */ \
+ Thread->WaitStatus = STATUS_ABANDONED; \
+ } \
+ \
+ /* Insert it into the Mutant List */ \
+ InsertHeadList(&Thread->MutantListHead, \
+ &(Object)->MutantListEntry); \
+ } \
+}
+
+/* The following macro satisfies the wait of any nonmutant dispatcher object */
+#define KiSatisfyNonMutantWait(Object, Thread) \
+{ \
+ if (((Object)->Header.Type & TIMER_OR_EVENT_TYPE) == \
+ EventSynchronizationObject) \
+ { \
+ /* Synchronization Timers and Events just get un-signaled */ \
+ (Object)->Header.SignalState = 0; \
+ } \
+ else if ((Object)->Header.Type == SemaphoreObject) \
+ { \
+ /* These ones can have multiple states, so we only decrease it */ \
+ (Object)->Header.SignalState--; \
+ } \
+}
+
+/* The following macro satisfies multiple objects in a wait state */
+#define KiSatisifyMultipleObjectWaits(FirstBlock) \
+{ \
+ PKWAIT_BLOCK WaitBlock = FirstBlock; \
+ PKTHREAD WaitThread = WaitBlock->Thread; \
+ \
+ /* Loop through all the Wait Blocks, and wake each Object */ \
+ do \
+ { \
+ /* Make sure it hasn't timed out */ \
+ if (WaitBlock->WaitKey != STATUS_TIMEOUT) \
+ { \
+ /* Wake the Object */ \
+ KiSatisfyObjectWait((PKMUTANT)WaitBlock->Object, WaitThread); \
+ } \
+ \
+ /* Move to the next block */ \
+ WaitBlock = WaitBlock->NextWaitBlock; \
+ } while (WaitBlock != FirstBlock); \
+}