Macros.h
Go to the documentation of this file.
1 #pragma once
2 
3 #define CHECK_WIN32_DWORD( func, message ) \
4 { \
5  DWORD asi_macro_dw_err_ = ( func ); \
6  if ( asi_macro_dw_err_ != 0 ) \
7  { \
8  std::wstringstream ss_message; ss_message << message; \
9  throw std::exception(AppSecInc::Exception::Win32Exception::GetErrorString(asi_macro_dw_err_, \
10  ss_message.str().c_str()).c_str()); \
11  } \
12 }
13 
14 #define CHECK_WIN32_BOOL( func, message ) \
15 { \
16  if ( FALSE == ( func ) ) \
17  { \
18  std::wstringstream ss_message; ss_message << message; \
19  throw std::exception(AppSecInc::Exception::Win32Exception::GetLastErrorString( \
20  ss_message.str().c_str()).c_str()); \
21  } \
22 }
23 
24 #define CHECK_BOOL( func, message ) \
25 { \
26  if ( FALSE == ( func ) ) \
27  { \
28  std::wstringstream ss_message; ss_message << message; \
29  throw std::exception(AppSecInc::StringUtils::wc2mb(ss_message.str()).c_str()); \
30  } \
31 }
32 
33 #define THROW( message ) \
34 { \
35  std::wstringstream ss_message; ss_message << message; \
36  throw std::exception(AppSecInc::StringUtils::wc2mb(ss_message.str()).c_str()); \
37 }
38 
39 #define CHECK_HR( func, message ) \
40 { \
41  HRESULT asi_macro_hr_ = ( func ); \
42  if (FAILED(asi_macro_hr_)) \
43  { \
44  std::wstringstream ss_message; ss_message << message; \
45  throw std::exception(AppSecInc::Exception::Win32Exception::GetErrorString(asi_macro_hr_, \
46  ss_message.str().c_str()).c_str()); \
47  } \
48 }


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com