summaryrefslogtreecommitdiff
path: root/dll.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-04-16 00:40:48 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-04-16 00:40:48 +0000
commitda8fd0df514d147efecd64e0052e563f55fea445 (patch)
tree20a68a9f5dbc859540d07175f1f1fb7ac605c6ad /dll.cpp
parentaa33502883c1fc2a150d4adec4b0205e3112fd21 (diff)
downloadcryptopp-da8fd0df514d147efecd64e0052e563f55fea445.tar.gz
add 64-bit mangled names of new and delete
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@319 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'dll.cpp')
-rw-r--r--dll.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/dll.cpp b/dll.cpp
index 0c7497d..2b4ef7a 100644
--- a/dll.cpp
+++ b/dll.cpp
@@ -96,14 +96,24 @@ static void SetNewAndDeleteFunctionPointers()
}
}
+ // try getting these directly using mangled names of new and delete operators
+
hModule = GetModuleHandle("msvcrtd");
if (!hModule)
hModule = GetModuleHandle("msvcrt");
if (hModule)
{
- s_pNew = (PNew)GetProcAddress(hModule, "??2@YAPAXI@Z"); // operator new
- s_pDelete = (PDelete)GetProcAddress(hModule, "??3@YAXPAX@Z"); // operator delete
- return;
+ // 32-bit versions
+ s_pNew = (PNew)GetProcAddress(hModule, "??2@YAPAXI@Z");
+ s_pDelete = (PDelete)GetProcAddress(hModule, "??3@YAXPAX@Z");
+ if (s_pNew && s_pDelete)
+ return;
+
+ // 64-bit versions
+ s_pNew = (PNew)GetProcAddress(hModule, "??2@YAPEAX_K@Z");
+ s_pDelete = (PDelete)GetProcAddress(hModule, "??3@YAXPEAX@Z");
+ if (s_pNew && s_pDelete)
+ return;
}
OutputDebugString("Crypto++ was not able to obtain new and delete function pointers.\n");