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.

74 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. leaks.h
  5. Abstract:
  6. header for leak filter dll
  7. Author:
  8. Charlie Wickham (charlwi) 28-Sep-1998
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. //
  14. // keep a table of caller and caller's caller for open handles. indexed by
  15. // handle value divided by 4. !leaks in clusexts will display this info.
  16. //
  17. typedef enum _LEAKS_HANDLE_TYPE {
  18. LeaksEvent = 1,
  19. LeaksRegistry,
  20. LeaksToken
  21. } LEAKS_HANDLE_TYPE;
  22. typedef struct _HANDLE_TABLE {
  23. PVOID Caller;
  24. PVOID CallersCaller;
  25. LEAKS_HANDLE_TYPE HandleType;
  26. BOOL InUse;
  27. } HANDLE_TABLE, *PHANDLE_TABLE;
  28. #define MAX_HANDLE 4096
  29. #define HANDLE_DELTA 4
  30. #define HINDEX( _h ) (((DWORD_PTR) _h ) / HANDLE_DELTA )
  31. #define SetHandleTable( _h, _inuse, _htype ) \
  32. { \
  33. RtlGetCallersAddress(&callersAddress, \
  34. &callersCaller ); \
  35. HandleTable[ HINDEX( _h )].InUse = _inuse; \
  36. HandleTable[ HINDEX( _h )].HandleType = _htype; \
  37. HandleTable[ HINDEX( _h )].Caller = callersAddress; \
  38. HandleTable[ HINDEX( _h )].CallersCaller = callersCaller; \
  39. }
  40. //
  41. // leaks memory header. This structure is at the front of the allocated area
  42. // and the area behind it is returned to the caller. PlaceHolder holds the
  43. // heap free list pointer. Signature holds ALOC or FREE.
  44. //
  45. #define HEAP_SIGNATURE_ALLOC 'COLA'
  46. #define HEAP_SIGNATURE_FREE 'EERF'
  47. typedef struct _MEM_HDR {
  48. PVOID PlaceHolder;
  49. DWORD Signature;
  50. PVOID CallersAddress;
  51. PVOID CallersCaller;
  52. } MEM_HDR, *PMEM_HDR;
  53. /* end leaks.h */