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.

109 lines
2.0 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1998-1999 Microsoft Corporation
  4. *
  5. * Abstract:
  6. *
  7. * Debugging routines
  8. *
  9. * Revision History:
  10. *
  11. * 09/07/1999 agodfrey
  12. * Created it.
  13. *
  14. \**************************************************************************/
  15. #include <windows.h>
  16. #include <stdio.h>
  17. #include "debug.h"
  18. #if DBG
  19. // _debugLevel is used to control the amount/severity of debugging messages
  20. // that are actually output.
  21. INT _debugLevel = DBG_VERBOSE;
  22. /**************************************************************************\
  23. *
  24. * Function Description:
  25. *
  26. * Removes the path portion of a pathname
  27. *
  28. * Arguments:
  29. *
  30. * [IN] str - pathname to strip
  31. *
  32. * Return Value:
  33. *
  34. * A pointer to the filename portion of the pathname
  35. *
  36. * History:
  37. *
  38. * 09/07/1999 agodfrey
  39. * Moved from Entry\Initialize.cpp
  40. *
  41. \**************************************************************************/
  42. const CHAR*
  43. StripDirPrefix(
  44. const CHAR* str
  45. )
  46. {
  47. const CHAR* p;
  48. p = strrchr(str, '\\');
  49. return p ? p+1 : str;
  50. }
  51. /**************************************************************************\
  52. *
  53. * Function Description:
  54. *
  55. * Outputs to the debugger
  56. *
  57. * Arguments:
  58. *
  59. * [IN] format - printf-like format string and variable arguments
  60. *
  61. * Return Value:
  62. *
  63. * Zero. This is to conform to NTDLL's definition of DbgPrint.
  64. *
  65. * Notes:
  66. *
  67. * There will be no output if a debugger is not connected.
  68. *
  69. * History:
  70. *
  71. * 09/07/1999 agodfrey
  72. * Moved from Entry\Initialize.cpp
  73. *
  74. \**************************************************************************/
  75. ULONG _cdecl
  76. DbgPrint(
  77. const CHAR* format,
  78. ...
  79. )
  80. {
  81. va_list arglist;
  82. va_start(arglist, format);
  83. const int BUFSIZE=1024;
  84. char buf[BUFSIZE];
  85. _vsnprintf(buf, BUFSIZE, format, arglist);
  86. buf[BUFSIZE-1]=0;
  87. OutputDebugStringA(buf);
  88. va_end(arglist);
  89. return 0;
  90. }
  91. #endif // DBG