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.

107 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. ntstatus.hxx
  6. Abstract:
  7. auto log
  8. Author:
  9. Larry Zhu (LZhu) December 8, 2001
  10. Revision History:
  11. --*/
  12. #ifndef _NTSTATUS_HXX_
  13. #define _NTSTATUS_HXX_
  14. #include "dbgstate.hxx"
  15. #ifdef DBG
  16. #define RELOCATE_ONE_2( _q ) \
  17. { \
  18. ULONG_PTR Offset; \
  19. \
  20. Offset = (((PUCHAR)((_q)->Buffer)) - ((PUCHAR)ClientBufferBase)); \
  21. if ( Offset >= SubmitBufferSize || \
  22. Offset + (_q)->Length > SubmitBufferSize || \
  23. !COUNT_IS_ALIGNED( Offset, ALIGN_WCHAR) ) { \
  24. \
  25. SspPrint((SSP_CRITICAL, "Failed RELOCATE_ONE\n")); \
  26. Status DBGCHK = STATUS_INVALID_PARAMETER; \
  27. goto Cleanup; \
  28. } \
  29. \
  30. (_q)->Buffer = (PWSTR)(((PUCHAR)ProtocolSubmitBuffer) + Offset); \
  31. (_q)->MaximumLength = (_q)->Length ; \
  32. }
  33. #define NULL_RELOCATE_ONE_2( _q ) \
  34. { \
  35. if ( (_q)->Buffer == NULL ) { \
  36. if ( (_q)->Length != 0 ) { \
  37. Status DBGCHK = STATUS_INVALID_PARAMETER; \
  38. goto Cleanup; \
  39. } \
  40. } else if ( (_q)->Length == 0 ) { \
  41. (_q)->Buffer = NULL; \
  42. } else { \
  43. RELOCATE_ONE_2( _q ); \
  44. } \
  45. }
  46. /********************************************************************
  47. TNtStatus
  48. ********************************************************************/
  49. class TNtStatus : public TStatusDerived<NTSTATUS> {
  50. public:
  51. TNtStatus(
  52. IN NTSTATUS Status = kUnInitializedValue
  53. );
  54. ~TNtStatus(
  55. VOID
  56. );
  57. virtual BOOL
  58. IsErrorSevereEnough(
  59. VOID
  60. ) const;
  61. virtual PCTSTR
  62. GetErrorServerityDescription(
  63. VOID
  64. ) const;
  65. private:
  66. TNtStatus(const TNtStatus& rhs);
  67. NTSTATUS
  68. operator=(
  69. IN NTSTATUS Status
  70. );
  71. };
  72. #else
  73. #define TNtStatus NTSTATUS // NTSTATUS in free build
  74. #define RELOCATE_ONE_2(_q) RELOCATE_ONE(_q)
  75. #define NULL_RELOCATE_ONE_2(_q) NULL_RELOCATE_ONE(_q)
  76. #endif // DBG
  77. #endif // _NTSTATUS_HXX