From 618dfb51d93898632830f1b87443d3f748780871 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:05:53 +0200 Subject: 3.5 --- shared/shadow.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'shared/shadow.cpp') diff --git a/shared/shadow.cpp b/shared/shadow.cpp index fd99da16..be0f7c85 100644 --- a/shared/shadow.cpp +++ b/shared/shadow.cpp @@ -34,13 +34,15 @@ bool newerThanXP() bool runningWOW64() //test if process is running under WOW64 (reference http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx) { + //dynamically load windows API function typedef BOOL (WINAPI *IsWow64ProcessFunc)( HANDLE hProcess, PBOOL Wow64Process); - const IsWow64ProcessFunc isWow64Process = reinterpret_cast( - ::GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process")); - if (isWow64Process != NULL) + static const IsWow64ProcessFunc isWow64Process = + Utility::loadDllFunction(L"kernel32.dll", "IsWow64Process"); + + if (isWow64Process) { BOOL isWow64 = FALSE; if ((*isWow64Process)(::GetCurrentProcess(), &isWow64)) @@ -59,13 +61,13 @@ const wxString& getShadowDllName() */ static const wxString filename( - Utility::is64BitBuild ? - (newerThanXP() ? + newerThanXP() ? + (Utility::is64BitBuild ? wxT("Shadow_Server2003_x64.dll") : - wxT("Shadow_XP_x64.dll")) : + wxT("Shadow_Server2003_Win32.dll")) : - (newerThanXP() ? - wxT("Shadow_Server2003_Win32.dll") : + (Utility::is64BitBuild ? + wxT("Shadow_XP_x64.dll") : wxT("Shadow_XP_Win32.dll"))); assert_static(Utility::is32BitBuild || Utility::is64BitBuild); -- cgit