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.

75 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: astg.hxx
  7. //
  8. // Contents: Common header file for async docfiles
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 19-Dec-95 PhilipLa Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __ASTG_HXX__
  18. #define __ASTG_HXX__
  19. #if DBG == 1
  20. DECLARE_DEBUG(astg);
  21. #endif
  22. #if DBG == 1
  23. #define astgDebugOut(x) astgInlineDebugOut x
  24. #ifndef REF
  25. #define astgAssert(e) Win4Assert(e)
  26. #define astgVerify(e) Win4Assert(e)
  27. #else
  28. #include <assert.h>
  29. #define astgAssert(e) assert(e)
  30. #define astgVerify(e) assert(e)
  31. #endif //!REF
  32. #else
  33. #define astgDebugOut(x)
  34. #define astgAssert(e)
  35. #define astgVerify(e) (e)
  36. #endif
  37. #define astgErr(l, e) ErrJmp(astg, l, e, sc)
  38. #define astgChkTo(l, e) if (FAILED(sc = (e))) astgErr(l, sc) else 1
  39. #define astgHChkTo(l, e) if (FAILED(sc = GetScode(e))) astgErr(l, sc) else 1
  40. #define astgChk(e) astgChkTo(Err, e)
  41. #define astgHChk(e) astgHChkTo(Err, e)
  42. #define astgMemTo(l, e) if ((e) == NULL) astgErr(l, STG_E_INSUFFICIENTMEMORY) else 1
  43. #define astgMem(e) astgMemTo(Err, e)
  44. #define IsValidHugePtrIn(pv, n) (((pv) == NULL) || !IsBadHugeReadPtr(pv, n))
  45. #define IsValidHugePtrOut(pv, n) (!IsBadHugeWritePtr(pv, n))
  46. #define ValidateBuffer(pv, n) \
  47. (((pv) == NULL || !IsValidPtrIn(pv, n)) ? STG_E_INVALIDPOINTER : S_OK)
  48. #define ValidatePtrBuffer(pv) \
  49. ValidateBuffer(pv, sizeof(void *))
  50. #define ValidateHugeBuffer(pv, n) \
  51. (((pv) == NULL || !IsValidHugePtrIn(pv, n)) ? STG_E_INVALIDPOINTER : S_OK)
  52. #define ValidateOutBuffer(pv, n) \
  53. (!IsValidPtrOut(pv, n) ? STG_E_INVALIDPOINTER : S_OK)
  54. #define ValidateOutPtrBuffer(pv) \
  55. ValidateOutBuffer(pv, sizeof(void *))
  56. #define ValidateHugeOutBuffer(pv, n) \
  57. (!IsValidHugePtrOut(pv, n) ? STG_E_INVALIDPOINTER : S_OK)
  58. #endif // #ifndef __ASTG_HXX__