Return error from low level driver when necessary.
[wine.git] / include / rpcproxy.h
blobcd88d1f7816b9afa41592b6e873cc16c75f210de
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 #define __midl_proxy
29 #include <basetsd.h>
30 #ifndef GUID_DEFINED
31 #include <guiddef.h>
32 #endif
33 #include <rpc.h>
34 #include <rpcndr.h>
36 typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
37 typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
38 typedef const char *PCInterfaceName;
39 typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
40 typedef IIDLookupRtn *PIIDLookup;
42 typedef struct tagProxyFileInfo
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;
57 typedef ProxyFileInfo ExtendedProxyFileInfo;
59 typedef struct tagCInterfaceProxyHeader
61 #ifdef USE_STUBLESS_PROXY
62 const void *pStublessProxyInfo;
63 #endif
64 const IID *piid;
65 } CInterfaceProxyHeader;
67 #define CINTERFACE_PROXY_VTABLE(n) \
68 struct \
69 { \
70 CInterfaceProxyHeader header; \
71 void *Vtbl[n]; \
74 typedef struct tagCInterfaceProxyVtbl
76 CInterfaceProxyHeader header;
77 #if defined(__GNUC__)
78 void *Vtbl[0];
79 #else
80 void *Vtbl[1];
81 #endif
82 } CInterfaceProxyVtbl;
84 typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
85 IRpcStubBuffer *This,
86 IRpcChannelBuffer *_pRpcChannelBuffer,
87 PRPC_MESSAGE _pRpcMessage,
88 DWORD *pdwStubPhase);
90 typedef struct tagCInterfaceStubHeader
92 const IID *piid;
93 const MIDL_SERVER_INFO *pServerInfo;
94 unsigned long DispatchTableCount;
95 const PRPC_STUB_FUNCTION *pDispatchTable;
96 } CInterfaceStubHeader;
98 typedef struct tagCInterfaceStubVtbl
100 CInterfaceStubHeader header;
101 IRpcStubBufferVtbl Vtbl;
102 } CInterfaceStubVtbl;
104 typedef struct tagCStdStubBuffer
106 const IRpcStubBufferVtbl *lpVtbl;
107 long RefCount;
108 struct IUnknown *pvServerObject;
109 const struct ICallFactoryVtbl *pCallFactoryVtbl;
110 const IID *pAsyncIID;
111 struct IPSFactoryBuffer *pPSFactory;
112 } CStdStubBuffer;
114 typedef struct tagCStdPSFactoryBuffer
116 const IPSFactoryBufferVtbl *lpVtbl;
117 long RefCount;
118 const ProxyFileInfo **pProxyFileList;
119 long Filler1;
120 } CStdPSFactoryBuffer;
122 HRESULT WINAPI
123 CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
124 ULONG WINAPI
125 CStdStubBuffer_AddRef( IRpcStubBuffer *This );
126 ULONG WINAPI
127 CStdStubBuffer_Release( IRpcStubBuffer *This );
128 ULONG WINAPI
129 NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
130 HRESULT WINAPI
131 CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
132 void WINAPI
133 CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
134 HRESULT WINAPI
135 CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
136 IRpcStubBuffer * WINAPI
137 CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
138 ULONG WINAPI
139 CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
140 HRESULT WINAPI
141 CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
142 void WINAPI
143 CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
145 #define CStdStubBuffer_METHODS \
146 CStdStubBuffer_QueryInterface, \
147 CStdStubBuffer_AddRef, \
148 CStdStubBuffer_Release, \
149 CStdStubBuffer_Connect, \
150 CStdStubBuffer_Disconnect, \
151 CStdStubBuffer_Invoke, \
152 CStdStubBuffer_IsIIDSupported, \
153 CStdStubBuffer_CountRefs, \
154 CStdStubBuffer_DebugServerQueryInterface, \
155 CStdStubBuffer_DebugServerRelease
157 RPCRTAPI void RPC_ENTRY
158 NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
159 PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum );
160 RPCRTAPI void RPC_ENTRY
161 NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
162 RPCRTAPI void RPC_ENTRY
163 NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg );
164 RPCRTAPI void RPC_ENTRY
165 NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
166 RPCRTAPI HRESULT RPC_ENTRY
167 NdrProxyErrorHandler( DWORD dwExceptionCode );
169 RPCRTAPI void RPC_ENTRY
170 NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
171 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer );
172 RPCRTAPI void RPC_ENTRY
173 NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
174 PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer,
175 unsigned long RequestedBufferSize );
176 void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
177 PRPC_MESSAGE pMsg, DWORD *pdwStubPhase );
178 RPCRTAPI void RPC_ENTRY
179 NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg );
180 RPCRTAPI HRESULT RPC_ENTRY
181 NdrStubErrorHandler( DWORD dwExceptionCode );
183 RPCRTAPI HRESULT RPC_ENTRY
184 NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList,
185 const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer );
186 RPCRTAPI HRESULT RPC_ENTRY
187 NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer );
189 RPCRTAPI HRESULT RPC_ENTRY
190 NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
191 RPCRTAPI HRESULT RPC_ENTRY
192 NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
194 #define CSTDSTUBBUFFERRELEASE(pFactory) \
195 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
196 { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
198 #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
201 * In these macros, BS stands for Binary Search. MIDL uses these to
202 * "unroll" a binary search into the module's IID_Lookup function.
203 * However, I haven't bothered to reimplement that stuff yet;
204 * I've just implemented a linear search for now.
206 #define IID_BS_LOOKUP_SETUP \
207 int c;
208 #define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)
209 #define IID_BS_LOOKUP_NEXT_TEST(name, split)
210 #define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index) \
211 for (c=0; c<sz; c++) if (!name##_CHECK_IID(c)) { (index)=c; return 1; } \
212 return 0;
214 #if 0
216 /* see http://www.microsoft.com/msj/0199/com/com0199.aspx */
218 RPCRTAPI HRESULT RPC_ENTRY
219 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
220 LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
221 RPCRTAPI HRESULT RPC_ENTRY
222 CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
223 LPRPCSTUBBUFFER *ppStub );
225 #endif
227 #endif /*__WINE_RPCDCE_H */