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.

85 lines
1.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000-2001.
  5. //
  6. // File: debug.cpp
  7. //
  8. // Contents: Debugging support
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #if DBG == 1
  13. static int indentLevel = 0;
  14. void __cdecl _TRACE (int level, const wchar_t *format, ... )
  15. {
  16. va_list arglist;
  17. WCHAR Buffer[512];
  18. int cb;
  19. // if ( level < 0 )
  20. // indentLevel += level;
  21. //
  22. // Format the output into a buffer and then print it.
  23. //
  24. // wstring strTabs;
  25. // for (int nLevel = 0; nLevel < indentLevel; nLevel++)
  26. // strTabs += L" ";
  27. // OutputDebugStringW (strTabs.c_str ());
  28. va_start(arglist, format);
  29. cb = _vsnwprintf (Buffer, sizeof(Buffer), format, arglist);
  30. if ( cb )
  31. {
  32. OutputDebugStringW (Buffer);
  33. }
  34. va_end(arglist);
  35. // if ( level > 0 )
  36. // indentLevel += level;
  37. }
  38. PCSTR
  39. StripDirPrefixA(
  40. PCSTR pszPathName
  41. )
  42. /*++
  43. Routine Description:
  44. Strip the directory prefix off a filename (ANSI version)
  45. Arguments:
  46. pstrFilename - Pointer to filename string
  47. Return Value:
  48. Pointer to the last component of a filename (without directory prefix)
  49. --*/
  50. {
  51. DWORD dwLen = lstrlenA(pszPathName);
  52. pszPathName += dwLen - 1; // go to the end
  53. while (*pszPathName != '\\' && dwLen--)
  54. {
  55. pszPathName--;
  56. }
  57. return pszPathName + 1;
  58. }
  59. #endif // if DBG