2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: include\ole32\guiddef.h
5 * PURPOSE: Guid definition macros
6 * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be]
10 /********************************************************************
13 This library is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Library General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Library General Public License for more details.
23 You should have received a copy of the GNU Library General Public
24 License along with this library; see the file COPYING.LIB. If
25 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
26 Cambridge, MA 02139, USA.
29 ********************************************************************/
38 #define EXTERN_C extern "C"
40 #define EXTERN_C extern
48 typedef struct _GUID
{
52 unsigned char Data4
[ 8 ];
55 typedef const GUID
* LPCGUID
;
59 // guid definition macro
65 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
66 const GUID name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}
68 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
71 #define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
77 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
82 typedef CLSID
* LPCLSID
;
83 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
87 typedef FMTID
* LPFMTID
;
88 #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
92 #ifndef _REFGUID_DEFINED
93 #define _REFGUID_DEFINED
95 #define REFGUID const GUID &
97 #define REFGUID const GUID *
102 #ifndef _REFIID_DEFINED
103 #define _REFIID_DEFINED
105 #define REFIID const IID &
107 #define REFIID const IID *
112 #ifndef _REFCLSID_DEFINED
113 #define _REFCLSID_DEFINED
115 #define REFCLSID const IID &
117 #define REFCLSID const IID *
122 #ifndef _REFFMTID_DEFINED
123 #define _REFFMTID_DEFINED
125 #define REFFMTID const IID &
127 #define REFFMTID const IID *
132 // compare functions for GUID
135 __inline
int InlineIsEqualGUID(REFGUID rguid1
, REFGUID rguid2
)
137 return(((unsigned long *) &rguid1
)[0] == ((unsigned long *) &rguid2
)[0] &&
138 ((unsigned long *) &rguid1
)[1] == ((unsigned long *) &rguid2
)[1] &&
139 ((unsigned long *) &rguid1
)[2] == ((unsigned long *) &rguid2
)[2] &&
140 ((unsigned long *) &rguid1
)[3] == ((unsigned long *) &rguid2
)[3]);
142 __inline
int IsEqualGUID(REFGUID rguid1
, REFGUID rguid2
)
144 return !memcmp(&rguid1
, &rguid2
, sizeof(GUID
));
148 #define InlineIsEqualGUID(rguid1, rguid2) \
149 (((unsigned long *) rguid1)[0] == ((unsigned long *) rguid2)[0] && \
150 ((unsigned long *) rguid1)[1] == ((unsigned long *) rguid2)[1] && \
151 ((unsigned long *) rguid1)[2] == ((unsigned long *) rguid2)[2] && \
152 ((unsigned long *) rguid1)[3] == ((unsigned long *) rguid2)[3])
154 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
157 // use the inline version???
158 #ifdef __INLINE_ISEQUAL_GUID
159 #define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID(rguid1, rguid2)
163 // compare functions for IID CLSID
164 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
165 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
167 // c++ helper functions
168 #if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
169 #define _SYS_GUID_OPERATOR_EQ_
171 __inline
int operator==(REFGUID guidOne
, REFGUID guidTwo
)
173 return IsEqualGUID(guidOne
,guidTwo
);
176 __inline
int operator!=(REFGUID guidOne
, REFGUID guidTwo
)
178 return !(guidOne
== guidTwo
);