The MoveToUserFromUser function safely moves data from user-mode memory to user-mode memory, supporting overlapping memory regions.
Syntax
VOID MoveToUserFromUser(
volatile VOID *Destination,
volatile const VOID *Source,
SIZE_T Length
);
Parameters
Destination
[out]データがコピーされるユーザー モードのメモリ位置の開始アドレスへのポインター。
Source
[in]データのコピー元となるユーザー モードのメモリ位置の開始アドレスへのポインター。
Length
[in]移動するバイト数。
Return value
None
Remarks
この関数は、重複するメモリ領域をサポートするユーザー モード メモリからユーザー モード メモリにデータを移動する安全な方法を提供します。
この関数には、次のプロパティがあります。
The function performs a move using memory_order_relaxed semantics.
関数はコンパイラ組み込み関数として認識されないため、コンパイラは呼び出しを最適化しません (呼び出しを完全に最適化したり、同等の命令シーケンスに置き換えたりすることはありません)。
When the call returns, the data has been copied from Source to Destination. This function's memory accesses to the Source and Destination will only be performed within the function (for example, the compiler can't move memory accesses out of this function).
プラットフォームで許可されている場合、関数はアラインされていないアクセスを実行する可能性があります。
この関数は、フィル操作の一環としてメモリ位置に複数回アクセスする場合があります。
この関数は、両方のポインターがユーザー モード メモリを参照していることを検証し、移動操作が失敗した場合 (ソース アドレスまたは宛先アドレスが有効なユーザー モード アドレスではない場合やアクセスできない場合など) に構造化例外を発生させます。
この関数は、最新バージョンだけでなく、すべてのバージョンの 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以下 |