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.

96 lines
1.9 KiB

  1. #include "precomp.hxx"
  2. #include "global.h"
  3. //// DebugMsg - display a message via OutputDebugString
  4. //
  5. // DebugMsg formats debug messages, including the file name
  6. // and line number the message originated form.
  7. //
  8. // Supports the TRACEMSG and TRACE macros.
  9. //
  10. // The current timer is adjusted to remove debug message
  11. // output from timing results.
  12. extern "C" void WINAPIV DebugMsg(char *fmt, ...) {
  13. va_list vargs;
  14. char c[200];
  15. // TIMESUSPEND;
  16. wsprintfA(c, "%s[%d] ", strrchr(DG.psFile, '\\')+1, DG.iLine);
  17. c[17] = 0;
  18. OutputDebugStringA(c);
  19. wsprintfA(c, "%ld: ", GetCurrentThreadId());
  20. c[5] = 0;
  21. OutputDebugStringA(c);
  22. va_start(vargs, fmt);
  23. wvsprintfA(c, fmt, vargs);
  24. OutputDebugStringA(c);
  25. OutputDebugStringA("\n");
  26. // TIMERESUME;
  27. }
  28. extern "C" void WINAPIV DebugHr(char *fmt, ...) {
  29. va_list vargs;
  30. char c[200];
  31. // TIMESUSPEND;
  32. wsprintfA(c, "%s[%d] ", strrchr(DG.psFile, '\\')+1, DG.iLine);
  33. c[17] = 0;
  34. OutputDebugStringA(c);
  35. wsprintfA(c, "%ld: ", GetCurrentThreadId());
  36. c[5] = 0;
  37. OutputDebugStringA(c);
  38. va_start(vargs, fmt);
  39. wvsprintfA(c, fmt, vargs);
  40. OutputDebugStringA(c);
  41. //
  42. // Parse USP and Win32 Errors
  43. //
  44. switch( DG.hrLastError )
  45. {
  46. case USP_E_SCRIPT_NOT_IN_FONT:
  47. lstrcpyA( DG.sLastError , "Selected font doesn't contain requested script\n");
  48. break;
  49. default:
  50. FormatMessageA(
  51. FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
  52. NULL, DG.hrLastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
  53. DG.sLastError, sizeof(DG.sLastError), NULL);
  54. }
  55. wsprintfA(c, " -- HRESULT = %x: %s", DG.hrLastError, DG.sLastError);
  56. OutputDebugStringA(c);
  57. // TIMERESUME;
  58. }