16.2.2 Initializing Spin Locks

Any NT driver must call KeInitializeSpinLock to initialize each executive spin lock it uses, before calling any support routine that requires access to a caller-supplied executive spin lock, such as the following routines:

·KeAcquireSpinLock and, subsequently, KeReleaseSpinLock

·KeAcquireSpinLockAtDpcLevel and, subsequently, KeReleaseSpinLockFromDpcLevel

·An ExInterlockedXxx routine

A lowest-level NT driver must call KeInitializeSpinLock to initialize an interrupt spin lock for which it provides storage before it calls IoConnectInterrupt and, subsequently, KeSynchronizeExecution to synchronize access to data and resources shared between its ISR (or ISRs) and SynchCritSection routines.