explorer:
[reactos.git] / reactos / w32api / include / guiddef.h
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 #ifndef GUID_DEFINED
20 #define GUID_DEFINED
21 typedef struct _GUID
22 {
23 unsigned long Data1;
24 unsigned short Data2;
25 unsigned short Data3;
26 unsigned char Data4[ 8 ];
27 } GUID;
28 #endif
29
30 #undef DEFINE_GUID
31
32 #ifdef INITGUID
33 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
34 const GUID name = \
35 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
36 #else
37 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
38 extern const GUID name;
39 #endif
40
41 #ifndef _GUIDDEF_H_
42 #define _GUIDDEF_H_
43
44 typedef GUID *LPGUID;
45 typedef GUID CLSID,*LPCLSID;
46 typedef GUID IID,*LPIID;
47 typedef GUID FMTID,*LPFMTID;
48
49 #if 0
50 #if defined(__cplusplus) && !defined(CINTERFACE)
51 #define REFGUID const GUID &
52 #define REFCLSID const CLSID &
53 #define REFIID const IID &
54 #define REFFMTID const FMTID &
55 #else /* !defined(__cplusplus) && !defined(CINTERFACE) */
56 #define REFGUID const GUID* const
57 #define REFCLSID const CLSID* const
58 #define REFIID const IID* const
59 #define REFFMTID const FMTID* const
60 #endif /* !defined(__cplusplus) && !defined(CINTERFACE) */
61 #endif
62
63 #if defined(__cplusplus) && !defined(CINTERFACE)
64 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
65 #else /* defined(__cplusplus) && !defined(CINTERFACE) */
66 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
67 #endif /* defined(__cplusplus) && !defined(CINTERFACE) */
68
69 #if defined(__cplusplus) && !defined(CINTERFACE)
70 #include <string.h>
71 inline bool operator==(const GUID& guidOne, const GUID& guidOther)
72 {
73 return !memcmp(&guidOne,&guidOther,sizeof(GUID));
74 }
75 inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
76 {
77 return !(guidOne == guidOther);
78 }
79 #endif
80
81 extern const IID GUID_NULL;
82 #define IID_NULL GUID_NULL
83 #define CLSID_NULL GUID_NULL
84 #define FMTID_NULL GUID_NULL
85
86 #endif /* _GUIDDEF_H_ */