From f5ca38f5bc5b1688bace6bc97e36091f1df4b466 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 24 Apr 2014 16:55:21 +0000 Subject: -fixes #652 (VersionInfo don't see langpacks) git-svn-id: http://svn.miranda-ng.org/main/trunk@9072 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/src/crshdmp.cpp | 5 ++- plugins/CrashDumper/src/utils.cpp | 70 +++++++++---------------------------- plugins/CrashDumper/src/utils.h | 2 -- 3 files changed, 19 insertions(+), 58 deletions(-) (limited to 'plugins/CrashDumper') diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index a2992f24db..710eae0a11 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -71,8 +71,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) TCHAR path[MAX_PATH]; mir_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder); - HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hDumpFile != INVALID_HANDLE_VALUE) { @@ -339,7 +338,7 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); - packlcid = (LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0); + packlcid = (LCID)Langpack_GetDefaultLocale(); InitIcons(); diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 49a2642e75..2bc906fb23 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -205,13 +205,12 @@ void GetOSDisplayString(CMString& buffer) if (osvi.wProductType == VER_NT_WORKSTATION) buffer.Append(TEXT("Professional")); - else { - if(osvi.wSuiteMask & VER_SUITE_DATACENTER) - buffer.Append(TEXT("Datacenter Server")); - else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - buffer.Append(TEXT("Advanced Server")); - else buffer.Append(TEXT("Server")); - } + else if(osvi.wSuiteMask & VER_SUITE_DATACENTER) + buffer.Append(TEXT("Datacenter Server")); + else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + buffer.Append(TEXT("Advanced Server")); + else + buffer.Append(TEXT("Server")); } if (osvi.szCSDVersion[0] != 0) { @@ -593,54 +592,19 @@ void GetLanguageString(CMString& buffer) void GetLanguagePackString(CMString& buffer) { buffer.Append(TEXT("Language pack: ")); - if (packlcid == LOCALE_USER_DEFAULT) - buffer.Append(TEXT("No language pack installed")); - else { - TCHAR path[MAX_PATH] = TEXT("Locale id invalid"); - GetLocaleInfo(packlcid, LOCALE_SENGLANGUAGE, path, MAX_PATH); - buffer.Append(path); - - GetLocaleInfo(packlcid, LOCALE_SISO3166CTRYNAME, path, MAX_PATH); - buffer.AppendFormat(TEXT(" (%s) [%04x]"), path, packlcid); - - GetModuleFileName(NULL, path, MAX_PATH); - - LPTSTR fname = _tcsrchr(path, TEXT('\\')); - if (fname == NULL) fname = path; - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\langpack_*.txt")); - - WIN32_FIND_DATA FindFileData; - HANDLE hFind = FindFirstFile(path, &FindFileData); - if (hFind == INVALID_HANDLE_VALUE) return; - FindClose(hFind); - - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\%s"), FindFileData.cFileName); - HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hDumpFile != INVALID_HANDLE_VALUE) { - char buf[8192]; - - DWORD bytes = 0; - ReadFile(hDumpFile, buf, 8190, &bytes, NULL); - buf[bytes] = 0; - - char *id = strstr(buf, "FLID:"); - if (id != NULL) { - char *endid = strchr(id, '\r'); - if (endid != NULL) *endid = 0; - - endid = strchr(id, '\n'); - if (endid != NULL) *endid = 0; - - TCHAR mirtime[30]; - GetLastWriteTime(path, mirtime, 30); - - TCHAR* tid; - crsi_a2t(tid, id+5); - buffer.AppendFormat(TEXT(", %s, modified: %s"), tid, mirtime); - } - CloseHandle(hDumpFile); + if (packlcid != LOCALE_USER_DEFAULT) { + TCHAR lang[MAX_PATH], ctry[MAX_PATH]; + if(GetLocaleInfo(packlcid, LOCALE_SENGLANGUAGE, lang, MAX_PATH)) { + if(GetLocaleInfo(packlcid, LOCALE_SISO3166CTRYNAME, ctry, MAX_PATH)) + buffer.AppendFormat(TEXT("%s (%s) [%04x]"), lang, ctry, packlcid); + else + buffer.Append(lang); } + else + buffer.Append(TEXT("Locale id invalid")); } + else + buffer.Append(TEXT("No language pack installed")); } void GetWow64String(CMString& buffer) diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h index 64c1c6483c..cbb540b039 100644 --- a/plugins/CrashDumper/src/utils.h +++ b/plugins/CrashDumper/src/utils.h @@ -44,8 +44,6 @@ along with this program. If not, see . #include "version.h" #include "resource.h" -#define MS_PROTO_ENUMPROTOS "Proto/EnumProtos" - #define crsi_u2a(dst, src) \ { \ int cbLen = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL); \ -- cgit v1.2.3