Changeset 20752
- Timestamp:
- 09/04/07 08:32:51 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/vapor/vpr/md/WIN32/Util/ErrorImplWin32.cpp
r19729 r20752 44 44 std::string ErrorImplWin32::getCurrentErrorMsg() 45 45 { 46 char* msg_buffer(NULL); 46 std::string err_str; 47 const DWORD error_code(GetLastError()); 47 48 48 DWORD error_code = GetLastError(); 49 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 50 NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 51 (LPTSTR) &msg_buffer, 0, NULL); 49 if ( ERROR_SUCCESS != error_code ) 50 { 51 char* msg_buffer(NULL); 52 52 53 std::string err_str; 53 FormatMessage( 54 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 55 NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 56 (LPTSTR) &msg_buffer, 0, NULL 57 ); 54 58 55 if ( NULL != msg_buffer ) 56 { 57 err_str = msg_buffer; 58 LocalFree(msg_buffer); 59 if ( NULL != msg_buffer ) 60 { 61 err_str = msg_buffer; 62 LocalFree(msg_buffer); 63 } 59 64 } 60 65 juggler/trunk/modules/vapor/vpr/md/WIN32/Util/ErrorImplWin32.h
r19729 r20752 55 55 { 56 56 public: 57 /** 58 * Returns the current error message from the OS for a failed operation. 59 * If the current error code is \c ERROR_SUCCESS or there is no message for 60 * the current error, then an empty string is returned. 61 */ 57 62 static std::string getCurrentErrorMsg(); 58 63
