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

Windows: Avoid wrong update of configuration XML file caused by not using the correct window handle to get some GUI fields content. Some code cleanup.

This commit is contained in:
Mounir IDRASSI
2016-01-10 20:17:30 +01:00
parent fb430c403b
commit 8586c51016
5 changed files with 12 additions and 12 deletions

View File

@@ -2251,7 +2251,7 @@ uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ()
} }
BOOL LoadSysEncSettings (HWND hwndDlg) BOOL LoadSysEncSettings ()
{ {
BOOL status = TRUE; BOOL status = TRUE;
DWORD size = 0; DWORD size = 0;
@@ -3947,7 +3947,7 @@ start:
{ {
#ifndef SETUP #ifndef SETUP
LoadSysEncSettings (NULL); LoadSysEncSettings ();
if (!CreateDriverSetupMutex ()) if (!CreateDriverSetupMutex ())
{ {
@@ -10657,7 +10657,7 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg)
try try
{ {
SecurityToken::InitLibrary (SecurityTokenLibraryPath, auto_ptr <GetPinFunctor> (new PinRequestHandler(hwndDlg)), auto_ptr <SendExceptionFunctor> (new WarningHandler(hwndDlg))); SecurityToken::InitLibrary (SecurityTokenLibraryPath, auto_ptr <GetPinFunctor> (new PinRequestHandler(MainDlg)), auto_ptr <SendExceptionFunctor> (new WarningHandler(MainDlg)));
} }
catch (Exception &e) catch (Exception &e)
{ {

View File

@@ -289,7 +289,7 @@ void CloseAppSetupMutex (void);
BOOL IsTrueCryptInstallerRunning (void); BOOL IsTrueCryptInstallerRunning (void);
uint32 ReadDriverConfigurationFlags (); uint32 ReadDriverConfigurationFlags ();
uint32 ReadEncryptionThreadPoolFreeCpuCountLimit (); uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ();
BOOL LoadSysEncSettings (HWND hwndDlg); BOOL LoadSysEncSettings ();
int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm); int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm);
void RemoveNonSysInPlaceEncNotifications (void); void RemoveNonSysInPlaceEncNotifications (void);
void SavePostInstallTasksSettings (int command); void SavePostInstallTasksSettings (int command);

View File

@@ -242,7 +242,7 @@ void LoadSettings (HWND hwndDlg)
{ {
WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE; WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE;
LoadSysEncSettings (hwndDlg); LoadSysEncSettings ();
if (LoadNonSysInPlaceEncSettings (&savedWipeAlgorithm) != 0) if (LoadNonSysInPlaceEncSettings (&savedWipeAlgorithm) != 0)
bInPlaceEncNonSysPending = TRUE; bInPlaceEncNonSysPending = TRUE;

Binary file not shown.

View File

@@ -653,7 +653,7 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE; WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE;
if (!bOnlyCheckModified) if (!bOnlyCheckModified)
LoadSysEncSettings (hwndDlg); LoadSysEncSettings ();
if (!bOnlyCheckModified && LoadNonSysInPlaceEncSettings (&savedWipeAlgorithm) != 0) if (!bOnlyCheckModified && LoadNonSysInPlaceEncSettings (&savedWipeAlgorithm) != 0)
bInPlaceEncNonSysPending = TRUE; bInPlaceEncNonSysPending = TRUE;
@@ -739,7 +739,7 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
// only check for last drive modification if history enabled // only check for last drive modification if history enabled
char szTmp[32] = {0}; char szTmp[32] = {0};
LPARAM lLetter; LPARAM lLetter;
lLetter = GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST)); lLetter = GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST));
if (LOWORD (lLetter) != 0xffff) if (LOWORD (lLetter) != 0xffff)
StringCbPrintfA (szTmp, sizeof(szTmp), "%lc:", (wchar_t) HIWORD (lLetter)); StringCbPrintfA (szTmp, sizeof(szTmp), "%lc:", (wchar_t) HIWORD (lLetter));
@@ -782,9 +782,9 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
// History // History
if (bHistoryCmdLine != TRUE) if (bHistoryCmdLine != TRUE)
{ {
LoadCombo (GetDlgItem (hwndDlg, IDC_VOLUME), bHistory, bOnlyCheckModified, pbHistoryModified); LoadCombo (GetDlgItem (MainDlg, IDC_VOLUME), bHistory, bOnlyCheckModified, pbHistoryModified);
if (!bOnlyCheckModified && CmdLineVolumeSpecified) if (!bOnlyCheckModified && CmdLineVolumeSpecified)
SetWindowText (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName); SetWindowText (GetDlgItem (MainDlg, IDC_VOLUME), szFileName);
} }
// Mount Options // Mount Options
@@ -885,7 +885,7 @@ void SaveSettings (HWND hwndDlg)
if (bHistory) if (bHistory)
{ {
// Drive Letter // Drive Letter
lLetter = GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST)); lLetter = GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST));
if (LOWORD (lLetter) != 0xffff) if (LOWORD (lLetter) != 0xffff)
StringCbPrintfA (szTmp, sizeof(szTmp), "%lc:", (wchar_t) HIWORD (lLetter)); StringCbPrintfA (szTmp, sizeof(szTmp), "%lc:", (wchar_t) HIWORD (lLetter));
ConfigWriteString ("LastSelectedDrive", szTmp); ConfigWriteString ("LastSelectedDrive", szTmp);
@@ -931,7 +931,7 @@ void SaveSettings (HWND hwndDlg)
if (bHistoryChanged) if (bHistoryChanged)
{ {
// History // History
DumpCombo (GetDlgItem (hwndDlg, IDC_VOLUME), IsButtonChecked (GetDlgItem (hwndDlg, IDC_NO_HISTORY))); DumpCombo (GetDlgItem (MainDlg, IDC_VOLUME), IsButtonChecked (GetDlgItem (MainDlg, IDC_NO_HISTORY)));
} }
NormalCursor (); NormalCursor ();
@@ -6989,7 +6989,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1; return 1;
case TC_APPMSG_SYSENC_CONFIG_UPDATE: case TC_APPMSG_SYSENC_CONFIG_UPDATE:
LoadSysEncSettings (hwndDlg); LoadSysEncSettings ();
// The wizard added VeraCrypt.exe to the system startup sequence or performed other operations that // The wizard added VeraCrypt.exe to the system startup sequence or performed other operations that
// require us to update our cached settings. // require us to update our cached settings.