Fixed some issues found by winapi_check.
[wine] / include / rpcproxy.h
1 /*
2  * Copyright (C) 2001 Ove Kaaven
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef __WINE_RPCPROXY_H
20 #define __WINE_RPCPROXY_H
21
22 #ifndef __RPCPROXY_H_VERSION__
23 /* FIXME: I'm not sure what version though */
24 #define __RPCPROXY_H_VERSION__
25 #endif
26
27 #include "basetsd.h"
28 #include "guiddef.h"
29 #include "winnt.h"
30 #include "rpc.h"
31 #include "rpcndr.h"
32 #include "rpc.h"
33 #include "rpcndr.h"
34
35 typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
36 typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
37 typedef const char *PCInterfaceName;
38 typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
39 typedef IIDLookupRtn *PIIDLookup;
40
41 typedef struct tagProxyFileInfo
42 {
43   const PCInterfaceProxyVtblList *pProxyVtblList;
44   const PCInterfaceStubVtblList *pStubVtblList;
45   const PCInterfaceName *pNamesArray;
46   const IID **pDelegatedIIDs;
47   const PIIDLookup pIIDLookupRtn;
48   unsigned short TableSize;
49   unsigned short TableVersion;
50   const IID **pAsyncIIDLookup;
51   LONG_PTR Filler2;
52   LONG_PTR Filler3;
53   LONG_PTR Filler4;
54 } ProxyFileInfo;
55
56 typedef ProxyFileInfo ExtendedProxyFileInfo;
57
58 typedef struct tagCInterfaceProxyHeader
59 {
60 #ifdef USE_STUBLESS_PROXY
61   const void *pStublessProxyInfo;
62 #endif
63   const IID *piid;
64 } CInterfaceProxyHeader;
65
66 #define CINTERFACE_PROXY_VTABLE(n) \
67   struct \
68   { \
69     CInterfaceProxyHeader header; \
70     void *Vtbl[n]; \
71   }
72
73 typedef struct tagCInterfaceProxyVtbl
74 {
75   CInterfaceProxyHeader header;
76 #if defined(__GNUC__)
77   void *Vtbl[0];
78 #else
79   void *Vtbl[1];
80 #endif
81 } CInterfaceProxyVtbl;
82
83 typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
84   IRpcStubBuffer *This,
85   IRpcChannelBuffer *_pRpcChannelBuffer,
86   PRPC_MESSAGE _pRpcMessage,
87   DWORD *pdwStubPhase);
88
89 typedef struct tagCInterfaceStubHeader
90 {
91   const IID *piid;
92   const MIDL_SERVER_INFO *pServerInfo;
93   unsigned long DispatchTableCount;
94   const PRPC_STUB_FUNCTION *pDispatchTable;
95 } CInterfaceStubHeader;
96
97 typedef struct tagCInterfaceStubVtbl
98 {
99   CInterfaceStubHeader header;
100   ICOM_VTABLE(IRpcStubBuffer) Vtbl;
101 } CInterfaceStubVtbl;
102
103 typedef struct tagCStdStubBuffer
104 {
105   const ICOM_VTABLE(IRpcStubBuffer) *lpVtbl;
106   long RefCount;
107   struct IUnknown *pvServerObject;
108   const struct ICallFactoryVtbl *pCallFactoryVtbl;
109   const IID *pAsyncIID;
110   struct IPSFactoryBuffer *pPSFactory;
111 } CStdStubBuffer;
112
113 typedef struct tagCStdPSFactoryBuffer
114 {
115   const IPSFactoryBufferVtbl *lpVtbl;
116   long RefCount;
117   const ProxyFileInfo **pProxyFileList;
118   long Filler1;
119 } CStdPSFactoryBuffer;
120
121 HRESULT WINAPI
122   CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
123 ULONG WINAPI
124   CStdStubBuffer_AddRef( IRpcStubBuffer *This );
125 ULONG WINAPI
126   CStdStubBuffer_Release( IRpcStubBuffer *This );
127 ULONG WINAPI
128   NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
129 HRESULT WINAPI
130   CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
131 void WINAPI
132   CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
133 HRESULT WINAPI
134   CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
135 IRpcStubBuffer * WINAPI
136   CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
137 ULONG WINAPI
138   CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
139 HRESULT WINAPI
140   CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
141 void WINAPI
142   CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
143
144 #define CStdStubBuffer_METHODS \
145   ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE \
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
156
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 );
168
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 );
182
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 );
188
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 );
193
194 #define CSTDSTUBBUFFERRELEASE(pFactory) \
195 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
196   { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
197
198 #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
199
200 #if defined(__WINE__) && defined(__WINE_WINE_OBJ_OLEAUT_H)
201 /* see http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp?frame=true */
202
203 RPCRTAPI HRESULT RPC_ENTRY
204   CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
205                            LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
206 RPCRTAPI HRESULT RPC_ENTRY
207   CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
208                           LPRPCSTUBBUFFER *ppStub );
209
210 #endif
211
212 #endif /*__WINE_RPCDCE_H */