The KeInitializeSpinLock routine initializes a variable of type KSPIN_LOCK.
void KeInitializeSpinLock( PKSPIN_LOCK SpinLock );
Pointer to a spin lock, for which the caller must provide the storage.
Storage for a spin lock 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.
This function is inlined for x64 systems from Windows XP till Windows 7.
Starting in Windows 8, this function is exported from
ntoskrnl.lib. As a result, if you are using the Windows 10 WDK to build a binary that runs on Windows 7 (and therefore you need NX pool usage to pass Windows 10 HLK tests), you must define
WIN9X_COMPAT_SPINLOCK. Otherwise, you may see
Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. (Code 39).
For more information about spin locks, see Spin Locks.
Callers of this routine can be running at any IRQL. Usually, a caller is running at IRQL = PASSIVE_LEVEL in an AddDevice routine.
|Minimum supported client||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|IRQL||Any level (see Remarks section)|
|DDI compliance rules||HwStorPortProhibitedDDIs|