Release 20030408.
[wine/gsoc-2012-control.git] / include / rpcproxy.h
blobf4e2059a523aff59b1b98127eeafe5aec5b3667c
1 /*
2 * Copyright (C) 2001 Ove Kaaven
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.
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.
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
19 #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
24 #ifndef __WINE_RPCPROXY_H
25 #define __WINE_RPCPROXY_H
27 #include "basetsd.h"
28 #include "guiddef.h"
29 #include "winnt.h"
30 #include "rpc.h"
31 #include "rpcndr.h"
33 typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
34 typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
35 typedef const char *PCInterfaceName;
36 typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
37 typedef IIDLookupRtn *PIIDLookup;
39 typedef struct tagProxyFileInfo
41 const PCInterfaceProxyVtblList *pProxyVtblList;
42 const PCInterfaceStubVtblList *pStubVtblList;
43 const PCInterfaceName *pNamesArray;
44 const IID **pDelegatedIIDs;
45 const PIIDLookup pIIDLookupRtn;
46 unsigned short TableSize;
47 unsigned short TableVersion;
48 const IID **pAsyncIIDLookup;
49 LONG_PTR Filler2;
50 LONG_PTR Filler3;
51 LONG_PTR Filler4;
52 } ProxyFileInfo;
54 typedef ProxyFileInfo ExtendedProxyFileInfo;
56 typedef struct tagCInterfaceProxyHeader
58 #ifdef USE_STUBLESS_PROXY
59 const void *pStublessProxyInfo;
60 #endif
61 const IID *piid;
62 } CInterfaceProxyHeader;
64 #define CINTERFACE_PROXY_VTABLE(n) \
65 struct \
66 { \
67 CInterfaceProxyHeader header; \
68 void *Vtbl[n]; \
71 typedef struct tagCInterfaceProxyVtbl
73 CInterfaceProxyHeader header;
74 #if defined(__GNUC__)
75 void *Vtbl[0];
76 #else
77 void *Vtbl[1];
78 #endif
79 } CInterfaceProxyVtbl;
81 typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
82 IRpcStubBuffer *This,
83 IRpcChannelBuffer *_pRpcChannelBuffer,
84 PRPC_MESSAGE _pRpcMessage,
85 DWORD *pdwStubPhase);
87 typedef struct tagCInterfaceStubHeader
89 const IID *piid;
90 const MIDL_SERVER_INFO *pServerInfo;
91 unsigned long DispatchTableCount;
92 const PRPC_STUB_FUNCTION *pDispatchTable;
93 } CInterfaceStubHeader;
95 typedef struct tagCInterfaceStubVtbl
97 CInterfaceStubHeader header;
98 ICOM_VTABLE(IRpcStubBuffer) Vtbl;
99 } CInterfaceStubVtbl;
101 typedef struct tagCStdStubBuffer
103 const ICOM_VTABLE(IRpcStubBuffer) *lpVtbl;
104 long RefCount;
105 struct IUnknown *pvServerObject;
106 const struct ICallFactoryVtbl *pCallFactoryVtbl;
107 const IID *pAsyncIID;
108 struct IPSFactoryBuffer *pPSFactory;
109 } CStdStubBuffer;
111 typedef struct tagCStdPSFactoryBuffer
113 const IPSFactoryBufferVtbl *lpVtbl;
114 long RefCount;
115 const ProxyFileInfo **pProxyFileList;
116 long Filler1;
117 } CStdPSFactoryBuffer;
119 HRESULT WINAPI
120 CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
121 ULONG WINAPI
122 CStdStubBuffer_AddRef( IRpcStubBuffer *This );
123 ULONG WINAPI
124 CStdStubBuffer_Release( IRpcStubBuffer *This );
125 ULONG WINAPI
126 NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
127 HRESULT WINAPI
128 CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
129 void WINAPI
130 CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
131 HRESULT WINAPI
132 CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
133 IRpcStubBuffer * WINAPI
134 CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
135 ULONG WINAPI
136 CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
137 HRESULT WINAPI
138 CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
139 void WINAPI
140 CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
142 #define CStdStubBuffer_METHODS \
143 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE \
144 CStdStubBuffer_QueryInterface, \
145 CStdStubBuffer_AddRef, \
146 CStdStubBuffer_Release, \
147 CStdStubBuffer_Connect, \
148 CStdStubBuffer_Disconnect, \
149 CStdStubBuffer_Invoke, \
150 CStdStubBuffer_IsIIDSupported, \
151 CStdStubBuffer_CountRefs, \
152 CStdStubBuffer_DebugServerQueryInterface, \
153 CStdStubBuffer_DebugServerRelease
155 RPCRTAPI void RPC_ENTRY
156 NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
157 PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum );
158 RPCRTAPI void RPC_ENTRY
159 NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
160 RPCRTAPI void RPC_ENTRY
161 NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg );
162 RPCRTAPI void RPC_ENTRY
163 NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
164 RPCRTAPI HRESULT RPC_ENTRY
165 NdrProxyErrorHandler( DWORD dwExceptionCode );
167 RPCRTAPI void RPC_ENTRY
168 NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
169 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer );
170 RPCRTAPI void RPC_ENTRY
171 NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
172 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer,
173 unsigned long RequestedBufferSize );
174 void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
175 PRPC_MESSAGE pMsg, DWORD *pdwStubPhase );
176 RPCRTAPI void RPC_ENTRY
177 NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg );
178 RPCRTAPI HRESULT RPC_ENTRY
179 NdrStubErrorHandler( DWORD dwExceptionCode );
181 RPCRTAPI HRESULT RPC_ENTRY
182 NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList,
183 const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer );
184 RPCRTAPI HRESULT RPC_ENTRY
185 NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer );
187 RPCRTAPI HRESULT RPC_ENTRY
188 NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
189 RPCRTAPI HRESULT RPC_ENTRY
190 NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
192 #define CSTDSTUBBUFFERRELEASE(pFactory) \
193 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
194 { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
196 #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
199 * In these macros, BS stands for Binary Search. MIDL uses these to
200 * "unroll" a binary search into the module's IID_Lookup function.
201 * However, I haven't bothered to reimplement that stuff yet;
202 * I've just implemented a linear search for now.
204 #define IID_BS_LOOKUP_SETUP \
205 int c;
206 #define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)
207 #define IID_BS_LOOKUP_NEXT_TEST(name, split)
208 #define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index) \
209 for (c=0; c<sz; c++) if (!name##_CHECK_IID(c)) { (index)=c; return 1; } \
210 return 0;
212 #if 0
214 /* see http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp?frame=true */
216 RPCRTAPI HRESULT RPC_ENTRY
217 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
218 LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
219 RPCRTAPI HRESULT RPC_ENTRY
220 CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
221 LPRPCSTUBBUFFER *ppStub );
223 #endif
225 #endif /*__WINE_RPCDCE_H */