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.

56 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. commsg.h
  5. Abstract:
  6. HRESULT <-> Win32 error mapping macros.
  7. Author:
  8. Michael W. Thomas (michth) 24-Sep-1996
  9. Revision History:
  10. Keith Moore (keithmo) 07-Feb-1997
  11. Cleanup, comment, made Metadata errors "real" HRESULTs.
  12. --*/
  13. #ifndef _COMMSG_H_
  14. #define _COMMSG_H_
  15. //
  16. // RETURNCODETOHRESULT() maps a return code to an HRESULT. If the return
  17. // code is a Win32 error (identified by a zero high word) then it is mapped
  18. // using the standard HRESULT_FROM_WIN32() macro. Otherwise, the return
  19. // code is assumed to already be an HRESULT and is returned unchanged.
  20. //
  21. #define RETURNCODETOHRESULT(rc) \
  22. (((rc) < 0x10000) \
  23. ? HRESULT_FROM_WIN32(rc) \
  24. : (rc))
  25. //
  26. // HRESULTTOWIN32() maps an HRESULT to a Win32 error. If the facility code
  27. // of the HRESULT is FACILITY_WIN32, then the code portion (i.e. the
  28. // original Win32 error) is returned. Otherwise, the original HRESULT is
  29. // returned unchagned.
  30. //
  31. #define HRESULTTOWIN32(hres) \
  32. ((HRESULT_FACILITY(hres) == FACILITY_WIN32) \
  33. ? HRESULT_CODE(hres) \
  34. : (hres))
  35. #endif // _COMMSG_H_