According to the definition of GUID structure on MSDN
typedef struct _GUID {
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[8];
} GUID;
GUID is a structure that does not have an overloaded == operator, so if you want to compare two GUIDs, you must either implement the == operator or honestly compare the member variables one by one.
// PVOID lpbuffer;
// GUID g = {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}};
GUID *p = (GUID*)lpbuffer;
BOOL flag = FALSE;
if ((*p->Data1 == g.Data1)
&& (*p->Data2 == g.Data2)
&& (*p->Data3 == g.Data3)){
flag = TRUE;
for(int i; i < 8; i++){
if (*p->Data4[i] != g.Data4[i]){
flag = FALSE;
}
}
}
// flag变量为比较结果
According to the definition of GUID structure on MSDN
GUID is a structure that does not have an overloaded == operator, so if you want to compare two GUIDs, you must either implement the == operator or honestly compare the member variables one by one.
There are two situations:
The addresses are different, assuming that the GUID type overloads the == operator
The address is the same and the number of bytes is the same
As for the GUID type that does not overload the == operator but knows its internal structure, you can refer to the answer of other respondent @一代Key客
The GUID type has not overloaded the == operator and does not know its internal structure. I think it can be compared byte by byte