|
|
|
1 |
|
//+--------------------------------------------------------------------------- |
2 |
|
// |
3 |
|
// Microsoft Windows |
4 |
|
// Copyright (c) Microsoft Corporation. All rights reserved. |
5 |
|
// |
6 |
|
// File: basetyps.h |
7 |
|
// |
8 |
|
//---------------------------------------------------------------------------- |
9 |
|
#if !defined( _BASETYPS_H_ ) |
10 |
|
#define _BASETYPS_H_ |
11 |
|
|
12 |
|
#if _MSC_VER > 1000 |
13 |
|
#pragma once |
14 |
|
#endif |
15 |
|
|
16 |
|
// Common macros gleamed from COMPOBJ.H |
17 |
|
|
18 |
|
#ifdef __cplusplus |
19 |
|
#define EXTERN_C extern "C" |
20 |
|
#else |
21 |
|
#define EXTERN_C extern |
22 |
|
#endif |
23 |
|
|
24 |
|
#ifdef _WIN32 |
25 |
|
|
26 |
|
// Win32 doesn't support __export |
27 |
|
|
28 |
|
#define STDMETHODCALLTYPE __stdcall |
29 |
|
#define STDMETHODVCALLTYPE __cdecl |
30 |
|
|
31 |
|
#define STDAPICALLTYPE __stdcall |
32 |
|
#define STDAPIVCALLTYPE __cdecl |
33 |
|
|
34 |
|
#else |
35 |
|
|
36 |
|
#define STDMETHODCALLTYPE __export __stdcall |
37 |
|
#define STDMETHODVCALLTYPE __export __cdecl |
38 |
|
|
39 |
|
#define STDAPICALLTYPE __export __stdcall |
40 |
|
#define STDAPIVCALLTYPE __export __cdecl |
41 |
|
|
42 |
|
#endif |
43 |
|
|
44 |
|
#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE |
45 |
|
#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE |
46 |
|
|
47 |
|
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE |
48 |
|
#define STDMETHODIMP_(type) type STDMETHODCALLTYPE |
49 |
|
|
50 |
|
// The 'V' versions allow Variable Argument lists. |
51 |
|
|
52 |
|
#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE |
53 |
|
#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE |
54 |
|
|
55 |
|
#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE |
56 |
|
#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
/****** Interface Declaration ***********************************************/ |
62 |
|
|
63 |
|
/* |
64 |
|
* These are macros for declaring interfaces. They exist so that |
65 |
|
* a single definition of the interface is simulataneously a proper |
66 |
|
* declaration of the interface structures (C++ abstract classes) |
67 |
|
* for both C and C++. |
68 |
|
* |
69 |
|
* DECLARE_INTERFACE(iface) is used to declare an interface that does |
70 |
|
* not derive from a base interface. |
71 |
|
* DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface |
72 |
|
* that does derive from a base interface. |
73 |
|
* |
74 |
|
* By default if the source file has a .c extension the C version of |
75 |
|
* the interface declaratations will be expanded; if it has a .cpp |
76 |
|
* extension the C++ version will be expanded. if you want to force |
77 |
|
* the C version expansion even though the source file has a .cpp |
78 |
|
* extension, then define the macro "CINTERFACE". |
79 |
|
* eg. cl -DCINTERFACE file.cpp |
80 |
|
* |
81 |
|
* Example Interface declaration: |
82 |
|
* |
83 |
|
* #undef INTERFACE |
84 |
|
* #define INTERFACE IClassFactory |
85 |
|
* |
86 |
|
* DECLARE_INTERFACE_(IClassFactory, IUnknown) |
87 |
|
* { |
88 |
|
* // *** IUnknown methods *** |
89 |
|
* STDMETHOD(QueryInterface) (THIS_ |
90 |
|
* REFIID riid, |
91 |
|
* LPVOID FAR* ppvObj) PURE; |
92 |
|
* STDMETHOD_(ULONG,AddRef) (THIS) PURE; |
93 |
|
* STDMETHOD_(ULONG,Release) (THIS) PURE; |
94 |
|
* |
95 |
|
* // *** IClassFactory methods *** |
96 |
|
* STDMETHOD(CreateInstance) (THIS_ |
97 |
|
* LPUNKNOWN pUnkOuter, |
98 |
|
* REFIID riid, |
99 |
|
* LPVOID FAR* ppvObject) PURE; |
100 |
|
* }; |
101 |
|
* |
102 |
|
* Example C++ expansion: |
103 |
|
* |
104 |
|
* struct FAR IClassFactory : public IUnknown |
105 |
|
* { |
116 |
|
* |
117 |
|
* NOTE: Our documentation says '#define interface class' but we use |
118 |
|
* 'struct' instead of 'class' to keep a lot of 'public:' lines |
119 |
|
* out of the interfaces. The 'FAR' forces the 'this' pointers to |
120 |
|
* be far, which is what we need. |
121 |
|
* |
122 |
|
* Example C expansion: |
123 |
|
* |
124 |
|
* typedef struct IClassFactory |
125 |
|
* { |
126 |
|
* const struct IClassFactoryVtbl FAR* lpVtbl; |
127 |
|
* } IClassFactory; |
128 |
|
* |
129 |
|
* typedef struct IClassFactoryVtbl IClassFactoryVtbl; |
130 |
|
* |
131 |
|
* struct IClassFactoryVtbl |
132 |
|
* { |
133 |
|
* HRESULT (STDMETHODCALLTYPE * QueryInterface) ( |
134 |
|
* IClassFactory FAR* This, |
135 |
|
* IID FAR* riid, |
136 |
|
* LPVOID FAR* ppvObj) ; |
137 |
|
* HRESULT (STDMETHODCALLTYPE * AddRef) (IClassFactory FAR* This) ; |
138 |
|
* HRESULT (STDMETHODCALLTYPE * Release) (IClassFactory FAR* This) ; |
139 |
|
* HRESULT (STDMETHODCALLTYPE * CreateInstance) ( |
140 |
|
* IClassFactory FAR* This, |
141 |
|
* LPUNKNOWN pUnkOuter, |
142 |
|
* IID FAR* riid, |
143 |
|
* LPVOID FAR* ppvObject); |
144 |
|
* HRESULT (STDMETHODCALLTYPE * LockServer) ( |
145 |
|
* IClassFactory FAR* This, |
146 |
|
* BOOL fLock); |
147 |
|
* }; |
148 |
|
*/ |
149 |
|
|
150 |
|
|
151 |
|
#if defined(__cplusplus) && !defined(CINTERFACE) |
152 |
|
//#define interface struct FAR |
153 |
|
|
154 |
|
#ifdef COM_STDMETHOD_CAN_THROW |
155 |
|
#define COM_DECLSPEC_NOTHROW |
156 |
|
#else |
157 |
|
#define COM_DECLSPEC_NOTHROW DECLSPEC_NOTHROW |
158 |
|
#endif |
159 |
|
|
160 |
|
#define __STRUCT__ struct |
161 |
|
#define interface __STRUCT__ |
162 |
|
#define STDMETHOD(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE method |
163 |
|
#define STDMETHOD_(type,method) virtual COM_DECLSPEC_NOTHROW type STDMETHODCALLTYPE method |
164 |
|
#define STDMETHODV(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODVCALLTYPE method |
165 |
|
#define STDMETHODV_(type,method) virtual COM_DECLSPEC_NOTHROW type STDMETHODVCALLTYPE method |
166 |
|
#define PURE = 0 |
167 |
|
#define THIS_ |
168 |
|
#define THIS void |
169 |
|
#define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface |
170 |
|
#define DECLARE_INTERFACE_(iface, baseiface) interface DECLSPEC_NOVTABLE iface : public baseiface |
171 |
|
|
172 |
|
#define IFACEMETHOD(method) __override STDMETHOD(method) |
173 |
|
#define IFACEMETHOD_(type,method) __override STDMETHOD_(type,method) |
174 |
|
#define IFACEMETHODV(method) __override STDMETHODV(method) |
175 |
|
#define IFACEMETHODV_(type,method) __override STDMETHODV_(type,method) |
176 |
|
|
177 |
|
#else |
178 |
|
|
179 |
|
#define interface struct |
180 |
|
|
181 |
|
#define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE * method) |
182 |
|
#define STDMETHOD_(type,method) type (STDMETHODCALLTYPE * method) |
183 |
|
#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE * method) |
184 |
|
#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE * method) |
185 |
|
|
186 |
|
#define IFACEMETHOD(method) __override STDMETHOD(method) |
187 |
|
#define IFACEMETHOD_(type,method) __override STDMETHOD_(type,method) |
188 |
|
#define IFACEMETHODV(method) __override STDMETHODV(method) |
189 |
|
#define IFACEMETHODV_(type,method) __override STDMETHODV_(type,method) |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
#define PURE |
194 |
|
#define THIS_ INTERFACE FAR* This, |
195 |
|
#define THIS INTERFACE FAR* This |
196 |
|
#ifdef CONST_VTABLE |
197 |
|
#define DECLARE_INTERFACE(iface) typedef interface iface { \ |
198 |
|
const struct iface##Vtbl FAR* lpVtbl; \ |
199 |
|
} iface; \ |
200 |
|
typedef const struct iface##Vtbl iface##Vtbl; \ |
201 |
|
const struct iface##Vtbl |
202 |
|
#else |
203 |
|
#define DECLARE_INTERFACE(iface) typedef interface iface { \ |
204 |
|
struct iface##Vtbl FAR* lpVtbl; \ |
205 |
|
} iface; \ |
206 |
|
typedef struct iface##Vtbl iface##Vtbl; \ |
207 |
|
struct iface##Vtbl |
208 |
|
#endif |
209 |
|
#define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE(iface) |
210 |
|
|
211 |
|
#endif |
212 |
|
|
213 |
|
#include <guiddef.h> |
214 |
|
|
215 |
|
#ifndef _ERROR_STATUS_T_DEFINED |
216 |
|
typedef unsigned long error_status_t; |
217 |
|
#define _ERROR_STATUS_T_DEFINED |
218 |
|
#endif |
219 |
|
|
220 |
|
#ifndef _WCHAR_T_DEFINED |
221 |
|
typedef unsigned short wchar_t; |
222 |
|
#define _WCHAR_T_DEFINED |
223 |
|
#endif |
224 |
|
|
225 |
|
#endif |
226 |
|
|
227 |
|
|
228 |
|
|
|
|
|