Fixed endianness #ifdefs (spotted by Jason Edmeades).
[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 #include "basetsd.h"
23 #include "guiddef.h"
24 #include "rpc.h"
25 #include "rpcndr.h"
26
27 typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
28 typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
29 typedef const char *PCInterfaceName;
30 typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
31 typedef IIDLookupRtn *PIIDLookup;
32
33 typedef struct tagProxyFileInfo
34 {
35   const PCInterfaceProxyVtblList *pProxyVtblList;
36   const PCInterfaceStubVtblList *pStubVtblList;
37   const PCInterfaceName *pNamesArray;
38   const IID **pDelegatedIIDs;
39   const PIIDLookup pIIDLookupRtn;
40   unsigned short TableSize;
41   unsigned short TableVersion;
42   const IID **pAsyncIIDLookup;
43   LONG_PTR Filler2;
44   LONG_PTR Filler3;
45   LONG_PTR Filler4;
46 } ProxyFileInfo;
47
48 typedef ProxyFileInfo ExtendedProxyFileInfo;
49
50 typedef struct tagCInterfaceProxyHeader
51 {
52 #ifdef USE_STUBLESS_PROXY
53   const void *pStublessProxyInfo;
54 #endif
55   const IID *piid;
56 } CInterfaceProxyHeader;
57
58 #define CINTERFACE_PROXY_VTABLE(n) \
59   struct \
60   { \
61     CInterfaceProxyHeader header; \
62     void *Vtbl[n]; \
63   }
64
65 typedef struct tagCInterfaceProxyVtbl
66 {
67   CInterfaceProxyHeader header;
68 #if defined(__GNUC__)
69   void *Vtbl[0];
70 #else
71   void *Vtbl[1];
72 #endif
73 } CInterfaceProxyVtbl;
74
75 typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
76   IRpcStubBuffer *This,
77   IRpcChannelBuffer *_pRpcChannelBuffer,
78   PRPC_MESSAGE _pRpcMessage,
79   DWORD *pdwStubPhase);
80
81 typedef struct tagCInterfaceStubHeader
82 {
83   const IID *piid;
84   const MIDL_SERVER_INFO *pServerInfo;
85   unsigned long DispatchTableCount;
86   const PRPC_STUB_FUNCTION *pDispatchTable;
87 } CInterfaceStubHeader;
88
89 typedef struct tagCInterfaceStubVtbl
90 {
91   CInterfaceStubHeader header;
92   ICOM_VTABLE(IRpcStubBuffer) Vtbl;
93 } CInterfaceStubVtbl;
94
95 typedef struct tagCStdStubBuffer
96 {
97   const ICOM_VTABLE(IRpcStubBuffer) *lpVtbl;
98   long RefCount;
99   struct IUnknown *pvServerObject;
100   const struct ICallFactoryVtbl *pCallFactoryVtbl;
101   const IID *pAsyncIID;
102   struct IPSFactoryBuffer *pPSFactory;
103 } CStdStubBuffer;
104
105 typedef struct tagCStdPSFactoryBuffer
106 {
107   const IPSFactoryBufferVtbl *lpVtbl;
108   long RefCount;
109   const ProxyFileInfo **pProxyFileList;
110   long Filler1;
111 } CStdPSFactoryBuffer;
112
113 HRESULT WINAPI
114   CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
115 ULONG WINAPI
116   CStdStubBuffer_AddRef( IRpcStubBuffer *This );
117 ULONG WINAPI
118   CStdStubBuffer_Release( IRpcStubBuffer *This );
119 ULONG WINAPI
120   NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
121 HRESULT WINAPI
122   CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
123 void WINAPI
124   CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
125 HRESULT WINAPI
126   CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
127 IRpcStubBuffer * WINAPI
128   CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
129 ULONG WINAPI
130   CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
131 HRESULT WINAPI
132   CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
133 void WINAPI
134   CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
135
136 #define CStdStubBuffer_METHODS \
137   ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE \
138   CStdStubBuffer_QueryInterface, \
139   CStdStubBuffer_AddRef, \
140   CStdStubBuffer_Release, \
141   CStdStubBuffer_Connect, \
142   CStdStubBuffer_Disconnect, \
143   CStdStubBuffer_Invoke, \
144   CStdStubBuffer_IsIIDSupported, \
145   CStdStubBuffer_CountRefs, \
146   CStdStubBuffer_DebugServerQueryInterface, \
147   CStdStubBuffer_DebugServerRelease
148
149 RPCRTAPI HRESULT RPC_ENTRY
150   NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList,
151                         const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer );
152 RPCRTAPI HRESULT RPC_ENTRY
153   NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer );
154
155 RPCRTAPI HRESULT RPC_ENTRY
156   NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
157 RPCRTAPI HRESULT RPC_ENTRY
158   NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
159
160 #define CSTDSTUBBUFFERRELEASE(pFactory) \
161 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
162   { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
163
164 #if defined(__WINE__) && defined(__WINE_WINE_OBJ_OLEAUT_H)
165 /* see http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp?frame=true */
166
167 RPCRTAPI HRESULT RPC_ENTRY
168   CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
169                            LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
170 RPCRTAPI HRESULT RPC_ENTRY
171   CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
172                           LPRPCSTUBBUFFER *ppStub );
173
174 #endif
175
176 #endif /*__WINE_RPCDCE_H */