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.

57 lines
1.2 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. #include "precomp.h"
  8. #include "arena.h"
  9. //
  10. // this obj is only linked into the dll version of wbemcomn. components
  11. // that use that static version will define their own localloc.
  12. //
  13. static class WbemComnInitializer
  14. {
  15. public:
  16. WbemComnInitializer()
  17. {
  18. HANDLE hHeap;
  19. hHeap = HeapCreate( 0, // will not use exceptions and will serialize
  20. 0x100000, // init size of 1Meg
  21. 0 ); // no max size
  22. if (hHeap == 0)
  23. return; // Arena remains uninitialized and properly returns errors later on
  24. if ( CWin32DefaultArena::WbemHeapInitialize( hHeap ) == FALSE )
  25. {
  26. HeapDestroy ( hHeap );
  27. }
  28. }
  29. ~WbemComnInitializer()
  30. {
  31. CWin32DefaultArena::WbemHeapFree(); // This destroys the heap
  32. }
  33. } g_WbemComnInitializer;
  34. void* __cdecl operator new ( size_t size )
  35. {
  36. return CWin32DefaultArena::WbemMemAlloc( size );
  37. }
  38. void __cdecl operator delete ( void* pv )
  39. {
  40. CWin32DefaultArena::WbemMemFree( pv );
  41. }