home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / rpcproxy.h < prev    next >
Text File  |  1997-10-25  |  19KB  |  631 lines

  1. /*++
  2.  
  3. Copyright (c) 1992-1997 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.2.88. 
  37. // used with NT4 and DevStudio 5, notably VC++ 5.0, build env.
  38.  
  39. #ifndef __RPCPROXY_H_VERSION__
  40. #define __RPCPROXY_H_VERSION__      ( 440 )  
  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.  
  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. void RPC_ENTRY
  230. NdrProxyInitialize(
  231.     void *              This,
  232.     PRPC_MESSAGE        pRpcMsg,
  233.     PMIDL_STUB_MESSAGE  pStubMsg,
  234.     PMIDL_STUB_DESC     pStubDescriptor,
  235.     unsigned int        ProcNum );
  236.  
  237. void RPC_ENTRY
  238. NdrProxyGetBuffer(
  239.     void *              This,
  240.     PMIDL_STUB_MESSAGE pStubMsg);
  241.  
  242. void RPC_ENTRY
  243. NdrProxySendReceive(
  244.     void                *This,
  245.     MIDL_STUB_MESSAGE   *pStubMsg);
  246.  
  247. void RPC_ENTRY
  248. NdrProxyFreeBuffer(
  249.     void                *This,
  250.     MIDL_STUB_MESSAGE   *pStubMsg);
  251.  
  252. HRESULT RPC_ENTRY
  253. NdrProxyErrorHandler(
  254.     DWORD dwExceptionCode);
  255.  
  256. void RPC_ENTRY
  257. NdrStubInitialize(
  258.     PRPC_MESSAGE        pRpcMsg,
  259.     PMIDL_STUB_MESSAGE  pStubMsg,
  260.     PMIDL_STUB_DESC     pStubDescriptor,
  261.     IRpcChannelBuffer * pRpcChannelBuffer);
  262.  
  263. void RPC_ENTRY
  264. NdrStubInitializePartial(
  265.     PRPC_MESSAGE        pRpcMsg,
  266.     PMIDL_STUB_MESSAGE  pStubMsg,
  267.     PMIDL_STUB_DESC     pStubDescriptor,
  268.     IRpcChannelBuffer * pRpcChannelBuffer,
  269.     unsigned long       RequestedBufferSize);
  270.  
  271. void __RPC_STUB NdrStubForwardingFunction(
  272.     IN  IRpcStubBuffer *    This,
  273.     IN  IRpcChannelBuffer * pChannel,
  274.     IN  PRPC_MESSAGE        pmsg,
  275.     OUT DWORD __RPC_FAR *   pdwStubPhase);
  276.  
  277. void RPC_ENTRY
  278. NdrStubGetBuffer(
  279.     IRpcStubBuffer *    This,
  280.     IRpcChannelBuffer * pRpcChannelBuffer,
  281.     PMIDL_STUB_MESSAGE  pStubMsg);
  282.  
  283. HRESULT RPC_ENTRY
  284. NdrStubErrorHandler(
  285.     DWORD dwExceptionCode);
  286.  
  287. HRESULT STDMETHODCALLTYPE
  288. CStdStubBuffer_QueryInterface(
  289.     IRpcStubBuffer *This,
  290.     REFIID riid,
  291.     void **ppvObject);
  292.  
  293. ULONG STDMETHODCALLTYPE
  294. CStdStubBuffer_AddRef(
  295.     IRpcStubBuffer *This);
  296.  
  297. ULONG STDMETHODCALLTYPE
  298. CStdStubBuffer_Release(
  299.     IRpcStubBuffer *This);
  300.  
  301. ULONG STDMETHODCALLTYPE
  302. NdrCStdStubBuffer_Release(
  303.     IRpcStubBuffer *This,
  304.     IPSFactoryBuffer * pPSF);
  305.  
  306. HRESULT STDMETHODCALLTYPE
  307. CStdStubBuffer_Connect(
  308.     IRpcStubBuffer *This,
  309.     IUnknown *pUnkServer);
  310.  
  311. void STDMETHODCALLTYPE
  312. CStdStubBuffer_Disconnect(
  313.     IRpcStubBuffer *This);
  314.  
  315. HRESULT STDMETHODCALLTYPE
  316. CStdStubBuffer_Invoke(
  317.     IRpcStubBuffer *This,
  318.     RPCOLEMESSAGE *pRpcMsg,
  319.     IRpcChannelBuffer *pRpcChannelBuffer);
  320.  
  321. IRpcStubBuffer * STDMETHODCALLTYPE
  322. CStdStubBuffer_IsIIDSupported(
  323.     IRpcStubBuffer *This,
  324.     REFIID riid);
  325.  
  326. ULONG STDMETHODCALLTYPE
  327. CStdStubBuffer_CountRefs(
  328.     IRpcStubBuffer *This);
  329.  
  330. HRESULT STDMETHODCALLTYPE
  331. CStdStubBuffer_DebugServerQueryInterface(
  332.     IRpcStubBuffer *This,
  333.     void **ppv);
  334.  
  335. void STDMETHODCALLTYPE
  336. CStdStubBuffer_DebugServerRelease(
  337.     IRpcStubBuffer *This,
  338.     void *pv);
  339.  
  340. #if defined(_MPPC_)
  341. #define CStdStubBuffer_METHODS \
  342.     0,  /* a PowerMac dummy */  \
  343.     CStdStubBuffer_QueryInterface,\
  344.     CStdStubBuffer_AddRef, \
  345.     CStdStubBuffer_Release, \
  346.     CStdStubBuffer_Connect, \
  347.     CStdStubBuffer_Disconnect, \
  348.     CStdStubBuffer_Invoke, \
  349.     CStdStubBuffer_IsIIDSupported, \
  350.     CStdStubBuffer_CountRefs, \
  351.     CStdStubBuffer_DebugServerQueryInterface, \
  352.     CStdStubBuffer_DebugServerRelease
  353. #else
  354. #define CStdStubBuffer_METHODS \
  355.     CStdStubBuffer_QueryInterface,\
  356.     CStdStubBuffer_AddRef, \
  357.     CStdStubBuffer_Release, \
  358.     CStdStubBuffer_Connect, \
  359.     CStdStubBuffer_Disconnect, \
  360.     CStdStubBuffer_Invoke, \
  361.     CStdStubBuffer_IsIIDSupported, \
  362.     CStdStubBuffer_CountRefs, \
  363.     CStdStubBuffer_DebugServerQueryInterface, \
  364.     CStdStubBuffer_DebugServerRelease
  365. #endif
  366.  
  367. //+-------------------------------------------------------------------------
  368. //
  369. //  Macro definitions for the proxy file
  370. //
  371. //--------------------------------------------------------------------------
  372.  
  373. #define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp( pIID, name##_ProxyVtblList[ index ]->header.piid, 16 )
  374.  
  375. #define IID_BS_LOOKUP_SETUP     int result, low=-1;
  376.  
  377. #define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)   \
  378.     if ( ( result = name##_CHECK_IID( split ) ) > 0 ) \
  379.         { low = sz - split; }                      \
  380.     else if ( !result )                               \
  381.         { low = split; goto found_label; }
  382.  
  383. #define IID_BS_LOOKUP_NEXT_TEST(name, split )         \
  384.     if ( ( result = name##_CHECK_IID( low + split )) >= 0 )  \
  385.         { low = low + split; if ( !result ) goto found_label; }
  386.  
  387. #define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index )                  \
  388.     low = low + 1;                                          \
  389.     if ( ( low >= sz ) || (result = name##_CHECK_IID( low ) )) goto not_found_label; \
  390.     found_label: (index) = low; return 1;                         \
  391.     not_found_label: return 0;
  392.  
  393. //+-------------------------------------------------------------------------
  394. //
  395. //  Macro and routine definitions for the dlldata file
  396. //
  397. //--------------------------------------------------------------------------
  398.  
  399. /****************************************************************************
  400.  * Proxy Dll APIs
  401.  ****************************************************************************/
  402.  
  403. HRESULT RPC_ENTRY
  404. NdrDllGetClassObject (
  405.     IN  REFCLSID                rclsid,
  406.     IN  REFIID                  riid,
  407.     OUT void **                 ppv,
  408.     IN const ProxyFileInfo **   pProxyFileList,
  409.     IN const CLSID *            pclsid,
  410.     IN CStdPSFactoryBuffer *    pPSFactoryBuffer);
  411.  
  412. HRESULT RPC_ENTRY
  413. NdrDllCanUnloadNow(
  414.     IN CStdPSFactoryBuffer * pPSFactoryBuffer);
  415.  
  416. // if the user specified a routine prefix, pick it up...
  417. //     if not, add nothing
  418.  
  419. #ifndef ENTRY_PREFIX
  420. #define ENTRY_PREFIX
  421. #endif
  422.  
  423. // get around the pain of cpp with an extra level of expansion
  424. #define EXPANDED_ENTRY_PREFIX() ENTRY_PREFIX
  425.  
  426. #define DLLREGISTERSERVER_ENTRY EXPANDED_ENTRY_PREFIX()##DllRegisterServer
  427. #define DLLUNREGISTERSERVER_ENTRY EXPANDED_ENTRY_PREFIX()##DllUnregisterServer
  428. #define DLLMAIN_ENTRY EXPANDED_ENTRY_PREFIX()##DllMain
  429.  
  430. #define DLLGETCLASSOBJECT_ENTRY EXPANDED_ENTRY_PREFIX()##DllGetClassObject
  431. #define DLLCANUNLOADNOW_ENTRY EXPANDED_ENTRY_PREFIX()##DllCanUnloadNow
  432.  
  433. /*************************************************************************
  434. The following new functions were added after the Windows NT 3.5 release.
  435. Programs intended to run on Windows NT 3.5 should define NT35_STRICT to
  436. ensure that no new functions are used.
  437. *************************************************************************/
  438. #ifndef NT35_STRICT
  439.  
  440. HRESULT RPC_ENTRY NdrDllRegisterProxy(
  441.     IN HMODULE                  hDll,
  442.     IN const ProxyFileInfo **   pProxyFileList,
  443.     IN const CLSID *            pclsid);
  444.  
  445. HRESULT RPC_ENTRY NdrDllUnregisterProxy(
  446.     IN HMODULE                  hDll,
  447.     IN const ProxyFileInfo **   pProxyFileList,
  448.     IN const CLSID *            pclsid);
  449.  
  450.  
  451. #define REGISTER_PROXY_DLL_ROUTINES(pProxyFileList, pClsID) \
  452.     \
  453.     HINSTANCE hProxyDll = 0; \
  454.     \
  455.     /*DllMain saves the DLL module handle for later use by DllRegisterServer */ \
  456.     BOOL WINAPI DLLMAIN_ENTRY( \
  457.         HINSTANCE  hinstDLL, \
  458.         DWORD  fdwReason, \
  459.         LPVOID  lpvReserved) \
  460.     { \
  461.         if(fdwReason == DLL_PROCESS_ATTACH) \
  462.             hProxyDll = hinstDLL; \
  463.         return TRUE; \
  464.     } \
  465.     \
  466.     /* DllRegisterServer registers the interfaces contained in the proxy DLL. */ \
  467.     HRESULT STDAPICALLTYPE DLLREGISTERSERVER_ENTRY() \
  468.     { \
  469.         return NdrDllRegisterProxy(hProxyDll, pProxyFileList, pClsID); \
  470.     }  \
  471.     \
  472.     /* DllUnregisterServer unregisters the interfaces contained in the proxy DLL. */ \
  473.     HRESULT STDAPICALLTYPE DLLUNREGISTERSERVER_ENTRY() \
  474.     { \
  475.         return NdrDllUnregisterProxy(hProxyDll, pProxyFileList, pClsID); \
  476.     }
  477.  
  478. //Delegation support.
  479. #define STUB_FORWARDING_FUNCTION        NdrStubForwardingFunction
  480.  
  481. ULONG STDMETHODCALLTYPE
  482. CStdStubBuffer2_Release(IRpcStubBuffer *This);
  483.  
  484. ULONG STDMETHODCALLTYPE
  485. NdrCStdStubBuffer2_Release(IRpcStubBuffer *This,IPSFactoryBuffer * pPSF);
  486.  
  487. #define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
  488.  
  489. #endif //NT35_STRICT
  490. /*************************************************************************
  491. End of new functions.
  492. *************************************************************************/
  493.  
  494. // PROXY_CLSID has precedence over PROXY_CLSID_IS
  495.  
  496. #ifdef PROXY_CLSID
  497.  
  498. #define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
  499.  
  500. #else // PROXY_CLSID
  501.  
  502. #ifdef PROXY_CLSID_IS
  503. #define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
  504. #define PROXY_CLSID     CLSID_PSFactoryBuffer
  505. #else // PROXY_CLSID_IS
  506. #define CLSID_PSFACTORYBUFFER
  507. #endif //PROXY_CLSID_IS
  508.  
  509. #endif //PROXY_CLSID
  510.  
  511. // if the user specified an override for the class id, it is
  512. // PROXY_CLSID at this point
  513.  
  514. #ifndef PROXY_CLSID
  515. #define GET_DLL_CLSID   \
  516.     ( aProxyFileList[0]->pStubVtblList[0] != 0 ? \
  517.     aProxyFileList[0]->pStubVtblList[0]->header.piid : 0)
  518. #else  //PROXY_CLSID
  519. #define GET_DLL_CLSID   &PROXY_CLSID
  520. #endif //PROXY_CLSID
  521.  
  522.  
  523.  
  524. #define EXTERN_PROXY_FILE(name) \
  525.     EXTERN_C const ProxyFileInfo name##_ProxyFileInfo;
  526.  
  527. #define PROXYFILE_LIST_START    \
  528.     const ProxyFileInfo  *  aProxyFileList[]    = {
  529.  
  530. #define REFERENCE_PROXY_FILE(name)  \
  531.     & name##_ProxyFileInfo
  532.  
  533. #define PROXYFILE_LIST_END      \
  534.     0 };
  535.  
  536. // return pointers to the class information
  537.  
  538. #define DLLDATA_GETPROXYDLLINFO(pPFList,pClsid) \
  539.     void RPC_ENTRY GetProxyDllInfo( const ProxyFileInfo*** pInfo, const CLSID ** pId )  \
  540.         {   \
  541.         *pInfo  = pPFList;  \
  542.         *pId    = pClsid;   \
  543.         };
  544.  
  545. // ole entry points:
  546. #define DLLGETCLASSOBJECTROUTINE(pPFlist, pClsid,pFactory)    \
  547.  HRESULT STDAPICALLTYPE DLLGETCLASSOBJECT_ENTRY ( \
  548.      REFCLSID rclsid, \
  549.      REFIID riid, \
  550.      void ** ppv ) \
  551.         { \
  552.         return  \
  553.             NdrDllGetClassObject(rclsid,riid,ppv,pPFlist,pClsid,pFactory ); \
  554.         }
  555.  
  556. #define DLLCANUNLOADNOW(pFactory)   \
  557.  HRESULT STDAPICALLTYPE DLLCANUNLOADNOW_ENTRY()    \
  558.     {   \
  559.     return NdrDllCanUnloadNow( pFactory );    \
  560.     }
  561.  
  562.  
  563. #define DLLDUMMYPURECALL    \
  564.     void __cdecl _purecall(void)    \
  565.         {   \
  566.         }
  567.  
  568. #define CSTDSTUBBUFFERRELEASE(pFactory)   \
  569. ULONG STDMETHODCALLTYPE CStdStubBuffer_Release(IRpcStubBuffer *This) \
  570.     {   \
  571.     return NdrCStdStubBuffer_Release(This,(IPSFactoryBuffer *)pFactory);   \
  572.     }   \
  573.  
  574. #ifdef PROXY_DELEGATION
  575. #define CSTDSTUBBUFFER2RELEASE(pFactory)   \
  576. ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) \
  577.     {   \
  578.     return NdrCStdStubBuffer2_Release(This,(IPSFactoryBuffer *)pFactory);   \
  579.     }
  580. #else
  581. #define CSTDSTUBBUFFER2RELEASE(pFactory)
  582. #endif //PROXY_DELEGATION
  583.  
  584.  
  585. #ifdef REGISTER_PROXY_DLL
  586. #define DLLREGISTRY_ROUTINES(pProxyFileList,pClsID ) REGISTER_PROXY_DLL_ROUTINES(pProxyFileList,pClsID )
  587. #else
  588. #define DLLREGISTRY_ROUTINES(pProxyFileList,pClsID )
  589. #endif //REGISTER_PROXY_DLL
  590.  
  591.  
  592. // the dll entry points that must be defined
  593. #define DLLDATA_ROUTINES(pProxyFileList,pClsID )    \
  594.     \
  595.     CLSID_PSFACTORYBUFFER \
  596.     \
  597.     CStdPSFactoryBuffer       gPFactory = {0,0,0,0};  \
  598.     \
  599.     DLLDATA_GETPROXYDLLINFO(pProxyFileList,pClsID) \
  600.     \
  601.     DLLGETCLASSOBJECTROUTINE(pProxyFileList,pClsID,&gPFactory)    \
  602.     \
  603.     DLLCANUNLOADNOW(&gPFactory)   \
  604.     \
  605.     CSTDSTUBBUFFERRELEASE(&gPFactory)   \
  606.     \
  607.     CSTDSTUBBUFFER2RELEASE(&gPFactory) \
  608.     \
  609.     DLLDUMMYPURECALL    \
  610.     \
  611.     DLLREGISTRY_ROUTINES(pProxyFileList, pClsID) \
  612.     \
  613.  
  614.     // more code goes here...
  615.  
  616.  
  617. #define DLLDATA_STANDARD_ROUTINES   \
  618.     DLLDATA_ROUTINES( (const ProxyFileInfo**) pProxyFileList, &CLSID_PSFactoryBuffer )  \
  619.  
  620. #else  // !defined(__RPC_DOS__) && !defined(__RPC_WIN16__)
  621.  
  622. //+-------------------------------------------------------------------------
  623. //
  624. //  16-bit definitions (all empty)
  625. //
  626. //--------------------------------------------------------------------------
  627.  
  628. #endif // WIN32 or _MPPC_
  629.  
  630. #endif // __RPCPROXY_H__
  631.