diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2010-11-30 23:42:47 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2010-11-30 23:42:47 +0000 |
commit | 7ba78f6857b31d1aead6192b79e10d6c19185a71 (patch) | |
tree | 7beee8bc8eb229d9657fda203e79b87077ed1342 /version_info.c | |
parent | 9e7e31e1af3bfde66f071634bb18768bba71316c (diff) |
Fix bug #5453: Use GetSystemNativeInfo() function if found on the machine running Wireshark instead of GetSystemInfo(), so that we obtain the machine's actual architecture even when running under WOW64 x86 emulation.
svn path=/trunk/; revision=35084
Diffstat (limited to 'version_info.c')
-rw-r--r-- | version_info.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/version_info.c b/version_info.c index 32f99fca4e..fe27476b83 100644 --- a/version_info.c +++ b/version_info.c @@ -190,6 +190,8 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) #if defined(_WIN32) OSVERSIONINFOEX info; SYSTEM_INFO system_info; + typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); + PGNSI pGNSI; #elif defined(HAVE_SYS_UTSNAME_H) struct utsname name; #endif @@ -229,7 +231,14 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) } memset(&system_info, '\0', sizeof system_info); - GetSystemInfo(&system_info); /* only for W2K or greater .... (which is what we support) */ + + /* Detect if the system we're *running on* supports the GetNativeSystemInfo() function (Windows XP/Server 2003 and higher), + * so we get the correct CPU architecture when running under "WOW64" x86 emulation on a 64-bit system. */ + pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); + if(NULL != pGNSI) + pGNSI(&system_info); /* Call GetNativeSystemInfo() if found */ + else + GetSystemInfo(&system_info); /* Fallback to GetSystemInfo() - only for W2K or greater .... (which is what we support) */ switch (info.dwPlatformId) { |