blob: 9b21bf6f1f3f4256fa018dc28a9745361aae139f [file] [log] [blame]
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00001/*
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
Ove Kaaven528d2c42002-10-10 23:26:53 +000019#ifndef __RPCPROXY_H_VERSION__
20/* FIXME: Find an appropriate version number. I guess something is better than nothing */
21#define __RPCPROXY_H_VERSION__ ( 399 )
22#endif
23
Ove Kaaven0dac9722001-10-14 16:15:37 +000024#ifndef __WINE_RPCPROXY_H
25#define __WINE_RPCPROXY_H
26
Mike McCormack90c29ab2004-09-06 21:25:16 +000027#define __midl_proxy
28
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +000029#include <basetsd.h>
Mike McCormack90c29ab2004-09-06 21:25:16 +000030#ifndef GUID_DEFINED
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +000031#include <guiddef.h>
Mike McCormack90c29ab2004-09-06 21:25:16 +000032#endif
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +000033#include <rpc.h>
34#include <rpcndr.h>
Ove Kaaven0dac9722001-10-14 16:15:37 +000035
36typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
37typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
38typedef const char *PCInterfaceName;
39typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
40typedef IIDLookupRtn *PIIDLookup;
41
42typedef struct tagProxyFileInfo
43{
44 const PCInterfaceProxyVtblList *pProxyVtblList;
45 const PCInterfaceStubVtblList *pStubVtblList;
46 const PCInterfaceName *pNamesArray;
47 const IID **pDelegatedIIDs;
48 const PIIDLookup pIIDLookupRtn;
49 unsigned short TableSize;
50 unsigned short TableVersion;
51 const IID **pAsyncIIDLookup;
52 LONG_PTR Filler2;
53 LONG_PTR Filler3;
54 LONG_PTR Filler4;
55} ProxyFileInfo;
56
57typedef ProxyFileInfo ExtendedProxyFileInfo;
58
Ove Kaaven0dac9722001-10-14 16:15:37 +000059typedef struct tagCInterfaceProxyHeader
60{
61#ifdef USE_STUBLESS_PROXY
62 const void *pStublessProxyInfo;
63#endif
64 const IID *piid;
65} CInterfaceProxyHeader;
66
67#define CINTERFACE_PROXY_VTABLE(n) \
68 struct \
69 { \
70 CInterfaceProxyHeader header; \
71 void *Vtbl[n]; \
72 }
73
74typedef struct tagCInterfaceProxyVtbl
75{
76 CInterfaceProxyHeader header;
77#if defined(__GNUC__)
78 void *Vtbl[0];
79#else
80 void *Vtbl[1];
81#endif
82} CInterfaceProxyVtbl;
83
84typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
85 IRpcStubBuffer *This,
86 IRpcChannelBuffer *_pRpcChannelBuffer,
87 PRPC_MESSAGE _pRpcMessage,
88 DWORD *pdwStubPhase);
89
90typedef struct tagCInterfaceStubHeader
91{
92 const IID *piid;
93 const MIDL_SERVER_INFO *pServerInfo;
94 unsigned long DispatchTableCount;
95 const PRPC_STUB_FUNCTION *pDispatchTable;
96} CInterfaceStubHeader;
97
98typedef struct tagCInterfaceStubVtbl
99{
100 CInterfaceStubHeader header;
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000101 IRpcStubBufferVtbl Vtbl;
Ove Kaaven0dac9722001-10-14 16:15:37 +0000102} CInterfaceStubVtbl;
103
104typedef struct tagCStdStubBuffer
105{
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000106 const IRpcStubBufferVtbl *lpVtbl;
Ove Kaaven0dac9722001-10-14 16:15:37 +0000107 long RefCount;
108 struct IUnknown *pvServerObject;
109 const struct ICallFactoryVtbl *pCallFactoryVtbl;
110 const IID *pAsyncIID;
111 struct IPSFactoryBuffer *pPSFactory;
112} CStdStubBuffer;
113
114typedef struct tagCStdPSFactoryBuffer
115{
116 const IPSFactoryBufferVtbl *lpVtbl;
117 long RefCount;
118 const ProxyFileInfo **pProxyFileList;
119 long Filler1;
120} CStdPSFactoryBuffer;
121
Huw Daviesc4e8f062005-10-26 13:56:00 +0000122#define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
123
124ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This);
125ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
126
127#define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
128
129
Ove Kaaven0dac9722001-10-14 16:15:37 +0000130HRESULT WINAPI
131 CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
132ULONG WINAPI
133 CStdStubBuffer_AddRef( IRpcStubBuffer *This );
134ULONG WINAPI
135 CStdStubBuffer_Release( IRpcStubBuffer *This );
136ULONG WINAPI
137 NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
138HRESULT WINAPI
139 CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
140void WINAPI
141 CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
142HRESULT WINAPI
143 CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
144IRpcStubBuffer * WINAPI
145 CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
146ULONG WINAPI
147 CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
148HRESULT WINAPI
149 CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
150void WINAPI
151 CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
152
153#define CStdStubBuffer_METHODS \
Ove Kaaven0dac9722001-10-14 16:15:37 +0000154 CStdStubBuffer_QueryInterface, \
155 CStdStubBuffer_AddRef, \
156 CStdStubBuffer_Release, \
157 CStdStubBuffer_Connect, \
158 CStdStubBuffer_Disconnect, \
159 CStdStubBuffer_Invoke, \
160 CStdStubBuffer_IsIIDSupported, \
161 CStdStubBuffer_CountRefs, \
162 CStdStubBuffer_DebugServerQueryInterface, \
163 CStdStubBuffer_DebugServerRelease
164
Ove Kaaven29b30612002-08-09 01:11:39 +0000165RPCRTAPI void RPC_ENTRY
166 NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
167 PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum );
168RPCRTAPI void RPC_ENTRY
169 NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
170RPCRTAPI void RPC_ENTRY
171 NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg );
172RPCRTAPI void RPC_ENTRY
173 NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
174RPCRTAPI HRESULT RPC_ENTRY
175 NdrProxyErrorHandler( DWORD dwExceptionCode );
176
177RPCRTAPI void RPC_ENTRY
178 NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
179 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer );
180RPCRTAPI void RPC_ENTRY
181 NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
182 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer,
183 unsigned long RequestedBufferSize );
184void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
185 PRPC_MESSAGE pMsg, DWORD *pdwStubPhase );
186RPCRTAPI void RPC_ENTRY
187 NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg );
188RPCRTAPI HRESULT RPC_ENTRY
189 NdrStubErrorHandler( DWORD dwExceptionCode );
190
Ove Kaaven0dac9722001-10-14 16:15:37 +0000191RPCRTAPI HRESULT RPC_ENTRY
192 NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList,
193 const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer );
194RPCRTAPI HRESULT RPC_ENTRY
195 NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer );
196
197RPCRTAPI HRESULT RPC_ENTRY
198 NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
199RPCRTAPI HRESULT RPC_ENTRY
200 NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
201
202#define CSTDSTUBBUFFERRELEASE(pFactory) \
203ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
204 { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
205
Huw Daviesc4e8f062005-10-26 13:56:00 +0000206#ifdef PROXY_DELEGATION
207#define CSTDSTUBBUFFER2RELEASE(pFactory) \
208ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
209 { return NdrCStdStubBuffer2_Release(This, (IPSFactoryBuffer *)pFactory); }
210#else
211#define CSTDSTUBBUFFER2RELEASE(pFactory)
212#endif
213
Ove Kaaven29b30612002-08-09 01:11:39 +0000214#define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
215
Ove Kaaven97b4e6f2003-02-19 03:38:07 +0000216/*
217 * In these macros, BS stands for Binary Search. MIDL uses these to
218 * "unroll" a binary search into the module's IID_Lookup function.
219 * However, I haven't bothered to reimplement that stuff yet;
220 * I've just implemented a linear search for now.
221 */
222#define IID_BS_LOOKUP_SETUP \
223 int c;
224#define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)
225#define IID_BS_LOOKUP_NEXT_TEST(name, split)
226#define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index) \
227 for (c=0; c<sz; c++) if (!name##_CHECK_IID(c)) { (index)=c; return 1; } \
228 return 0;
229
Robert Shearman95b62662005-10-27 12:09:05 +0000230/* macros used in dlldata.c files */
231#define EXTERN_PROXY_FILE(proxy) \
232 EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo
233
234#define PROXYFILE_LIST_START \
235 const ProxyFileInfo *aProxyFileList[] = \
236 {
237
238#define REFERENCE_PROXY_FILE(proxy) \
239 & proxy##_ProxyFileInfo
240
241#define PROXYFILE_LIST_END \
242 NULL \
243 };
244
Dimitrie O. Paun4fd679b2003-03-23 20:03:48 +0000245#if 0
246
Mike McCormacka3c80812004-09-03 01:02:32 +0000247/* see http://www.microsoft.com/msj/0199/com/com0199.aspx */
Ove Kaaven0dac9722001-10-14 16:15:37 +0000248
249RPCRTAPI HRESULT RPC_ENTRY
250 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
251 LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
252RPCRTAPI HRESULT RPC_ENTRY
253 CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
254 LPRPCSTUBBUFFER *ppStub );
255
256#endif
257
258#endif /*__WINE_RPCDCE_H */