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 )
24 #ifndef __WINE_RPCPROXY_H
25 #define __WINE_RPCPROXY_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
;
57 typedef ProxyFileInfo ExtendedProxyFileInfo
;
59 typedef struct tagCInterfaceProxyHeader
61 #ifdef USE_STUBLESS_PROXY
62 const void *pStublessProxyInfo
;
65 } CInterfaceProxyHeader
;
67 #define CINTERFACE_PROXY_VTABLE(n) \
70 CInterfaceProxyHeader header; \
74 typedef struct tagCInterfaceProxyVtbl
76 CInterfaceProxyHeader header
;
82 } CInterfaceProxyVtbl
;
84 typedef void (__RPC_STUB
*PRPC_STUB_FUNCTION
)(
86 IRpcChannelBuffer
*_pRpcChannelBuffer
,
87 PRPC_MESSAGE _pRpcMessage
,
90 typedef struct tagCInterfaceStubHeader
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
;
108 struct IUnknown
*pvServerObject
;
109 const struct ICallFactoryVtbl
*pCallFactoryVtbl
;
110 const IID
*pAsyncIID
;
111 struct IPSFactoryBuffer
*pPSFactory
;
114 typedef struct tagCStdPSFactoryBuffer
116 const IPSFactoryBufferVtbl
*lpVtbl
;
118 const ProxyFileInfo
**pProxyFileList
;
120 } CStdPSFactoryBuffer
;
122 #define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
124 ULONG STDMETHODCALLTYPE
CStdStubBuffer2_Release(IRpcStubBuffer
*This
);
125 ULONG STDMETHODCALLTYPE
NdrCStdStubBuffer2_Release(IRpcStubBuffer
*This
, IPSFactoryBuffer
*pPSF
);
127 #define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
131 CStdStubBuffer_QueryInterface( IRpcStubBuffer
*This
, REFIID riid
, void **ppvObject
);
133 CStdStubBuffer_AddRef( IRpcStubBuffer
*This
);
135 CStdStubBuffer_Release( IRpcStubBuffer
*This
);
137 NdrCStdStubBuffer_Release( IRpcStubBuffer
*This
, IPSFactoryBuffer
*pPSF
);
139 CStdStubBuffer_Connect( IRpcStubBuffer
*This
, IUnknown
*pUnkServer
);
141 CStdStubBuffer_Disconnect( IRpcStubBuffer
*This
);
143 CStdStubBuffer_Invoke( IRpcStubBuffer
*This
, RPCOLEMESSAGE
*pRpcMsg
, IRpcChannelBuffer
*pRpcChannelBuffer
);
144 IRpcStubBuffer
* WINAPI
145 CStdStubBuffer_IsIIDSupported( IRpcStubBuffer
*This
, REFIID riid
);
147 CStdStubBuffer_CountRefs( IRpcStubBuffer
*This
);
149 CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer
*This
, void **ppv
);
151 CStdStubBuffer_DebugServerRelease( IRpcStubBuffer
*This
, void *pv
);
153 #define CStdStubBuffer_METHODS \
154 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
165 RPCRTAPI
void RPC_ENTRY
166 NdrProxyInitialize( void *This
, PRPC_MESSAGE pRpcMsg
, PMIDL_STUB_MESSAGE pStubMsg
,
167 PMIDL_STUB_DESC pStubDescriptor
, unsigned int ProcNum
);
168 RPCRTAPI
void RPC_ENTRY
169 NdrProxyGetBuffer( void *This
, PMIDL_STUB_MESSAGE pStubMsg
);
170 RPCRTAPI
void RPC_ENTRY
171 NdrProxySendReceive( void *This
, PMIDL_STUB_MESSAGE pStubMsg
);
172 RPCRTAPI
void RPC_ENTRY
173 NdrProxyFreeBuffer( void *This
, PMIDL_STUB_MESSAGE pStubMsg
);
174 RPCRTAPI HRESULT RPC_ENTRY
175 NdrProxyErrorHandler( DWORD dwExceptionCode
);
177 RPCRTAPI
void RPC_ENTRY
178 NdrStubInitialize( PRPC_MESSAGE pRpcMsg
, PMIDL_STUB_MESSAGE pStubMsg
,
179 PMIDL_STUB_DESC pStubDescriptor
, IRpcChannelBuffer
*pRpcChannelBuffer
);
180 RPCRTAPI
void RPC_ENTRY
181 NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg
, PMIDL_STUB_MESSAGE pStubMsg
,
182 PMIDL_STUB_DESC pStubDescriptor
, IRpcChannelBuffer
*pRpcChannelBuffer
,
183 unsigned long RequestedBufferSize
);
184 void __RPC_STUB
NdrStubForwardingFunction( IRpcStubBuffer
*This
, IRpcChannelBuffer
*pChannel
,
185 PRPC_MESSAGE pMsg
, DWORD
*pdwStubPhase
);
186 RPCRTAPI
void RPC_ENTRY
187 NdrStubGetBuffer( IRpcStubBuffer
*This
, IRpcChannelBuffer
*pRpcChannelBuffer
, PMIDL_STUB_MESSAGE pStubMsg
);
188 RPCRTAPI HRESULT RPC_ENTRY
189 NdrStubErrorHandler( DWORD dwExceptionCode
);
191 RPCRTAPI HRESULT RPC_ENTRY
192 NdrDllGetClassObject( REFCLSID rclsid
, REFIID riid
, void **ppv
, const ProxyFileInfo
**pProxyFileList
,
193 const CLSID
*pclsid
, CStdPSFactoryBuffer
*pPSFactoryBuffer
);
194 RPCRTAPI HRESULT RPC_ENTRY
195 NdrDllCanUnloadNow( CStdPSFactoryBuffer
*pPSFactoryBuffer
);
197 RPCRTAPI HRESULT RPC_ENTRY
198 NdrDllRegisterProxy( HMODULE hDll
, const ProxyFileInfo
**pProxyFileList
, const CLSID
*pclsid
);
199 RPCRTAPI HRESULT RPC_ENTRY
200 NdrDllUnregisterProxy( HMODULE hDll
, const ProxyFileInfo
**pProxyFileList
, const CLSID
*pclsid
);
202 #define CSTDSTUBBUFFERRELEASE(pFactory) \
203 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
204 { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
206 #ifdef PROXY_DELEGATION
207 #define CSTDSTUBBUFFER2RELEASE(pFactory) \
208 ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
209 { return NdrCStdStubBuffer2_Release(This, (IPSFactoryBuffer *)pFactory); }
211 #define CSTDSTUBBUFFER2RELEASE(pFactory)
214 #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
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.
222 #define IID_BS_LOOKUP_SETUP \
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; } \
232 /* see http://www.microsoft.com/msj/0199/com/com0199.aspx */
234 RPCRTAPI HRESULT RPC_ENTRY
235 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo
, LPUNKNOWN pUnkOuter
, REFIID riid
,
236 LPRPCPROXYBUFFER
*ppProxy
, LPVOID
*ppv
);
237 RPCRTAPI HRESULT RPC_ENTRY
238 CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo
, REFIID riid
, LPUNKNOWN pUnkServer
,
239 LPRPCSTUBBUFFER
*ppStub
);
243 #endif /*__WINE_RPCDCE_H */