Compartir a través de


Macro RtlEqualDeviceMemory (wdm.h)

The RtlEqualDeviceMemory routine compares two blocks of device memory to determine whether the specified number of bytes are identical. Esta función es segura para su uso en la memoria del dispositivo porque usa requisitos de alineación estrictos.

Syntax

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

Parameters

[in] Source1

Puntero a un bloque asignado por el autor de la llamada de la memoria del dispositivo que se va a comparar.

[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 el número de bytes que se van a comparar.

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.

  • La función usa requisitos de alineación estrictos para garantizar el control adecuado de la memoria del dispositivo que puede tener efectos secundarios o requisitos de acceso especiales.

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

Esta función funciona en todas las versiones de Windows, no solo en la más reciente. Debe consumir el WDK más reciente para obtener la declaración de función del encabezado wdm.h. También necesita la biblioteca (volatileaccessk.lib) del WDK más reciente. Sin embargo, el controlador resultante se ejecutará correctamente en versiones anteriores de 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 (incluya Wdm.h)
Library volatileaccessk.lib (modo kernel), volatileaccessu.lib (modo de usuario)
IRQL Cualquier nivel (consulte la sección Comentarios)

See also

RtlEqualMemory

RtlCompareDeviceMemory