KfAcquireSpinLock

This function obtains exclusive use of whatever resource is protected by the given lock.

Declaration

KIRQL __fastcall KfAcquireSpinLock (KSPIN_LOCK *SpinLock);

Parameters

The SpinLock argument is the address of the lock that is to be acquired.

Return Value

The function returns the Interrupt Request Level (IRQL) that is to be restored when the lock is released.

Availability

The KfAcquireSpinLock function is exported by name from x86 builds of the HAL in version 3.50 and higher and of the kernel in version 6.2 and higher. The HAL’s export in version 6.2 and higher is merely a forward to the kernel.

Documentation Status

The KfAcquireSpinLock function is not documented. It has a C-language declaration in all known editions of the DDK or Windows Driver Kit (WDK) since at least the DDK for Windows NT 3.51.

Behaviour

The KfAcquireSpinLock function is a __fastcall improvement of the documented KeAcquireSpinLock. Starting at least from the Device Driver Kit (DDK) for Windows NT 3.51, a macro definition reinterprets the old function in terms of the new. Programmers continue to use the old and be none the wiser unless they look into the headers for the details. The old function continues to be exported but its implementation is only a thunk that reinterprets in terms of KfAcquireSpinLock just like the macro.

That KfAcquireSpinLock has all the substance is here treated just as a detail of internal organisation. As far as should concern any code outside the kernel or HAL, the behavour is all in KeAcquireSpinLock.