From fba12be553799e51a0c48bc9083edc21741888bd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 31 Jul 2015 17:35:52 +0000 Subject: custom os version detection replaced with the core one git-svn-id: http://svn.miranda-ng.org/main/trunk@14766 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/src/dumper.cpp | 9 +- plugins/CrashDumper/src/stdafx.h | 1 - plugins/CrashDumper/src/ui.cpp | 2 +- plugins/CrashDumper/src/utils.cpp | 178 ------------------------------------- 4 files changed, 6 insertions(+), 184 deletions(-) (limited to 'plugins/CrashDumper') diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 80e6b474fc..1978a04e35 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -124,9 +124,9 @@ void GetLinkedModulesInfo(TCHAR *moduleName, CMString &buffer) IMAGE_DIRECTORY_ENTRY_IMPORT, &tableSize); if (importData) { while (importData->Name) { - char* moduleName = (char*)ImageRvaToVa(nthdrs, dllAddr, importData->Name, NULL); - if (!SearchPathA(NULL, moduleName, NULL, NULL, 0, NULL)) - buffer.AppendFormat(format, moduleName); + char *szImportModule = (char*)ImageRvaToVa(nthdrs, dllAddr, importData->Name, NULL); + if (!SearchPathA(NULL, szImportModule, NULL, NULL, 0, NULL)) + buffer.AppendFormat(format, szImportModule); importData++; //go to next record } @@ -447,7 +447,8 @@ void PrintVersionInfo(CMString& buffer, unsigned flags) GetFreeMemoryString(buffer); buffer.Append(TEXT("\r\n")); - GetOSDisplayString(buffer); + TCHAR tszOsVer[200]; + GetOSDisplayString(tszOsVer, _countof(tszOsVer)); buffer.Append(TEXT("\r\n")); GetInternetExplorerVersion(buffer); diff --git a/plugins/CrashDumper/src/stdafx.h b/plugins/CrashDumper/src/stdafx.h index a99afa3317..ed12cc4687 100644 --- a/plugins/CrashDumper/src/stdafx.h +++ b/plugins/CrashDumper/src/stdafx.h @@ -101,7 +101,6 @@ LONG WINAPI myfilter(PEXCEPTION_POINTERS exc_ptr); LONG WINAPI myfilterv(PEXCEPTION_POINTERS exc_ptr); DWORD MirandaThreadFilter(DWORD code, EXCEPTION_POINTERS* info); -void GetOSDisplayString(CMString& buffer); void GetInternetExplorerVersion(CMString& buffer); void GetProcessorString(CMString& buffer); void GetFreeMemoryString(CMString& buffer); diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 5f6066cafa..26989f5ad8 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -271,7 +271,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_COMMAND: - switch ((int)PUGetPluginData(hWnd)) { + switch ((INT_PTR)PUGetPluginData(hWnd)) { case 0: OpenAuthUrl("http://vi.miranda-ng.org/detail/%s"); break; diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index f904e6ef5c..990212c935 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -20,184 +20,6 @@ along with this program. If not, see . static HINSTANCE hKernel = GetModuleHandleA("kernel32.dll"); -typedef BOOL(WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD); -tGetProductInfo pGetProductInfo = (tGetProductInfo)GetProcAddress(hKernel, "GetProductInfo"); - -void GetOSDisplayString(CMString &buffer) -{ - OSVERSIONINFOEX osvi = { 0 }; - SYSTEM_INFO si = { 0 }; - BOOL bOsVersionInfoEx; - DWORD dwType = 0; - - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - - bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*)&osvi); - if (!bOsVersionInfoEx) { - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO*)&osvi)) - return; - } - - GetNativeSystemInfo(&si); - - if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4) { - buffer.Append(TEXT("Operating System: Microsoft ")); - - // Test for the specific product. - if (osvi.dwMajorVersion == 6) { - switch (osvi.dwMinorVersion) { - case 0: - if (osvi.wProductType == VER_NT_WORKSTATION) - buffer.Append(TEXT("Windows Vista ")); - else - buffer.Append(TEXT("Windows Server 2008 ")); - break; - - case 1: - if (osvi.wProductType == VER_NT_WORKSTATION) - buffer.Append(TEXT("Windows 7 ")); - else - buffer.Append(TEXT("Windows Server 2008 R2 ")); - break; - - case 2: - if (osvi.wProductType == VER_NT_WORKSTATION) - buffer.Append(TEXT("Windows 8 ")); - else - buffer.Append(TEXT("Windows Server 2012 ")); - break; - - case 3: - if (osvi.wProductType == VER_NT_WORKSTATION) - buffer.Append(TEXT("Windows 8.1 ")); - else - buffer.Append(TEXT("Windows Server 2012 R2 ")); - break; - } - - if (pGetProductInfo) - pGetProductInfo(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); - - switch (dwType) { - case PRODUCT_ULTIMATE: - buffer.Append(TEXT("Ultimate Edition")); - break; - case PRODUCT_PROFESSIONAL: - buffer.Append(TEXT("Professional Edition")); - break; - case PRODUCT_HOME_PREMIUM: - buffer.Append(TEXT("Home Premium Edition")); - break; - case PRODUCT_HOME_BASIC: - buffer.Append(TEXT("Home Basic Edition")); - break; - case PRODUCT_ENTERPRISE: - buffer.Append(TEXT("Enterprise Edition")); - break; - case PRODUCT_BUSINESS: - buffer.Append(TEXT("Business Edition")); - break; - case PRODUCT_STARTER: - buffer.Append(TEXT("Starter Edition")); - break; - case PRODUCT_CLUSTER_SERVER: - buffer.Append(TEXT("Cluster Server Edition")); - break; - case PRODUCT_DATACENTER_SERVER: - buffer.Append(TEXT("Datacenter Edition")); - break; - case PRODUCT_DATACENTER_SERVER_CORE: - buffer.Append(TEXT("Datacenter Edition (core installation)")); - break; - case PRODUCT_ENTERPRISE_SERVER: - buffer.Append(TEXT("Enterprise Edition")); - break; - case PRODUCT_ENTERPRISE_SERVER_CORE: - buffer.Append(TEXT("Enterprise Edition (core installation)")); - break; - case PRODUCT_ENTERPRISE_SERVER_IA64: - buffer.Append(TEXT("Enterprise Edition for Itanium-based Systems")); - break; - case PRODUCT_SMALLBUSINESS_SERVER: - buffer.Append(TEXT("Small Business Server")); - break; - case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: - buffer.Append(TEXT("Small Business Server Premium Edition")); - break; - case PRODUCT_STANDARD_SERVER: - buffer.Append(TEXT("Standard Edition")); - break; - case PRODUCT_STANDARD_SERVER_CORE: - buffer.Append(TEXT("Standard Edition (core installation)")); - break; - case PRODUCT_WEB_SERVER: - buffer.Append(TEXT("Web Server Edition")); - break; - } - - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - buffer.Append(TEXT(", 64-bit")); - else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) - buffer.Append(TEXT(", 32-bit")); - } - - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { - if (GetSystemMetrics(SM_SERVERR2)) - buffer.Append(TEXT("Windows Server 2003 R2, ")); - else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER) - buffer.Append(TEXT("Windows Storage Server 2003")); - else if (osvi.wProductType == VER_NT_WORKSTATION && - si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - buffer.Append(TEXT("Windows XP Professional x64 Edition")); - else buffer.Append(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) - buffer.Append(TEXT("Datacenter Edition for Itanium-based Systems")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - buffer.Append(TEXT("Enterprise Edition for Itanium-based Systems")); - } - else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { - if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - buffer.Append(TEXT("Datacenter x64 Edition")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - buffer.Append(TEXT("Enterprise x64 Edition")); - else buffer.Append(TEXT("Standard x64 Edition")); - } - else { - if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER) - buffer.Append(TEXT("Compute Cluster Edition")); - else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - buffer.Append(TEXT("Datacenter Edition")); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - buffer.Append(TEXT("Enterprise Edition")); - else if (osvi.wSuiteMask & VER_SUITE_BLADE) - buffer.Append(TEXT("Web Edition")); - else buffer.Append(TEXT("Standard Edition")); - } - } - } - - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { - buffer.Append(TEXT("Windows XP ")); - if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - buffer.Append(TEXT("Home Edition")); - else - buffer.Append(TEXT("Professional")); - } - - if (osvi.szCSDVersion[0] != 0) { - buffer.Append(TEXT(" ")); - buffer.Append(osvi.szCSDVersion); - } - - buffer.AppendFormat(TEXT(" (build %d)"), osvi.dwBuildNumber); - } -} - int GetTZOffset(void) { TIME_ZONE_INFORMATION tzInfo = { 0 }; -- cgit v1.2.3