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.

133 lines
2.9 KiB

  1. // Copyright (c) 1998 Microsoft Corporation
  2. //
  3. //
  4. //
  5. #ifndef _KernHelp_
  6. #define _KernHelp_
  7. // Use kernel mutex to implement critical section
  8. //
  9. typedef KMUTEX CRITICAL_SECTION;
  10. typedef CRITICAL_SECTION *LPCRITICAL_SECTION;
  11. VOID InitializeCriticalSection(
  12. LPCRITICAL_SECTION);
  13. VOID EnterCriticalSection(
  14. LPCRITICAL_SECTION);
  15. VOID LeaveCriticalSection(
  16. LPCRITICAL_SECTION);
  17. VOID DeleteCriticalSection(
  18. LPCRITICAL_SECTION);
  19. // We have very little registry work to do, so just encapsulate the
  20. // entire process
  21. //
  22. int GetRegValueDword(
  23. LPTSTR RegPath,
  24. LPTSTR ValueName,
  25. PULONG Value);
  26. ULONG GetTheCurrentTime();
  27. #ifndef _NEW_DELETE_OPERATORS_
  28. #define _NEW_DELETE_OPERATORS_
  29. inline void* __cdecl operator new
  30. (
  31. unsigned int iSize
  32. )
  33. {
  34. PVOID result = ExAllocatePoolWithTag(NonPagedPool, iSize, 'suMD');
  35. if (result)
  36. {
  37. RtlZeroMemory(result, iSize);
  38. }
  39. return result;
  40. }
  41. /*****************************************************************************
  42. * ::new()
  43. *****************************************************************************
  44. * New function for creating objects with a specified allocation tag.
  45. */
  46. inline PVOID operator new
  47. (
  48. unsigned int iSize,
  49. POOL_TYPE poolType
  50. )
  51. {
  52. PVOID result = ExAllocatePoolWithTag(poolType, iSize, 'suMD');
  53. if (result)
  54. {
  55. RtlZeroMemory(result, iSize);
  56. }
  57. return result;
  58. }
  59. /*****************************************************************************
  60. * ::new()
  61. *****************************************************************************
  62. * New function for creating objects with a specified allocation tag.
  63. */
  64. inline PVOID operator new
  65. (
  66. unsigned int iSize,
  67. POOL_TYPE poolType,
  68. ULONG tag
  69. )
  70. {
  71. PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);
  72. if (result)
  73. {
  74. RtlZeroMemory(result,iSize);
  75. }
  76. return result;
  77. }
  78. /*****************************************************************************
  79. * ::delete()
  80. *****************************************************************************
  81. * Delete function.
  82. */
  83. inline void __cdecl operator delete
  84. (
  85. PVOID pVoid
  86. )
  87. {
  88. ExFreePool(pVoid);
  89. }
  90. #endif //!_NEW_DELETE_OPERATORS_
  91. #define DM_DEBUG_CRITICAL 1 // Used to include critical messages
  92. #define DM_DEBUG_NON_CRITICAL 2 // Used to include level 1 plus important non-critical messages
  93. #define DM_DEBUG_STATUS 3 // Used to include level 1 and level 2 plus status\state messages
  94. #define DM_DEBUG_FUNC_FLOW 4 // Used to include level 1, level 2 and level 3 plus function flow messages
  95. #define DM_DEBUG_ALL 5 // Used to include all debug messages
  96. // Debug trace facility
  97. //
  98. #ifdef DBG
  99. extern void DebugInit(void);
  100. extern void DebugTrace(int iDebugLevel, LPSTR pstrFormat, ...);
  101. #define Trace DebugTrace
  102. #else
  103. #define Trace
  104. #endif
  105. // Paramter validation unused
  106. //
  107. #define V_INAME(x)
  108. #define V_BUFPTR_READ(p,cb)
  109. #endif // _KernHelp_