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

  1. /*++
  2.  
  3. Copyright 1991-1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     rpc.h
  8.  
  9. Abstract:
  10.  
  11.     Master include file for RPC applications.
  12.  
  13. --*/
  14.  
  15. #if !defined( RPC_NO_WINDOWS_H ) && !defined( MAC ) && !defined( _MAC )
  16. #include <windows.h>
  17. #endif // RPC_NO_WINDOWS_H
  18.  
  19. #ifndef __RPC_H__
  20. #define __RPC_H__
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. //-------------------------------------------------------------
  27. // platform specific defines
  28. //-------------------------------------------------------------
  29.  
  30. //-------------------  MAC ---------------------------
  31. #if defined( MAC ) || defined( _MAC )
  32.  
  33. #define __RPC_MAC__
  34. // Set the packing level for RPC structures.
  35.  
  36. #include <pshpack2.h>
  37.  
  38. //-------------------  WIN32 ---------------------------
  39. #else // win32 platforms
  40.  
  41. #define __RPC_WIN32__
  42.  
  43. #endif
  44.  
  45.  
  46. #ifndef __MIDL_USER_DEFINED
  47. #define midl_user_allocate MIDL_user_allocate
  48. #define midl_user_free     MIDL_user_free
  49. #define __MIDL_USER_DEFINED
  50. #endif
  51.  
  52. typedef void * I_RPC_HANDLE;
  53. typedef long RPC_STATUS;
  54.  
  55. #ifndef _MAC
  56. #define RPC_UNICODE_SUPPORTED
  57. #endif //_MAC
  58.  
  59.  
  60. #ifdef __RPC_MAC__
  61. #    define __RPC_FAR
  62. #    define __RPC_API
  63. #    define __RPC_USER
  64. #    define __RPC_STUB
  65. #    define RPC_ENTRY
  66. #elif   (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
  67. #    define __RPC_FAR
  68. #    define __RPC_API  __stdcall
  69. #    define __RPC_USER __stdcall
  70. #    define __RPC_STUB __stdcall
  71. #    define  RPC_ENTRY __stdcall
  72. #else
  73. #    define __RPC_FAR
  74. #    define __RPC_API
  75. #    define __RPC_USER
  76. #    define __RPC_STUB
  77. #endif
  78.  
  79. // Some RPC platforms don't define DECLSPEC_IMPORT
  80. #if !defined(DECLSPEC_IMPORT)
  81. #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
  82. #define DECLSPEC_IMPORT __declspec(dllimport)
  83. #else
  84. #define DECLSPEC_IMPORT
  85. #endif
  86. #endif
  87.  
  88. #if !defined(_RPCRT4_)
  89. #define RPCRTAPI DECLSPEC_IMPORT
  90. #else
  91. #define RPCRTAPI
  92. #endif
  93.  
  94. #if !defined(_RPCNS4_)
  95. #define RPCNSAPI DECLSPEC_IMPORT
  96. #else
  97. #define RPCNSAPI
  98. #endif
  99.  
  100. #ifdef IN
  101. #undef IN
  102. #undef OUT
  103. #undef OPTIONAL
  104. #endif /* IN */
  105.  
  106. #ifdef __RPC_MAC__
  107.  
  108. #include <setjmp.h>
  109.  
  110. #define RPCXCWORD (sizeof(jmp_buf)/sizeof(int))
  111.  
  112. #pragma warning( disable: 4005 ) 
  113. #include <rpcdce.h>
  114. #include <rpcnsi.h>
  115. #include <rpcerr.h>
  116. #include <rpcmac.h>
  117. #pragma warning( default :  4005 )
  118.  
  119. typedef void  (RPC_ENTRY *MACYIELDCALLBACK)(/*OSErr*/ short *) ; 
  120. RPC_STATUS RPC_ENTRY
  121. RpcMacSetYieldInfo(
  122.     MACYIELDCALLBACK pfnCallback) ;
  123.  
  124. #if !defined(UNALIGNED)
  125. #define UNALIGNED
  126. #endif
  127.  
  128. #include <poppack.h>
  129.  
  130. #else // __RPC_MAC__
  131.  
  132. #include <rpcdce.h>
  133. #include <rpcnsi.h>
  134. #include <rpcnterr.h>
  135. #include <excpt.h>
  136. #include <winerror.h>
  137.  
  138. #define RpcTryExcept \
  139.     __try \
  140.         {
  141.  
  142. // trystmts
  143.  
  144. #define RpcExcept(expr) \
  145.         } \
  146.     __except (expr) \
  147.         {
  148.  
  149. // exceptstmts
  150.  
  151. #define RpcEndExcept \
  152.         }
  153.  
  154. #define RpcTryFinally \
  155.     __try \
  156.         {
  157.  
  158. // trystmts
  159.  
  160. #define RpcFinally \
  161.         } \
  162.     __finally \
  163.         {
  164.  
  165. // finallystmts
  166.  
  167. #define RpcEndFinally \
  168.         }
  169.  
  170. #define RpcExceptionCode() GetExceptionCode()
  171. #define RpcAbnormalTermination() AbnormalTermination()
  172.  
  173. RPCRTAPI
  174. RPC_STATUS
  175. RPC_ENTRY
  176. RpcImpersonateClient (
  177.     IN RPC_BINDING_HANDLE BindingHandle OPTIONAL
  178.     );
  179.  
  180. RPCRTAPI
  181. RPC_STATUS
  182. RPC_ENTRY
  183. RpcRevertToSelfEx (
  184.     IN RPC_BINDING_HANDLE BindingHandle OPTIONAL
  185.     );
  186.  
  187. RPCRTAPI
  188. RPC_STATUS
  189. RPC_ENTRY
  190. RpcRevertToSelf (
  191.     );
  192.  
  193. RPCRTAPI
  194. long
  195. RPC_ENTRY
  196. I_RpcMapWin32Status (
  197.     IN RPC_STATUS Status
  198.     );
  199.  
  200. #endif // __RPC_MAC__
  201.  
  202. // Definitions which depend on windows.h
  203. #if !defined( RPC_NO_WINDOWS_H ) && !defined( MAC ) && !defined( _MAC )
  204.  
  205. #include <rpcasync.h>
  206.  
  207. #endif // RPC_NO_WINDOWS_H
  208.  
  209. #ifdef __cplusplus
  210. }
  211. #endif
  212.  
  213. #endif // __RPC_H__
  214.  
  215.