diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-04-24 16:55:21 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-04-24 16:55:21 +0000 |
commit | f5ca38f5bc5b1688bace6bc97e36091f1df4b466 (patch) | |
tree | 8a47686779c1e617eeace5a7c9b09caba0e83f95 /plugins | |
parent | 263eb6c9c953a24df9944ea364e429e9a4076918 (diff) |
-fixes #652 (VersionInfo don't see langpacks)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9072 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CrashDumper/src/crshdmp.cpp | 5 | ||||
-rw-r--r-- | plugins/CrashDumper/src/utils.cpp | 70 | ||||
-rw-r--r-- | plugins/CrashDumper/src/utils.h | 2 | ||||
-rw-r--r-- | plugins/VersionInfo/src/CVersionInfo.cpp | 85 |
4 files changed, 34 insertions, 128 deletions
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 <http://www.gnu.org/licenses/>. #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); \
diff --git a/plugins/VersionInfo/src/CVersionInfo.cpp b/plugins/VersionInfo/src/CVersionInfo.cpp index 2f0a0dcd0d..38950bfbd2 100644 --- a/plugins/VersionInfo/src/CVersionInfo.cpp +++ b/plugins/VersionInfo/src/CVersionInfo.cpp @@ -408,79 +408,24 @@ int SaveInfo(const char *data, const char *lwrData, const char *search, TCHAR *d bool CVersionInfo::GetLangpackInfo()
{
- TCHAR langpackPath[MAX_PATH] = {0};
- TCHAR search[MAX_PATH] = {0};
-
- lpzLangpackModifiedDate = _T("");
- GetModuleFileName(GetModuleHandle(NULL), langpackPath, SIZEOF(langpackPath));
- TCHAR* p = _tcsrchr(langpackPath, '\\');
- if (p) {
- WIN32_FIND_DATA data = {0};
- HANDLE hLangpack;
-
- p[1] = '\0';
- _tcscpy(search, langpackPath);
- _tcscat(search, _T("langpack_*.txt"));
- hLangpack = FindFirstFile(search, &data);
- if (hLangpack != INVALID_HANDLE_VALUE) {
- char buffer[1024];
- char temp[1024];
- FillLocalTime(lpzLangpackModifiedDate, &data.ftLastWriteTime);
-
- TCHAR locale[128] = {0};
- TCHAR language[128] = {0};
- TCHAR version[128] = {0};
- _tcscpy(version, _T("N/A"));
-
- _tcsncpy(language, data.cFileName, SIZEOF(language));
- p = _tcsrchr(language, '.');
- p[0] = '\0';
-
- _tcscat(langpackPath, data.cFileName);
- FILE *fin = _tfopen(langpackPath, _T("rt"));
- if (fin) {
- size_t len;
- while (!feof(fin)) {
- fgets(buffer, SIZEOF(buffer), fin);
- len = strlen(buffer);
- if (buffer[len - 1] == '\n') buffer[len - 1] = '\0';
- strncpy(temp, buffer, SIZEOF(temp));
- _strlwr(temp);
- if (SaveInfo(buffer, temp, "language: ", language, SIZEOF(language))) {
- if (SaveInfo(buffer, temp, "locale: ", locale, SIZEOF(locale))) {
- char* p = strstr(buffer, "; FLID: ");
- if (p) {
- int ok = 1;
- int i;
- for (i = 0; ((i < 3) && (ok)); i++) {
- p = strrchr(temp, '.');
- if (p)
- p[0] = '\0';
- else
- ok = 0;
- }
- p = strrchr(temp, ' ');
- if ((ok) && (p))
- _tcsncpy(version, _A2T(&buffer[p - temp + 1]), SIZEOF(version));
- else
- _tcsncpy(version, _T("<unknown>"), SIZEOF(version));
- } } } }
-
- lpzLangpackInfo = std::tstring(language) + _T(" [") + std::tstring(locale) + _T("]");
- if ( version[0] )
- lpzLangpackInfo += _T(" v. ") + std::tstring(version);
-
- fclose(fin);
- }
- else {
- int err = GetLastError();
- lpzLangpackInfo = _T("<error> Could not open file " + std::tstring(data.cFileName));
+ LCID packlcid = Langpack_GetDefaultLocale();
+
+ 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)) {
+ TCHAR langpackInfo[MAX_PATH];
+ mir_sntprintf(langpackInfo,SIZEOF(langpackInfo),TEXT("%s (%s) [%04x]"), lang, ctry, packlcid);
+ lpzLangpackInfo = langpackInfo;
}
- FindClose(hLangpack);
+ else
+ lpzLangpackInfo.append(lang);
}
- else lpzLangpackInfo = _T("No language pack installed");
+ else
+ lpzLangpackInfo = _T("Locale id invalid");
}
-
+ else
+ lpzLangpackInfo = _T("No language pack installed");
return true;
}
|