home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / RPCPROXY.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  18.6 KB  |  672 lines

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