repo sync | baa3858 | 2013-07-26 17:53:31 -0700 | [diff] [blame] | 1 | // Common/MyGuidDef.h
|
| 2 |
|
| 3 | #ifndef GUID_DEFINED
|
| 4 | #define GUID_DEFINED
|
| 5 |
|
| 6 | #include "Types.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 | #define REFCLSID REFGUID
|
| 22 | #define REFIID REFGUID
|
| 23 |
|
| 24 | #ifdef __cplusplus
|
| 25 | inline int operator==(REFGUID g1, REFGUID g2)
|
| 26 | {
|
| 27 | for (int i = 0; i < (int)sizeof(g1); i++)
|
| 28 | if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i])
|
| 29 | return 0;
|
| 30 | return 1;
|
| 31 | }
|
| 32 | inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
|
| 33 | #endif
|
| 34 |
|
| 35 | #ifdef __cplusplus
|
| 36 | #define MY_EXTERN_C extern "C"
|
| 37 | #else
|
| 38 | #define MY_EXTERN_C extern
|
| 39 | #endif
|
| 40 |
|
| 41 | #endif
|
| 42 |
|
| 43 |
|
| 44 | #ifdef DEFINE_GUID
|
| 45 | #undef DEFINE_GUID
|
| 46 | #endif
|
| 47 |
|
| 48 | #ifdef INITGUID
|
| 49 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
| 50 | MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
| 51 | #else
|
| 52 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
| 53 | MY_EXTERN_C const GUID name
|
| 54 | #endif
|