WriteInt16ToUserRelease 函数 (usermode_accessors.h)

The WriteInt16ToUserRelease function safely writes an INT16 value to user-mode memory with release semantics.

Syntax

VOID WriteInt16ToUserRelease(
  volatile INT16 *Destination,
  INT16          Value
);

Parameters

Destination

[out]指向将写入 INT16 值的用户模式内存位置的指针。

Value

[in]要写入目标内存位置的 INT16 值。

Return value

None

Remarks

此函数提供了将 INT16 值写入用户模式内存的安全方法。 在写入地址之前,它可确保提供的地址是用户模式地址。 The release semantics ensure that preceding memory operations can't be reordered after this write operation.

此函数不强制对齐。

如果内存访问失败(例如目标地址不是用户模式地址或不可访问),则会引发结构化异常。

编译器永远不会优化此函数,也不会在调用函数或函数返回后(除非源代码显式执行这些访问)之前创建对此内存位置的其他访问权限。 The memory access is performed with memory_order_release semantics.

此函数适用于所有版本的 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

See also

WriteInt16ToUser

ReadInt16FromUserAcquire