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.

24 lines
1.2 KiB

  1. #ifndef FUSION_MSI_CA_INC_MACROS_H
  2. #define FUSION_MSI_CA_INC_MACROS_H
  3. #define SETFAIL_AND_EXIT do { hr = E_FAIL; goto Exit;} while (0);
  4. #if !defined(NUMBER_OF)
  5. #define NUMBER_OF(x) (sizeof(x)/sizeof(x[0]))
  6. #endif
  7. #define SAFE_RELEASE_COMPOINTER(x) do {if (x != NULL) x->Release();} while(0)
  8. extern void Msmgen_TracingFunctionFailure(PWSTR x, PSTR func, DWORD line);
  9. #define IFFALSE_EXIT(x) do {if (!(x)) {Msmgen_TracingFunctionFailure(L ## # x, __FUNCTION__, __LINE__); hr = HRESULT_FROM_WIN32(::GetLastError()); goto Exit;}} while(0)
  10. #define IFFAILED_EXIT(x) do {if ((hr = (x)) != ERROR_SUCCESS) { Msmgen_TracingFunctionFailure(L ## # x, __FUNCTION__, __LINE__); goto Exit;}} while(0)
  11. #define IF_NOTSUCCESS_SET_HRERR_EXIT(x) do {UINT __t ; __t = (x); if (__t != ERROR_SUCCESS) {hr = HRESULT_FROM_WIN32(__t); goto Exit;}} while(0)
  12. #define SET_HRERR_AND_EXIT(err) do { hr = HRESULT_FROM_WIN32(err); goto Exit;} while (0)
  13. #define PARAMETER_CHECK_NTC(x) do { if (!(x)) { hr = E_INVALIDARG; goto Exit;}} while (0)
  14. #define INTERNAL_ERROR_CHECK_NTC(x) do { if (!(x)) { hr = HRESULT_FROM_WIN32(ERROR_INTERNAL_ERROR); goto Exit;}} while (0)
  15. #endif