Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 3.36 KB

nf-wdm-exinterlockedcompareexchange64.md

File metadata and controls

94 lines (63 loc) · 3.36 KB
UID title description old-location 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.ExInterlockedCompareExchange64
ExInterlockedCompareExchange64 macro (wdm.h)
The ExInterlockedCompareExchange64 routine compares one integer variable to another and, if they are equal, sets the first variable to a caller-supplied value.
kernel\exinterlockedcompareexchange64.htm
kernel
04/30/2018
ExInterlockedCompareExchange64 macro
ExInterlockedCompareExchange64, ExInterlockedCompareExchange64 routine [Kernel-Mode Driver Architecture], k102_424c24f9-3965-40fd-b02b-f9bf1f7df4ec.xml, kernel.exinterlockedcompareexchange64, wdm/ExInterlockedCompareExchange64
wdm.h
Wdm.h, Ntddk.h, Ntifs.h
Universal
Available starting with Windows 2000.
NtosKrnl.lib
NtosKrnl.exe
Any level (see Remarks section)
Windows
ExInterlockedCompareExchange64
wdm/ExInterlockedCompareExchange64
APIRef
kbSyntax
DllExport
NtosKrnl.exe
ExInterlockedCompareExchange64

ExInterlockedCompareExchange64 macro

-description

The ExInterlockedCompareExchange64 routine compares one integer variable to another and, if they are equal, sets the first variable to a caller-supplied value.

-parameters

-param Destination [in, out]

A pointer to an integer that will be compared and possibly replaced.

-param Exchange [in]

A pointer to an integer that will replace the one at Destination if the comparison results in equality.

-param Comperand

A pointer to an integer with which the value at Destination will be compared.

-param Lock [in]

A pointer to a caller-allocated spin-lock that is used if the host system does not support an 8-byte atomic compare-and-exchange operation.

-remarks

This macro wraps InterlockedCompareExchange64 or ExfInterlockedCompareExchange64 and assumes the return value of the type LONGLONG.

ExInterlockedCompareExchange64 tests and, possibly, replaces the value of a given variable. For most underlying microprocessors, this routine is implemented inline by the compiler to execute as an atomic operation. If a spin lock is used, this routine can only be safely used on nonpaged parameters.

If the Destination and Comparand are unequal, ExInterlockedCompareExchange64 simply returns the value of Destination.

ExInterlockedCompareExchange64 is atomic only with respect to other (Ex)InterlockedXxx calls.

Callers of ExInterlockedCompareExchange64 can be running at any IRQL. The storage for the Destination, Comparand, and Exchange parameter and the list entries must be resident at all IRQLs.

-see-also

InterlockedCompareExchange

InterlockedExchange

InterlockedExchangeAdd