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.

71 lines
1.5 KiB

  1. #ifndef mynew_h
  2. #define mynew_h
  3. #ifndef _NEW_DELETE_OPERATORS_
  4. #define _NEW_DELETE_OPERATORS_
  5. /*****************************************************************************
  6. * ::new()
  7. *****************************************************************************
  8. * New function for creating objects with a specified allocation tag.
  9. */
  10. inline PVOID operator new
  11. (
  12. size_t iSize,
  13. POOL_TYPE poolType
  14. )
  15. {
  16. PVOID result = ExAllocatePoolWithTag(poolType,iSize,'3mrD');
  17. if (result)
  18. {
  19. RtlZeroMemory(result,iSize);
  20. }
  21. return result;
  22. }
  23. /*****************************************************************************
  24. * ::new()
  25. *****************************************************************************
  26. * New function for creating objects with a specified allocation tag.
  27. */
  28. inline PVOID operator new
  29. (
  30. size_t iSize,
  31. POOL_TYPE poolType,
  32. ULONG tag
  33. )
  34. {
  35. PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag);
  36. if (result)
  37. {
  38. RtlZeroMemory(result,iSize);
  39. }
  40. return result;
  41. }
  42. /*****************************************************************************
  43. * ::delete()
  44. *****************************************************************************
  45. * Delete function.
  46. */
  47. inline void __cdecl operator delete
  48. (
  49. PVOID pVoid
  50. )
  51. {
  52. if (pVoid)
  53. {
  54. ExFreePool(pVoid);
  55. }
  56. }
  57. #endif //!_NEW_DELETE_OPERATORS_
  58. #endif