次の方法で共有


WriteUInt32ToUserRelease 関数 (usermode_accessors.h)

The WriteUInt32ToUserRelease function safely writes a UINT32 value to user-mode memory with release semantics.

Syntax

VOID WriteUInt32ToUserRelease(
  volatile UINT32 *Destination,
  UINT32          Value
);

Parameters

Destination

[out]UINT32 値が書き込まれるユーザー モードのメモリ位置へのポインター。

Value

[in]宛先メモリの場所に書き込む UINT32 値。

Return value

None

Remarks

この関数は、UINT32 値をユーザー モード メモリに書き込む安全な方法を提供します。 指定されたアドレスが、書き込み前にユーザー モード のアドレスであることを確認します。 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, providing additional ordering guarantees for synchronization operations.

この関数は、最新バージョンだけでなく、すべてのバージョンの 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

WriteUInt32ToUser

ReadUInt32FromUserAcquire