1 | /*
|
---|
2 | * Copyright (C) 2000 Alexandre Julliard
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Lesser General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Lesser General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Lesser General Public
|
---|
15 | * License along with this library; if not, write to the Free Software
|
---|
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef GUID_DEFINED
|
---|
20 | #define GUID_DEFINED
|
---|
21 |
|
---|
22 | #ifdef __WIDL__
|
---|
23 | typedef struct
|
---|
24 | {
|
---|
25 | unsigned long Data1;
|
---|
26 | unsigned short Data2;
|
---|
27 | unsigned short Data3;
|
---|
28 | byte Data4[ 8 ];
|
---|
29 | } GUID;
|
---|
30 | #else
|
---|
31 | typedef struct _GUID
|
---|
32 | {
|
---|
33 | #ifdef _MSC_VER
|
---|
34 | unsigned long Data1;
|
---|
35 | #else
|
---|
36 | unsigned int Data1;
|
---|
37 | #endif
|
---|
38 | unsigned short Data2;
|
---|
39 | unsigned short Data3;
|
---|
40 | unsigned char Data4[ 8 ];
|
---|
41 | } GUID;
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | /* Macros for __uuidof emulation */
|
---|
45 | #if defined(__cplusplus) && !defined(_MSC_VER)
|
---|
46 |
|
---|
47 | extern "C++" {
|
---|
48 | template<typename T> const GUID &__wine_uuidof();
|
---|
49 | }
|
---|
50 |
|
---|
51 | #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
|
---|
52 | extern "C++" { \
|
---|
53 | template<> inline const GUID &__wine_uuidof<type>() { \
|
---|
54 | static const IID __uuid_inst = {l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}}; \
|
---|
55 | return __uuid_inst; \
|
---|
56 | } \
|
---|
57 | template<> inline const GUID &__wine_uuidof<type*>() { \
|
---|
58 | return __wine_uuidof<type>(); \
|
---|
59 | } \
|
---|
60 | }
|
---|
61 |
|
---|
62 | #define __uuidof(type) __wine_uuidof<typeof(type)>()
|
---|
63 |
|
---|
64 | #else
|
---|
65 |
|
---|
66 | #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
|
---|
67 |
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | #undef DEFINE_GUID
|
---|
73 |
|
---|
74 | #ifdef INITGUID
|
---|
75 | #ifdef __cplusplus
|
---|
76 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
---|
77 | EXTERN_C const GUID name DECLSPEC_HIDDEN; \
|
---|
78 | EXTERN_C const GUID name = \
|
---|
79 | { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
---|
80 | #else
|
---|
81 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
---|
82 | const GUID name DECLSPEC_HIDDEN; \
|
---|
83 | const GUID name = \
|
---|
84 | { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
---|
85 | #endif
|
---|
86 | #else
|
---|
87 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
---|
88 | EXTERN_C const GUID name DECLSPEC_HIDDEN
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #define DEFINE_OLEGUID(name, l, w1, w2) \
|
---|
92 | DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
|
---|
93 |
|
---|
94 | #ifndef _GUIDDEF_H_
|
---|
95 | #define _GUIDDEF_H_
|
---|
96 |
|
---|
97 | #ifndef __LPGUID_DEFINED__
|
---|
98 | #define __LPGUID_DEFINED__
|
---|
99 | typedef GUID *LPGUID;
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | #ifndef __LPCGUID_DEFINED__
|
---|
103 | #define __LPCGUID_DEFINED__
|
---|
104 | typedef const GUID *LPCGUID;
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | #ifndef __IID_DEFINED__
|
---|
108 | #define __IID_DEFINED__
|
---|
109 |
|
---|
110 | typedef GUID IID,*LPIID;
|
---|
111 | typedef GUID CLSID,*LPCLSID;
|
---|
112 | typedef GUID FMTID,*LPFMTID;
|
---|
113 | #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
|
---|
114 | #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
|
---|
115 | #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
|
---|
116 | #define IID_NULL GUID_NULL
|
---|
117 | #define CLSID_NULL GUID_NULL
|
---|
118 | #define FMTID_NULL GUID_NULL
|
---|
119 |
|
---|
120 | #ifdef __midl_proxy
|
---|
121 | #define __MIDL_CONST
|
---|
122 | #else
|
---|
123 | #define __MIDL_CONST const
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | #endif /* ndef __IID_DEFINED__ */
|
---|
127 |
|
---|
128 | #ifdef __cplusplus
|
---|
129 | #define REFGUID const GUID &
|
---|
130 | #define REFCLSID const CLSID &
|
---|
131 | #define REFIID const IID &
|
---|
132 | #define REFFMTID const FMTID &
|
---|
133 | #else /* !defined(__cplusplus) && !defined(CINTERFACE) */
|
---|
134 | #define REFGUID const GUID* __MIDL_CONST
|
---|
135 | #define REFCLSID const CLSID* __MIDL_CONST
|
---|
136 | #define REFIID const IID* __MIDL_CONST
|
---|
137 | #define REFFMTID const FMTID* __MIDL_CONST
|
---|
138 | #endif /* !defined(__cplusplus) && !defined(CINTERFACE) */
|
---|
139 |
|
---|
140 | #if defined(__cplusplus) && !defined(CINTERFACE)
|
---|
141 | #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
|
---|
142 | #else /* defined(__cplusplus) && !defined(CINTERFACE) */
|
---|
143 | #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
|
---|
144 | #endif /* defined(__cplusplus) && !defined(CINTERFACE) */
|
---|
145 |
|
---|
146 | #if defined(__cplusplus) && !defined(CINTERFACE)
|
---|
147 | #include <string.h>
|
---|
148 | inline bool operator==(const GUID& guidOne, const GUID& guidOther)
|
---|
149 | {
|
---|
150 | return !memcmp(&guidOne,&guidOther,sizeof(GUID));
|
---|
151 | }
|
---|
152 | inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
|
---|
153 | {
|
---|
154 | return !(guidOne == guidOther);
|
---|
155 | }
|
---|
156 | #endif
|
---|
157 |
|
---|
158 | extern const IID GUID_NULL;
|
---|
159 |
|
---|
160 | #endif /* _GUIDDEF_H_ */
|
---|