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.

96 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. regleak.h
  5. Abstract:
  6. This file contains declarations for data structures
  7. needed for tracking win32 registry leaks
  8. Author:
  9. Adam Edwards (adamed) 14-Nov-1997
  10. Notes:
  11. --*/
  12. #ifdef LOCAL
  13. #include "winver.h"
  14. #if !defined(_REGLEAK_H_)
  15. #define _REGLEAK_H_
  16. #ifdef LEAK_TRACK
  17. #include "imagehlp.h"
  18. #define MAX_LEAK_STACK_DEPTH 40
  19. #define SYM_PATH_MAX_SIZE 1000
  20. typedef struct _TrackObjectData
  21. {
  22. LIST_ENTRY Links;
  23. HKEY hKey;
  24. DWORD dwStackDepth;
  25. PVOID* rgStack;
  26. } TrackObjectData;
  27. void TrackObjectDataPrint(TrackObjectData* pKeyData);
  28. NTSTATUS TrackObjectDataInit(TrackObjectData* pKeyData, PVOID* rgStack, DWORD dwMaxStackDepth, HKEY hKey);
  29. NTSTATUS TrackObjectDataClear(TrackObjectData* pKeyData);
  30. NTSTATUS GetLeakStack(PVOID** prgStack, DWORD* pdwMaxDepth, DWORD dwMaxDepth);
  31. enum
  32. {
  33. LEAK_TRACK_FLAG_NONE = 0,
  34. LEAK_TRACK_FLAG_USER = 1,
  35. LEAK_TRACK_FLAG_ALL = 0xFFFFFFFF
  36. };
  37. typedef struct _RegLeakTable
  38. {
  39. TrackObjectData* pHead;
  40. DWORD cKeys;
  41. DWORD dwFlags;
  42. BOOL bCriticalSectionInitialized;
  43. RTL_CRITICAL_SECTION CriticalSection;
  44. } RegLeakTable;
  45. typedef struct _RegLeakTraceInfo {
  46. DWORD dwMaxStackDepth;
  47. LPTSTR szSymPath;
  48. BOOL bEnableLeakTrack;
  49. RTL_CRITICAL_SECTION StackInitCriticalSection;
  50. } RegLeakTraceInfo;
  51. extern RegLeakTraceInfo g_RegLeakTraceInfo;
  52. NTSTATUS RegLeakTableInit(RegLeakTable* pLeakTable, DWORD dwFlags);
  53. NTSTATUS RegLeakTableClear(RegLeakTable* pLeakTable);
  54. NTSTATUS RegLeakTableAddKey(RegLeakTable* pLeakTable, HKEY hKey);
  55. NTSTATUS RegLeakTableRemoveKey(RegLeakTable* pLeakTable, HKEY hKey);
  56. BOOL RegLeakTableIsEmpty(RegLeakTable* pLeakTable);
  57. BOOL RegLeakTableIsTrackedObject(RegLeakTable* pLeakTable, HKEY hKey);
  58. NTSTATUS TrackObject(HKEY hKey);
  59. BOOL InitializeLeakTrackTable();
  60. BOOL CleanupLeakTrackTable();
  61. NTSTATUS UnTrackObject(HKEY hKey);
  62. extern RegLeakTable gLeakTable;
  63. #endif // LEAK_TRACK
  64. #endif // _REGLEAK_H_
  65. #endif // LOCAL