user2672807
user2672807

Reputation: 1

Does the Windows API (not CRT) have a memory compare function?

I know I can use memcmp in Windows but I'm wondering if there's something native to the platform like CompareMemory. I have heard of RtlCompareMemory but that's for drivers apparently.

Upvotes: 2

Views: 2516

Answers (2)

Guest
Guest

Reputation: 1

There is the "RtlEqualMemory" macro in the Windows API. It returns TRUE if the Destination and Source are same, and FALSE otherwise.

#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))

Upvotes: 0

Patrick
Patrick

Reputation: 386

According to this https://support.microsoft.com/en-us/help/99456/win32-equivalents-for-c-run-time-functions

It would appear there is no Win32 equivalent to memcmp.

It is also worth noting that RtlCompareMemory's return value is different from memcmp. It returns the count of identical bytes.

Upvotes: 1

Related Questions