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.

32 lines
543 B

  1. #include "precomp.h"
  2. #include "util.h"
  3. void ErrorMessage( void ) {
  4. ErrorMessage( "", GetLastError() );
  5. }
  6. void ErrorMessage( LPCTSTR str, HRESULT hr ) {
  7. #ifdef _DEBUG
  8. void* pMsgBuf;
  9. ::FormatMessage(
  10. FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
  11. NULL,
  12. hr,
  13. MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
  14. (LPTSTR ) &pMsgBuf,
  15. 0,
  16. NULL
  17. );
  18. OutputDebugString( str );
  19. if( NULL != pMsgBuf ) {
  20. OutputDebugString( (LPTSTR ) pMsgBuf );
  21. }
  22. LocalFree( pMsgBuf );
  23. #endif _DEBUG
  24. }