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.

133 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1990-2003 Microsoft Corporation
  3. All Rights Reserved
  4. Module Name:
  5. debug.c
  6. Abstract:
  7. This module contains all debugging routines
  8. [Environment:]
  9. NT Windows - Common Printer Driver UI DLL.
  10. [Notes:]
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. #if DBG
  16. BOOL DoCPSUIWarn = TRUE;
  17. VOID
  18. cdecl
  19. CPSUIDbgPrint
  20. (
  21. LPSTR pszFormat,
  22. ...
  23. )
  24. /*++
  25. Routine Description:
  26. This fucntion output the debug informat to the debugger
  27. Arguments:
  28. pszFormat - format string
  29. ... - variable data
  30. Return Value:
  31. VOID
  32. --*/
  33. {
  34. va_list vaList;
  35. static TCHAR OutBuf[768];
  36. #ifdef UNICODE
  37. static WCHAR FormatBuf[256];
  38. #endif
  39. //
  40. // We assume that UNICODE flag is turn on for the compilation, bug the
  41. // format string passed to here is ASCII version, so we need to convert
  42. // it to LPWSTR before the wvsprintf()
  43. //
  44. va_start(vaList, pszFormat);
  45. #ifdef UNICODE
  46. MultiByteToWideChar(CP_ACP, 0, pszFormat, -1, FormatBuf, COUNT_ARRAY(FormatBuf));
  47. StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), FormatBuf, vaList);
  48. #else
  49. StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), pszFormat, vaList);
  50. #endif
  51. va_end(vaList);
  52. OutputDebugString((LPTSTR)OutBuf);
  53. OutputDebugString(TEXT("\n"));
  54. }
  55. VOID
  56. CPSUIDbgType
  57. (
  58. INT Type
  59. )
  60. /*++
  61. Routine Description:
  62. this function output the ERROR/WARNING message
  63. Arguments:
  64. Type
  65. Return Value:
  66. --*/
  67. {
  68. static TCHAR DebugDLLName[] = TEXT("SurPtrUI");
  69. if (Type < 0)
  70. {
  71. OutputDebugString(TEXT("ERROR) "));
  72. }
  73. else if (Type > 0)
  74. {
  75. OutputDebugString(TEXT("WARNING: "));
  76. }
  77. OutputDebugString(DebugDLLName);
  78. OutputDebugString(TEXT("!"));
  79. }
  80. #endif // DBG