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.

69 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. HeapForceGrowable.cpp
  5. Abstract:
  6. Remove upper limit on heap calls by setting the maximum size to zero, which
  7. means that the heap will grow to accomodate new allocations.
  8. Notes:
  9. This is a general purpose shim.
  10. History:
  11. 04/25/2000 linstev Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(HeapForceGrowable)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(HeapCreate)
  18. APIHOOK_ENUM_END
  19. /*++
  20. Fix the heap so it can grow.
  21. --*/
  22. HANDLE
  23. APIHOOK(HeapCreate)(
  24. DWORD flOptions,
  25. DWORD dwInitialSize,
  26. DWORD dwMaximumSize
  27. )
  28. {
  29. if (dwMaximumSize)
  30. {
  31. LOGN( eDbgLevelError,
  32. "[APIHook_HeapCreate] Setting heap maximum to 0.");
  33. dwMaximumSize = 0;
  34. }
  35. return ORIGINAL_API(HeapCreate)(flOptions, dwInitialSize, dwMaximumSize);
  36. }
  37. /*++
  38. Register hooked functions
  39. --*/
  40. HOOK_BEGIN
  41. APIHOOK_ENTRY(KERNEL32.DLL, HeapCreate)
  42. HOOK_END
  43. IMPLEMENT_SHIM_END