From d2b1030f624fc0b0688972388d68a85a47180476 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 31 Jul 2015 17:30:01 +0000 Subject: - Windows 10 version detection; - GetOSDisplayString() moved to mir_core.mir; - numerous warning fixes in mir_core git-svn-id: http://svn.miranda-ng.org/main/trunk@14765 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_iq_handlers.cpp | 292 --------------------------- 1 file changed, 292 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 5afce7aaa9..dd5a94857c 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -28,298 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_rc.h" #include "version.h" -#ifndef VER_SUITE_WH_SERVER - #define VER_SUITE_WH_SERVER 0x00008000 -#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_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 BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); - -#define StringCchCopy(x,y,z) mir_tstrncpy((x),(z),(y)) -#define StringCchCat(x,y,z) mir_tstrcat((x),(z)) - -// slightly modified sample from MSDN -BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) -{ - OSVERSIONINFOEX osvi = { 0 }; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi); - if (!bOsVersionInfoEx) { - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO*)&osvi)) - return FALSE; - } - - SYSTEM_INFO si = { 0 }; - GetNativeSystemInfo(&si); - - // 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) { - case 0: - if (osvi.wProductType == VER_NT_WORKSTATION) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista ")); - else - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 ")); - break; - - case 1: - if (osvi.wProductType == VER_NT_WORKSTATION) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows 7 ")); - else - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 R2 ")); - break; - - case 2: - if (osvi.wProductType == VER_NT_WORKSTATION) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows 8 ")); - else - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2012 ")); - break; - - case 3: - if (osvi.wProductType == VER_NT_WORKSTATION) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows 8.1 ")); - else - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2012 R2 ")); - break; - } - - DWORD dwType = 0; - HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll")); - PGPI pGPI = (PGPI)GetProcAddress(hKernel, "GetProductInfo"); - 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; - case PRODUCT_HOME_BASIC: - StringCchCat(pszOS, BUFSIZE, TEXT("Home Basic Edition")); - break; - case PRODUCT_ENTERPRISE: - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition")); - break; - case PRODUCT_BUSINESS: - StringCchCat(pszOS, BUFSIZE, TEXT("Business Edition")); - break; - case PRODUCT_STARTER: - StringCchCat(pszOS, BUFSIZE, TEXT("Starter Edition")); - break; - case PRODUCT_CLUSTER_SERVER: - StringCchCat(pszOS, BUFSIZE, TEXT("Cluster Server Edition")); - break; - case PRODUCT_DATACENTER_SERVER: - StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition")); - break; - case PRODUCT_DATACENTER_SERVER_CORE: - StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition (core installation)")); - break; - case PRODUCT_ENTERPRISE_SERVER: - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition")); - break; - case PRODUCT_ENTERPRISE_SERVER_CORE: - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition (core installation)")); - break; - case PRODUCT_ENTERPRISE_SERVER_IA64: - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition for Itanium-based Systems")); - break; - case PRODUCT_SMALLBUSINESS_SERVER: - StringCchCat(pszOS, BUFSIZE, TEXT("Small Business Server")); - break; - case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: - StringCchCat(pszOS, BUFSIZE, TEXT("Small Business Server Premium Edition")); - break; - case PRODUCT_STANDARD_SERVER: - StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition")); - break; - case PRODUCT_STANDARD_SERVER_CORE: - StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition (core installation)")); - break; - case PRODUCT_WEB_SERVER: - StringCchCat(pszOS, BUFSIZE, TEXT("Web Server Edition")); - break; - } - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - StringCchCat(pszOS, BUFSIZE, TEXT(", 64-bit")); - else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) - StringCchCat(pszOS, BUFSIZE, TEXT(", 32-bit")); - } - - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { - if (GetSystemMetrics(SM_SERVERR2)) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003 R2, ")); - else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Storage Server 2003")); - else if (osvi.wSuiteMask == VER_SUITE_WH_SERVER) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Home Server")); - else if (osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP Professional x64 Edition")); - else - StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003, ")); - - // Test for the server type. - if (osvi.wProductType != VER_NT_WORKSTATION) { - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) { - if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition for Itanium-based Systems")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition for Itanium-based Systems")); - } - else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { - if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter x64 Edition")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise x64 Edition")); - else StringCchCat(pszOS, BUFSIZE, TEXT("Standard x64 Edition")); - } - else { - if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER) - StringCchCat(pszOS, BUFSIZE, TEXT("Compute Cluster Edition")); - else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition")); - else if (osvi.wSuiteMask & VER_SUITE_BLADE) - StringCchCat(pszOS, BUFSIZE, TEXT("Web Edition")); - else StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition")); - } - } - } - - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { - StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP ")); - if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - StringCchCat(pszOS, BUFSIZE, TEXT("Home Edition")); - else StringCchCat(pszOS, BUFSIZE, TEXT("Professional")); - } - - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) { - StringCchCat(pszOS, BUFSIZE, TEXT("Windows 2000 ")); - - if (osvi.wProductType == VER_NT_WORKSTATION) - StringCchCat(pszOS, BUFSIZE, TEXT("Professional")); - else { - if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Server")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - StringCchCat(pszOS, BUFSIZE, TEXT("Advanced Server")); - else StringCchCat(pszOS, BUFSIZE, TEXT("Server")); - } - } - - // Include service pack (if any) and build number. - - if (mir_tstrlen(osvi.szCSDVersion) > 0) { - StringCchCat(pszOS, BUFSIZE, TEXT(" ")); - StringCchCat(pszOS, BUFSIZE, osvi.szCSDVersion); - } - - TCHAR buf[80]; - mir_sntprintf(buf, TEXT(" (build %d)"), osvi.dwBuildNumber); - StringCchCat(pszOS, BUFSIZE, buf); - return TRUE; - } - - return FALSE; -} - - BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) { if (!pInfo->GetFrom()) -- cgit v1.2.3