cabinet: Simplify concatenation of path and filename.
[wine] / 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef GUID_DEFINED
20 #define GUID_DEFINED
21 typedef struct _GUID
22 {
23 #ifdef _MSC_VER
24     unsigned long  Data1;
25 #else
26     unsigned int   Data1;
27 #endif
28     unsigned short Data2;
29     unsigned short Data3;
30     unsigned char  Data4[ 8 ];
31 } GUID;
32
33 /* Macros for __uuidof emulation */
34 #if defined(__cplusplus) && !defined(_MSC_VER)
35
36 extern "C++" {
37     template<typename T> const GUID &__wine_uuidof();
38 }
39
40 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)           \
41     extern "C++" {                                                      \
42     template<> inline const GUID &__wine_uuidof<type>() {               \
43         static const IID __uuid_inst = {l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}}; \
44         return __uuid_inst;                                             \
45     }                                                                   \
46     template<> inline const GUID &__wine_uuidof<type*>() {              \
47         return __wine_uuidof<type>();                                   \
48     }                                                                   \
49     }
50
51 #define __uuidof(type) __wine_uuidof<typeof(type)>()
52
53 #else
54
55 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
56
57 #endif
58
59 #endif
60
61 #undef DEFINE_GUID
62
63 #ifdef INITGUID
64 #ifdef __cplusplus
65 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
66         EXTERN_C const GUID name DECLSPEC_HIDDEN; \
67         EXTERN_C const GUID name = \
68         { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
69 #else
70 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
71         const GUID name DECLSPEC_HIDDEN; \
72         const GUID name = \
73         { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
74 #endif
75 #else
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 #endif
79
80 #define DEFINE_OLEGUID(name, l, w1, w2) \
81         DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
82
83 #ifndef _GUIDDEF_H_
84 #define _GUIDDEF_H_
85
86 #ifndef __LPGUID_DEFINED__
87 #define __LPGUID_DEFINED__
88 typedef GUID *LPGUID;
89 #endif
90
91 #ifndef __LPCGUID_DEFINED__
92 #define __LPCGUID_DEFINED__
93 typedef const GUID *LPCGUID;
94 #endif
95
96 #ifndef __IID_DEFINED__
97 #define __IID_DEFINED__
98
99 typedef GUID IID,*LPIID;
100 typedef GUID CLSID,*LPCLSID;
101 typedef GUID FMTID,*LPFMTID;
102 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
103 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
104 #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
105 #define IID_NULL   GUID_NULL
106 #define CLSID_NULL GUID_NULL
107 #define FMTID_NULL GUID_NULL
108
109 #ifdef __midl_proxy
110 #define __MIDL_CONST
111 #else
112 #define __MIDL_CONST const
113 #endif
114
115 #endif /* ndef __IID_DEFINED__ */
116
117 #ifdef __cplusplus
118 #define REFGUID             const GUID &
119 #define REFCLSID            const CLSID &
120 #define REFIID              const IID &
121 #define REFFMTID            const FMTID &
122 #else /* !defined(__cplusplus) && !defined(CINTERFACE) */
123 #define REFGUID             const GUID* __MIDL_CONST
124 #define REFCLSID            const CLSID* __MIDL_CONST
125 #define REFIID              const IID* __MIDL_CONST
126 #define REFFMTID            const FMTID* __MIDL_CONST
127 #endif /* !defined(__cplusplus) && !defined(CINTERFACE) */
128
129 #if defined(__cplusplus) && !defined(CINTERFACE)
130 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
131 #else /* defined(__cplusplus) && !defined(CINTERFACE) */
132 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
133 #endif /* defined(__cplusplus) && !defined(CINTERFACE) */
134
135 #if defined(__cplusplus) && !defined(CINTERFACE)
136 #include <string.h>
137 inline bool operator==(const GUID& guidOne, const GUID& guidOther)
138 {
139     return !memcmp(&guidOne,&guidOther,sizeof(GUID));
140 }
141 inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
142 {
143     return !(guidOne == guidOther);
144 }
145 #endif
146
147 extern const IID GUID_NULL;
148
149 #endif /* _GUIDDEF_H_ */