Source code of Windows XP (NT5)
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.

54 lines
1.0 KiB

  1. //*************************************************************
  2. //
  3. // Debugging functions
  4. //
  5. // Microsoft Confidential
  6. // Copyright (c) Microsoft Corporation 1995
  7. // All rights reserved
  8. //
  9. //*************************************************************
  10. #include "pch.h"
  11. VOID
  12. _DebugMsg (
  13. UINT mask,
  14. PCSTR Format,
  15. ...
  16. )
  17. {
  18. va_list args;
  19. DWORD Error;
  20. WCHAR Output[2048];
  21. PWSTR UnicodeFormat;
  22. UINT Size;
  23. Error = GetLastError();
  24. va_start (args, Format);
  25. Size = (lstrlenA (Format) + 1) * sizeof (WCHAR);
  26. UnicodeFormat = LocalAlloc (LPTR, Size);
  27. if (!UnicodeFormat) {
  28. SetLastError (Error);
  29. return;
  30. }
  31. MultiByteToWideChar (CP_ACP, 0, Format, -1, UnicodeFormat, Size/sizeof(WCHAR));
  32. _vsnwprintf (Output, sizeof(Output) - 3, UnicodeFormat, args);
  33. lstrcatW (Output, L"\r\n");
  34. OutputDebugStringW (Output);
  35. if (mask == DM_ASSERT) {
  36. DebugBreak();
  37. }
  38. va_end (args);
  39. LocalFree (UnicodeFormat);
  40. SetLastError (Error);
  41. }