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