ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rpcproxy.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001 Ove Kaaven
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #ifndef __RPCPROXY_H_VERSION__
00020 /* FIXME: Find an appropriate version number.  I guess something is better than nothing */
00021 #define __RPCPROXY_H_VERSION__ ( 399 )
00022 #endif
00023 
00024 #ifndef __WINE_RPCPROXY_H
00025 #define __WINE_RPCPROXY_H
00026 
00027 #define __midl_proxy
00028 
00029 #include <basetsd.h>
00030 #ifndef GUID_DEFINED
00031 #include <guiddef.h>
00032 #endif
00033 #include <rpc.h>
00034 #include <rpcndr.h>
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 typedef struct tagCInterfaceStubVtbl *PCInterfaceStubVtblList;
00041 typedef struct tagCInterfaceProxyVtbl *PCInterfaceProxyVtblList;
00042 typedef const char *PCInterfaceName;
00043 typedef int __stdcall IIDLookupRtn( const IID *pIID, int *pIndex );
00044 typedef IIDLookupRtn *PIIDLookup;
00045 
00046 typedef struct tagProxyFileInfo
00047 {
00048   const PCInterfaceProxyVtblList *pProxyVtblList;
00049   const PCInterfaceStubVtblList *pStubVtblList;
00050   const PCInterfaceName *pNamesArray;
00051   const IID **pDelegatedIIDs;
00052   const PIIDLookup pIIDLookupRtn;
00053   unsigned short TableSize;
00054   unsigned short TableVersion;
00055   const IID **pAsyncIIDLookup;
00056   LONG_PTR Filler2;
00057   LONG_PTR Filler3;
00058   LONG_PTR Filler4;
00059 } ProxyFileInfo;
00060 
00061 typedef ProxyFileInfo ExtendedProxyFileInfo;
00062 
00063 typedef struct tagCInterfaceProxyHeader
00064 {
00065 #ifdef USE_STUBLESS_PROXY
00066   const void *pStublessProxyInfo;
00067 #endif
00068   const IID *piid;
00069 } CInterfaceProxyHeader;
00070 
00071 #define CINTERFACE_PROXY_VTABLE(n) \
00072   struct \
00073   { \
00074     CInterfaceProxyHeader header; \
00075     void *Vtbl[n]; \
00076   }
00077 
00078 typedef struct tagCInterfaceProxyVtbl
00079 {
00080   CInterfaceProxyHeader header;
00081 #if defined(__GNUC__)
00082   void *Vtbl[0];
00083 #else
00084   void *Vtbl[1];
00085 #endif
00086 } CInterfaceProxyVtbl;
00087 
00088 typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
00089   IRpcStubBuffer *This,
00090   IRpcChannelBuffer *_pRpcChannelBuffer,
00091   PRPC_MESSAGE _pRpcMessage,
00092   DWORD *pdwStubPhase);
00093 
00094 typedef struct tagCInterfaceStubHeader
00095 {
00096   const IID *piid;
00097   const MIDL_SERVER_INFO *pServerInfo;
00098   ULONG DispatchTableCount;
00099   const PRPC_STUB_FUNCTION *pDispatchTable;
00100 } CInterfaceStubHeader;
00101 
00102 typedef struct tagCInterfaceStubVtbl
00103 {
00104   CInterfaceStubHeader header;
00105   IRpcStubBufferVtbl Vtbl;
00106 } CInterfaceStubVtbl;
00107 
00108 typedef struct tagCStdStubBuffer
00109 {
00110   const IRpcStubBufferVtbl *lpVtbl;
00111   LONG RefCount;
00112   struct IUnknown *pvServerObject;
00113   const struct ICallFactoryVtbl *pCallFactoryVtbl;
00114   const IID *pAsyncIID;
00115   struct IPSFactoryBuffer *pPSFactory;
00116 } CStdStubBuffer;
00117 
00118 typedef struct tagCStdPSFactoryBuffer
00119 {
00120   const IPSFactoryBufferVtbl *lpVtbl;
00121   LONG RefCount;
00122   const ProxyFileInfo **pProxyFileList;
00123   LONG Filler1;
00124 } CStdPSFactoryBuffer;
00125 
00126 #define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
00127 
00128 ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) DECLSPEC_HIDDEN;
00129 ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
00130 
00131 #define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
00132 
00133 
00134 HRESULT WINAPI
00135   CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
00136 ULONG WINAPI
00137   CStdStubBuffer_AddRef( IRpcStubBuffer *This );
00138 ULONG WINAPI
00139   CStdStubBuffer_Release( IRpcStubBuffer *This ) DECLSPEC_HIDDEN;
00140 ULONG WINAPI
00141   NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
00142 HRESULT WINAPI
00143   CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
00144 void WINAPI
00145   CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
00146 HRESULT WINAPI
00147   CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
00148 IRpcStubBuffer * WINAPI
00149   CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
00150 ULONG WINAPI
00151   CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
00152 HRESULT WINAPI
00153   CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
00154 void WINAPI
00155   CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
00156 
00157 #define CStdStubBuffer_METHODS \
00158   CStdStubBuffer_QueryInterface, \
00159   CStdStubBuffer_AddRef, \
00160   CStdStubBuffer_Release, \
00161   CStdStubBuffer_Connect, \
00162   CStdStubBuffer_Disconnect, \
00163   CStdStubBuffer_Invoke, \
00164   CStdStubBuffer_IsIIDSupported, \
00165   CStdStubBuffer_CountRefs, \
00166   CStdStubBuffer_DebugServerQueryInterface, \
00167   CStdStubBuffer_DebugServerRelease
00168 
00169 RPCRTAPI void RPC_ENTRY
00170   NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
00171                       PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum );
00172 RPCRTAPI void RPC_ENTRY
00173   NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
00174 RPCRTAPI void RPC_ENTRY
00175   NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg );
00176 RPCRTAPI void RPC_ENTRY
00177   NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg );
00178 RPCRTAPI HRESULT RPC_ENTRY
00179   NdrProxyErrorHandler( DWORD dwExceptionCode );
00180 
00181 RPCRTAPI void RPC_ENTRY
00182   NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
00183                      PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer );
00184 RPCRTAPI void RPC_ENTRY
00185   NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
00186                             PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer,
00187                             ULONG RequestedBufferSize );
00188 void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
00189                                            PRPC_MESSAGE pMsg, DWORD *pdwStubPhase );
00190 RPCRTAPI void RPC_ENTRY
00191   NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg );
00192 RPCRTAPI HRESULT RPC_ENTRY
00193   NdrStubErrorHandler( DWORD dwExceptionCode );
00194 
00195 RPCRTAPI HRESULT RPC_ENTRY
00196   NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList,
00197                         const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer );
00198 RPCRTAPI HRESULT RPC_ENTRY
00199   NdrDllCanUnloadNow( CStdPSFactoryBuffer *pPSFactoryBuffer );
00200 
00201 RPCRTAPI HRESULT RPC_ENTRY
00202   NdrDllRegisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
00203 RPCRTAPI HRESULT RPC_ENTRY
00204   NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
00205 
00206 HRESULT __wine_register_resources( HMODULE module ) DECLSPEC_HIDDEN;
00207 HRESULT __wine_unregister_resources( HMODULE module ) DECLSPEC_HIDDEN;
00208 
00209 #define CSTDSTUBBUFFERRELEASE(pFactory) \
00210 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
00211   { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); }
00212 
00213 #ifdef PROXY_DELEGATION
00214 #define CSTDSTUBBUFFER2RELEASE(pFactory) \
00215 ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
00216   { return NdrCStdStubBuffer2_Release(This, (IPSFactoryBuffer *)pFactory); }
00217 #else
00218 #define CSTDSTUBBUFFER2RELEASE(pFactory)
00219 #endif
00220 
00221 #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID))
00222 
00223 /*
00224  * In these macros, BS stands for Binary Search. MIDL uses these to
00225  * "unroll" a binary search into the module's IID_Lookup function.
00226  * However, I haven't bothered to reimplement that stuff yet;
00227  * I've just implemented a linear search for now.
00228  */
00229 #define IID_BS_LOOKUP_SETUP \
00230   int c;
00231 #define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)
00232 #define IID_BS_LOOKUP_NEXT_TEST(name, split)
00233 #define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index) \
00234   for (c=0; c<sz; c++) if (!name##_CHECK_IID(c)) { (index)=c; return 1; } \
00235   return 0;
00236 
00237 /* macros used in dlldata.c files */
00238 #define EXTERN_PROXY_FILE(proxy) \
00239     EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo DECLSPEC_HIDDEN;
00240 
00241 #define PROXYFILE_LIST_START \
00242     const ProxyFileInfo * aProxyFileList[] DECLSPEC_HIDDEN = \
00243     {
00244 
00245 #define REFERENCE_PROXY_FILE(proxy) \
00246         & proxy##_ProxyFileInfo
00247 
00248 #define PROXYFILE_LIST_END \
00249         NULL \
00250     };
00251 
00252 
00253 /* define PROXY_CLSID to use an existing CLSID */
00254 /* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */
00255 /* define neither to use the GUID of the first interface */
00256 #ifdef PROXY_CLSID
00257 # define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID DECLSPEC_HIDDEN;
00258 #else
00259 # ifdef PROXY_CLSID_IS
00260 #  define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; \
00261     const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
00262 #  define PROXY_CLSID CLSID_PSFactoryBuffer
00263 # else
00264 #  define CLSID_PSFACTORYBUFFER
00265 # endif
00266 #endif
00267 
00268 #ifndef PROXY_CLSID
00269 # define GET_DLL_CLSID (aProxyFileList[0]->pStubVtblList[0] ? \
00270     aProxyFileList[0]->pStubVtblList[0]->header.piid : NULL)
00271 #else
00272 # define GET_DLL_CLSID &PROXY_CLSID
00273 #endif
00274 
00275 #ifdef ENTRY_PREFIX
00276 # define __rpc_macro_expand2(a, b) a##b
00277 # define __rpc_macro_expand(a, b) __rpc_macro_expand2(a, b)
00278 # define DLLREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllRegisterServer)
00279 # define DLLUNREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllUnregisterServer)
00280 # define DLLMAIN_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllMain)
00281 # define DLLGETCLASSOBJECT_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllGetClassObject)
00282 # define DLLCANUNLOADNOW_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllCanUnloadNow)
00283 #else
00284 # define DLLREGISTERSERVER_ENTRY DllRegisterServer
00285 # define DLLUNREGISTERSERVER_ENTRY DllUnregisterServer
00286 # define DLLMAIN_ENTRY DllMain
00287 # define DLLGETCLASSOBJECT_ENTRY DllGetClassObject
00288 # define DLLCANUNLOADNOW_ENTRY DllCanUnloadNow
00289 #endif
00290 
00291 #ifdef WINE_REGISTER_DLL
00292 # define WINE_DO_REGISTER_DLL(pfl, clsid) return __wine_register_resources( hProxyDll )
00293 # define WINE_DO_UNREGISTER_DLL(pfl, clsid) return __wine_unregister_resources( hProxyDll )
00294 #else
00295 # define WINE_DO_REGISTER_DLL(pfl, clsid)   return NdrDllRegisterProxy( hProxyDll, (pfl), (clsid) )
00296 # define WINE_DO_UNREGISTER_DLL(pfl, clsid) return NdrDllUnregisterProxy( hProxyDll, (pfl), (clsid) )
00297 #endif
00298 
00299 
00300 #define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \
00301     void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
00302                                    const CLSID **ppClsid) DECLSPEC_HIDDEN; \
00303     void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
00304                                    const CLSID **ppClsid) \
00305     { \
00306         *ppProxyFileInfo = (pfl); \
00307         *ppClsid = (rclsid); \
00308     }
00309 
00310 #define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \
00311     HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN; \
00312     HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \
00313                                            void **ppv) \
00314     { \
00315         return NdrDllGetClassObject(rclsid, riid, ppv, (pfl), \
00316                                     (factory_clsid), factory); \
00317     }
00318 
00319 #define DLLCANUNLOADNOW(factory) \
00320     HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) DECLSPEC_HIDDEN; \
00321     HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \
00322     { \
00323         return NdrDllCanUnloadNow((factory)); \
00324     }
00325 
00326 #define REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) \
00327     HINSTANCE hProxyDll DECLSPEC_HIDDEN = NULL; \
00328     \
00329     BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; \
00330     BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, \
00331                               LPVOID lpvReserved) \
00332     { \
00333         if (fdwReason == DLL_PROCESS_ATTACH) \
00334         { \
00335             DisableThreadLibraryCalls(hinstDLL); \
00336             hProxyDll = hinstDLL; \
00337         } \
00338         return TRUE; \
00339     } \
00340     \
00341     HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
00342     HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) \
00343     { \
00344         WINE_DO_REGISTER_DLL( (pfl), (factory_clsid) ); \
00345     } \
00346     \
00347     HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
00348     HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) \
00349     { \
00350         WINE_DO_UNREGISTER_DLL( (pfl), (factory_clsid) ); \
00351     }
00352 
00353 #if defined(REGISTER_PROXY_DLL) || defined(WINE_REGISTER_DLL)
00354 # define DLLREGISTRY_ROUTINES(pfl, factory_clsid) \
00355     REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid)
00356 #else
00357 # define DLLREGISTRY_ROUTINES(pfl, factory_clsid)
00358 #endif
00359 
00360 #define DLLDATA_ROUTINES(pfl, factory_clsid) \
00361     CLSID_PSFACTORYBUFFER \
00362     CStdPSFactoryBuffer DECLSPEC_HIDDEN gPFactory = { NULL, 0, NULL, 0 }; \
00363     DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \
00364     DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \
00365     DLLCANUNLOADNOW(&gPFactory) \
00366     CSTDSTUBBUFFERRELEASE(&gPFactory) \
00367     CSTDSTUBBUFFER2RELEASE(&gPFactory) \
00368     DLLREGISTRY_ROUTINES(pfl, factory_clsid)
00369 
00370 #if 0
00371 
00372 RPCRTAPI HRESULT RPC_ENTRY
00373   CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
00374                            LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
00375 RPCRTAPI HRESULT RPC_ENTRY
00376   CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
00377                           LPRPCSTUBBUFFER *ppStub );
00378 
00379 #endif
00380 
00381 #ifdef __cplusplus
00382 }
00383 #endif
00384 
00385 #endif /*__WINE_RPCPROXY_H */

Generated on Sun May 27 2012 04:32:17 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.