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.

101 lines
2.3 KiB

  1. //*************************************************************
  2. //
  3. // Microsoft Confidential. Copyright (c) Microsoft Corporation 1999. All rights reserved
  4. //
  5. // File: RsopDbg.h
  6. //
  7. // Description: Debugging functions
  8. //
  9. // History: 8-20-99 leonardm Created
  10. //
  11. //*************************************************************
  12. #ifndef DEBUG_H__D91F1DC7_B995_403d_9166_9D43DB050017__INCLUDED_
  13. #define DEBUG_H__D91F1DC7_B995_403d_9166_9D43DB050017__INCLUDED_
  14. #include "rsoputil.h"
  15. #include "smartptr.h"
  16. //
  17. // Debug Levels
  18. //
  19. const DWORD DEBUG_LEVEL_NONE = 0x00000000;
  20. const DWORD DEBUG_LEVEL_WARNING = 0x00000001;
  21. const DWORD DEBUG_LEVEL_VERBOSE = 0x00000002;
  22. //
  23. // Debug message output destination
  24. //
  25. const DWORD DEBUG_DESTINATION_LOGFILE = 0x00010000;
  26. const DWORD DEBUG_DESTINATION_DEBUGGER = 0x00020000;
  27. //
  28. // Debug message types
  29. //
  30. const DWORD DEBUG_MESSAGE_ASSERT = 0x00000001;
  31. const DWORD DEBUG_MESSAGE_WARNING = 0x00000002;
  32. const DWORD DEBUG_MESSAGE_VERBOSE = 0x00000004;
  33. //*************************************************************
  34. //
  35. // Class:
  36. //
  37. // Description:
  38. //
  39. //*************************************************************
  40. class CDebug
  41. {
  42. private:
  43. CWString _sRegPath;
  44. CWString _sKeyName;
  45. CWString _sLogFilename;
  46. CWString _sBackupLogFilename;
  47. bool _bInitialized;
  48. DWORD _dwDebugLevel;
  49. XCritSec xCritSec;
  50. void CleanupAndCheckForDbgBreak(DWORD dwErrorCode, DWORD dwMask);
  51. public:
  52. CDebug();
  53. CDebug( const WCHAR* sRegPath,
  54. const WCHAR* sKeyName,
  55. const WCHAR* sLogFilename,
  56. const WCHAR* sBackupLogFilename,
  57. bool bResetLogFile = false);
  58. bool Initialize(const WCHAR* sRegPath,
  59. const WCHAR* sKeyName,
  60. const WCHAR* sLogFilename,
  61. const WCHAR* sBackupLogFilename,
  62. bool bResetLogFile = false);
  63. bool Initialize(bool bResetLogFile = false);
  64. void Msg(DWORD dwMask, LPCTSTR pszMsg, ...);
  65. };
  66. extern CDebug dbgRsop;
  67. extern CDebug dbgCommon;
  68. extern CDebug dbgAccessCheck;
  69. // default to dbgRsop..
  70. // The common routines need to define it to dbgCommon or #define dbg to dbgCommon and then
  71. // use..
  72. #define dbg dbgRsop
  73. #endif // DEBUG_H__D91F1DC7_B995_403d_9166_9D43DB050017__INCLUDED_