VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-08-16 17:36:36 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-08-16 17:58:06 +0200
commit55a267a171bac0b1fa415c38b6e5ecec2e2eb004 (patch)
tree21de1b2d465fcc5a5bb08ae69f827b8ffef063a7 /src/Common
parentba9af466624706ada9bff2d74a257c7fbedba5cc (diff)
downloadVeraCrypt-55a267a171bac0b1fa415c38b6e5ecec2e2eb004.tar.gz
VeraCrypt-55a267a171bac0b1fa415c38b6e5ecec2e2eb004.zip
Windows: Solve UI language change not taken into account for new install unless a preference is changed. Code refactoring.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c41
-rw-r--r--src/Common/Dlgcode.h2
2 files changed, 43 insertions, 0 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 74a2c831..abad5e70 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -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)
{
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 752b0cb1..e3f73e07 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -425,6 +425,8 @@ BOOL ConfigWriteString (char *configKey, char *configValue);
BOOL ConfigWriteInt (char *configKey, int configValue);
int ConfigReadInt (char *configKey, int defaultValue);
char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen);
+void ConfigReadCompareInt(char *configKey, int defaultValue, int* pOutputValue, BOOL bOnlyCheckModified, BOOL* pbModified);
+void ConfigReadCompareString (char *configKey, char *defaultValue, char *str, int maxLen, BOOL bOnlyCheckModified, BOOL *pbModified);
void RestoreDefaultKeyFilesParam (void);
BOOL LoadDefaultKeyFilesParam (void);
void Debug (char *format, ...);