Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1991 - 1999
  6. //
  7. // File: rpcx86.h
  8. //
  9. //--------------------------------------------------------------------------
  10. /*********************************************************/
  11. /** Microsoft LAN Manager **/
  12. /** Copyright(c) Microsoft Corp., 1991 **/
  13. /** **/
  14. /** Exceptions package for C for DOS/WIN/OS2 **/
  15. /** **/
  16. /*********************************************************/
  17. #ifndef __RPCx86_H__
  18. #define __RPCx86_H__
  19. typedef struct _ExceptionBuff {
  20. int registers[RPCXCWORD];
  21. struct _ExceptionBuff __RPC_FAR *pExceptNext;
  22. } ExceptionBuff, __RPC_FAR *pExceptionBuff;
  23. int RPC_ENTRY RpcSetException(pExceptionBuff);
  24. void RPC_ENTRY RpcLeaveException(void);
  25. #define RpcTryExcept \
  26. { \
  27. int _exception_code; \
  28. ExceptionBuff exception; \
  29. \
  30. _exception_code = RpcSetException(&exception); \
  31. \
  32. if (!_exception_code) \
  33. {
  34. // trystmts
  35. #define RpcExcept(expr) \
  36. RpcLeaveException(); \
  37. } \
  38. else \
  39. { \
  40. if (!(expr)) \
  41. RpcRaiseException(_exception_code);
  42. // exceptstmts
  43. #define RpcEndExcept \
  44. } \
  45. }
  46. #define RpcTryFinally \
  47. { \
  48. int _abnormal_termination; \
  49. ExceptionBuff exception; \
  50. \
  51. _abnormal_termination = RpcSetException(&exception); \
  52. \
  53. if (!_abnormal_termination) \
  54. {
  55. // trystmts
  56. #define RpcFinally \
  57. RpcLeaveException(); \
  58. }
  59. // finallystmts
  60. #define RpcEndFinally \
  61. if (_abnormal_termination) \
  62. RpcRaiseException(_abnormal_termination); \
  63. }
  64. #define RpcExceptionCode() _exception_code
  65. #define RpcAbnormalTermination() _abnormal_termination
  66. #endif // __RPCx86_H__
  67.