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.

78 lines
2.1 KiB

  1. //*************************************************************
  2. // File name: DEBUG.C
  3. //
  4. // Description: Debug helper code for System control panel
  5. // applet
  6. //
  7. //
  8. // Microsoft Confidential
  9. // Copyright (c) Microsoft Corporation 1992-2000
  10. // All rights reserved
  11. //
  12. //*************************************************************
  13. #include "sysdm.h"
  14. // Define some things for debug.h
  15. #define SZ_DEBUGINI "ccshell.ini"
  16. #define SZ_DEBUGSECTION "SYSDM"
  17. #define SZ_MODULE "SYSDM"
  18. #define DECLARE_DEBUG
  19. #include <ccstock.h>
  20. #include <debug.h>
  21. #ifdef DBG_CODE
  22. /*
  23. * Buffer used for OutputDebugString formatting (See DbgPrintf and DbgStopX)
  24. */
  25. TCHAR g_szDbgOutBuffer[1024];
  26. #define COMPILETIME_ASSERT(f) switch (0) case 0: case f:
  27. //***************************************************************
  28. //
  29. // void DbgPrintf( LPTSTR szFmt, ... )
  30. //
  31. // Formatted version of OutputDebugString
  32. //
  33. // Parameters: Same as printf()
  34. //
  35. // History:
  36. // 18-Jan-1996 JonPa Wrote it
  37. //***************************************************************
  38. void DbgPrintf( LPTSTR szFmt, ... ) {
  39. va_list marker;
  40. va_start( marker, szFmt );
  41. StringCchVPrintf( g_szDbgOutBuffer, ARRAYSIZE(g_szDbgOutBuffer), szFmt, marker); // truncation ok
  42. OutputDebugString( g_szDbgOutBuffer );
  43. va_end( marker );
  44. }
  45. //***************************************************************
  46. //
  47. // void DbgStopX(LPSTR mszFile, int iLine, LPTSTR szText )
  48. //
  49. // Print a string (with location id) and then break
  50. //
  51. // Parameters:
  52. // mszFile ANSI filename (__FILE__)
  53. // iLine line number (__LINE__)
  54. // szText Text string to send to debug port
  55. //
  56. // History:
  57. // 18-Jan-1996 JonPa Wrote it
  58. //***************************************************************
  59. void DbgStopX(LPSTR mszFile, int iLine, LPTSTR szText )
  60. {
  61. StringCchPrintf(g_szDbgOutBuffer, ARRAYSIZE(g_szDbgOutBuffer), TEXT("SYSDM.CPL (%hs %d) : %s\n"), mszFile, iLine, szText); // truncation ok
  62. OutputDebugString(g_szDbgOutBuffer);
  63. DebugBreak();
  64. }
  65. #endif // DBG_CODE