/*\r
- * Copyright (c) 2009 Intel Corporation. All rights reserved.\r
+ * Copyright (c) 2009-2010 Intel Corporation. All rights reserved.\r
+ * Copyright (c) 2010 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
protected:\r
};\r
\r
+extern HANDLE g_hHeap;\r
+\r
__inline void* __cdecl operator new(size_t size)\r
{\r
- return HeapAlloc(GetProcessHeap(), 0, size);\r
+ return HeapAlloc(g_hHeap, 0, size);\r
}\r
\r
__inline void __cdecl operator delete(void *pObj)\r
{\r
- HeapFree(GetProcessHeap(), 0, pObj);\r
+ HeapFree(g_hHeap, 0, pObj);\r
}\r
\r
HRESULT NDConvertWVStatus(HRESULT hr);\r
/*\r
- * Copyright (c) 2009 Intel Corporation. All rights reserved.\r
+ * Copyright (c) 2009-2010 Intel Corporation. All rights reserved.\r
+ * Copyright (c) 2010 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
#include <stdio.h>\r
#include "nd_provider.h"\r
\r
+HANDLE g_hHeap;\r
\r
extern "C" {\r
\r
{\r
switch (dwReason) {\r
case DLL_PROCESS_ATTACH:\r
+ if (_DllMainCRTStartupForGS(hInstance, dwReason, lpReserved)) {\r
+ return FALSE;\r
+ }\r
+\r
+ g_hHeap = HeapCreate(0, 0, 0);\r
+ return (g_hHeap != NULL);\r
case DLL_PROCESS_DETACH:\r
+ if (g_hHeap != NULL) {\r
+ HeapDestroy(g_hHeap);\r
+ }\r
return _DllMainCRTStartupForGS(hInstance, dwReason, lpReserved);\r
default:\r
- return TRUE;\r
+ return FALSE;\r
}\r
}\r
\r