d8cb3c72cca9e40ef2946b2fad2afc0969914dc2
[reactos.git] / reactos / w32api / include / basetyps.h
1 #ifndef _BASETYPS_H
2 #define _BASETYPS_H
3 #if __GNUC__ >=3
4 #pragma GCC system_header
5 #endif
6
7 #ifndef __OBJC__
8 # ifdef __cplusplus
9 # define EXTERN_C extern "C"
10 # else
11 # define EXTERN_C extern
12 # endif /* __cplusplus */
13 # ifndef __int64
14 # define __int64 long long
15 # endif
16 # ifndef __int32
17 # define __int32 long
18 # endif
19 # ifndef __int16
20 # define __int16 int
21 # endif
22 # ifndef __int8
23 # define __int8 char
24 # endif
25 # ifndef __small
26 # define __small char
27 # endif
28 # ifndef __hyper
29 # define __hyper long long
30 # endif
31 # define STDMETHODCALLTYPE __stdcall
32 # define STDMETHODVCALLTYPE __cdecl
33 # define STDAPICALLTYPE __stdcall
34 # define STDAPIVCALLTYPE __cdecl
35 # define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
36 # define STDAPI_(t) EXTERN_C t STDAPICALLTYPE
37 # define STDMETHODIMP HRESULT STDMETHODCALLTYPE
38 # define STDMETHODIMP_(t) t STDMETHODCALLTYPE
39 # define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
40 # define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE
41 # define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
42 # define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE
43 # define interface struct
44 # if defined(__cplusplus) && !defined(CINTERFACE)
45 # define STDMETHOD(m) virtual HRESULT STDMETHODCALLTYPE m
46 # define STDMETHOD_(t,m) virtual t STDMETHODCALLTYPE m
47 # define PURE =0
48 # define THIS_
49 # define THIS void
50 /*
51 __attribute__((com_interface)) is obsolete in __GNUC__ >= 3
52 g++ vtables are now COM-compatible by default
53 */
54 # if defined(__GNUC__) && __GNUC__ < 3 && !defined(NOCOMATTRIBUTE)
55 # define DECLARE_INTERFACE(i) interface __attribute__((com_interface)) i
56 # define DECLARE_INTERFACE_(i,b) interface __attribute__((com_interface)) i : public b
57 # else
58 # define DECLARE_INTERFACE(i) interface i
59 # define DECLARE_INTERFACE_(i,b) interface i : public b
60 # endif
61 # else
62 # define STDMETHOD(m) HRESULT(STDMETHODCALLTYPE *m)
63 # define STDMETHOD_(t,m) t(STDMETHODCALLTYPE *m)
64 # define PURE
65 # define THIS_ INTERFACE *,
66 # define THIS INTERFACE *
67 # ifndef CONST_VTABLE
68 # define CONST_VTABLE
69 # endif
70 # define DECLARE_INTERFACE(i) \
71 typedef interface i { CONST_VTABLE struct i##Vtbl *lpVtbl; } i; \
72 typedef CONST_VTABLE struct i##Vtbl i##Vtbl; \
73 CONST_VTABLE struct i##Vtbl
74 # define DECLARE_INTERFACE_(i,b) DECLARE_INTERFACE(i)
75 # endif
76 # define BEGIN_INTERFACE
77 # define END_INTERFACE
78
79 # define FWD_DECL(i) typedef interface i i
80 # if defined(__cplusplus) && !defined(CINTERFACE)
81 # define IENUM_THIS(T)
82 # define IENUM_THIS_(T)
83 # else
84 # define IENUM_THIS(T) T*
85 # define IENUM_THIS_(T) T*,
86 # endif
87 # define DECLARE_ENUMERATOR_(I,T) \
88 DECLARE_INTERFACE_(I,IUnknown) \
89 { \
90 STDMETHOD(QueryInterface)(IENUM_THIS_(I) REFIID,PVOID*) PURE; \
91 STDMETHOD_(ULONG,AddRef)(IENUM_THIS(I)) PURE; \
92 STDMETHOD_(ULONG,Release)(IENUM_THIS(I)) PURE; \
93 STDMETHOD(Next)(IENUM_THIS_(I) ULONG,T*,ULONG*) PURE; \
94 STDMETHOD(Skip)(IENUM_THIS_(I) ULONG) PURE; \
95 STDMETHOD(Reset)(IENUM_THIS(I)) PURE; \
96 STDMETHOD(Clone)(IENUM_THIS_(I) I**) PURE; \
97 }
98 # define DECLARE_ENUMERATOR(T) DECLARE_ENUMERATOR_(IEnum##T,T)
99
100 #endif /* __OBJC__ */
101
102 #ifdef _GUID_DEFINED
103 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
104 #endif
105
106 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in winnt.h */
107 #define GUID_DEFINED
108 typedef struct _GUID
109 {
110 unsigned long Data1;
111 unsigned short Data2;
112 unsigned short Data3;
113 unsigned char Data4[8];
114 } GUID,*REFGUID,*LPGUID;
115 #endif /* GUID_DEFINED */
116 #ifndef UUID_DEFINED
117 #define UUID_DEFINED
118 typedef GUID UUID;
119 #endif /* UUID_DEFINED */
120 typedef GUID IID;
121 typedef GUID CLSID;
122 typedef CLSID *LPCLSID;
123 typedef IID *LPIID;
124 typedef IID *REFIID;
125 typedef CLSID *REFCLSID;
126 typedef GUID FMTID;
127 typedef FMTID *REFFMTID;
128 typedef unsigned long error_status_t;
129 #define uuid_t UUID
130 typedef unsigned long PROPID;
131
132 #ifndef _REFGUID_DEFINED
133 #if defined (__cplusplus) && !defined (CINTERFACE)
134 #define REFGUID const GUID&
135 #define REFIID const IID&
136 #define REFCLSID const CLSID&
137 #else
138 #define REFGUID const GUID* const
139 #define REFIID const IID* const
140 #define REFCLSID const CLSID* const
141 #endif
142 #define _REFGUID_DEFINED
143 #define _REFIID_DEFINED
144 #define _REFCLSID_DEFINED
145 #endif
146 #ifndef GUID_SECTION
147 #define GUID_SECTION ".text"
148 #endif
149 #ifdef __GNUC__
150 #define GUID_SECT __attribute__ ((section (GUID_SECTION)))
151 #else
152 #define GUID_SECT
153 #endif
154 #if !defined(INITGUID) || (defined(INITGUID) && defined(__cplusplus))
155 #define GUID_EXT EXTERN_C
156 #else
157 #define GUID_EXT
158 #endif
159 #ifdef INITGUID
160 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
161 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46)
162 #else
163 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n
164 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46)
165 #endif
166 #endif