Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 3.14 KB

nf-wdm-keinitializespinlock.md

File metadata and controls

80 lines (60 loc) · 3.14 KB
UID title description tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:wdm.KeInitializeSpinLock
KeInitializeSpinLock function (wdm.h)
The KeInitializeSpinLock routine initializes a variable of type KSPIN_LOCK.
kernel
01/05/2023
KeInitializeSpinLock function
KeInitializeSpinLock, KeInitializeSpinLock routine [Kernel-Mode Driver Architecture], k105_715eff59-827a-4d41-8e3a-2ce0d1f1181d.xml, kernel.keinitializespinlock, wdm/KeInitializeSpinLock
wdm.h
Wdm.h, Ntddk.h, Ntifs.h
Universal
HwStorPortProhibitedDDIs
NtosKrnl.lib
NtosKrnl.exe
Any level (see Remarks section)
Windows
KeInitializeSpinLock
wdm/KeInitializeSpinLock
APIRef
kbSyntax
DllExport
NtosKrnl.exe
KeInitializeSpinLock

-description

The KeInitializeSpinLock routine initializes a variable of type KSPIN_LOCK.

-parameters

-param SpinLock [out]

Pointer to a spin lock, for which the caller must provide the storage.

-remarks

This routine must be called before an initial call to KeAcquireSpinLock, to KeAcquireInStackQueuedSpinLock, or to any other support routine that requires a spin lock as an argument.

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.

-see-also

KeAcquireInStackQueuedSpinLock

KeAcquireInStackQueuedSpinLockAtDpcLevel

KeAcquireSpinLock

KeAcquireSpinLockAtDpcLevel

KeReleaseInStackQueuedSpinLock

KeReleaseInStackQueuedSpinLockFromDpcLevel

KeReleaseSpinLock

KeReleaseSpinLockFromDpcLevel