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.

23 lines
1.7 KiB

  1. // Execute the given call and check that the return code must be S_OK
  2. #define CHECK_SUCCESS( Call ) \
  3. { \
  4. hr = Call; \
  5. if (hr != S_OK) \
  6. Error(1, L"\nError in %S(%d): \n\t- Call %S not succeeded. \n" \
  7. L"\t Error code = 0x%08lx. Error description = %s\n", \
  8. __FILE__, __LINE__, #Call, hr, GetStringFromFailureType(hr)); \
  9. }
  10. #define CHECK_NOFAIL( Call ) \
  11. { \
  12. hr = Call; \
  13. if (FAILED(hr)) \
  14. Error(1, L"\nError in %S(%d): \n\t- Call %S not succeeded. \n" \
  15. L"\t Error code = 0x%08lx. Error description = %s\n", \
  16. __FILE__, __LINE__, #Call, hr, GetStringFromFailureType(hr)); \
  17. }
  18. void Error(INT nReturnCode, const WCHAR* pwszMsgFormat, ...);
  19. LPCWSTR GetStringFromFailureType(HRESULT hrStatus);