1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * Copyright (C) 2001 Ove Kaaven 3*c2c66affSColin Finck * 4*c2c66affSColin Finck * This library is free software; you can redistribute it and/or 5*c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public 6*c2c66affSColin Finck * License as published by the Free Software Foundation; either 7*c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version. 8*c2c66affSColin Finck * 9*c2c66affSColin Finck * This library is distributed in the hope that it will be useful, 10*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of 11*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12*c2c66affSColin Finck * Lesser General Public License for more details. 13*c2c66affSColin Finck * 14*c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public 15*c2c66affSColin Finck * License along with this library; if not, write to the Free Software 16*c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17*c2c66affSColin Finck */ 18*c2c66affSColin Finck 19*c2c66affSColin Finck #ifndef __RPCPROXY_H_VERSION__ 20*c2c66affSColin Finck /* FIXME: Find an appropriate version number. I guess something is better than nothing */ 21*c2c66affSColin Finck #define __RPCPROXY_H_VERSION__ ( 399 ) 22*c2c66affSColin Finck #endif 23*c2c66affSColin Finck 24*c2c66affSColin Finck #ifndef __WINE_RPCPROXY_H 25*c2c66affSColin Finck #define __WINE_RPCPROXY_H 26*c2c66affSColin Finck 27*c2c66affSColin Finck #define __midl_proxy 28*c2c66affSColin Finck 29*c2c66affSColin Finck #include <basetsd.h> 30*c2c66affSColin Finck #ifndef GUID_DEFINED 31*c2c66affSColin Finck #include <guiddef.h> 32*c2c66affSColin Finck #endif 33*c2c66affSColin Finck #include <rpc.h> 34*c2c66affSColin Finck #include <rpcndr.h> 35*c2c66affSColin Finck 36*c2c66affSColin Finck #ifdef __cplusplus 37*c2c66affSColin Finck extern "C" { 38*c2c66affSColin Finck #endif 39*c2c66affSColin Finck 40*c2c66affSColin Finck typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList; 41*c2c66affSColin Finck typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList; 42*c2c66affSColin Finck typedef const char *PCInterfaceName; 43*c2c66affSColin Finck typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex ); 44*c2c66affSColin Finck typedef IIDLookupRtn *PIIDLookup; 45*c2c66affSColin Finck 46*c2c66affSColin Finck typedef struct tagProxyFileInfo 47*c2c66affSColin Finck { 48*c2c66affSColin Finck const PCInterfaceProxyVtblList *pProxyVtblList; 49*c2c66affSColin Finck const PCInterfaceStubVtblList *pStubVtblList; 50*c2c66affSColin Finck const PCInterfaceName *pNamesArray; 51*c2c66affSColin Finck const IID **pDelegatedIIDs; 52*c2c66affSColin Finck const PIIDLookup pIIDLookupRtn; 53*c2c66affSColin Finck unsigned short TableSize; 54*c2c66affSColin Finck unsigned short TableVersion; 55*c2c66affSColin Finck const IID **pAsyncIIDLookup; 56*c2c66affSColin Finck LONG_PTR Filler2; 57*c2c66affSColin Finck LONG_PTR Filler3; 58*c2c66affSColin Finck LONG_PTR Filler4; 59*c2c66affSColin Finck } ProxyFileInfo; 60*c2c66affSColin Finck 61*c2c66affSColin Finck typedef ProxyFileInfo ExtendedProxyFileInfo; 62*c2c66affSColin Finck 63*c2c66affSColin Finck typedef struct tagCInterfaceProxyHeader 64*c2c66affSColin Finck { 65*c2c66affSColin Finck #ifdef USE_STUBLESS_PROXY 66*c2c66affSColin Finck const void *pStublessProxyInfo; 67*c2c66affSColin Finck #endif 68*c2c66affSColin Finck const IID *piid; 69*c2c66affSColin Finck } CInterfaceProxyHeader; 70*c2c66affSColin Finck 71*c2c66affSColin Finck #define CINTERFACE_PROXY_VTABLE(n) \ 72*c2c66affSColin Finck struct \ 73*c2c66affSColin Finck { \ 74*c2c66affSColin Finck CInterfaceProxyHeader header; \ 75*c2c66affSColin Finck void *Vtbl[n]; \ 76*c2c66affSColin Finck } 77*c2c66affSColin Finck 78*c2c66affSColin Finck typedef struct tagCInterfaceProxyVtbl 79*c2c66affSColin Finck { 80*c2c66affSColin Finck CInterfaceProxyHeader header; 81*c2c66affSColin Finck #if defined(__GNUC__) 82*c2c66affSColin Finck void *Vtbl[0]; 83*c2c66affSColin Finck #else 84*c2c66affSColin Finck void *Vtbl[1]; 85*c2c66affSColin Finck #endif 86*c2c66affSColin Finck } CInterfaceProxyVtbl; 87*c2c66affSColin Finck 88*c2c66affSColin Finck typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)( 89*c2c66affSColin Finck IRpcStubBuffer *This, 90*c2c66affSColin Finck IRpcChannelBuffer *_pRpcChannelBuffer, 91*c2c66affSColin Finck PRPC_MESSAGE _pRpcMessage, 92*c2c66affSColin Finck DWORD *pdwStubPhase); 93*c2c66affSColin Finck 94*c2c66affSColin Finck typedef struct tagCInterfaceStubHeader 95*c2c66affSColin Finck { 96*c2c66affSColin Finck const IID *piid; 97*c2c66affSColin Finck const MIDL_SERVER_INFO *pServerInfo; 98*c2c66affSColin Finck ULONG DispatchTableCount; 99*c2c66affSColin Finck const PRPC_STUB_FUNCTION *pDispatchTable; 100*c2c66affSColin Finck } CInterfaceStubHeader; 101*c2c66affSColin Finck 102*c2c66affSColin Finck typedef struct tagCInterfaceStubVtbl 103*c2c66affSColin Finck { 104*c2c66affSColin Finck CInterfaceStubHeader header; 105*c2c66affSColin Finck IRpcStubBufferVtbl Vtbl; 106*c2c66affSColin Finck } CInterfaceStubVtbl; 107*c2c66affSColin Finck 108*c2c66affSColin Finck typedef struct tagCStdStubBuffer 109*c2c66affSColin Finck { 110*c2c66affSColin Finck const IRpcStubBufferVtbl *lpVtbl; 111*c2c66affSColin Finck LONG RefCount; 112*c2c66affSColin Finck struct IUnknown *pvServerObject; 113*c2c66affSColin Finck const struct ICallFactoryVtbl *pCallFactoryVtbl; 114*c2c66affSColin Finck const IID *pAsyncIID; 115*c2c66affSColin Finck struct IPSFactoryBuffer *pPSFactory; 116*c2c66affSColin Finck } CStdStubBuffer; 117*c2c66affSColin Finck 118*c2c66affSColin Finck typedef struct tagCStdPSFactoryBuffer 119*c2c66affSColin Finck { 120*c2c66affSColin Finck const IPSFactoryBufferVtbl *lpVtbl; 121*c2c66affSColin Finck LONG RefCount; 122*c2c66affSColin Finck const ProxyFileInfo **pProxyFileList; 123*c2c66affSColin Finck LONG Filler1; 124*c2c66affSColin Finck } CStdPSFactoryBuffer; 125*c2c66affSColin Finck 126*c2c66affSColin Finck #define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction 127*c2c66affSColin Finck 128*c2c66affSColin Finck ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) DECLSPEC_HIDDEN; 129*c2c66affSColin Finck ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF); 130*c2c66affSColin Finck 131*c2c66affSColin Finck #define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0 132*c2c66affSColin Finck 133*c2c66affSColin Finck 134*c2c66affSColin Finck HRESULT WINAPI 135*c2c66affSColin Finck CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject ); 136*c2c66affSColin Finck ULONG WINAPI 137*c2c66affSColin Finck CStdStubBuffer_AddRef( IRpcStubBuffer *This ); 138*c2c66affSColin Finck ULONG WINAPI 139*c2c66affSColin Finck CStdStubBuffer_Release( IRpcStubBuffer *This ) DECLSPEC_HIDDEN; 140*c2c66affSColin Finck ULONG WINAPI 141*c2c66affSColin Finck NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF ); 142*c2c66affSColin Finck HRESULT WINAPI 143*c2c66affSColin Finck CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer ); 144*c2c66affSColin Finck void WINAPI 145*c2c66affSColin Finck CStdStubBuffer_Disconnect( IRpcStubBuffer *This ); 146*c2c66affSColin Finck HRESULT WINAPI 147*c2c66affSColin Finck CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer ); 148*c2c66affSColin Finck IRpcStubBuffer * WINAPI 149*c2c66affSColin Finck CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid ); 150*c2c66affSColin Finck ULONG WINAPI 151*c2c66affSColin Finck CStdStubBuffer_CountRefs( IRpcStubBuffer *This ); 152*c2c66affSColin Finck HRESULT WINAPI 153*c2c66affSColin Finck CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv ); 154*c2c66affSColin Finck void WINAPI 155*c2c66affSColin Finck CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv ); 156*c2c66affSColin Finck 157*c2c66affSColin Finck #define CStdStubBuffer_METHODS \ 158*c2c66affSColin Finck CStdStubBuffer_QueryInterface, \ 159*c2c66affSColin Finck CStdStubBuffer_AddRef, \ 160*c2c66affSColin Finck CStdStubBuffer_Release, \ 161*c2c66affSColin Finck CStdStubBuffer_Connect, \ 162*c2c66affSColin Finck CStdStubBuffer_Disconnect, \ 163*c2c66affSColin Finck CStdStubBuffer_Invoke, \ 164*c2c66affSColin Finck CStdStubBuffer_IsIIDSupported, \ 165*c2c66affSColin Finck CStdStubBuffer_CountRefs, \ 166*c2c66affSColin Finck CStdStubBuffer_DebugServerQueryInterface, \ 167*c2c66affSColin Finck CStdStubBuffer_DebugServerRelease 168*c2c66affSColin Finck 169*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 170*c2c66affSColin Finck NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, 171*c2c66affSColin Finck PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum ); 172*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 173*c2c66affSColin Finck NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg ); 174*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 175*c2c66affSColin Finck NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg ); 176*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 177*c2c66affSColin Finck NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg ); 178*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 179*c2c66affSColin Finck NdrProxyErrorHandler( DWORD dwExceptionCode ); 180*c2c66affSColin Finck 181*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 182*c2c66affSColin Finck NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, 183*c2c66affSColin Finck PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer ); 184*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 185*c2c66affSColin Finck NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, 186*c2c66affSColin Finck PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer, 187*c2c66affSColin Finck ULONG RequestedBufferSize ); 188*c2c66affSColin Finck void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel, 189*c2c66affSColin Finck PRPC_MESSAGE pMsg, DWORD *pdwStubPhase ); 190*c2c66affSColin Finck RPCRTAPI void RPC_ENTRY 191*c2c66affSColin Finck NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg ); 192*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 193*c2c66affSColin Finck NdrStubErrorHandler( DWORD dwExceptionCode ); 194*c2c66affSColin Finck 195*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 196*c2c66affSColin Finck NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList, 197*c2c66affSColin Finck const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer ); 198*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 199*c2c66affSColin Finck NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer ); 200*c2c66affSColin Finck 201*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 202*c2c66affSColin Finck NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid ); 203*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 204*c2c66affSColin Finck NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid ); 205*c2c66affSColin Finck 206*c2c66affSColin Finck HRESULT __wine_register_resources( HMODULE module ) DECLSPEC_HIDDEN; 207*c2c66affSColin Finck HRESULT __wine_unregister_resources( HMODULE module ) DECLSPEC_HIDDEN; 208*c2c66affSColin Finck 209*c2c66affSColin Finck #define CSTDSTUBBUFFERRELEASE(pFactory) \ 210*c2c66affSColin Finck ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \ 211*c2c66affSColin Finck { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); } 212*c2c66affSColin Finck 213*c2c66affSColin Finck #ifdef PROXY_DELEGATION 214*c2c66affSColin Finck #define CSTDSTUBBUFFER2RELEASE(pFactory) \ 215*c2c66affSColin Finck ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \ 216*c2c66affSColin Finck { return NdrCStdStubBuffer2_Release(This, (IPSFactoryBuffer *)pFactory); } 217*c2c66affSColin Finck #else 218*c2c66affSColin Finck #define CSTDSTUBBUFFER2RELEASE(pFactory) 219*c2c66affSColin Finck #endif 220*c2c66affSColin Finck 221*c2c66affSColin Finck #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID)) 222*c2c66affSColin Finck 223*c2c66affSColin Finck /* 224*c2c66affSColin Finck * In these macros, BS stands for Binary Search. MIDL uses these to 225*c2c66affSColin Finck * "unroll" a binary search into the module's IID_Lookup function. 226*c2c66affSColin Finck * However, I haven't bothered to reimplement that stuff yet; 227*c2c66affSColin Finck * I've just implemented a linear search for now. 228*c2c66affSColin Finck */ 229*c2c66affSColin Finck #define IID_BS_LOOKUP_SETUP \ 230*c2c66affSColin Finck int c; 231*c2c66affSColin Finck #define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split) 232*c2c66affSColin Finck #define IID_BS_LOOKUP_NEXT_TEST(name, split) 233*c2c66affSColin Finck #define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index) \ 234*c2c66affSColin Finck for (c=0; c<sz; c++) if (!name##_CHECK_IID(c)) { (index)=c; return 1; } \ 235*c2c66affSColin Finck return 0; 236*c2c66affSColin Finck 237*c2c66affSColin Finck /* macros used in dlldata.c files */ 238*c2c66affSColin Finck #define EXTERN_PROXY_FILE(proxy) \ 239*c2c66affSColin Finck EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo DECLSPEC_HIDDEN; 240*c2c66affSColin Finck 241*c2c66affSColin Finck #define PROXYFILE_LIST_START \ 242*c2c66affSColin Finck const ProxyFileInfo * aProxyFileList[] DECLSPEC_HIDDEN = \ 243*c2c66affSColin Finck { 244*c2c66affSColin Finck 245*c2c66affSColin Finck #define REFERENCE_PROXY_FILE(proxy) \ 246*c2c66affSColin Finck & proxy##_ProxyFileInfo 247*c2c66affSColin Finck 248*c2c66affSColin Finck #define PROXYFILE_LIST_END \ 249*c2c66affSColin Finck NULL \ 250*c2c66affSColin Finck }; 251*c2c66affSColin Finck 252*c2c66affSColin Finck 253*c2c66affSColin Finck /* define PROXY_CLSID to use an existing CLSID */ 254*c2c66affSColin Finck /* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */ 255*c2c66affSColin Finck /* define neither to use the GUID of the first interface */ 256*c2c66affSColin Finck #ifdef PROXY_CLSID 257*c2c66affSColin Finck # define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID DECLSPEC_HIDDEN; 258*c2c66affSColin Finck #else 259*c2c66affSColin Finck # ifdef PROXY_CLSID_IS 260*c2c66affSColin Finck # define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; \ 261*c2c66affSColin Finck const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS; 262*c2c66affSColin Finck # define PROXY_CLSID CLSID_PSFactoryBuffer 263*c2c66affSColin Finck # else 264*c2c66affSColin Finck # define CLSID_PSFACTORYBUFFER 265*c2c66affSColin Finck # endif 266*c2c66affSColin Finck #endif 267*c2c66affSColin Finck 268*c2c66affSColin Finck #ifndef PROXY_CLSID 269*c2c66affSColin Finck # define GET_DLL_CLSID (aProxyFileList[0]->pStubVtblList[0] ? \ 270*c2c66affSColin Finck aProxyFileList[0]->pStubVtblList[0]->header.piid : NULL) 271*c2c66affSColin Finck #else 272*c2c66affSColin Finck # define GET_DLL_CLSID &PROXY_CLSID 273*c2c66affSColin Finck #endif 274*c2c66affSColin Finck 275*c2c66affSColin Finck #ifdef ENTRY_PREFIX 276*c2c66affSColin Finck # define __rpc_macro_expand2(a, b) a##b 277*c2c66affSColin Finck # define __rpc_macro_expand(a, b) __rpc_macro_expand2(a, b) 278*c2c66affSColin Finck # define DLLREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllRegisterServer) 279*c2c66affSColin Finck # define DLLUNREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllUnregisterServer) 280*c2c66affSColin Finck # define DLLMAIN_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllMain) 281*c2c66affSColin Finck # define DLLGETCLASSOBJECT_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllGetClassObject) 282*c2c66affSColin Finck # define DLLCANUNLOADNOW_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllCanUnloadNow) 283*c2c66affSColin Finck #else 284*c2c66affSColin Finck # define DLLREGISTERSERVER_ENTRY DllRegisterServer 285*c2c66affSColin Finck # define DLLUNREGISTERSERVER_ENTRY DllUnregisterServer 286*c2c66affSColin Finck # define DLLMAIN_ENTRY DllMain 287*c2c66affSColin Finck # define DLLGETCLASSOBJECT_ENTRY DllGetClassObject 288*c2c66affSColin Finck # define DLLCANUNLOADNOW_ENTRY DllCanUnloadNow 289*c2c66affSColin Finck #endif 290*c2c66affSColin Finck 291*c2c66affSColin Finck #ifdef WINE_REGISTER_DLL 292*c2c66affSColin Finck # define WINE_DO_REGISTER_DLL(pfl, clsid) return __wine_register_resources( hProxyDll ) 293*c2c66affSColin Finck # define WINE_DO_UNREGISTER_DLL(pfl, clsid) return __wine_unregister_resources( hProxyDll ) 294*c2c66affSColin Finck #else 295*c2c66affSColin Finck # define WINE_DO_REGISTER_DLL(pfl, clsid) return NdrDllRegisterProxy( hProxyDll, (pfl), (clsid) ) 296*c2c66affSColin Finck # define WINE_DO_UNREGISTER_DLL(pfl, clsid) return NdrDllUnregisterProxy( hProxyDll, (pfl), (clsid) ) 297*c2c66affSColin Finck #endif 298*c2c66affSColin Finck 299*c2c66affSColin Finck 300*c2c66affSColin Finck #define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \ 301*c2c66affSColin Finck void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \ 302*c2c66affSColin Finck const CLSID **ppClsid) DECLSPEC_HIDDEN; \ 303*c2c66affSColin Finck void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \ 304*c2c66affSColin Finck const CLSID **ppClsid) \ 305*c2c66affSColin Finck { \ 306*c2c66affSColin Finck *ppProxyFileInfo = (pfl); \ 307*c2c66affSColin Finck *ppClsid = (rclsid); \ 308*c2c66affSColin Finck } 309*c2c66affSColin Finck 310*c2c66affSColin Finck #define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \ 311*c2c66affSColin Finck HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN; \ 312*c2c66affSColin Finck HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \ 313*c2c66affSColin Finck void **ppv) \ 314*c2c66affSColin Finck { \ 315*c2c66affSColin Finck return NdrDllGetClassObject(rclsid, riid, ppv, (pfl), \ 316*c2c66affSColin Finck (factory_clsid), factory); \ 317*c2c66affSColin Finck } 318*c2c66affSColin Finck 319*c2c66affSColin Finck #define DLLCANUNLOADNOW(factory) \ 320*c2c66affSColin Finck HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) DECLSPEC_HIDDEN; \ 321*c2c66affSColin Finck HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \ 322*c2c66affSColin Finck { \ 323*c2c66affSColin Finck return NdrDllCanUnloadNow((factory)); \ 324*c2c66affSColin Finck } 325*c2c66affSColin Finck 326*c2c66affSColin Finck #define REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) \ 327*c2c66affSColin Finck HINSTANCE hProxyDll DECLSPEC_HIDDEN = NULL; \ 328*c2c66affSColin Finck \ 329*c2c66affSColin Finck BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; \ 330*c2c66affSColin Finck BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, \ 331*c2c66affSColin Finck LPVOID lpvReserved) \ 332*c2c66affSColin Finck { \ 333*c2c66affSColin Finck if (fdwReason == DLL_PROCESS_ATTACH) \ 334*c2c66affSColin Finck { \ 335*c2c66affSColin Finck DisableThreadLibraryCalls(hinstDLL); \ 336*c2c66affSColin Finck hProxyDll = hinstDLL; \ 337*c2c66affSColin Finck } \ 338*c2c66affSColin Finck return TRUE; \ 339*c2c66affSColin Finck } \ 340*c2c66affSColin Finck \ 341*c2c66affSColin Finck HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \ 342*c2c66affSColin Finck HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) \ 343*c2c66affSColin Finck { \ 344*c2c66affSColin Finck WINE_DO_REGISTER_DLL( (pfl), (factory_clsid) ); \ 345*c2c66affSColin Finck } \ 346*c2c66affSColin Finck \ 347*c2c66affSColin Finck HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \ 348*c2c66affSColin Finck HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) \ 349*c2c66affSColin Finck { \ 350*c2c66affSColin Finck WINE_DO_UNREGISTER_DLL( (pfl), (factory_clsid) ); \ 351*c2c66affSColin Finck } 352*c2c66affSColin Finck 353*c2c66affSColin Finck #if defined(REGISTER_PROXY_DLL) || defined(WINE_REGISTER_DLL) 354*c2c66affSColin Finck # define DLLREGISTRY_ROUTINES(pfl, factory_clsid) \ 355*c2c66affSColin Finck REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) 356*c2c66affSColin Finck #else 357*c2c66affSColin Finck # define DLLREGISTRY_ROUTINES(pfl, factory_clsid) 358*c2c66affSColin Finck #endif 359*c2c66affSColin Finck 360*c2c66affSColin Finck #define DLLDATA_ROUTINES(pfl, factory_clsid) \ 361*c2c66affSColin Finck CLSID_PSFACTORYBUFFER \ 362*c2c66affSColin Finck CStdPSFactoryBuffer DECLSPEC_HIDDEN gPFactory = { NULL, 0, NULL, 0 }; \ 363*c2c66affSColin Finck DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \ 364*c2c66affSColin Finck DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \ 365*c2c66affSColin Finck DLLCANUNLOADNOW(&gPFactory) \ 366*c2c66affSColin Finck CSTDSTUBBUFFERRELEASE(&gPFactory) \ 367*c2c66affSColin Finck CSTDSTUBBUFFER2RELEASE(&gPFactory) \ 368*c2c66affSColin Finck DLLREGISTRY_ROUTINES(pfl, factory_clsid) 369*c2c66affSColin Finck 370*c2c66affSColin Finck #if 0 371*c2c66affSColin Finck 372*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 373*c2c66affSColin Finck CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid, 374*c2c66affSColin Finck LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv ); 375*c2c66affSColin Finck RPCRTAPI HRESULT RPC_ENTRY 376*c2c66affSColin Finck CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer, 377*c2c66affSColin Finck LPRPCSTUBBUFFER *ppStub ); 378*c2c66affSColin Finck 379*c2c66affSColin Finck #endif 380*c2c66affSColin Finck 381*c2c66affSColin Finck #ifdef __cplusplus 382*c2c66affSColin Finck } 383*c2c66affSColin Finck #endif 384*c2c66affSColin Finck 385*c2c66affSColin Finck #endif /*__WINE_RPCPROXY_H */ 386