| 1 |
/** |
| 2 |
* This file is part of the mingw-w64 runtime package. |
| 3 |
* No warranty is given; refer to the file DISCLAIMER within this package. |
| 4 |
*/ |
| 5 |
#ifndef GUID_DEFINED |
| 6 |
#define GUID_DEFINED |
| 7 |
|
| 8 |
/* Make sure __LONG32 is defined. */ |
| 9 |
#include <_mingw.h> |
| 10 |
|
| 11 |
#ifdef __WIDL__ |
| 12 |
typedef struct { |
| 13 |
unsigned long Data1; |
| 14 |
unsigned short Data2; |
| 15 |
unsigned short Data3; |
| 16 |
byte Data4[8]; |
| 17 |
} GUID; |
| 18 |
#else |
| 19 |
typedef struct _GUID { |
| 20 |
unsigned __LONG32 Data1; |
| 21 |
unsigned short Data2; |
| 22 |
unsigned short Data3; |
| 23 |
unsigned char Data4[8]; |
| 24 |
} GUID; |
| 25 |
#endif |
| 26 |
#endif |
| 27 |
|
| 28 |
#if defined(__cplusplus) && (USE___UUIDOF == 0) |
| 29 |
extern "C++" { |
| 30 |
#if __cpp_constexpr >= 200704l && __cpp_inline_variables >= 201606L |
| 31 |
__extension__ template<typename T> struct __mingw_uuidof_s; |
| 32 |
__extension__ template<typename T> constexpr const GUID &__mingw_uuidof(); |
| 33 |
#else |
| 34 |
__extension__ template<typename T> const GUID &__mingw_uuidof(); |
| 35 |
#endif |
| 36 |
} |
| 37 |
#endif |
| 38 |
|
| 39 |
#ifndef FAR |
| 40 |
#define FAR |
| 41 |
#endif |
| 42 |
|
| 43 |
#ifndef DECLSPEC_SELECTANY |
| 44 |
#define DECLSPEC_SELECTANY __declspec(selectany) |
| 45 |
#endif |
| 46 |
|
| 47 |
#ifndef EXTERN_C |
| 48 |
#ifdef __cplusplus |
| 49 |
#define EXTERN_C extern "C" |
| 50 |
#else |
| 51 |
#define EXTERN_C extern |
| 52 |
#endif |
| 53 |
#endif |
| 54 |
|
| 55 |
#ifdef DEFINE_GUID |
| 56 |
#undef DEFINE_GUID |
| 57 |
#endif |
| 58 |
|
| 59 |
#ifdef INITGUID |
| 60 |
#ifdef __cplusplus |
| 61 |
#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } |
| 62 |
#else |
| 63 |
#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } |
| 64 |
#endif |
| 65 |
#else |
| 66 |
/* __declspec(selectany) must be applied to initialized objects on GCC 5 hence must not be used here. */ |
| 67 |
#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name |
| 68 |
#endif |
| 69 |
|
| 70 |
#define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID (name, l, w1, w2, 0xc0, 0, 0, 0, 0, 0, 0, 0x46) |
| 71 |
|
| 72 |
#ifndef _GUIDDEF_H_ |
| 73 |
#define _GUIDDEF_H_ |
| 74 |
|
| 75 |
#ifndef __LPGUID_DEFINED__ |
| 76 |
#define __LPGUID_DEFINED__ |
| 77 |
typedef GUID *LPGUID; |
| 78 |
#endif |
| 79 |
|
| 80 |
#ifndef __LPCGUID_DEFINED__ |
| 81 |
#define __LPCGUID_DEFINED__ |
| 82 |
typedef const GUID *LPCGUID; |
| 83 |
#endif |
| 84 |
|
| 85 |
#ifndef __IID_DEFINED__ |
| 86 |
#define __IID_DEFINED__ |
| 87 |
|
| 88 |
typedef GUID IID; |
| 89 |
typedef IID *LPIID; |
| 90 |
|
| 91 |
#define IID_NULL GUID_NULL |
| 92 |
#define IsEqualIID(riid1, riid2) IsEqualGUID (riid1, riid2) |
| 93 |
|
| 94 |
#ifndef CLSID_DEFINED |
| 95 |
#define CLSID_DEFINED |
| 96 |
typedef GUID CLSID; |
| 97 |
#endif |
| 98 |
|
| 99 |
typedef CLSID *LPCLSID; |
| 100 |
|
| 101 |
#define CLSID_NULL GUID_NULL |
| 102 |
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID (rclsid1, rclsid2) |
| 103 |
typedef GUID FMTID; |
| 104 |
typedef FMTID *LPFMTID; |
| 105 |
#define FMTID_NULL GUID_NULL |
| 106 |
#define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID (rfmtid1, rfmtid2) |
| 107 |
|
| 108 |
#ifdef __WIDL_proxy |
| 109 |
#define __MIDL_CONST |
| 110 |
#else |
| 111 |
#define __MIDL_CONST const |
| 112 |
#endif |
| 113 |
|
| 114 |
#ifndef _REFGUID_DEFINED |
| 115 |
#define _REFGUID_DEFINED |
| 116 |
#ifdef __cplusplus |
| 117 |
#define REFGUID const GUID & |
| 118 |
#else |
| 119 |
#define REFGUID const GUID *__MIDL_CONST |
| 120 |
#endif |
| 121 |
#endif |
| 122 |
|
| 123 |
#ifndef _REFIID_DEFINED |
| 124 |
#define _REFIID_DEFINED |
| 125 |
#ifdef __cplusplus |
| 126 |
#define REFIID const IID & |
| 127 |
#else |
| 128 |
#define REFIID const IID *__MIDL_CONST |
| 129 |
#endif |
| 130 |
#endif |
| 131 |
|
| 132 |
#ifndef _REFCLSID_DEFINED |
| 133 |
#define _REFCLSID_DEFINED |
| 134 |
#ifdef __cplusplus |
| 135 |
#define REFCLSID const IID & |
| 136 |
#else |
| 137 |
#define REFCLSID const IID *__MIDL_CONST |
| 138 |
#endif |
| 139 |
#endif |
| 140 |
|
| 141 |
#ifndef _REFFMTID_DEFINED |
| 142 |
#define _REFFMTID_DEFINED |
| 143 |
#ifdef __cplusplus |
| 144 |
#define REFFMTID const IID & |
| 145 |
#else |
| 146 |
#define REFFMTID const IID *__MIDL_CONST |
| 147 |
#endif |
| 148 |
#endif |
| 149 |
#endif |
| 150 |
|
| 151 |
#ifndef __WIDL__ |
| 152 |
#ifndef _SYS_GUID_OPERATORS_ |
| 153 |
#define _SYS_GUID_OPERATORS_ |
| 154 |
#include <string.h> |
| 155 |
|
| 156 |
#ifdef __cplusplus |
| 157 |
__inline int InlineIsEqualGUID (REFGUID rguid1, REFGUID rguid2) { |
| 158 |
return ((&rguid1.Data1)[0] == (&rguid2.Data1)[0] && (&rguid1.Data1)[1] == (&rguid2.Data1)[1] && (&rguid1.Data1)[2] == (&rguid2.Data1)[2] && (&rguid1.Data1)[3] == (&rguid2.Data1)[3]); |
| 159 |
} |
| 160 |
|
| 161 |
__inline int IsEqualGUID (REFGUID rguid1, REFGUID rguid2) { |
| 162 |
return !memcmp (&rguid1,&rguid2, sizeof (GUID)); |
| 163 |
} |
| 164 |
#else |
| 165 |
#define InlineIsEqualGUID(rguid1, rguid2) ((&(rguid1)->Data1)[0] == (&(rguid2)->Data1)[0] && (&(rguid1)->Data1)[1] == (&(rguid2)->Data1)[1] && (&(rguid1)->Data1)[2] == (&(rguid2)->Data1)[2] && (&(rguid1)->Data1)[3] == (&(rguid2)->Data1)[3]) |
| 166 |
#define IsEqualGUID(rguid1, rguid2) (!memcmp (rguid1, rguid2, sizeof (GUID))) |
| 167 |
#endif |
| 168 |
|
| 169 |
#ifdef __INLINE_ISEQUAL_GUID |
| 170 |
#undef IsEqualGUID |
| 171 |
#define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID (rguid1, rguid2) |
| 172 |
#endif |
| 173 |
|
| 174 |
#define IsEqualIID(riid1, riid2) IsEqualGUID (riid1, riid2) |
| 175 |
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID (rclsid1, rclsid2) |
| 176 |
|
| 177 |
#if !defined (_SYS_GUID_OPERATOR_EQ_) && !defined (_NO_SYS_GUID_OPERATOR_EQ_) |
| 178 |
#define _SYS_GUID_OPERATOR_EQ_ |
| 179 |
#ifdef __cplusplus |
| 180 |
__inline bool operator== (REFGUID guidOne, REFGUID guidOther) { return !!IsEqualGUID (guidOne, guidOther); } |
| 181 |
__inline bool operator!= (REFGUID guidOne, REFGUID guidOther) { return ! (guidOne == guidOther); } |
| 182 |
#endif |
| 183 |
#endif |
| 184 |
|
| 185 |
#endif |
| 186 |
#endif |
| 187 |
#endif |