Call_When_Not_Critical

include vmm.inc

mov     esi, CritSecCallback
mov     edx, RefData
VMMCall Call_When_Not_Critical
 

This function is not implemented in Windows 95. For Windows 3.11 and below, this function installs a critical-section callback function. The system calls this function when a virtual device releases the critical section. Uses Flags.

CritSecCallback
Address of the callback function to install. For more information, see CritSecCallback.
RefData
Address of reference data to pass to the callback function.

The system does not execute the callback until the current virtual machine's execution priority is less than the Critical_Section_Boost value even if the current virtual machine is not in a critical section. This allows a virtual device to release the critical section and process any simulated interrupts before the system calls the callback function.

Virtual devices can install any number of callback functions, but the system calls only the most recent function on the list when the critical section is released. The system removes the callback function from the list as it calls the function. This is a common point of confusion. Unlike services like Call_When_Task_Switched, which install a hook permanently, the Call_When_Not_Critical service removes the callback once it is dispatched.

Under Windows 95, use Call_Restricted_Event with PEF_Wait_Not_Crit, and cancel it with Cancel_Restricted_Event instead, since the Cancel_Call_When_Not_Critical function is a no-op.

If the critical section is taken when this function is called (it is necessary to schedule the event instead of immediately calling your function), it schedules a restricted event as follows:

xor    eax, eax        ; no boost
xor    ebx, ebx        ; global
mov    ecx, PEF_Wait_Not_Crit
 

VMMCall Call_Restricted_Event

See Also

Call_When_Idle, Call_When_Task_Switched, CritSecCallback