From c55e08b31e8100a593b4f81784489a820de807a1 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 9 Sep 2015 01:16:27 +0200 Subject: Windows: When no language selected by user, explicitly use English as default one unless VeraCrypt is in portable mode. --- src/Mount/Mount.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src/Mount/Mount.c') diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 01c5108d..0d8cace2 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -776,9 +776,23 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* ConfigReadCompareInt ("DefaultTrueCryptMode", FALSE, &DefaultVolumeTrueCryptMode, bOnlyCheckModified, pbSettingsModified); if (bOnlyCheckModified) - { - StringCbCopyA (langid, sizeof(langid), GetPreferredLangId ()); - ConfigReadCompareString ("Language", "", langid, sizeof (langid), TRUE, pbSettingsModified); + { + if (!IsNonInstallMode ()) + { + ConfigReadString ("Language", "", langid, sizeof (langid)); + // when installed, if no preferred language set by user, English is set default + // + if (langid [0] == 0) + StringCbCopyA (langid, sizeof(langid), "en"); + + if (pbSettingsModified && strcmp (langid, GetPreferredLangId ())) + *pbSettingsModified = TRUE; + } + else + { + StringCbCopyA (langid, sizeof(langid), GetPreferredLangId ()); + ConfigReadCompareString ("Language", "", langid, sizeof (langid), TRUE, pbSettingsModified); + } } if (DefaultVolumePkcs5 < 0 || DefaultVolumePkcs5 > LAST_PRF_ID) @@ -881,8 +895,7 @@ void SaveSettings (HWND hwndDlg) ConfigWriteInt ("DisplayMsgBoxOnHotkeyDismount", bDisplayBalloonOnSuccessfulHkDismount); // Language - if (GetPreferredLangId () != NULL) - ConfigWriteString ("Language", GetPreferredLangId ()); + ConfigWriteString ("Language", GetPreferredLangId ()); // PKCS#11 Library Path ConfigWriteString ("SecurityTokenLibrary", SecurityTokenLibraryPath[0] ? SecurityTokenLibraryPath : ""); @@ -4111,11 +4124,11 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa goto stop; } - if (GetPreferredLangId () && strcmp (GetPreferredLangId (), "en") != 0) + if (strcmp (GetPreferredLangId (), "en") != 0) { // Language pack - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Language.%s.xml", appDir, GetPreferredLangId ()); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Language.%s.xml", dstDir, GetPreferredLangId ()); + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Language.%hs.xml", appDir, GetPreferredLangId ()); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Language.%hs.xml", dstDir, GetPreferredLangId ()); TCCopyFileW (srcPath, dstPath); } -- cgit v1.2.3