From 69d69411790a5eca902698116217bd24546becf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 9 Nov 2012 12:26:21 +0000 Subject: Jabber: Fixed detection of Win 8 Professional and some improvements (from hosteddinner patch) git-svn-id: http://svn.miranda-ng.org/main/trunk@2255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_iq_handlers.cpp | 130 +++++++++++++++++++-------- 1 file changed, 95 insertions(+), 35 deletions(-) (limited to 'protocols/JabberG/src/jabber_iq_handlers.cpp') diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 7f3385ff6e..82f82b633f 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -35,34 +35,86 @@ extern int bSecureIM; #endif #ifndef PRODUCT_ULTIMATE - #define PRODUCT_UNDEFINED 0x00000000 - #define PRODUCT_ULTIMATE 0x00000001 - #define PRODUCT_HOME_BASIC 0x00000002 - #define PRODUCT_HOME_PREMIUM 0x00000003 - #define PRODUCT_ENTERPRISE 0x00000004 - #define PRODUCT_HOME_BASIC_N 0x00000005 - #define PRODUCT_BUSINESS 0x00000006 - #define PRODUCT_STANDARD_SERVER 0x00000007 - #define PRODUCT_DATACENTER_SERVER 0x00000008 - #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009 - #define PRODUCT_ENTERPRISE_SERVER 0x0000000A - #define PRODUCT_STARTER 0x0000000B - #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C - #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D - #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E - #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F - #define PRODUCT_BUSINESS_N 0x00000010 - #define PRODUCT_WEB_SERVER 0x00000011 - #define PRODUCT_CLUSTER_SERVER 0x00000012 - #define PRODUCT_HOME_SERVER 0x00000013 - #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014 - #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015 - #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016 - #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017 - #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018 - #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019 - #define PRODUCT_UNLICENSED 0xABCDABCD + #define PRODUCT_UNDEFINED 0x00000000 + #define PRODUCT_ULTIMATE 0x00000001 + #define PRODUCT_HOME_BASIC 0x00000002 + #define PRODUCT_HOME_PREMIUM 0x00000003 + #define PRODUCT_ENTERPRISE 0x00000004 + #define PRODUCT_HOME_BASIC_N 0x00000005 + #define PRODUCT_BUSINESS 0x00000006 + #define PRODUCT_STANDARD_SERVER 0x00000007 + #define PRODUCT_DATACENTER_SERVER 0x00000008 + #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009 + #define PRODUCT_ENTERPRISE_SERVER 0x0000000A + #define PRODUCT_STARTER 0x0000000B + #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C + #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D + #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E + #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F + #define PRODUCT_BUSINESS_N 0x00000010 + #define PRODUCT_WEB_SERVER 0x00000011 + #define PRODUCT_CLUSTER_SERVER 0x00000012 + #define PRODUCT_HOME_SERVER 0x00000013 + #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014 + #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015 + #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016 + #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017 + #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018 + #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019 + #define PRODUCT_HOME_PREMIUM_N 0x0000001a + #define PRODUCT_ENTERPRISE_N 0x0000001b + #define PRODUCT_ULTIMATE_N 0x0000001c + #define PRODUCT_WEB_SERVER_CORE 0x0000001d + #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001e + #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001f + #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020 + #define PRODUCT_SERVER_FOUNDATION 0x00000021 + #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022 + #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023 + #define PRODUCT_STANDARD_SERVER_V 0x00000024 + #define PRODUCT_DATACENTER_SERVER_V 0x00000025 + #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026 + #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027 + #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028 + #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029 + #define PRODUCT_HYPERV 0x0000002a + #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002b + #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002c + #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002d + #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002e + #define PRODUCT_STARTER_N 0x0000002f + #define PRODUCT_PROFESSIONAL 0x00000030 + #define PRODUCT_PROFESSIONAL_N 0x00000031 + #define PRODUCT_SB_SOLUTION_SERVER 0x00000032 + #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033 + #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034 + #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035 + #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036 + #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037 + #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038 + #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039 + #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B + #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C + #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D + #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E + #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003f + #define PRODUCT_CLUSTER_SERVER_V 0x00000040 + #define PRODUCT_EMBEDDED 0x00000041 + #define PRODUCT_STARTER_E 0x00000042 + #define PRODUCT_HOME_BASIC_E 0x00000043 + #define PRODUCT_HOME_PREMIUM_E 0x00000044 + #define PRODUCT_PROFESSIONAL_E 0x00000045 + #define PRODUCT_ENTERPRISE_E 0x00000046 + #define PRODUCT_ULTIMATE_E 0x00000047 #endif +#ifndef PRODUCT_CORE_N // Win8 + #define PRODUCT_CORE_N 0x00000062 + #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063 + #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064 + #define PRODUCT_CORE 0x00000065 + #define PRODUCT_PROFESSIONAL_WMC 0x00000067 + #define PRODUCT_UNLICENSED 0xABCDABCD +#endif typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); @@ -87,7 +139,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi); - if ( !bOsVersionInfoEx ) + if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx((OSVERSIONINFO*)&osvi)) @@ -96,13 +148,14 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll")); - pGNSI = (PGNSI) GetProcAddress(hKernel,"GetNativeSystemInfo"); - if(NULL != pGNSI) + pGNSI = (PGNSI) GetProcAddress(hKernel, "GetNativeSystemInfo"); + if (pGNSI != NULL) pGNSI(&si); - else GetSystemInfo(&si); + else + GetSystemInfo(&si); - //Some code from Crash Dumper Plugin :-) - 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 ")); @@ -125,7 +178,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 R2 ")); break; - default: + case 2: if (osvi.wProductType == VER_NT_WORKSTATION) StringCchCat(pszOS, BUFSIZE, TEXT("Windows 8 ")); else @@ -134,13 +187,20 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) } pGPI = (PGPI) GetProcAddress(hKernel, "GetProductInfo"); - if(pGPI != NULL) pGPI( 6, 0, 0, 0, &dwType); + if (pGPI != NULL) + pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); switch( dwType ) { case PRODUCT_ULTIMATE: StringCchCat(pszOS, BUFSIZE, TEXT("Ultimate Edition" )); break; + case PRODUCT_PROFESSIONAL: + StringCchCat(pszOS, BUFSIZE, TEXT("Professional Edition" )); + break; + case PRODUCT_PROFESSIONAL_WMC: + StringCchCat(pszOS, BUFSIZE, TEXT("Professional Edition with Media Center" )); + break; case PRODUCT_HOME_PREMIUM: StringCchCat(pszOS, BUFSIZE, TEXT("Home Premium Edition" )); break; -- cgit v1.2.3