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.

123 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. dnsmem.h
  5. Abstract:
  6. Domain Name System (DNS) Library
  7. Memory routines declarations.
  8. Author:
  9. Jim Gilroy (jamesg) January 1997
  10. Revision History:
  11. --*/
  12. #ifndef _DNS_MEMORY_INCLUDED_
  13. #define _DNS_MEMORY_INCLUDED_
  14. //
  15. // Ram's leak tracking debug routines
  16. // Changes made here to be exportable to dns server end
  17. LPVOID
  18. DnsApiAlloc(
  19. DWORD cb
  20. );
  21. #if DBG
  22. LPVOID
  23. DebugDnsApiAlloc(
  24. CHAR*,
  25. int,
  26. DWORD cb
  27. );
  28. #endif
  29. #if DBG
  30. BOOL
  31. DebugDnsApiFree(
  32. LPVOID
  33. );
  34. #endif
  35. BOOL
  36. DnsApiFree(
  37. LPVOID pMem
  38. );
  39. //
  40. // Dont care about ReAlloc because it is not exported to server
  41. // side. May need to fix this if this is changed at a future point
  42. //
  43. #if DBG
  44. LPVOID
  45. DebugDnsApiReAlloc(
  46. CHAR*,
  47. int,
  48. LPVOID pOldMem,
  49. DWORD cbOld,
  50. DWORD cbNew
  51. );
  52. #define DnsApiReAlloc( pOldMem, cbOld, cbNew ) DebugDnsApiReAlloc( __FILE__, __LINE__, pOldMem, cbOld, cbNew )
  53. #else
  54. LPVOID
  55. DnsApiReAlloc(
  56. LPVOID pOldMem,
  57. DWORD cbOld,
  58. DWORD cbNew
  59. );
  60. #endif
  61. #if DBG
  62. extern LIST_ENTRY DnsMemList ;
  63. extern CRITICAL_SECTION DnsMemCritSect ;
  64. VOID InitDnsMem(
  65. VOID
  66. );
  67. VOID AssertDnsMemLeaks(
  68. VOID
  69. );
  70. VOID
  71. DumpMemoryTracker(
  72. VOID
  73. );
  74. #else
  75. //
  76. // non-debug, macroize away heap tracking
  77. //
  78. #define InitDnsMem()
  79. #define AssertDnsMemLeaks()
  80. #define DumpMemoryTracker()
  81. #endif
  82. //
  83. // DCR: a better idea is just to call DnsApiHeapReset (if necessary)
  84. // to install any underlying allocators you want
  85. //
  86. // then just cover the standard macros for your debug builds
  87. //
  88. #define DNS_ALLOCATE_HEAP(size) DnsApiAlloc(size)
  89. #define DNS_FREE_HEAP(p) DnsApiFree(p)
  90. #endif // _DNS_MEMORY_INCLUDED_