The RtlFillDeviceMemory routine fills a block of device memory with the specified fill value and returns a pointer to the filled memory. この関数は、デバイス メモリ領域に適切なアクセス パターンを使用するため、デバイス メモリで使用しても安全です。
Syntax
volatile void * RtlFillDeviceMemory(
[out] volatile void *Destination,
[in] size_t Length,
[in] int Fill
);
Parameters
[out] Destination
塗りつぶす揮発性デバイス メモリ ブロックの開始アドレスへのポインター。
[in] Length
埋めるメモリ ブロックのサイズ (バイト単位)。 This value must be less than or equal to the size of the Destination buffer.
[in] Fill
メモリ ブロックを埋めるバイト値。
Return value
RtlFillDeviceMemory returns a pointer to the filled volatile device memory block (Destination).
Remarks
The RtlFillDeviceMemory routine is designed for safe filling of device memory regions where standard memory filling functions might not be appropriate due to the special characteristics of device memory.
この関数では、揮発性メモリ アクセスを使用して、副作用や特殊なアクセス要件を持つ可能性があるデバイス メモリを適切に処理します。
この機能は、デバイスのメモリ アクセス パターンの安全性を維持しながら、パフォーマンスのために最適化されています。
この関数は、プラットフォームで許可されている場合に、アライメントされていないメモリ アクセスを実行する可能性があります。
この関数では、デバイスのメモリの安全性を確保しながら、より大きなメモリ ブロックに最適化された充填パターンを使用する場合があります。
This function provides RtlFillMemory behavior specifically designed for device memory regions.
Callers of RtlFillDeviceMemory can be running at any IRQL if the destination memory block is in nonpaged system memory. それ以外の場合、呼び出し元は IRQL <= APC_LEVELで実行されている必要があります。
この関数は、最新バージョンだけでなく、すべてのバージョンの Windows で動作します。 wdm.h ヘッダーから関数宣言を取得するには、最新の WDK を使用する必要があります。 また、最新の WDK のライブラリ (volatileaccessk.lib) も必要です。 ただし、結果として得られるドライバーは、古いバージョンの Windows では正常に動作します。
Example
volatile UCHAR* DeviceBuffer;
SIZE_T BufferSize = 1024;
// Allocate or map device memory
DeviceBuffer = MapDeviceMemory(BufferSize);
// Fill the device memory with a specific pattern
volatile void* result = RtlFillDeviceMemory(DeviceBuffer, BufferSize, 0xAA);
// Use the filled device memory
ProcessDeviceData(DeviceBuffer, BufferSize);
// Clean up
UnmapDeviceMemory(DeviceBuffer);
Requirements
| Requirement | Value |
|---|---|
| Target Platform | Universal |
| Header | wdm.h (Wdm.h、Ntddk.h、Ntifs.h を含む) |
| Library | volatileaccessk.lib (カーネル モード)、volatileaccessu.lib (ユーザー モード) |
| DLL | NtosKrnl.exe |
| IRQL | 任意のレベル (「解説」セクションを参照) |