Compartilhar via


Macro RtlEqualDeviceMemory (wdm.h)

The RtlEqualDeviceMemory routine compares two blocks of device memory to determine whether the specified number of bytes are identical. Essa função é segura para uso na memória do dispositivo porque usa requisitos de alinhamento estritos.

Syntax

BOOL RtlEqualDeviceMemory(
   [in] const void* Source1,
   [in] const void* Source2,
   [in] size_t      Length
);

Parameters

[in] Source1

Um ponteiro para um bloco alocado por chamador de memória do dispositivo a ser comparado.

[in] Source2

A pointer to a caller-allocated block of device memory that is compared to the block of memory to which Source1 points.

[in] Length

Especifica o número de bytes a serem comparados.

Return value

RtlEqualDeviceMemory returns TRUE if Source1 and Source2 are equivalent; otherwise, it returns FALSE.

Remarks

RtlEqualDeviceMemory begins the comparison with byte zero of each block.

The RtlEqualDeviceMemory routine is designed for safe comparison of device memory regions where standard memory comparison functions might not be appropriate due to the special characteristics of device memory.

  • A função usa requisitos de alinhamento estritos para garantir o tratamento adequado da memória do dispositivo que pode ter efeitos colaterais ou requisitos especiais de acesso.

Callers of RtlEqualDeviceMemory can be running at any IRQL if both blocks of memory are resident.

Essa função funciona em todas as versões do Windows, não apenas nas mais recentes. Você precisa consumir o WDK mais recente para obter a declaração de função do cabeçalho wdm.h. Você também precisa da biblioteca (volatileaccessk.lib) do WDK mais recente. No entanto, o driver resultante será executado bem em versões mais antigas do Windows.

Example

UCHAR DeviceBuffer1[256];
UCHAR DeviceBuffer2[256];

// Read data from device memory into buffers
ReadFromDevice(DeviceBuffer1, sizeof(DeviceBuffer1));
ReadFromDevice(DeviceBuffer2, sizeof(DeviceBuffer2));

// Compare the device memory buffers
if (RtlEqualDeviceMemory(DeviceBuffer1, DeviceBuffer2, sizeof(DeviceBuffer1))) {
    DbgPrint("Device buffers are identical\n");
} else {
    DbgPrint("Device buffers are different\n");
}

Requirements

Requirement Value
Target Platform Desktop
Header wdm.h (inclua Wdm.h)
Library volatileaccessk.lib (modo Kernel), volatileaccessu.lib (modo usuário)
IRQL Qualquer nível (seção Ver Comentários)

See also

RtlEqualMemory

RtlCompareDeviceMemory