3 #ifndef __CDS_OS_WIN_SYSERROR_H
4 #define __CDS_OS_WIN_SYSERROR_H
9 namespace cds { namespace OS {
12 /// OS-specific type of error code
13 typedef DWORD error_code;
15 /// Get system error code
16 static inline error_code getErrorCode()
18 return ::GetLastError();
21 /// Get system error text
22 static inline std::string getSystemErrorText( error_code nCode )
25 if ( !FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
28 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
29 (LPTSTR) &ptmp, 0, 0 )
36 std::string str( ptmp );
42 using Win32::error_code;
43 using Win32::getErrorCode;
44 using Win32::getSystemErrorText;
45 }} // namespace cds::OS
47 #endif // #ifndef __CDS_OS_WIN_SYSERROR_H