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.

99 lines
1.8 KiB

  1. /* ----------------------------------------------------------------------
  2. Copyright (c) 1996, Microsoft Corporation
  3. All rights reserved
  4. siDebug.c
  5. ---------------------------------------------------------------------- */
  6. #include "precomp.h"
  7. #ifdef DEBUG /* These functions are only available for DEBUG */
  8. HDBGZONE ghZoneApi = NULL; // API zones
  9. static PTCHAR _rgZonesApi[] = {
  10. TEXT("API"),
  11. TEXT("Warning"),
  12. TEXT("Events"),
  13. TEXT("Trace"),
  14. TEXT("Data"),
  15. TEXT("Objects"),
  16. TEXT("RefCount"),
  17. };
  18. VOID InitDebug(void)
  19. {
  20. // Enable memory leak checking and keep freed memory blocks on the
  21. // heap's linked list (filled with 0xDD)
  22. //
  23. // This depends on the use of the debug c runtime library from VC++ 4.x
  24. #if 0
  25. int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
  26. tmpFlag |= (_CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
  27. _CrtSetDbgFlag(tmpFlag);
  28. _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); // create a message box
  29. // To track down memory leaks, uncomment the following lines
  30. LONG cAlloc = 0; // Allocation number
  31. if (0 != cAlloc)
  32. {
  33. _CrtSetBreakAlloc(cAlloc);
  34. }
  35. #endif // 0
  36. InitDebugModule(TEXT("MSCONF"));
  37. DBGINIT(&ghZoneApi, _rgZonesApi);
  38. }
  39. VOID DeInitDebug(void)
  40. {
  41. DBGDEINIT(&ghZoneApi);
  42. ExitDebugModule();
  43. }
  44. UINT DbgApiWarn(PCSTR pszFormat,...)
  45. {
  46. va_list v1;
  47. va_start(v1, pszFormat);
  48. DbgPrintf("API:Warning", pszFormat, v1);
  49. va_end(v1);
  50. return 0;
  51. }
  52. UINT DbgApiEvent(PCSTR pszFormat,...)
  53. {
  54. va_list v1;
  55. va_start(v1, pszFormat);
  56. DbgPrintf("API:Event", pszFormat, v1);
  57. va_end(v1);
  58. return 0;
  59. }
  60. UINT DbgApiTrace(PCSTR pszFormat,...)
  61. {
  62. va_list v1;
  63. va_start(v1, pszFormat);
  64. DbgPrintf("API:Trace", pszFormat, v1);
  65. va_end(v1);
  66. return 0;
  67. }
  68. UINT DbgApiData(PCSTR pszFormat,...)
  69. {
  70. va_list v1;
  71. va_start(v1, pszFormat);
  72. DbgPrintf("API:Data", pszFormat, v1);
  73. va_end(v1);
  74. return 0;
  75. }
  76. #endif /* DEBUG - the whole file */