📄 rpcproxy.h
字号:
RPCOLEMESSAGE *pRpcMsg,
IRpcChannelBuffer *pRpcChannelBuffer);
IRpcStubBuffer * STDMETHODCALLTYPE
CStdStubBuffer_IsIIDSupported(
IRpcStubBuffer *This,
REFIID riid);
ULONG STDMETHODCALLTYPE
CStdStubBuffer_CountRefs(
IRpcStubBuffer *This);
HRESULT STDMETHODCALLTYPE
CStdStubBuffer_DebugServerQueryInterface(
IRpcStubBuffer *This,
void **ppv);
void STDMETHODCALLTYPE
CStdStubBuffer_DebugServerRelease(
IRpcStubBuffer *This,
void *pv);
#if defined(_MPPC_)
#define CStdStubBuffer_METHODS \
0, /* a PowerMac dummy */ \
CStdStubBuffer_QueryInterface,\
CStdStubBuffer_AddRef, \
CStdStubBuffer_Release, \
CStdStubBuffer_Connect, \
CStdStubBuffer_Disconnect, \
CStdStubBuffer_Invoke, \
CStdStubBuffer_IsIIDSupported, \
CStdStubBuffer_CountRefs, \
CStdStubBuffer_DebugServerQueryInterface, \
CStdStubBuffer_DebugServerRelease
#else
#define CStdStubBuffer_METHODS \
CStdStubBuffer_QueryInterface,\
CStdStubBuffer_AddRef, \
CStdStubBuffer_Release, \
CStdStubBuffer_Connect, \
CStdStubBuffer_Disconnect, \
CStdStubBuffer_Invoke, \
CStdStubBuffer_IsIIDSupported, \
CStdStubBuffer_CountRefs, \
CStdStubBuffer_DebugServerQueryInterface, \
CStdStubBuffer_DebugServerRelease
#endif
#define CStdAsyncStubBuffer_METHODS 0,0,0,0,0,0,0,0,0,0
#define CStdAsyncStubBuffer_DELEGATING_METHODS 0,0,0,0,0,0,0,0,0,0
//+-------------------------------------------------------------------------
//
// Macro definitions for the proxy file
//
//--------------------------------------------------------------------------
#define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp( pIID, name##_ProxyVtblList[ index ]->header.piid, 16 )
#define IID_BS_LOOKUP_SETUP int result, low=-1;
#define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split) \
if ( ( result = name##_CHECK_IID( split ) ) > 0 ) \
{ low = sz - split; } \
else if ( !result ) \
{ low = split; goto found_label; }
#define IID_BS_LOOKUP_NEXT_TEST(name, split ) \
if ( ( result = name##_CHECK_IID( low + split )) >= 0 ) \
{ low = low + split; if ( !result ) goto found_label; }
#define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index ) \
low = low + 1; \
if ( ( low >= sz ) || (result = name##_CHECK_IID( low ) )) goto not_found_label; \
found_label: (index) = low; return 1; \
not_found_label: return 0;
//+-------------------------------------------------------------------------
//
// Macro and routine definitions for the dlldata file
//
//--------------------------------------------------------------------------
/****************************************************************************
* Proxy Dll APIs
****************************************************************************/
RPCRTAPI
HRESULT
RPC_ENTRY
NdrDllGetClassObject (
IN REFCLSID rclsid,
IN REFIID riid,
OUT void ** ppv,
IN const ProxyFileInfo ** pProxyFileList,
IN const CLSID * pclsid,
IN CStdPSFactoryBuffer * pPSFactoryBuffer);
RPCRTAPI
HRESULT
RPC_ENTRY
NdrDllCanUnloadNow(
IN CStdPSFactoryBuffer * pPSFactoryBuffer);
// if the user specified a routine prefix, pick it up...
// if not, add nothing
#ifndef ENTRY_PREFIX
#ifndef DllMain
#define DISABLE_THREAD_LIBRARY_CALLS(x) DisableThreadLibraryCalls(x)
#endif
#define ENTRY_PREFIX
#endif
#ifndef DISABLE_THREAD_LIBRARY_CALLS
#define DISABLE_THREAD_LIBRARY_CALLS(x)
#endif
// get around the pain of cpp with an extra level of expansion
#define EXPANDED_ENTRY_PREFIX() ENTRY_PREFIX
#define DLLREGISTERSERVER_ENTRY EXPANDED_ENTRY_PREFIX()##DllRegisterServer
#define DLLUNREGISTERSERVER_ENTRY EXPANDED_ENTRY_PREFIX()##DllUnregisterServer
#define DLLMAIN_ENTRY EXPANDED_ENTRY_PREFIX()##DllMain
#define DLLGETCLASSOBJECT_ENTRY EXPANDED_ENTRY_PREFIX()##DllGetClassObject
#define DLLCANUNLOADNOW_ENTRY EXPANDED_ENTRY_PREFIX()##DllCanUnloadNow
/*************************************************************************
The following new functions were added after the Windows NT 3.5 release.
Programs intended to run on Windows NT 3.5 should define NT35_STRICT to
ensure that no new functions are used.
*************************************************************************/
#ifndef NT35_STRICT
RPCRTAPI
HRESULT
RPC_ENTRY
NdrDllRegisterProxy(
IN HMODULE hDll,
IN const ProxyFileInfo ** pProxyFileList,
IN const CLSID * pclsid);
RPCRTAPI
HRESULT
RPC_ENTRY
NdrDllUnregisterProxy(
IN HMODULE hDll,
IN const ProxyFileInfo ** pProxyFileList,
IN const CLSID * pclsid);
#define REGISTER_PROXY_DLL_ROUTINES(pProxyFileList, pClsID) \
\
HINSTANCE hProxyDll = 0; \
\
/*DllMain saves the DLL module handle for later use by DllRegisterServer */ \
BOOL WINAPI DLLMAIN_ENTRY( \
HINSTANCE hinstDLL, \
DWORD fdwReason, \
LPVOID lpvReserved) \
{ \
if(fdwReason == DLL_PROCESS_ATTACH) \
{ \
hProxyDll = hinstDLL; \
DISABLE_THREAD_LIBRARY_CALLS(hinstDLL); \
} \
return TRUE; \
} \
\
/* DllRegisterServer registers the interfaces contained in the proxy DLL. */ \
HRESULT STDAPICALLTYPE DLLREGISTERSERVER_ENTRY() \
{ \
return NdrDllRegisterProxy(hProxyDll, pProxyFileList, pClsID); \
} \
\
/* DllUnregisterServer unregisters the interfaces contained in the proxy DLL. */ \
HRESULT STDAPICALLTYPE DLLUNREGISTERSERVER_ENTRY() \
{ \
return NdrDllUnregisterProxy(hProxyDll, pProxyFileList, pClsID); \
}
//Delegation support.
#define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
ULONG STDMETHODCALLTYPE
CStdStubBuffer2_Release(IRpcStubBuffer *This);
ULONG STDMETHODCALLTYPE
NdrCStdStubBuffer2_Release(IRpcStubBuffer *This,IPSFactoryBuffer * pPSF);
#define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
#endif //NT35_STRICT
/*************************************************************************
End of new functions.
*************************************************************************/
// PROXY_CLSID has precedence over PROXY_CLSID_IS
#ifdef PROXY_CLSID
#define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
#else // PROXY_CLSID
#ifdef PROXY_CLSID_IS
#define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
#define PROXY_CLSID CLSID_PSFactoryBuffer
#else // PROXY_CLSID_IS
#define CLSID_PSFACTORYBUFFER
#endif //PROXY_CLSID_IS
#endif //PROXY_CLSID
// if the user specified an override for the class id, it is
// PROXY_CLSID at this point
#ifndef PROXY_CLSID
#define GET_DLL_CLSID \
( aProxyFileList[0]->pStubVtblList[0] != 0 ? \
aProxyFileList[0]->pStubVtblList[0]->header.piid : 0)
#else //PROXY_CLSID
#define GET_DLL_CLSID &PROXY_CLSID
#endif //PROXY_CLSID
#define EXTERN_PROXY_FILE(name) \
EXTERN_C const ProxyFileInfo name##_ProxyFileInfo;
#define PROXYFILE_LIST_START \
const ProxyFileInfo * aProxyFileList[] = {
#define REFERENCE_PROXY_FILE(name) \
& name##_ProxyFileInfo
#define PROXYFILE_LIST_END \
0 };
// return pointers to the class information
#define DLLDATA_GETPROXYDLLINFO(pPFList,pClsid) \
void RPC_ENTRY GetProxyDllInfo( const ProxyFileInfo*** pInfo, const CLSID ** pId ) \
{ \
*pInfo = pPFList; \
*pId = pClsid; \
};
// ole entry points:
#define DLLGETCLASSOBJECTROUTINE(pPFlist, pClsid,pFactory) \
HRESULT STDAPICALLTYPE DLLGETCLASSOBJECT_ENTRY ( \
REFCLSID rclsid, \
REFIID riid, \
void ** ppv ) \
{ \
return \
NdrDllGetClassObject(rclsid,riid,ppv,pPFlist,pClsid,pFactory ); \
}
#define DLLCANUNLOADNOW(pFactory) \
HRESULT STDAPICALLTYPE DLLCANUNLOADNOW_ENTRY() \
{ \
return NdrDllCanUnloadNow( pFactory ); \
}
#define DLLDUMMYPURECALL \
void __cdecl _purecall(void) \
{ \
}
#define CSTDSTUBBUFFERRELEASE(pFactory) \
ULONG STDMETHODCALLTYPE CStdStubBuffer_Release(IRpcStubBuffer *This) \
{ \
return NdrCStdStubBuffer_Release(This,(IPSFactoryBuffer *)pFactory); \
} \
#ifdef PROXY_DELEGATION
#define CSTDSTUBBUFFER2RELEASE(pFactory) \
ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) \
{ \
return NdrCStdStubBuffer2_Release(This,(IPSFactoryBuffer *)pFactory); \
}
#else
#define CSTDSTUBBUFFER2RELEASE(pFactory)
#endif //PROXY_DELEGATION
#ifdef REGISTER_PROXY_DLL
#define DLLREGISTRY_ROUTINES(pProxyFileList,pClsID ) REGISTER_PROXY_DLL_ROUTINES(pProxyFileList,pClsID )
#else
#define DLLREGISTRY_ROUTINES(pProxyFileList,pClsID )
#endif //REGISTER_PROXY_DLL
// the dll entry points that must be defined
#define DLLDATA_ROUTINES(pProxyFileList,pClsID ) \
\
CLSID_PSFACTORYBUFFER \
\
CStdPSFactoryBuffer gPFactory = {0,0,0,0}; \
\
DLLDATA_GETPROXYDLLINFO(pProxyFileList,pClsID) \
\
DLLGETCLASSOBJECTROUTINE(pProxyFileList,pClsID,&gPFactory) \
\
DLLCANUNLOADNOW(&gPFactory) \
\
CSTDSTUBBUFFERRELEASE(&gPFactory) \
\
CSTDSTUBBUFFER2RELEASE(&gPFactory) \
\
DLLDUMMYPURECALL \
\
DLLREGISTRY_ROUTINES(pProxyFileList, pClsID) \
\
// more code goes here...
#define DLLDATA_STANDARD_ROUTINES \
DLLDATA_ROUTINES( (const ProxyFileInfo**) pProxyFileList, &CLSID_PSFactoryBuffer ) \
#else // WIN32 or _MPPC_
//+-------------------------------------------------------------------------
//
// 16-bit definitions (all empty)
//
//--------------------------------------------------------------------------
#endif // WIN32 or _MPPC_
#if defined(_M_IA64) || defined(_M_AXP64)
#include <poppack.h>
#endif
#endif // __RPCPROXY_H__
#pragma option pop /*P_O_Pop*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -