NdisInterlockedAddUlong macro

The NdisInterlockedAddUlong function adds an unsigned long value to a given unsigned integer as an atomic operation, using a caller-supplied spin lock to synchronize access to the integer variable.


void NdisInterlockedAddUlong(



A pointer to the variable for which the value is to be adjusted by the given Increment .


The value to be added to that at Addend .


A pointer to a caller-initialized spin lock.

Return Value



The caller of NdisInterlockedAddUlong must provide resident storage for the spin lock, which must be initialized with the NdisAllocateSpinLock function before the initial call to NdisInterlockedAddUlong.

The SpinLock value that is passed to the NdisInterlockedAddUlong function is used to assure that the addition to the variable at the Addend parameter is atomic with respect to any other operations on the same variable that synchronize with the same spin lock.

NdisInterlockedAddUlong raises the IRQL to DISPATCH_LEVEL when it acquires the given spin lock and restores the original IRQL before it returns control. Consequently, any driver function that calls NdisInterlockedAddUlong cannot be pageable code.


Minimum supported client Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisInterlockedAddUlong (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisInterlockedAddUlong (NDIS 5.1)) in Windows XP.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL Any level

See Also