Leaked source code of windows server 2003
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.

101 lines
2.4 KiB

  1. ;; Copyright Microsoft Corporation
  2. ;;
  3. ;; Module Name:
  4. ;;
  5. ;; winthrow_yuck.tpl
  6. ;;
  7. ;; Abstract:
  8. ;;
  9. ;; Author:
  10. ;;
  11. ;; July 2001 JayKrell
  12. ;;
  13. ;; Revision History:
  14. ;;
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. ;;
  17. ;; Code reuse is not ideal here..pending genthnk understanding and improvement..
  18. ;; The yuckiness is in winthrow_err.tpl too, but only as much as could not be moved out.
  19. [Macros]
  20. ;;
  21. ;; Underscore, dash, dollar are not part of identifiers, so "j" is used for hierarchy.
  22. ;;
  23. TemplateName=RegistryjFailed
  24. Begin=
  25. RetVal != ERROR_SUCCESS
  26. End=
  27. TemplateName=RegistryjIsErrorAcceptable
  28. Begin=
  29. ::@PrivateNamespace_IsWin32ErrorAcceptable(RetVal, NumberOfAcceptableErrors, VaListOfAcceptableErrors)
  30. End=
  31. TemplateName=RegistryjThrowError
  32. Begin=
  33. EXCEPTION_TYPE Exception;@NL
  34. __if_exists(EXCEPTION_TYPE::Init@ApiName)@NL
  35. {@Indent(@NL
  36. Exception.Init@ApiName(RetVal@IfArgs(@NL, @ArgsOut));@NL
  37. )}@NL
  38. __if_not_exists(EXCEPTION_TYPE::Init@ApiName)@NL
  39. {@Indent(@NL
  40. Exception.InitWin32Error(RetVal);@NL
  41. )}@NL
  42. Exception.Throw();@NL
  43. End=
  44. ;;
  45. ;; Registry functions have no ErrorOut other than RetVal.
  46. ;; As well, they have no seperate clear or set operations for error out.
  47. ;; As well, the middle layers do not need an extra local.
  48. ;;
  49. ;; HRESULT and NTSTATUS functions are this way too.
  50. ;;
  51. TemplateName=LastErrorjIsErrorAcceptable
  52. Begin=
  53. ::@PrivateNamespace_IsWin32ErrorAcceptable(Win32Error, NumberOfAcceptableErrors, VaListOfAcceptableErrors)
  54. End=
  55. TemplateName=LastErrorjDeclareErrorOut
  56. Begin=
  57. OUT DWORD& Win32ErrorOut,@NL
  58. End=
  59. TemplateName=LastErrorjPassErrorOut
  60. Begin=
  61. Win32ErrorOut,@NL
  62. End=
  63. TemplateName=LastErrorjDeclareLocalErrorOut
  64. Begin=
  65. DWORD Win32ErrorOut = NO_ERROR;@NL
  66. End=
  67. TemplateName=LastErrorjSetErrorOut
  68. Begin=
  69. const DWORD Win32Error = ::GetLastError();@NL
  70. Win32ErrorOut = Win32Error;@NL
  71. End=
  72. TemplateName=LastErrorjClearErrorOut
  73. Begin=
  74. Win32ErrorOut = NO_ERROR;@NL
  75. End=
  76. TemplateName=LastErrorjThrowError
  77. Begin=
  78. EXCEPTION_TYPE Exception;@NL
  79. __if_exists(EXCEPTION_TYPE::Init@ApiName)@NL
  80. {@Indent(@NL
  81. Exception.Init@ApiName(@IfArgs(@Indent(@NL@ListColWin32Error,@NL@ListCol@ArgsOut))@Else(Win32Error));@NL
  82. )}@NL
  83. __if_not_exists(EXCEPTION_TYPE::Init@ApiName)@NL
  84. {@Indent(@NL
  85. Exception.InitWin32Error(Win32Error);@NL
  86. )}@NL
  87. Exception.Throw();@NL
  88. End=