1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: Solve UI language change not taken into account for new install unless a preference is changed. Code refactoring.

This commit is contained in:
Mounir IDRASSI
2015-08-16 17:36:36 +02:00
parent ba9af46662
commit 55a267a171
4 changed files with 44 additions and 67 deletions

View File

@@ -8713,9 +8713,50 @@ char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxL
if (ConfigRead (configKey, str, maxLen))
return str;
else
{
StringCbCopyA (str, maxLen, defaultValue);
return defaultValue;
}
}
void ConfigReadCompareInt(char *configKey, int defaultValue, int* pOutputValue, BOOL bOnlyCheckModified, BOOL* pbModified)
{
int intValue = ConfigReadInt (configKey, defaultValue);
if (pOutputValue)
{
if (pbModified && (*pOutputValue != intValue))
*pbModified = TRUE;
if (!bOnlyCheckModified)
*pOutputValue = intValue;
}
}
void ConfigReadCompareString (char *configKey, char *defaultValue, char *str, int maxLen, BOOL bOnlyCheckModified, BOOL *pbModified)
{
char *strValue = (char*) malloc (maxLen);
if (strValue)
{
memcpy (strValue, str, maxLen);
ConfigReadString (configKey, defaultValue, strValue, maxLen);
if (pbModified && strcmp (str, strValue))
*pbModified = TRUE;
if (!bOnlyCheckModified)
memcpy(str, strValue, maxLen);
free (strValue);
}
else
{
/* allocation failed. Suppose that value changed */
if (pbModified)
*pbModified = TRUE;
if (!bOnlyCheckModified)
ConfigReadString (configKey, defaultValue, str, maxLen);
}
}
void OpenPageHelp (HWND hwndDlg, int nPage)
{