The KeInitializeSemaphore routine initializes a semaphore object with a specified count and specifies an upper limit that the count can attain.
void KeInitializeSemaphore( PRKSEMAPHORE Semaphore, LONG Count, LONG Limit );
Pointer to a dispatcher object of type semaphore, for which the caller provides the storage.
Specifies the initial count value to be assigned to the semaphore. This value must be positive. A nonzero value sets the initial state of the semaphore to signaled.
Specifies the maximum count value that the semaphore can attain. This value must be positive. It determines how many waiting threads become eligible for execution when the semaphore is set to the signaled state and can therefore access the resource that the semaphore protects.
The semaphore object is initialized with the specified initial count and limit.
Storage for a semaphore object must be resident: in the device extension of a driver-created device object, in the controller extension of a driver-created controller object, or in nonpaged pool allocated by the caller.
For more information about semaphore objects, see Semaphore Objects.
|Minimum supported client||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||IrqlKeDispatchLte, PowerIrpDDis, HwStorPortProhibitedDDIs|