From 0318ff1ecdc49088cbc15bc1aa3b6eaa06c16efc Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 24 Aug 2012 17:48:39 +0000 Subject: more fixes for Windows 8 detection git-svn-id: http://svn.miranda-ng.org/main/trunk@1529 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/jabber_iq_handlers.cpp | 37 +++++++++++++------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/jabber_iq_handlers.cpp b/protocols/JabberG/jabber_iq_handlers.cpp index 7ccbd31e01..c0cdf8b332 100644 --- a/protocols/JabberG/jabber_iq_handlers.cpp +++ b/protocols/JabberG/jabber_iq_handlers.cpp @@ -78,7 +78,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) SYSTEM_INFO si; PGNSI pGNSI; PGPI pGPI; - BOOL bOsVersionInfoEx; + DWORD dwType; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -86,25 +86,27 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - if ( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi))) - return FALSE; + BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi); + if ( !bOsVersionInfoEx ) + { + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (!GetVersionEx((OSVERSIONINFO*)&osvi)) + return; + } // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. - - pGNSI = (PGNSI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "GetNativeSystemInfo"); + HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll")); + pGNSI = (PGNSI) GetProcAddress(hKernel,"GetNativeSystemInfo"); if(NULL != pGNSI) pGNSI(&si); else GetSystemInfo(&si); - if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && - osvi.dwMajorVersion > 4 ) + //Some code from Crash Dumper Plugin :-) + if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) { StringCchCopy(pszOS, BUFSIZE, TEXT("Microsoft ")); // Test for the specific product. - if (osvi.dwMajorVersion == 6) { switch (osvi.dwMinorVersion) @@ -129,19 +131,10 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2012 ")); break; - } - - if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 ) - { - if ( osvi.wProductType == VER_NT_WORKSTATION ) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista ")); - else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 " )); - - pGPI = (PGPI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "GetProductInfo"); + } - pGPI( 6, 0, 0, 0, &dwType); + pGPI = (PGPI) GetProcAddress(hKernel, "GetProductInfo"); + if(pGPI != NULL) pGPI( 6, 0, 0, 0, &dwType); switch( dwType ) { -- cgit v1.2.3