RtlCompareMemory 函数 (wdm.h)

The RtlCompareMemory routine compares two blocks of memory and returns the number of bytes that match until the first difference.

Syntax

NTSYSAPI SIZE_T RtlCompareMemory(
  [in] const VOID *Source1,
  [in] const VOID *Source2,
  [in] SIZE_T     Length
);

Parameters

[in] Source1

指向第一个内存块的指针。

[in] Source2

指向第二个内存块的指针。

[in] Length

要比较的字节数。

Return value

RtlCompareMemory returns the number of bytes in the two blocks that match. If all bytes match up to the specified Length value, the Length value is returned.

Remarks

该例程首先将第一个块中的第一个字节与第二个块中的第一个字节进行比较,并在字节匹配时继续比较两个块中的连续字节。 The routine stops comparing bytes when it encounters the first pair of bytes that are not equal, or when the number of matching bytes equals the Length parameter value, whichever occurs first.

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

Requirements

Requirement Value
Target Platform Universal
Header wdm.h (包括 Wdm.h、Ntddk.h、Ntifs.h)
Library NtosKrnl.lib;Windows 10 上的 OneCoreUAP.lib
DLL NtDll.dll(用户模式):Kernel32.dll(用户模式):NtosKrnl.exe (内核模式)
IRQL 任何级别 (请参阅“备注”部分)
DDI 符合性规则 BufAfterReqCompletedIntIoctlA(kmdf), BufAfterReqCompletedIoctlA(kmdf), BufAfterReqCompletedReadA(kmdf), BufAfterReqCompletedWriteA(kmdf)

See also

RtlCompareDeviceMemory