1 // Common/MyGuidDef.h 2 3 #ifndef GUID_DEFINED 4 #define GUID_DEFINED 5 6 #include "MyTypes.h" 7 8 typedef struct { 9 UInt32 Data1; 10 UInt16 Data2; 11 UInt16 Data3; 12 unsigned char Data4[8]; 13 } GUID; 14 15 #ifdef __cplusplus 16 #define REFGUID const GUID & 17 #else 18 #define REFGUID const GUID * 19 #endif 20 21 // typedef GUID IID; 22 typedef GUID CLSID; 23 24 #define REFCLSID REFGUID 25 #define REFIID REFGUID 26 27 #ifdef __cplusplus 28 inline int operator==(REFGUID g1, REFGUID g2) 29 { 30 for (int i = 0; i < (int)sizeof(g1); i++) 31 if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i]) 32 return 0; 33 return 1; 34 } 35 inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); } 36 #endif 37 38 #ifdef __cplusplus 39 #define MY_EXTERN_C extern "C" 40 #else 41 #define MY_EXTERN_C extern 42 #endif 43 44 #endif 45 46 47 #ifdef DEFINE_GUID 48 #undef DEFINE_GUID 49 #endif 50 51 #ifdef INITGUID 52 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 53 MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } 54 #else 55 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 56 MY_EXTERN_C const GUID name 57 #endif 58