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.

43 lines
645 B

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "alloc.h"
  4. #include "except.h"
  5. void * __cdecl operator new(
  6. size_t size
  7. )
  8. {
  9. void *pv = LocalAlloc(LMEM_FIXED, size);
  10. if (NULL == pv)
  11. throw CAllocException();
  12. return pv;
  13. }
  14. void* __cdecl operator new[] (size_t size)
  15. {
  16. void *pv = LocalAlloc(LMEM_FIXED, size);
  17. if (NULL == pv)
  18. throw CAllocException();
  19. return pv;
  20. }
  21. void __cdecl operator delete(
  22. void *ptr
  23. )
  24. {
  25. if (NULL != ptr)
  26. LocalFree(ptr);
  27. }
  28. void __cdecl operator delete[] (void* ptr)
  29. {
  30. if (NULL != ptr)
  31. LocalFree(ptr);
  32. }