include: Update the PEB and TEB structures.
[wine.git] / include / guiddef.h
blob6f7e26df0c6809bd66bb1a92c6b84a79d96848a6
1 /*
2 * Copyright (C) 2000 Alexandre Julliard
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.
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.
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
19 #ifndef GUID_DEFINED
20 #define GUID_DEFINED
22 #ifdef __WIDL__
23 typedef struct
25 unsigned long Data1;
26 unsigned short Data2;
27 unsigned short Data3;
28 byte Data4[ 8 ];
29 } GUID;
30 #else
31 typedef struct _GUID
33 #ifndef __LP64__
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
44 /* Macros for __uuidof emulation */
45 #ifdef __cplusplus
46 # if defined(__MINGW32__)
47 # if !defined(__uuidof) /* Mingw64 can provide support for __uuidof and __CRT_UUID_DECL */
48 # define __WINE_UUID_ATTR __attribute__((selectany))
49 # undef __CRT_UUID_DECL
50 # endif
51 # elif defined(__GNUC__)
52 # define __WINE_UUID_ATTR __attribute__((visibility("hidden"),weak))
53 # endif
54 #endif
56 #ifdef __WINE_UUID_ATTR
58 extern "C++" {
59 template<typename T> struct __wine_uuidof;
61 template<typename T> struct __wine_uuidof_type {
62 typedef __wine_uuidof<T> inst;
64 template<typename T> struct __wine_uuidof_type<T *> {
65 typedef __wine_uuidof<T> inst;
67 template<typename T> struct __wine_uuidof_type<T * const> {
68 typedef __wine_uuidof<T> inst;
72 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
73 extern "C++" { \
74 template<> struct __wine_uuidof<type> { \
75 static const GUID uuid; \
76 }; \
77 __WINE_UUID_ATTR const GUID __wine_uuidof<type>::uuid = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}; \
80 #define __uuidof(type) __wine_uuidof_type<__typeof__(type)>::inst::uuid
82 #elif !defined(__CRT_UUID_DECL)
84 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
86 #endif /* __WINE_UUID_ATTR */
88 #endif
90 #undef DEFINE_GUID
92 #ifndef DECLSPEC_HIDDEN
93 # if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
94 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
95 # else
96 # define DECLSPEC_HIDDEN
97 # endif
98 #endif
100 #ifdef INITGUID
101 #ifdef __cplusplus
102 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
103 EXTERN_C const GUID name DECLSPEC_HIDDEN; \
104 EXTERN_C const GUID name = \
105 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
106 #else
107 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
108 const GUID name DECLSPEC_HIDDEN; \
109 const GUID name = \
110 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
111 #endif
112 #else
113 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
114 EXTERN_C const GUID name DECLSPEC_HIDDEN
115 #endif
117 #define DEFINE_OLEGUID(name, l, w1, w2) \
118 DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
120 #ifndef _GUIDDEF_H_
121 #define _GUIDDEF_H_
123 #ifndef __LPGUID_DEFINED__
124 #define __LPGUID_DEFINED__
125 typedef GUID *LPGUID;
126 #endif
128 #ifndef __LPCGUID_DEFINED__
129 #define __LPCGUID_DEFINED__
130 typedef const GUID *LPCGUID;
131 #endif
133 #ifndef __IID_DEFINED__
134 #define __IID_DEFINED__
136 typedef GUID IID,*LPIID;
137 typedef GUID CLSID,*LPCLSID;
138 typedef GUID FMTID,*LPFMTID;
139 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
140 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
141 #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
142 #define IID_NULL GUID_NULL
143 #define CLSID_NULL GUID_NULL
144 #define FMTID_NULL GUID_NULL
146 #ifdef __midl_proxy
147 #define __MIDL_CONST
148 #else
149 #define __MIDL_CONST const
150 #endif
152 #endif /* ndef __IID_DEFINED__ */
154 #ifdef __cplusplus
155 #define REFGUID const GUID &
156 #define REFCLSID const CLSID &
157 #define REFIID const IID &
158 #define REFFMTID const FMTID &
159 #else
160 #define REFGUID const GUID* __MIDL_CONST
161 #define REFCLSID const CLSID* __MIDL_CONST
162 #define REFIID const IID* __MIDL_CONST
163 #define REFFMTID const FMTID* __MIDL_CONST
164 #endif
166 #ifdef __cplusplus
167 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
168 inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
170 return (((unsigned int *)&rguid1)[0] == ((unsigned int *)&rguid2)[0] &&
171 ((unsigned int *)&rguid1)[1] == ((unsigned int *)&rguid2)[1] &&
172 ((unsigned int *)&rguid1)[2] == ((unsigned int *)&rguid2)[2] &&
173 ((unsigned int *)&rguid1)[3] == ((unsigned int *)&rguid2)[3]);
175 #else
176 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
177 #define InlineIsEqualGUID(rguid1, rguid2) \
178 (((unsigned int *)rguid1)[0] == ((unsigned int *)rguid2)[0] && \
179 ((unsigned int *)rguid1)[1] == ((unsigned int *)rguid2)[1] && \
180 ((unsigned int *)rguid1)[2] == ((unsigned int *)rguid2)[2] && \
181 ((unsigned int *)rguid1)[3] == ((unsigned int *)rguid2)[3])
182 #endif
184 #ifdef __cplusplus
185 #include <string.h>
186 inline bool operator==(const GUID& guidOne, const GUID& guidOther)
188 return !memcmp(&guidOne,&guidOther,sizeof(GUID));
190 inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
192 return !(guidOne == guidOther);
194 #endif
196 #endif /* _GUIDDEF_H_ */