home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / rpcproxy.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  19.2 KB  |  691 lines

  1. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  2. /*++
  3.  
  4. Copyright (c) 1992-1998 Microsoft Corporation
  5.  
  6. Module Name:
  7.  
  8.     rpcproxy.h
  9.  
  10. Abstract:
  11.  
  12.     Definitions for rpc proxy  stubs.
  13.  
  14. Compiler switches:
  15.  
  16.     -DREGISTER_PROXY_DLL
  17.         Generates DllMain, DllRegisterServer, and DllUnregisterServer functions
  18.         for automatically registering a proxy DLL.
  19.  
  20.     -DPROXY_CLSID=clsid
  21.         Specifies a class ID to be used by the proxy DLL.
  22.  
  23.     -DPROXY_CLSID_IS={0x6f11fe5c,0x2fc5,0x101b,{0x9e,0x45,0x00,0x00,0x0b,0x65,0xc7,0xef}}
  24.         Specifies the value of the class ID to be used by the proxy DLL.
  25.  
  26.     -DENTRY_PREFIX=<prefix>
  27.         String to be prepended on all the DllGetClassObject etc routines
  28.         in dlldata.c.  This includes: DllGetClassObject, DllCanUnloadNow
  29.         and DllMain, DllRegisterServer, and DllUnregisterServer.
  30.  
  31.     -DNT35_STRICT
  32.         Specifies that the target platform is Windows NT 3.5. This switch disables
  33.         the new functions added after the Windows NT 3.5 release.
  34.  
  35. --*/
  36.  
  37. // This version of the rpcndr.h file corresponds to MIDL version 5.0.+
  38. // used with NT5 beta1+ env from build #1700 on.
  39.  
  40. #ifndef __RPCPROXY_H_VERSION__
  41. #define __RPCPROXY_H_VERSION__      ( 475 )
  42. #endif // __RPCPROXY_H_VERSION__
  43.  
  44.  
  45. #ifndef __RPCPROXY_H__
  46. #define __RPCPROXY_H__
  47. #define __midl_proxy
  48.  
  49. #ifdef __REQUIRED_RPCPROXY_H_VERSION__
  50.     #if ( __RPCPROXY_H_VERSION__ < __REQUIRED_RPCPROXY_H_VERSION__ )
  51.         #error incorrect <rpcproxy.h> version. Use the header that matches with the MIDL compiler.
  52.     #endif
  53. #endif
  54.  
  55. // If this is the first file included __RPC_WIN64__ is not defined yet.
  56. #if defined(_M_IA64) || defined(_M_AXP64)
  57. #include <pshpack8.h>
  58. #endif
  59.  
  60. #include <basetsd.h>
  61.  
  62. #ifndef INC_OLE2
  63. #define INC_OLE2
  64. #endif
  65.  
  66. #if defined(WIN32) || defined(__RPC_WIN64__) || defined(_MPPC_)
  67.  
  68. //We need to define REFIID, REFCLSID, REFGUID, & REFFMTID here so that the
  69. //proxy code won't get the const GUID *const definition.
  70. #ifndef GUID_DEFINED
  71. #define GUID_DEFINED
  72. typedef struct _GUID
  73. {
  74.     unsigned long Data1;
  75.     unsigned short Data2;
  76.     unsigned short Data3;
  77.     unsigned char Data4[8];
  78. } GUID;
  79. #endif /* GUID_DEFINED */
  80.  
  81. #if !defined( __IID_DEFINED__ )
  82.     #define __IID_DEFINED__
  83.  
  84.     typedef GUID IID;
  85.     typedef IID *LPIID;
  86.     #define IID_NULL            GUID_NULL
  87.     #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
  88.     typedef GUID CLSID;
  89.     typedef CLSID *LPCLSID;
  90.     #define CLSID_NULL          GUID_NULL
  91.     #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
  92.     typedef GUID FMTID;
  93.     typedef FMTID *LPFMTID;
  94.     #define FMTID_NULL          GUID_NULL
  95.     #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
  96.  
  97.     #ifndef _REFGUID_DEFINED
  98.         #define _REFGUID_DEFINED
  99.         typedef const GUID *REFGUID;
  100.     #endif // !_REFGUID_DEFINED
  101.  
  102.     #ifndef _REFIID_DEFINED
  103.         #define _REFIID_DEFINED
  104.         typedef const IID *REFIID;
  105.     #endif // !_REFIID_DEFINED
  106.  
  107.     #ifndef _REFCLSID_DEFINED
  108.         #define _REFCLSID_DEFINED
  109.         typedef const CLSID *REFCLSID;
  110.     #endif // !_REFCLSID_DEFINED
  111.  
  112.     #ifndef _REFFMTID_DEFINED
  113.         #define _REFFMTID_DEFINED
  114.         typedef const FMTID *REFFMTID;
  115.     #endif // !_REFFMTID_DEFINED
  116.  
  117. #endif // !__IID_DEFINED__
  118.  
  119. // forward declarations
  120. struct tagCInterfaceStubVtbl;
  121. struct tagCInterfaceProxyVtbl;
  122.  
  123. typedef struct tagCInterfaceStubVtbl *  PCInterfaceStubVtblList;
  124. typedef struct tagCInterfaceProxyVtbl *  PCInterfaceProxyVtblList;
  125. typedef const char *                    PCInterfaceName;
  126. typedef int __stdcall IIDLookupRtn( const IID * pIID, int * pIndex );
  127. typedef IIDLookupRtn * PIIDLookup;
  128.  
  129. // pointers to arrays of CInterfaceProxyVtbl's and CInterfaceStubVtbls
  130. typedef struct tagProxyFileInfo
  131. {
  132.     const PCInterfaceProxyVtblList *pProxyVtblList;
  133.     const PCInterfaceStubVtblList *pStubVtblList;
  134.     const PCInterfaceName *     pNamesArray;
  135.     const IID **                pDelegatedIIDs;
  136.     const PIIDLookup            pIIDLookupRtn;
  137.     unsigned short              TableSize;
  138.     unsigned short              TableVersion;
  139.     const IID **                pAsyncIIDLookup;
  140.     LONG_PTR                    Filler2;
  141.     LONG_PTR                    Filler3;
  142.     LONG_PTR                    Filler4;
  143. }ProxyFileInfo;
  144.  
  145. // extended info with list of interface names
  146. typedef ProxyFileInfo ExtendedProxyFileInfo;
  147.  
  148. #include <rpc.h>
  149. #include <rpcndr.h>
  150. #include <string.h>
  151. #include <memory.h>
  152.  
  153. typedef struct tagCInterfaceProxyHeader
  154. {
  155.     //
  156.     // New fields should be added here, at the beginning of the structure.
  157.     //
  158. #ifdef USE_STUBLESS_PROXY
  159.     const void *    pStublessProxyInfo;
  160. #endif
  161.     const IID *     piid;
  162. } CInterfaceProxyHeader;
  163.  
  164. // Macro used for ANSI compatible stubs.
  165.  
  166. #if defined(_MPPC_)
  167. #define CINTERFACE_PROXY_VTABLE( n )  \
  168. struct \
  169. {                                     \
  170.     CInterfaceProxyHeader header;     \
  171.     void * pDummyEntryForPowerMac;    \
  172.     void *Vtbl[ n ];                  \
  173. }
  174. #else
  175. #define CINTERFACE_PROXY_VTABLE( n )  \
  176. struct \
  177. {                                     \
  178.     CInterfaceProxyHeader header;     \
  179.     void *Vtbl[ n ];                  \
  180. }
  181. #endif
  182.  
  183. #pragma warning( disable:4200 )
  184. typedef struct tagCInterfaceProxyVtbl
  185. {
  186.     CInterfaceProxyHeader header;
  187. #if defined(_MPPC_)
  188.     void * pDummyEntryForPowerMac;
  189. #endif
  190. #if defined( _MSC_VER )
  191.     void *Vtbl[];
  192. #else
  193.     void *Vtbl[1];
  194. #endif
  195. } CInterfaceProxyVtbl;
  196. #pragma warning( default:4200 )
  197.  
  198. typedef
  199. void
  200. (__RPC_STUB __RPC_FAR * PRPC_STUB_FUNCTION) (
  201.     IRpcStubBuffer *This,
  202.     IRpcChannelBuffer * _pRpcChannelBuffer,
  203.     PRPC_MESSAGE _pRpcMessage,
  204.     DWORD __RPC_FAR *pdwStubPhase);
  205.  
  206. typedef struct tagCInterfaceStubHeader
  207. {
  208.     //New fields should be added here, at the beginning of the structure.
  209.     const IID *piid;
  210.     const MIDL_SERVER_INFO *pServerInfo;
  211.     unsigned long DispatchTableCount;
  212.     const PRPC_STUB_FUNCTION *pDispatchTable;
  213. } CInterfaceStubHeader;
  214.  
  215. typedef struct tagCInterfaceStubVtbl
  216. {
  217.     CInterfaceStubHeader header;
  218.     IRpcStubBufferVtbl Vtbl;
  219. } CInterfaceStubVtbl;
  220.  
  221. typedef struct tagCStdStubBuffer
  222. {
  223.     const struct IRpcStubBufferVtbl *   lpVtbl; //Points to Vtbl field in CInterfaceStubVtbl.
  224.     long                                RefCount;
  225.     struct IUnknown *                   pvServerObject;
  226.  
  227.     const struct ICallFactoryVtbl *     pCallFactoryVtbl;
  228.     const IID *                         pAsyncIID;
  229.     struct IPSFactoryBuffer *           pPSFactory;
  230. } CStdStubBuffer;
  231.  
  232. typedef struct tagCStdPSFactoryBuffer
  233. {
  234.     const IPSFactoryBufferVtbl *lpVtbl;
  235.     long                    RefCount;
  236.     const ProxyFileInfo **  pProxyFileList;
  237.     long                    Filler1;  //Reserved for future use.
  238. } CStdPSFactoryBuffer;
  239.  
  240. RPCRTAPI
  241. void
  242. RPC_ENTRY
  243. NdrProxyInitialize(
  244.     void *              This,
  245.     PRPC_MESSAGE        pRpcMsg,
  246.     PMIDL_STUB_MESSAGE  pStubMsg,
  247.     PMIDL_STUB_DESC     pStubDescriptor,
  248.     unsigned int        ProcNum );
  249.  
  250. RPCRTAPI
  251. void
  252. RPC_ENTRY
  253. NdrProxyGetBuffer(
  254.     void *              This,
  255.     PMIDL_STUB_MESSAGE pStubMsg);
  256.  
  257. RPCRTAPI
  258. void
  259. RPC_ENTRY
  260. NdrProxySendReceive(
  261.     void                *This,
  262.     MIDL_STUB_MESSAGE   *pStubMsg);
  263.  
  264. RPCRTAPI
  265. void
  266. RPC_ENTRY
  267. NdrProxyFreeBuffer(
  268.     void                *This,
  269.     MIDL_STUB_MESSAGE   *pStubMsg);
  270.  
  271. RPCRTAPI
  272. HRESULT
  273. RPC_ENTRY
  274. NdrProxyErrorHandler(
  275.     DWORD dwExceptionCode);
  276.  
  277. RPCRTAPI
  278. void
  279. RPC_ENTRY
  280. NdrStubInitialize(
  281.     PRPC_MESSAGE        pRpcMsg,
  282.     PMIDL_STUB_MESSAGE  pStubMsg,
  283.     PMIDL_STUB_DESC     pStubDescriptor,
  284.     IRpcChannelBuffer * pRpcChannelBuffer);
  285.  
  286. RPCRTAPI
  287. void
  288. RPC_ENTRY
  289. NdrStubInitializePartial(
  290.     PRPC_MESSAGE        pRpcMsg,
  291.     PMIDL_STUB_MESSAGE  pStubMsg,
  292.     PMIDL_STUB_DESC     pStubDescriptor,
  293.     IRpcChannelBuffer * pRpcChannelBuffer,
  294.     unsigned long       RequestedBufferSize);
  295.  
  296. void __RPC_STUB NdrStubForwardingFunction(
  297.     IN  IRpcStubBuffer *    This,
  298.     IN  IRpcChannelBuffer * pChannel,
  299.     IN  PRPC_MESSAGE        pmsg,
  300.     OUT DWORD __RPC_FAR *   pdwStubPhase);
  301.  
  302. RPCRTAPI
  303. void
  304. RPC_ENTRY
  305. NdrStubGetBuffer(
  306.     IRpcStubBuffer *    This,
  307.     IRpcChannelBuffer * pRpcChannelBuffer,
  308.     PMIDL_STUB_MESSAGE  pStubMsg);
  309.  
  310. RPCRTAPI
  311. HRESULT
  312. RPC_ENTRY
  313. NdrStubErrorHandler(
  314.     DWORD dwExceptionCode);
  315.  
  316. HRESULT STDMETHODCALLTYPE
  317. CStdStubBuffer_QueryInterface(
  318.     IRpcStubBuffer *This,
  319.     REFIID riid,
  320.     void **ppvObject);
  321.  
  322. ULONG STDMETHODCALLTYPE
  323. CStdStubBuffer_AddRef(
  324.     IRpcStubBuffer *This);
  325.  
  326. ULONG STDMETHODCALLTYPE
  327. CStdStubBuffer_Release(
  328.     IRpcStubBuffer *This);
  329.  
  330. ULONG STDMETHODCALLTYPE
  331. NdrCStdStubBuffer_Release(
  332.     IRpcStubBuffer *This,
  333.     IPSFactoryBuffer * pPSF);
  334.  
  335. HRESULT STDMETHODCALLTYPE
  336. CStdStubBuffer_Connect(
  337.     IRpcStubBuffer *This,
  338.     IUnknown *pUnkServer);
  339.  
  340. void STDMETHODCALLTYPE
  341. CStdStubBuffer_Disconnect(
  342.     IRpcStubBuffer *This);
  343.  
  344. HRESULT STDMETHODCALLTYPE
  345. CStdStubBuffer_Invoke(
  346.     IRpcStubBuffer *This,
  347.     RPCOLEMESSAGE *pRpcMsg,
  348.     IRpcChannelBuffer *pRpcChannelBuffer);
  349.  
  350. IRpcStubBuffer * STDMETHODCALLTYPE
  351. CStdStubBuffer_IsIIDSupported(
  352.     IRpcStubBuffer *This,
  353.     REFIID riid);
  354.  
  355. ULONG STDMETHODCALLTYPE
  356. CStdStubBuffer_CountRefs(
  357.     IRpcStubBuffer *This);
  358.  
  359. HRESULT STDMETHODCALLTYPE
  360. CStdStubBuffer_DebugServerQueryInterface(
  361.     IRpcStubBuffer *This,
  362.     void **ppv);
  363.  
  364. void STDMETHODCALLTYPE
  365. CStdStubBuffer_DebugServerRelease(
  366.     IRpcStubBuffer *This,
  367.     void *pv);
  368.  
  369. #if defined(_MPPC_)
  370. #define CStdStubBuffer_METHODS \
  371.     0,  /* a PowerMac dummy */  \
  372.     CStdStubBuffer_QueryInterface,\
  373.     CStdStubBuffer_AddRef, \
  374.     CStdStubBuffer_Release, \
  375.     CStdStubBuffer_Connect, \
  376.     CStdStubBuffer_Disconnect, \
  377.     CStdStubBuffer_Invoke, \
  378.     CStdStubBuffer_IsIIDSupported, \
  379.     CStdStubBuffer_CountRefs, \
  380.     CStdStubBuffer_DebugServerQueryInterface, \
  381.     CStdStubBuffer_DebugServerRelease
  382. #else
  383. #define CStdStubBuffer_METHODS \
  384.     CStdStubBuffer_QueryInterface,\
  385.     CStdStubBuffer_AddRef, \
  386.     CStdStubBuffer_Release, \
  387.     CStdStubBuffer_Connect, \
  388.     CStdStubBuffer_Disconnect, \
  389.     CStdStubBuffer_Invoke, \
  390.     CStdStubBuffer_IsIIDSupported, \
  391.     CStdStubBuffer_CountRefs, \
  392.     CStdStubBuffer_DebugServerQueryInterface, \
  393.     CStdStubBuffer_DebugServerRelease
  394. #endif
  395.  
  396. #define CStdAsyncStubBuffer_METHODS              0,0,0,0,0,0,0,0,0,0
  397. #define CStdAsyncStubBuffer_DELEGATING_METHODS   0,0,0,0,0,0,0,0,0,0
  398.  
  399. //+-------------------------------------------------------------------------
  400. //
  401. //  Macro definitions for the proxy file
  402. //
  403. //--------------------------------------------------------------------------
  404.  
  405. #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp( pIID, name##_ProxyVtblList[ index ]->header.piid, 16 )
  406.  
  407. #define IID_BS_LOOKUP_SETUP     int result, low=-1;
  408.  
  409. #define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)   \
  410.     if ( ( result = name##_CHECK_IID( split ) ) > 0 ) \
  411.         { low = sz - split; }                      \
  412.     else if ( !result )                               \
  413.         { low = split; goto found_label; }
  414.  
  415. #define IID_BS_LOOKUP_NEXT_TEST(name, split )         \
  416.     if ( ( result = name##_CHECK_IID( low + split )) >= 0 )  \
  417.         { low = low + split; if ( !result ) goto found_label; }
  418.  
  419. #define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index )                  \
  420.     low = low + 1;                                          \
  421.     if ( ( low >= sz ) || (result = name##_CHECK_IID( low ) )) goto not_found_label; \
  422.     found_label: (index) = low; return 1;                         \
  423.     not_found_label: return 0;
  424.  
  425. //+-------------------------------------------------------------------------
  426. //
  427. //  Macro and routine definitions for the dlldata file
  428. //
  429. //--------------------------------------------------------------------------
  430.  
  431. /****************************************************************************
  432.  * Proxy Dll APIs
  433.  ****************************************************************************/
  434.  
  435. RPCRTAPI
  436. HRESULT
  437. RPC_ENTRY
  438. NdrDllGetClassObject (
  439.     IN  REFCLSID                rclsid,
  440.     IN  REFIID                  riid,
  441.     OUT void **                 ppv,
  442.     IN const ProxyFileInfo **   pProxyFileList,
  443.     IN const CLSID *            pclsid,
  444.     IN CStdPSFactoryBuffer *    pPSFactoryBuffer);
  445.  
  446. RPCRTAPI
  447. HRESULT
  448. RPC_ENTRY
  449. NdrDllCanUnloadNow(
  450.     IN CStdPSFactoryBuffer * pPSFactoryBuffer);
  451.  
  452. // if the user specified a routine prefix, pick it up...
  453. //     if not, add nothing
  454.  
  455. #ifndef ENTRY_PREFIX
  456.  
  457. #ifndef DllMain
  458. #define DISABLE_THREAD_LIBRARY_CALLS(x) DisableThreadLibraryCalls(x)
  459. #endif
  460.  
  461. #define ENTRY_PREFIX
  462. #endif
  463.  
  464. #ifndef DISABLE_THREAD_LIBRARY_CALLS
  465. #define DISABLE_THREAD_LIBRARY_CALLS(x)
  466. #endif
  467.  
  468. // get around the pain of cpp with an extra level of expansion
  469. #define EXPANDED_ENTRY_PREFIX() ENTRY_PREFIX
  470.  
  471. #define DLLREGISTERSERVER_ENTRY EXPANDED_ENTRY_PREFIX()##DllRegisterServer
  472. #define DLLUNREGISTERSERVER_ENTRY EXPANDED_ENTRY_PREFIX()##DllUnregisterServer
  473. #define DLLMAIN_ENTRY EXPANDED_ENTRY_PREFIX()##DllMain
  474.  
  475. #define DLLGETCLASSOBJECT_ENTRY EXPANDED_ENTRY_PREFIX()##DllGetClassObject
  476. #define DLLCANUNLOADNOW_ENTRY EXPANDED_ENTRY_PREFIX()##DllCanUnloadNow
  477.  
  478. /*************************************************************************
  479. The following new functions were added after the Windows NT 3.5 release.
  480. Programs intended to run on Windows NT 3.5 should define NT35_STRICT to
  481. ensure that no new functions are used.
  482. *************************************************************************/
  483. #ifndef NT35_STRICT
  484.  
  485. RPCRTAPI
  486. HRESULT
  487. RPC_ENTRY
  488. NdrDllRegisterProxy(
  489.     IN HMODULE                  hDll,
  490.     IN const ProxyFileInfo **   pProxyFileList,
  491.     IN const CLSID *            pclsid);
  492.  
  493. RPCRTAPI
  494. HRESULT
  495. RPC_ENTRY
  496. NdrDllUnregisterProxy(
  497.     IN HMODULE                  hDll,
  498.     IN const ProxyFileInfo **   pProxyFileList,
  499.     IN const CLSID *            pclsid);
  500.  
  501. #define REGISTER_PROXY_DLL_ROUTINES(pProxyFileList, pClsID) \
  502.     \
  503.     HINSTANCE hProxyDll = 0; \
  504.     \
  505.     /*DllMain saves the DLL module handle for later use by DllRegisterServer */ \
  506.     BOOL WINAPI DLLMAIN_ENTRY( \
  507.         HINSTANCE  hinstDLL, \
  508.         DWORD  fdwReason, \
  509.         LPVOID  lpvReserved) \
  510.     { \
  511.         if(fdwReason == DLL_PROCESS_ATTACH) \
  512.             { \
  513.             hProxyDll = hinstDLL; \
  514.             DISABLE_THREAD_LIBRARY_CALLS(hinstDLL); \
  515.             } \
  516.         return TRUE; \
  517.     } \
  518.     \
  519.     /* DllRegisterServer registers the interfaces contained in the proxy DLL. */ \
  520.     HRESULT STDAPICALLTYPE DLLREGISTERSERVER_ENTRY() \
  521.     { \
  522.         return NdrDllRegisterProxy(hProxyDll, pProxyFileList, pClsID); \
  523.     }  \
  524.     \
  525.     /* DllUnregisterServer unregisters the interfaces contained in the proxy DLL. */ \
  526.     HRESULT STDAPICALLTYPE DLLUNREGISTERSERVER_ENTRY() \
  527.     { \
  528.         return NdrDllUnregisterProxy(hProxyDll, pProxyFileList, pClsID); \
  529.     }
  530.  
  531. //Delegation support.
  532. #define STUB_FORWARDING_FUNCTION        NdrStubForwardingFunction
  533.  
  534. ULONG STDMETHODCALLTYPE
  535. CStdStubBuffer2_Release(IRpcStubBuffer *This);
  536.  
  537. ULONG STDMETHODCALLTYPE
  538. NdrCStdStubBuffer2_Release(IRpcStubBuffer *This,IPSFactoryBuffer * pPSF);
  539.  
  540. #define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
  541.  
  542. #endif //NT35_STRICT
  543. /*************************************************************************
  544. End of new functions.
  545. *************************************************************************/
  546.  
  547. // PROXY_CLSID has precedence over PROXY_CLSID_IS
  548.  
  549. #ifdef PROXY_CLSID
  550.  
  551. #define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
  552.  
  553. #else // PROXY_CLSID
  554.  
  555. #ifdef PROXY_CLSID_IS
  556. #define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
  557. #define PROXY_CLSID     CLSID_PSFactoryBuffer
  558. #else // PROXY_CLSID_IS
  559. #define CLSID_PSFACTORYBUFFER
  560. #endif //PROXY_CLSID_IS
  561.  
  562. #endif //PROXY_CLSID
  563.  
  564. // if the user specified an override for the class id, it is
  565. // PROXY_CLSID at this point
  566.  
  567. #ifndef PROXY_CLSID
  568. #define GET_DLL_CLSID   \
  569.     ( aProxyFileList[0]->pStubVtblList[0] != 0 ? \
  570.     aProxyFileList[0]->pStubVtblList[0]->header.piid : 0)
  571. #else  //PROXY_CLSID
  572. #define GET_DLL_CLSID   &PROXY_CLSID
  573. #endif //PROXY_CLSID
  574.  
  575.  
  576.  
  577. #define EXTERN_PROXY_FILE(name) \
  578.     EXTERN_C const ProxyFileInfo name##_ProxyFileInfo;
  579.  
  580. #define PROXYFILE_LIST_START    \
  581.     const ProxyFileInfo  *  aProxyFileList[]    = {
  582.  
  583. #define REFERENCE_PROXY_FILE(name)  \
  584.     & name##_ProxyFileInfo
  585.  
  586. #define PROXYFILE_LIST_END      \
  587.     0 };
  588.  
  589. // return pointers to the class information
  590.  
  591. #define DLLDATA_GETPROXYDLLINFO(pPFList,pClsid) \
  592.     void RPC_ENTRY GetProxyDllInfo( const ProxyFileInfo*** pInfo, const CLSID ** pId )  \
  593.         {   \
  594.         *pInfo  = pPFList;  \
  595.         *pId    = pClsid;   \
  596.         };
  597.  
  598. // ole entry points:
  599. #define DLLGETCLASSOBJECTROUTINE(pPFlist, pClsid,pFactory)    \
  600.  HRESULT STDAPICALLTYPE DLLGETCLASSOBJECT_ENTRY ( \
  601.      REFCLSID rclsid, \
  602.      REFIID riid, \
  603.      void ** ppv ) \
  604.         { \
  605.         return  \
  606.             NdrDllGetClassObject(rclsid,riid,ppv,pPFlist,pClsid,pFactory ); \
  607.         }
  608.  
  609. #define DLLCANUNLOADNOW(pFactory)   \
  610.  HRESULT STDAPICALLTYPE DLLCANUNLOADNOW_ENTRY()    \
  611.     {   \
  612.     return NdrDllCanUnloadNow( pFactory );    \
  613.     }
  614.  
  615.  
  616. #define DLLDUMMYPURECALL    \
  617.     void __cdecl _purecall(void)    \
  618.         {   \
  619.         }
  620.  
  621. #define CSTDSTUBBUFFERRELEASE(pFactory)   \
  622. ULONG STDMETHODCALLTYPE CStdStubBuffer_Release(IRpcStubBuffer *This) \
  623.     {   \
  624.     return NdrCStdStubBuffer_Release(This,(IPSFactoryBuffer *)pFactory);   \
  625.     }   \
  626.  
  627. #ifdef PROXY_DELEGATION
  628. #define CSTDSTUBBUFFER2RELEASE(pFactory)   \
  629. ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) \
  630.     {   \
  631.     return NdrCStdStubBuffer2_Release(This,(IPSFactoryBuffer *)pFactory);   \
  632.     }
  633. #else
  634. #define CSTDSTUBBUFFER2RELEASE(pFactory)
  635. #endif //PROXY_DELEGATION
  636.  
  637.  
  638. #ifdef REGISTER_PROXY_DLL
  639. #define DLLREGISTRY_ROUTINES(pProxyFileList,pClsID ) REGISTER_PROXY_DLL_ROUTINES(pProxyFileList,pClsID )
  640. #else
  641. #define DLLREGISTRY_ROUTINES(pProxyFileList,pClsID )
  642. #endif //REGISTER_PROXY_DLL
  643.  
  644.  
  645. // the dll entry points that must be defined
  646. #define DLLDATA_ROUTINES(pProxyFileList,pClsID )    \
  647.     \
  648.     CLSID_PSFACTORYBUFFER \
  649.     \
  650.     CStdPSFactoryBuffer       gPFactory = {0,0,0,0};  \
  651.     \
  652.     DLLDATA_GETPROXYDLLINFO(pProxyFileList,pClsID) \
  653.     \
  654.     DLLGETCLASSOBJECTROUTINE(pProxyFileList,pClsID,&gPFactory)    \
  655.     \
  656.     DLLCANUNLOADNOW(&gPFactory)   \
  657.     \
  658.     CSTDSTUBBUFFERRELEASE(&gPFactory)   \
  659.     \
  660.     CSTDSTUBBUFFER2RELEASE(&gPFactory) \
  661.     \
  662.     DLLDUMMYPURECALL    \
  663.     \
  664.     DLLREGISTRY_ROUTINES(pProxyFileList, pClsID) \
  665.     \
  666.  
  667.     // more code goes here...
  668.  
  669.  
  670. #define DLLDATA_STANDARD_ROUTINES   \
  671.     DLLDATA_ROUTINES( (const ProxyFileInfo**) pProxyFileList, &CLSID_PSFactoryBuffer )  \
  672.  
  673.  
  674. #else  // WIN32 or _MPPC_
  675.  
  676. //+-------------------------------------------------------------------------
  677. //
  678. //  16-bit definitions (all empty)
  679. //
  680. //--------------------------------------------------------------------------
  681.  
  682. #endif // WIN32 or _MPPC_
  683.  
  684. #if defined(_M_IA64) || defined(_M_AXP64)
  685. #include <poppack.h>
  686. #endif
  687.  
  688. #endif // __RPCPROXY_H__
  689.  
  690. #pragma option pop /*P_O_Pop*/
  691.