forked from osmocom/wireshark
Don't assume we can get a module handle for kernel32.dll.
A failure "shouldn't happen", but check anyway; if nothing else, that squelches some complaining from the VS Code Analysis tool. Change-Id: I9b06db399741176d0e9f859eb650bed8a2f96d9c Reviewed-on: https://code.wireshark.org/review/15860 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
d72b29c1cb
commit
010e55ccf4
|
@ -199,6 +199,7 @@ void
|
|||
get_os_version_info(GString *str)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
HMODULE kernel_dll_handle;
|
||||
OSVERSIONINFOEX info;
|
||||
SYSTEM_INFO system_info;
|
||||
nativesi_func_ptr nativesi_func;
|
||||
|
@ -238,7 +239,15 @@ get_os_version_info(GString *str)
|
|||
memset(&system_info, '\0', sizeof system_info);
|
||||
/* Look for and use the GetNativeSystemInfo() function if available to get the correct processor
|
||||
* architecture even when running 32-bit Wireshark in WOW64 (x86 emulation on 64-bit Windows) */
|
||||
nativesi_func = (nativesi_func_ptr)GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetNativeSystemInfo");
|
||||
kernel_dll_handle = GetModuleHandle(_T("kernel32.dll");
|
||||
if (kernel_dll_handle == NULL) {
|
||||
/*
|
||||
* XXX - get the failure reason.
|
||||
*/
|
||||
g_string_append(str, "unknown Windows version");
|
||||
return;
|
||||
}
|
||||
nativesi_func = (nativesi_func_ptr)GetProcAddress(kernel_dll_handle), "GetNativeSystemInfo");
|
||||
if(nativesi_func)
|
||||
nativesi_func(&system_info);
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue