When I was working on the Bluetooth core, I got this mistake the first time I tried to compare 2 bluetooth addresses (a bluetooth address is 48 bits wide and at the time we were not using a ULONGLONG to represent the address, so we were doing structure comparisons).  The result from RtlCompareMemory is the number of bytes that matched, while the result from memcmp is the standard CRT result for a comparison function where the result is <0 if the first buffer is less then the second buffer, result == 0 if the 2 buffers are equal, and  result >0 when the first buffer is greater then the second.  This made the following code which was trying to compare for equality return the opposite result

typedef struct _BDADDR {
    union {
        struct {
            unsigned int LAP : 24;            
            unsigned int UAP : 8;                          
        unsigned int SAP;                                  

    unsigned short NAP;                                    

PBDADDR pSrc, pDest;

// initialize pSrc, pDest

if (RtlCompareMemory(pSrc, pDest, sizeof(BDADDR)) == 0x0) {
    // they are equal

which was wrong and corrected to the following correct check

if (RtlCompareMemory(pSrc, pDest, sizeof(BDADDR)) == sizeof(BDADDR)) {
    // they are equal