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
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
;
54 typedef ProxyFileInfo ExtendedProxyFileInfo
;
56 typedef struct tagCInterfaceProxyHeader
58 #ifdef USE_STUBLESS_PROXY
59 const void *pStublessProxyInfo
;
62 } CInterfaceProxyHeader
;
64 #define CINTERFACE_PROXY_VTABLE(n) \
67 CInterfaceProxyHeader header; \
71 typedef struct tagCInterfaceProxyVtbl
73 CInterfaceProxyHeader header
;
79 } CInterfaceProxyVtbl
;
81 typedef void (__RPC_STUB
*PRPC_STUB_FUNCTION
)(
83 IRpcChannelBuffer
*_pRpcChannelBuffer
,
84 PRPC_MESSAGE _pRpcMessage
,
87 typedef struct tagCInterfaceStubHeader
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
;
101 typedef struct tagCStdStubBuffer
103 const ICOM_VTABLE(IRpcStubBuffer
) *lpVtbl
;
105 struct IUnknown
*pvServerObject
;
106 const struct ICallFactoryVtbl
*pCallFactoryVtbl
;
107 const IID
*pAsyncIID
;
108 struct IPSFactoryBuffer
*pPSFactory
;
111 typedef struct tagCStdPSFactoryBuffer
113 const IPSFactoryBufferVtbl
*lpVtbl
;
115 const ProxyFileInfo
**pProxyFileList
;
117 } CStdPSFactoryBuffer
;
120 CStdStubBuffer_QueryInterface( IRpcStubBuffer
*This
, REFIID riid
, void **ppvObject
);
122 CStdStubBuffer_AddRef( IRpcStubBuffer
*This
);
124 CStdStubBuffer_Release( IRpcStubBuffer
*This
);
126 NdrCStdStubBuffer_Release( IRpcStubBuffer
*This
, IPSFactoryBuffer
*pPSF
);
128 CStdStubBuffer_Connect( IRpcStubBuffer
*This
, IUnknown
*pUnkServer
);
130 CStdStubBuffer_Disconnect( IRpcStubBuffer
*This
);
132 CStdStubBuffer_Invoke( IRpcStubBuffer
*This
, RPCOLEMESSAGE
*pRpcMsg
, IRpcChannelBuffer
*pRpcChannelBuffer
);
133 IRpcStubBuffer
* WINAPI
134 CStdStubBuffer_IsIIDSupported( IRpcStubBuffer
*This
, REFIID riid
);
136 CStdStubBuffer_CountRefs( IRpcStubBuffer
*This
);
138 CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer
*This
, void **ppv
);
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 \
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; } \
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
);
225 #endif /*__WINE_RPCDCE_H */