VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/rpcproxy.h@ 33223

Last change on this file since 33223 was 16477, checked in by vboxsync, 16 years ago

LGPL disclaimer by filemuncher

  • Property svn:eol-style set to native
File size: 13.1 KB
Line 
1/*
2 * Copyright (C) 2001 Ove Kaaven
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/*
20 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
21 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
22 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
23 * a choice of LGPL license versions is made available with the language indicating
24 * that LGPLv2 or any later version may be used, or where a choice of which version
25 * of the LGPL is applied is otherwise unspecified.
26 */
27
28#ifndef __RPCPROXY_H_VERSION__
29/* FIXME: Find an appropriate version number. I guess something is better than nothing */
30#define __RPCPROXY_H_VERSION__ ( 399 )
31#endif
32
33#ifndef __WINE_RPCPROXY_H
34#define __WINE_RPCPROXY_H
35
36#define __midl_proxy
37
38#include <basetsd.h>
39#ifndef GUID_DEFINED
40#include <guiddef.h>
41#endif
42#include <rpc.h>
43#include <rpcndr.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
50typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
51typedef const char *PCInterfaceName;
52typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
53typedef IIDLookupRtn *PIIDLookup;
54
55typedef struct tagProxyFileInfo
56{
57 const PCInterfaceProxyVtblList *pProxyVtblList;
58 const PCInterfaceStubVtblList *pStubVtblList;
59 const PCInterfaceName *pNamesArray;
60 const IID **pDelegatedIIDs;
61 const PIIDLookup pIIDLookupRtn;
62 unsigned short TableSize;
63 unsigned short TableVersion;
64 const IID **pAsyncIIDLookup;
65 LONG_PTR Filler2;
66 LONG_PTR Filler3;
67 LONG_PTR Filler4;
68} ProxyFileInfo;
69
70typedef ProxyFileInfo ExtendedProxyFileInfo;
71
72typedef struct tagCInterfaceProxyHeader
73{
74#ifdef USE_STUBLESS_PROXY
75 const void *pStublessProxyInfo;
76#endif
77 const IID *piid;
78} CInterfaceProxyHeader;
79
80#define CINTERFACE_PROXY_VTABLE(n) \
81 struct \
82 { \
83 CInterfaceProxyHeader header; \
84 void *Vtbl[n]; \
85 }
86
87typedef struct tagCInterfaceProxyVtbl
88{
89 CInterfaceProxyHeader header;
90#if defined(__GNUC__)
91 void *Vtbl[0];
92#else
93 void *Vtbl[1];
94#endif
95} CInterfaceProxyVtbl;
96
97typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
98 IRpcStubBuffer *This,
99 IRpcChannelBuffer *_pRpcChannelBuffer,
100 PRPC_MESSAGE _pRpcMessage,
101 DWORD *pdwStubPhase);
102
103typedef struct tagCInterfaceStubHeader
104{
105 const IID *piid;
106 const MIDL_SERVER_INFO *pServerInfo;
107 ULONG DispatchTableCount;
108 const PRPC_STUB_FUNCTION *pDispatchTable;
109} CInterfaceStubHeader;
110
111typedef struct tagCInterfaceStubVtbl
112{
113 CInterfaceStubHeader header;
114 IRpcStubBufferVtbl Vtbl;
115} CInterfaceStubVtbl;
116
117typedef struct tagCStdStubBuffer
118{
119 const IRpcStubBufferVtbl *lpVtbl;
120 LONG RefCount;
121 struct IUnknown *pvServerObject;
122 const struct ICallFactoryVtbl *pCallFactoryVtbl;
123 const IID *pAsyncIID;
124 struct IPSFactoryBuffer *pPSFactory;
125} CStdStubBuffer;
126
127typedef struct tagCStdPSFactoryBuffer
128{
129 const IPSFactoryBufferVtbl *lpVtbl;
130 LONG RefCount;
131 const ProxyFileInfo **pProxyFileList;
132 LONG Filler1;
133} CStdPSFactoryBuffer;
134
135#define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
136
137ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) DECLSPEC_HIDDEN;
138ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
139
140#define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
141
142
143HRESULT WINAPI
144 CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
145ULONG WINAPI
146 CStdStubBuffer_AddRef( IRpcStubBuffer *This );
147ULONG WINAPI
148 CStdStubBuffer_Release( IRpcStubBuffer *This ) DECLSPEC_HIDDEN;
149ULONG WINAPI
150 NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
151HRESULT WINAPI
152 CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
153void WINAPI
154 CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
155HRESULT WINAPI
156 CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
157IRpcStubBuffer * WINAPI
158 CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
159ULONG WINAPI
160 CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
161HRESULT WINAPI
162 CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
163void WINAPI
164 CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
165
166#define CStdStubBuffer_METHODS \
167 CStdStubBuffer_QueryInterface, \
168 CStdStubBuffer_AddRef, \
169 CStdStubBuffer_Release, \
170 CStdStubBuffer_Connect, \
171 CStdStubBuffer_Disconnect, \
172 CStdStubBuffer_Invoke, \
173 CStdStubBuffer_IsIIDSupported, \
174 CStdStubBuffer_CountRefs, \
175 CStdStubBuffer_DebugServerQueryInterface, \
176 CStdStubBuffer_DebugServerRelease
177
178RPCRTAPI void RPC_ENTRY
179 NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
180 PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum );
181RPCRTAPI void RPC_ENTRY
182 NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
183RPCRTAPI void RPC_ENTRY
184 NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg );
185RPCRTAPI void RPC_ENTRY
186 NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
187RPCRTAPI HRESULT RPC_ENTRY
188 NdrProxyErrorHandler( DWORD dwExceptionCode );
189
190RPCRTAPI void RPC_ENTRY
191 NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
192 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer );
193RPCRTAPI void RPC_ENTRY
194 NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
195 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer,
196 ULONG RequestedBufferSize );
197void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
198 PRPC_MESSAGE pMsg, DWORD *pdwStubPhase );
199RPCRTAPI void RPC_ENTRY
200 NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg );
201RPCRTAPI HRESULT RPC_ENTRY
202 NdrStubErrorHandler( DWORD dwExceptionCode );
203
204RPCRTAPI HRESULT RPC_ENTRY
205 NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList,
206 const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer );
207RPCRTAPI HRESULT RPC_ENTRY
208 NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer );
209
210RPCRTAPI HRESULT RPC_ENTRY
211 NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
212RPCRTAPI HRESULT RPC_ENTRY
213 NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
214
215#define CSTDSTUBBUFFERRELEASE(pFactory) \
216ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
217 { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
218
219#ifdef PROXY_DELEGATION
220#define CSTDSTUBBUFFER2RELEASE(pFactory) \
221ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
222 { return NdrCStdStubBuffer2_Release(This, (IPSFactoryBuffer *)pFactory); }
223#else
224#define CSTDSTUBBUFFER2RELEASE(pFactory)
225#endif
226
227#define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
228
229/*
230 * In these macros, BS stands for Binary Search. MIDL uses these to
231 * "unroll" a binary search into the module's IID_Lookup function.
232 * However, I haven't bothered to reimplement that stuff yet;
233 * I've just implemented a linear search for now.
234 */
235#define IID_BS_LOOKUP_SETUP \
236 int c;
237#define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)
238#define IID_BS_LOOKUP_NEXT_TEST(name, split)
239#define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index) \
240 for (c=0; c<sz; c++) if (!name##_CHECK_IID(c)) { (index)=c; return 1; } \
241 return 0;
242
243/* macros used in dlldata.c files */
244#define EXTERN_PROXY_FILE(proxy) \
245 EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo DECLSPEC_HIDDEN;
246
247#define PROXYFILE_LIST_START \
248 const ProxyFileInfo * aProxyFileList[] DECLSPEC_HIDDEN = \
249 {
250
251#define REFERENCE_PROXY_FILE(proxy) \
252 & proxy##_ProxyFileInfo
253
254#define PROXYFILE_LIST_END \
255 NULL \
256 };
257
258
259/* define PROXY_CLSID to use an existing CLSID */
260/* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */
261/* define neither to use the GUID of the first interface */
262#ifdef PROXY_CLSID
263# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID DECLSPEC_HIDDEN;
264#else
265# ifdef PROXY_CLSID_IS
266# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; \
267 const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
268# define PROXY_CLSID CLSID_PSFactoryBuffer
269# else
270# define CLSID_PSFACTORYBUFFER
271# endif
272#endif
273
274#ifndef PROXY_CLSID
275# define GET_DLL_CLSID (aProxyFileList[0]->pStubVtblList[0] ? \
276 aProxyFileList[0]->pStubVtblList[0]->header.piid : NULL)
277#else
278# define GET_DLL_CLSID &PROXY_CLSID
279#endif
280
281#ifdef ENTRY_PREFIX
282# define __rpc_macro_expand2(a, b) a##b
283# define __rpc_macro_expand(a, b) __rpc_macro_expand2(a, b)
284# define DLLREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllRegisterServer)
285# define DLLUNREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllUnregisterServer)
286# define DLLMAIN_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllMain)
287# define DLLGETCLASSOBJECT_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllGetClassObject)
288# define DLLCANUNLOADNOW_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllCanUnloadNow)
289#else
290# define DLLREGISTERSERVER_ENTRY DllRegisterServer
291# define DLLUNREGISTERSERVER_ENTRY DllUnregisterServer
292# define DLLMAIN_ENTRY DllMain
293# define DLLGETCLASSOBJECT_ENTRY DllGetClassObject
294# define DLLCANUNLOADNOW_ENTRY DllCanUnloadNow
295#endif
296
297#define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \
298 void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
299 const CLSID **ppClsid) DECLSPEC_HIDDEN; \
300 void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
301 const CLSID **ppClsid) \
302 { \
303 *ppProxyFileInfo = (pfl); \
304 *ppClsid = (rclsid); \
305 }
306
307#define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \
308 HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN; \
309 HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \
310 void **ppv) \
311 { \
312 return NdrDllGetClassObject(rclsid, riid, ppv, (pfl), \
313 (factory_clsid), factory); \
314 }
315
316#define DLLCANUNLOADNOW(factory) \
317 HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) DECLSPEC_HIDDEN; \
318 HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \
319 { \
320 return NdrDllCanUnloadNow((factory)); \
321 }
322
323#define REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) \
324 HINSTANCE hProxyDll DECLSPEC_HIDDEN = NULL; \
325 \
326 BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; \
327 BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, \
328 LPVOID lpvReserved) \
329 { \
330 if (fdwReason == DLL_PROCESS_ATTACH) \
331 { \
332 DisableThreadLibraryCalls(hinstDLL); \
333 hProxyDll = hinstDLL; \
334 } \
335 return TRUE; \
336 } \
337 \
338 HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
339 HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) \
340 { \
341 return NdrDllRegisterProxy(hProxyDll, (pfl), (factory_clsid)); \
342 } \
343 \
344 HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
345 HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) \
346 { \
347 return NdrDllUnregisterProxy(hProxyDll, (pfl), (factory_clsid)); \
348 }
349
350#ifdef REGISTER_PROXY_DLL
351# define DLLREGISTRY_ROUTINES(pfl, factory_clsid) \
352 REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid)
353#else
354# define DLLREGISTRY_ROUTINES(pfl, factory_clsid)
355#endif
356
357#define DLLDATA_ROUTINES(pfl, factory_clsid) \
358 CLSID_PSFACTORYBUFFER \
359 CStdPSFactoryBuffer DECLSPEC_HIDDEN gPFactory = { NULL, 0, NULL, 0 }; \
360 DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \
361 DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \
362 DLLCANUNLOADNOW(&gPFactory) \
363 CSTDSTUBBUFFERRELEASE(&gPFactory) \
364 CSTDSTUBBUFFER2RELEASE(&gPFactory) \
365 DLLREGISTRY_ROUTINES(pfl, factory_clsid)
366
367#if 0
368
369RPCRTAPI HRESULT RPC_ENTRY
370 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
371 LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
372RPCRTAPI HRESULT RPC_ENTRY
373 CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
374 LPRPCSTUBBUFFER *ppStub );
375
376#endif
377
378#ifdef __cplusplus
379}
380#endif
381
382#endif /*__WINE_RPCPROXY_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette