다음을 통해 공유


RtlFillDeviceMemory 함수(wdm.h)

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 모든 수준(설명 섹션 참조)

See also

RtlFillMemory

RtlSetVolatileMemory

RtlCompareDeviceMemory

RtlEqualDeviceMemory