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.

71 lines
1.1 KiB

  1. //
  2. // REGDEBUG.C
  3. //
  4. // Copyright (C) Microsoft Corporation, 1995
  5. //
  6. #include "pch.h"
  7. // VXD_NODEBUGGER: Uses debug services available when a debugger is not
  8. // installed, but at the cost of an intermediate debug buffer.
  9. //#define VXD_NODEBUGGER
  10. #ifdef DEBUG
  11. #include <stdarg.h>
  12. #ifdef STDIO_DEBUG
  13. #include <stdio.h>
  14. #else
  15. static char g_RgDebugBuffer[256];
  16. #endif
  17. #ifdef VXD_NODEBUGGER
  18. extern ULONG (SERVICE*_Vsprintf)(PCHAR,PCHAR,va_list);
  19. #endif
  20. VOID
  21. INTERNALV
  22. RgDebugPrintf(
  23. LPCSTR lpFormatString,
  24. ...
  25. )
  26. {
  27. va_list arglist;
  28. va_start(arglist, lpFormatString);
  29. #ifdef STDIO_DEBUG
  30. vprintf(lpFormatString, arglist);
  31. #else
  32. #ifdef VXD
  33. #ifdef VXD_NODEBUGGER
  34. _Vsprintf(g_RgDebugBuffer, (PCHAR) lpFormatString, arglist);
  35. _Debug_Out_Service(g_RgDebugBuffer);
  36. #else
  37. _Debug_Printf_Service((PCHAR) lpFormatString, arglist);
  38. #endif
  39. #else
  40. wvsprintf(g_RgDebugBuffer, lpFormatString, arglist);
  41. OutputDebugString(g_RgDebugBuffer);
  42. #endif
  43. #endif
  44. }
  45. VOID
  46. INTERNAL
  47. RgDebugAssert(
  48. LPCSTR lpFile,
  49. UINT LineNumber
  50. )
  51. {
  52. RgDebugPrintf("assert failed %s@%d\n", lpFile, LineNumber);
  53. TRAP();
  54. }
  55. #endif