The InterlockedAndToUser function performs an atomic AND operation on a 32-bit value in user-mode memory.
Syntax
LONG InterlockedAndToUser(
LONG volatile *Destination,
LONG Value
);
Parameters
Destination
[in, out]指向包含第一个作数的用户模式内存位置的指针。 此值将替换为作的结果。 The pointer must be naturally aligned for the data type; that is, the memory location must be 4-byte aligned since Destination points to a 4-byte type.
Value
[in]第二个作数。
Return value
The function returns the original value of the Destination parameter.
Remarks
联锁函数提供了一种简单的机制,用于同步对多个线程共享的变量的访问。 对于对其他互锁函数的调用,此函数是原子的。 它生成完整内存屏障,以确保按顺序完成内存作。
This function provides atomic access to a 32-bit value in user-mode memory, performing a bitwise AND operation between the value at Destination and Value.
如果作失败(例如目标地址不是有效的用户模式地址或不可访问),该函数将引发结构化异常。
此函数适用于所有版本的 Windows,而不仅仅是最新版本。 You need to consume the latest WDK to get the function declaration from the usermode_accessors.h header. You also need the library (umaccess.lib) from the latest WDK. 但是,生成的驱动程序将在较旧版本的 Windows 上运行。
Requirements
| Requirement | Value |
|---|---|
| 最低支持的客户端 | See Remarks |
| Header | usermode_accessors.h |
| Library | umaccess.lib |
| IRQL | 小于或等于APC_LEVEL |