Commit | Line | Data |
---|---|---|
b08cb175 AJ |
1 | #ifndef GUID_DEFINED |
2 | #define GUID_DEFINED | |
3 | typedef struct _GUID | |
4 | { | |
5 | unsigned long Data1; | |
6 | unsigned short Data2; | |
7 | unsigned short Data3; | |
8 | unsigned char Data4[ 8 ]; | |
9 | } GUID; | |
10 | #endif | |
11 | ||
12 | #undef DEFINE_GUID | |
13 | ||
14 | #ifdef INITGUID | |
15 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ | |
16 | const GUID name = \ | |
17 | { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } | |
18 | #else | |
19 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ | |
20 | extern const GUID name | |
21 | #endif | |
22 | ||
23 | #define DEFINE_OLEGUID(name, l, w1, w2) \ | |
24 | DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46) | |
25 | ||
26 | #ifndef _GUIDDEF_H_ | |
27 | #define _GUIDDEF_H_ | |
28 | ||
29 | typedef GUID *LPGUID; | |
30 | typedef GUID CLSID,*LPCLSID; | |
31 | typedef GUID IID,*LPIID; | |
32 | typedef GUID FMTID,*LPFMTID; | |
33 | ||
34 | #if defined(__cplusplus) && !defined(CINTERFACE) | |
35 | #define REFGUID const GUID & | |
36 | #define REFCLSID const CLSID & | |
37 | #define REFIID const IID & | |
38 | #define REFFMTID const FMTID & | |
39 | #else /* !defined(__cplusplus) && !defined(CINTERFACE) */ | |
40 | #define REFGUID const GUID* const | |
41 | #define REFCLSID const CLSID* const | |
42 | #define REFIID const IID* const | |
43 | #define REFFMTID const FMTID* const | |
44 | #endif /* !defined(__cplusplus) && !defined(CINTERFACE) */ | |
45 | ||
46 | #if defined(__cplusplus) && !defined(CINTERFACE) | |
47 | #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID))) | |
48 | #else /* defined(__cplusplus) && !defined(CINTERFACE) */ | |
49 | #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID))) | |
50 | #endif /* defined(__cplusplus) && !defined(CINTERFACE) */ | |
51 | #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2) | |
52 | #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2) | |
53 | ||
54 | #if defined(__cplusplus) && !defined(CINTERFACE) | |
ccb257ac | 55 | inline bool operator==(const GUID& guidOne, const GUID& guidOther) |
b08cb175 AJ |
56 | { |
57 | return !memcmp(&guidOne,&guidOther,sizeof(GUID)); | |
58 | } | |
ccb257ac | 59 | inline bool operator!=(const GUID& guidOne, const GUID& guidOther) |
b08cb175 AJ |
60 | { |
61 | return !(guidOne == guidOther); | |
62 | } | |
63 | #endif | |
64 | ||
65 | extern const IID GUID_NULL; | |
66 | #define IID_NULL GUID_NULL | |
67 | #define CLSID_NULL GUID_NULL | |
68 | #define FMTID_NULL GUID_NULL | |
69 | ||
70 | #endif /* _GUIDDEF_H_ */ |