home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / rpcproxy.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  19KB  |  670 lines

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