VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-27 11:18:58 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-27 13:39:22 +0100
commita8112b8373a9cd9c4c481895179f6b31db33d967 (patch)
treec40c7bafb960e5038e7eb3194f5969f9245a6f32
parent2dbbd6b9d210c32bb672512d74a0761845608dd5 (diff)
downloadVeraCrypt-a8112b8373a9cd9c4c481895179f6b31db33d967.tar.gz
VeraCrypt-a8112b8373a9cd9c4c481895179f6b31db33d967.zip
Windows: use the correct window handle for creating message boxes. This became important after the introduction of the wait dialog in order to avoid having message boxes behind the wait dialog.
-rw-r--r--src/Common/BaseCom.cpp2
-rw-r--r--src/Common/BootEncryption.cpp18
-rw-r--r--src/Common/Dlgcode.c298
-rw-r--r--src/Common/Dlgcode.h76
-rw-r--r--src/Common/Exception.h6
-rw-r--r--src/Common/Fat.c9
-rw-r--r--src/Common/Fat.h2
-rw-r--r--src/Common/Format.c29
-rw-r--r--src/Common/Format.h2
-rw-r--r--src/Common/Keyfiles.c28
-rw-r--r--src/Common/Keyfiles.h2
-rw-r--r--src/Common/Password.c4
-rw-r--r--src/Common/Random.c12
-rw-r--r--src/Common/Random.h6
-rw-r--r--src/Common/SecurityToken.cpp4
-rw-r--r--src/Common/SecurityToken.h8
-rw-r--r--src/Common/Volumes.c12
-rw-r--r--src/Common/Volumes.h4
-rw-r--r--src/Format/InPlace.c100
-rw-r--r--src/Format/InPlace.h8
-rw-r--r--src/Format/Tcformat.c334
-rw-r--r--src/Format/Tcformat.h2
-rw-r--r--src/Mount/Favorites.cpp30
-rw-r--r--src/Mount/Favorites.h2
-rw-r--r--src/Mount/Hotkeys.c4
-rw-r--r--src/Mount/Mount.c474
-rw-r--r--src/Mount/Mount.h12
-rw-r--r--src/Setup/SelfExtract.c30
-rw-r--r--src/Setup/Setup.c38
-rw-r--r--src/Setup/Wizard.c22
30 files changed, 793 insertions, 785 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 69c614af..349edabc 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -48,7 +48,7 @@ BOOL ComGetInstanceBase (HWND hWnd, REFCLSID clsid, REFIID iid, void **tcServer)
r = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer) == S_OK;
if (!r)
- Error ("UAC_INIT_ERROR");
+ Error ("UAC_INIT_ERROR", hWnd);
return r;
}
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 47f6418f..a974c47d 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -1295,7 +1295,7 @@ namespace VeraCrypt
UserEnrichRandomPool (ParentWindow);
- if (!RandgetBytes (request.WipeKey, sizeof (request.WipeKey), TRUE))
+ if (!RandgetBytes (ParentWindow, request.WipeKey, sizeof (request.WipeKey), TRUE))
throw ParameterIncorrect (SRC_POS);
CallDriver (TC_IOCTL_START_DECOY_SYSTEM_WIPE, &request, sizeof (request), NULL, 0);
@@ -1348,7 +1348,7 @@ namespace VeraCrypt
#endif
byte randData[PRAND_DISK_WIPE_PASSES];
- if (!RandgetBytes (randData, sizeof (randData), FALSE))
+ if (!RandgetBytes (ParentWindow, randData, sizeof (randData), FALSE))
throw ParameterIncorrect (SRC_POS);
for (int wipePass = 0; wipePass < PRAND_DISK_WIPE_PASSES; wipePass++)
@@ -1557,7 +1557,7 @@ namespace VeraCrypt
catch (Exception &e)
{
e.Show (ParentWindow);
- Warning ("SYS_LOADER_UNAVAILABLE_FOR_RESCUE_DISK");
+ Warning ("SYS_LOADER_UNAVAILABLE_FOR_RESCUE_DISK", ParentWindow);
}
// Boot loader backup
@@ -1631,7 +1631,7 @@ namespace VeraCrypt
if (!IsRandomNumberGeneratorStarted())
throw ParameterIncorrect (SRC_POS);
- throw_sys_if (CreateVolumeHeaderInMemory (TRUE, (char *) VolumeHeader, ea, mode, password, pkcs5, NULL, &cryptoInfo,
+ throw_sys_if (CreateVolumeHeaderInMemory (ParentWindow, TRUE, (char *) VolumeHeader, ea, mode, password, pkcs5, NULL, &cryptoInfo,
volumeSize, 0, encryptedAreaStart, 0, TC_SYSENC_KEYSCOPE_MIN_REQ_PROG_VERSION, TC_HEADER_FLAG_ENCRYPTED_SYSTEM, TC_SECTOR_SIZE_BIOS, FALSE) != 0);
finally_do_arg (PCRYPTO_INFO*, &cryptoInfo, { crypto_close (*finally_arg); });
@@ -1708,7 +1708,7 @@ namespace VeraCrypt
{
if (memcmp (bootLoaderBuf + i, TC_APP_NAME, strlen (TC_APP_NAME)) == 0)
{
- if (AskWarnNoYes ("TC_BOOT_LOADER_ALREADY_INSTALLED") == IDNO)
+ if (AskWarnNoYes ("TC_BOOT_LOADER_ALREADY_INSTALLED", ParentWindow) == IDNO)
throw UserAbort (SRC_POS);
return;
}
@@ -1974,7 +1974,7 @@ namespace VeraCrypt
{
static bool confirmed = false;
- if (!confirmed && AskWarnNoYes ("WINDOWS_NOT_ON_BOOT_DRIVE_ERROR") == IDNO)
+ if (!confirmed && AskWarnNoYes ("WINDOWS_NOT_ON_BOOT_DRIVE_ERROR", ParentWindow) == IDNO)
throw UserAbort (SRC_POS);
confirmed = true;
@@ -2022,7 +2022,7 @@ namespace VeraCrypt
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION")
+ L"\n\n\n"
+ GetString ("RESTRICT_PAGING_FILES_TO_SYS_PARTITION")
- ).c_str()) == IDYES)
+ ).c_str(), ParentWindow) == IDYES)
{
RestrictPagingFilesToSystemPartition();
RestartComputer();
@@ -2209,7 +2209,7 @@ namespace VeraCrypt
{
PCRYPTO_INFO tmpCryptoInfo = NULL;
- status = CreateVolumeHeaderInMemory (!encStatus.HiddenSystem,
+ status = CreateVolumeHeaderInMemory (ParentWindow, !encStatus.HiddenSystem,
header,
cryptoInfo->ea,
cryptoInfo->mode,
@@ -2346,7 +2346,7 @@ namespace VeraCrypt
if (e.ErrorCode != ERROR_CRC)
{
e.Show (ParentWindow);
- Error ("WHOLE_DRIVE_ENCRYPTION_PREVENTED_BY_DRIVERS");
+ Error ("WHOLE_DRIVE_ENCRYPTION_PREVENTED_BY_DRIVERS", ParentWindow);
throw UserAbort (SRC_POS);
}
}
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 21998368..3eb4e69d 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -538,7 +538,7 @@ DWORD handleWin32Error (HWND hwndDlg)
// Access denied
if (dwError == ERROR_ACCESS_DENIED && !IsAdmin ())
{
- Error ("ERR_ACCESS_DENIED");
+ Error ("ERR_ACCESS_DENIED", hwndDlg);
SetLastError (dwError); // Preserve the original error code
return dwError;
}
@@ -558,11 +558,11 @@ DWORD handleWin32Error (HWND hwndDlg)
// User-friendly hardware error explanation
if (IsDiskError (dwError))
- Error ("ERR_HARDWARE_ERROR");
+ Error ("ERR_HARDWARE_ERROR", hwndDlg);
// Device not ready
if (dwError == ERROR_NOT_READY)
- HandleDriveNotReadyError();
+ HandleDriveNotReadyError(hwndDlg);
SetLastError (dwError); // Preserve the original error code
@@ -2269,13 +2269,13 @@ void SavePostInstallTasksSettings (int command)
}
-void DoPostInstallTasks (void)
+void DoPostInstallTasks (HWND hwndDlg)
{
BOOL bDone = FALSE;
if (FileExists (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL)))
{
- if (AskYesNo ("AFTER_INSTALL_TUTORIAL") == IDYES)
+ if (AskYesNo ("AFTER_INSTALL_TUTORIAL", hwndDlg) == IDYES)
Applink ("beginnerstutorial", TRUE, "");
bDone = TRUE;
@@ -2283,7 +2283,7 @@ void DoPostInstallTasks (void)
if (FileExists (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES)))
{
- if (AskYesNo ("AFTER_UPGRADE_RELEASE_NOTES") == IDYES)
+ if (AskYesNo ("AFTER_UPGRADE_RELEASE_NOTES", hwndDlg) == IDYES)
Applink ("releasenotes", TRUE, "");
bDone = TRUE;
@@ -2396,7 +2396,7 @@ void InitApp (HINSTANCE hInstance, char *lpszCommandLine)
if (strstr (lpszCommandLine, "/q UAC ") == lpszCommandLine)
{
- Error ("UAC_INIT_ERROR");
+ Error ("UAC_INIT_ERROR", NULL);
exit (1);
}
@@ -2454,7 +2454,7 @@ void InitApp (HINSTANCE hInstance, char *lpszCommandLine)
{
case WIN_2000:
if (osEx.wServicePackMajor < 3)
- Warning ("LARGE_IDE_WARNING_2K");
+ Warning ("LARGE_IDE_WARNING_2K", NULL);
else
{
DWORD val = 0, size = sizeof(val);
@@ -2465,7 +2465,7 @@ void InitApp (HINSTANCE hInstance, char *lpszCommandLine)
if (RegQueryValueEx (hkey, "EnableBigLba", 0, 0, (LPBYTE) &val, &size) != ERROR_SUCCESS
|| val != 1)
{
- Warning ("LARGE_IDE_WARNING_2K_REGISTRY");
+ Warning ("LARGE_IDE_WARNING_2K_REGISTRY", NULL);
}
RegCloseKey (hkey);
}
@@ -2478,7 +2478,7 @@ void InitApp (HINSTANCE hInstance, char *lpszCommandLine)
HKEY k;
// PE environment does not report version of SP
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\minint", 0, KEY_READ, &k) != ERROR_SUCCESS)
- Warning ("LARGE_IDE_WARNING_XP");
+ Warning ("LARGE_IDE_WARNING_XP", NULL);
else
RegCloseKey (k);
}
@@ -3133,7 +3133,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
- if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE") == IDNO)
+ if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
EndDialog (hwndDlg, IDCANCEL);
return 1;
@@ -3165,9 +3165,9 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
if (bWarnDeviceFormatAdvanced
&& !bHiddenVolDirect
- && AskWarnNoYes("FORMAT_DEVICE_FOR_ADVANCED_ONLY") == IDNO)
+ && AskWarnNoYes("FORMAT_DEVICE_FOR_ADVANCED_ONLY", hwndDlg) == IDNO)
{
- if (AskNoYes("CONFIRM_CHANGE_WIZARD_MODE_TO_FILE_CONTAINER") == IDYES)
+ if (AskNoYes("CONFIRM_CHANGE_WIZARD_MODE_TO_FILE_CONTAINER", hwndDlg) == IDYES)
{
SwitchWizardToFileContainerMode ();
}
@@ -3195,7 +3195,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
- if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE") == IDNO)
+ if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
EndDialog (hwndDlg, IDCANCEL);
@@ -3231,11 +3231,11 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (!selectedDevice.Partitions.empty())
{
EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE);
- Error ("DEVICE_PARTITIONS_ERR_W_INPLACE_ENC_NOTE");
+ Error ("DEVICE_PARTITIONS_ERR_W_INPLACE_ENC_NOTE", hwndDlg);
return 1;
}
- if (AskWarnNoYes ("WHOLE_NONSYS_DEVICE_ENC_CONFIRM") == IDNO)
+ if (AskWarnNoYes ("WHOLE_NONSYS_DEVICE_ENC_CONFIRM", hwndDlg) == IDNO)
return 1;
}
#else // #ifdef VOLFORMAT
@@ -3994,7 +3994,7 @@ void handleError (HWND hwndDlg, int code)
break;
case ERR_DRIVER_VERSION:
- Error ("DRIVER_VERSION");
+ Error ("DRIVER_VERSION", hwndDlg);
break;
case ERR_NEW_VERSION_REQUIRED:
@@ -4002,27 +4002,27 @@ void handleError (HWND hwndDlg, int code)
break;
case ERR_SELF_TESTS_FAILED:
- Error ("ERR_SELF_TESTS_FAILED");
+ Error ("ERR_SELF_TESTS_FAILED", hwndDlg);
break;
case ERR_VOL_FORMAT_BAD:
- Error ("ERR_VOL_FORMAT_BAD");
+ Error ("ERR_VOL_FORMAT_BAD", hwndDlg);
break;
case ERR_ENCRYPTION_NOT_COMPLETED:
- Error ("ERR_ENCRYPTION_NOT_COMPLETED");
+ Error ("ERR_ENCRYPTION_NOT_COMPLETED", hwndDlg);
break;
case ERR_NONSYS_INPLACE_ENC_INCOMPLETE:
- Error ("ERR_NONSYS_INPLACE_ENC_INCOMPLETE");
+ Error ("ERR_NONSYS_INPLACE_ENC_INCOMPLETE", hwndDlg);
break;
case ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG:
- Error ("ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG");
+ Error ("ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG", hwndDlg);
break;
case ERR_PARAMETER_INCORRECT:
- Error ("ERR_PARAMETER_INCORRECT");
+ Error ("ERR_PARAMETER_INCORRECT", hwndDlg);
break;
case ERR_USER_ABORT:
@@ -4037,13 +4037,13 @@ void handleError (HWND hwndDlg, int code)
}
-BOOL CheckFileStreamWriteErrors (FILE *file, const char *fileName)
+BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const char *fileName)
{
if (ferror (file))
{
wchar_t s[TC_MAX_PATH];
StringCbPrintfW (s, sizeof (s), GetString ("CANNOT_WRITE_FILE_X"), fileName);
- ErrorDirect (s);
+ ErrorDirect (s, hwndDlg);
return FALSE;
}
@@ -4713,7 +4713,7 @@ BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (is_aes_hw_cpu_supported() && (driverConfig & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION))
{
- Warning ("DISABLED_HW_AES_AFFECTS_PERFORMANCE");
+ Warning ("DISABLED_HW_AES_AFFECTS_PERFORMANCE", hwndDlg);
}
SYSTEM_INFO sysInfo;
@@ -4742,7 +4742,7 @@ BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (nbrThreads < min (sysInfo.dwNumberOfProcessors, GetMaxEncryptionThreadCount())
&& sysInfo.dwNumberOfProcessors > 1)
{
- Warning ("LIMITED_THREAD_COUNT_AFFECTS_PERFORMANCE");
+ Warning ("LIMITED_THREAD_COUNT_AFFECTS_PERFORMANCE", hwndDlg);
}
return 1;
@@ -4852,7 +4852,7 @@ static BOOL CALLBACK RandomPoolEnrichementDlgProc (HWND hwndDlg, UINT msg, WPARA
if (bDisplayPoolContents)
{
- RandpeekBytes (randPool, sizeof (randPool));
+ RandpeekBytes (hwndDlg, randPool, sizeof (randPool));
if (memcmp (lastRandPool, randPool, sizeof(lastRandPool)) != 0)
{
@@ -4989,7 +4989,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
#ifndef VOLFORMAT
if (Randinit ())
{
- Error ("INIT_RAND");
+ Error ("INIT_RAND", hwndDlg);
EndDialog (hwndDlg, IDCLOSE);
}
#endif
@@ -5014,7 +5014,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (bDisplayPoolContents)
{
- RandpeekBytes (randPool, sizeof (randPool));
+ RandpeekBytes (hwndDlg, randPool, sizeof (randPool));
if (memcmp (lastRandPool, randPool, sizeof(lastRandPool)) != 0)
{
@@ -5091,7 +5091,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
keyfilesCount = strtoul(szNumber, NULL, 0);
if (keyfilesCount <= 0 || keyfilesCount == LONG_MAX)
{
- Warning("KEYFILE_INCORRECT_NUMBER");
+ Warning("KEYFILE_INCORRECT_NUMBER", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_NUMBER_KEYFILES), TRUE);
return 1;
}
@@ -5104,7 +5104,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
keyfilesSize = strtoul(szNumber, NULL, 0);
if (keyfilesSize < 64 || keyfilesSize > 1024*1024)
{
- Warning("KEYFILE_INCORRECT_SIZE");
+ Warning("KEYFILE_INCORRECT_SIZE", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), TRUE);
return 1;
}
@@ -5116,14 +5116,14 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
// Trim trailing space
if (TrimWhiteSpace(szFileBaseName) == 0)
{
- Warning("KEYFILE_EMPTY_BASE_NAME");
+ Warning("KEYFILE_EMPTY_BASE_NAME", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), TRUE);
return 1;
}
if (!IsValidFileName(szFileBaseName))
{
- Warning("KEYFILE_INVALID_BASE_NAME");
+ Warning("KEYFILE_INVALID_BASE_NAME", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), TRUE);
return 1;
}
@@ -5175,7 +5175,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
MultiByteToWideChar(CP_ACP, 0, szFileName, -1, wszFileName, sizeof(wszFileName) / sizeof(WCHAR));
StringCbPrintfW (s, sizeof(s), GetString ("KEYFILE_ALREADY_EXISTS"), wszFileName);
- status = AskWarnNoYesString (s);
+ status = AskWarnNoYesString (s, hwndDlg);
if (status == IDNO)
{
TCfree(keyfile);
@@ -5196,7 +5196,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (bRandomSize)
{
/* Generate a random size */
- if (!RandgetBytes ((unsigned char*) &keyfilesSize, sizeof(keyfilesSize), FALSE))
+ if (!RandgetBytes (hwndDlg, (unsigned char*) &keyfilesSize, sizeof(keyfilesSize), FALSE))
{
_close (fhKeyfile);
DeleteFile (szFileName);
@@ -5213,7 +5213,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
/* Generate the keyfile */
- if (!RandgetBytesFull (keyfile, keyfilesSize, TRUE, TRUE))
+ if (!RandgetBytesFull (hwndDlg, keyfile, keyfilesSize, TRUE, TRUE))
{
_close (fhKeyfile);
DeleteFile (szFileName);
@@ -5239,7 +5239,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
TCfree(keyfile);
NormalCursor();
- Info("KEYFILE_CREATED");
+ Info("KEYFILE_CREATED", hwndDlg);
return 1;
}
@@ -5410,7 +5410,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
n = GetWindowText(GetDlgItem(hwndDlg, IDC_KEY), szTmp, sizeof(szTmp));
if (n != ks * 2)
{
- Warning ("TEST_KEY_SIZE");
+ Warning ("TEST_KEY_SIZE", hwndDlg);
return 1;
}
@@ -5446,12 +5446,12 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (bEncrypt)
{
- Warning ("TEST_PLAINTEXT_SIZE");
+ Warning ("TEST_PLAINTEXT_SIZE", hwndDlg);
return 1;
}
else
{
- Warning ("TEST_CIPHERTEXT_SIZE");
+ Warning ("TEST_CIPHERTEXT_SIZE", hwndDlg);
return 1;
}
}
@@ -5477,7 +5477,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (GetWindowText(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), szTmp, sizeof(szTmp)) != 64)
{
- Warning ("TEST_INCORRECT_SECONDARY_KEY_SIZE");
+ Warning ("TEST_INCORRECT_SECONDARY_KEY_SIZE", hwndDlg);
return 1;
}
@@ -5501,7 +5501,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (tlen > 16 || tlen < 1)
{
- Warning ("TEST_INCORRECT_TEST_DATA_UNIT_SIZE");
+ Warning ("TEST_INCORRECT_TEST_DATA_UNIT_SIZE", hwndDlg);
return 1;
}
@@ -6283,7 +6283,7 @@ int MountVolume (HWND hwndDlg,
#ifdef TCMOUNT
if (mountOptions->PartitionInInactiveSysEncScope)
{
- if (!CheckSysEncMountWithoutPBA (volumePath, quiet))
+ if (!CheckSysEncMountWithoutPBA (hwndDlg, volumePath, quiet))
return -1;
}
#endif
@@ -6291,14 +6291,14 @@ int MountVolume (HWND hwndDlg,
if (IsMountedVolume (volumePath))
{
if (!quiet)
- Error ("VOL_ALREADY_MOUNTED");
+ Error ("VOL_ALREADY_MOUNTED", hwndDlg);
return -1;
}
if (!IsDriveAvailable (driveNo))
{
if (!quiet)
- Error ("DRIVE_LETTER_UNAVAILABLE");
+ Error ("DRIVE_LETTER_UNAVAILABLE", hwndDlg);
return -1;
}
@@ -6431,7 +6431,7 @@ retry:
if (mount.bExclusiveAccess == FALSE)
{
if (!quiet)
- Error ("FILE_IN_USE_FAILED");
+ Error ("FILE_IN_USE_FAILED", hwndDlg);
return -1;
}
@@ -6444,7 +6444,7 @@ retry:
}
// Ask user
- if (IDYES == AskWarnNoYes ("FILE_IN_USE"))
+ if (IDYES == AskWarnNoYes ("FILE_IN_USE", hwndDlg))
{
mount.bExclusiveAccess = FALSE;
goto retry;
@@ -6491,7 +6491,7 @@ retry:
DWORD dwResult;
if (DeviceIoControl (hDriver, TC_IOCTL_OPEN_TEST, &openTestStruct, sizeof (OPEN_TEST_STRUCT), &openTestStruct, sizeof (OPEN_TEST_STRUCT), &dwResult, NULL) && openTestStruct.TCBootLoaderDetected)
- WarningDirect ((GetWrongPasswordErrorMessage (hwndDlg) + L"\n\n" + GetString ("HIDDEN_VOL_PROT_PASSWORD_US_KEYB_LAYOUT")).c_str());
+ WarningDirect ((GetWrongPasswordErrorMessage (hwndDlg) + L"\n\n" + GetString ("HIDDEN_VOL_PROT_PASSWORD_US_KEYB_LAYOUT")).c_str(), hwndDlg);
else
handleError (hwndDlg, mount.nReturnCode);
}
@@ -6515,7 +6515,7 @@ retry:
&& mount.UseBackupHeader)
{
if (bReportWrongPassword && !Silent)
- Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK");
+ Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK", hwndDlg);
}
LastMountedVolumeDirty = mount.FilesystemDirty;
@@ -6526,8 +6526,8 @@ retry:
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_VOLUME_DIRTY"), mountPoint);
- if (AskWarnYesNoStringTopmost (msg) == IDYES)
- CheckFilesystem (driveNo, TRUE);
+ if (AskWarnYesNoStringTopmost (msg, hwndDlg) == IDYES)
+ CheckFilesystem (hwndDlg, driveNo, TRUE);
}
if (mount.VolumeMountedReadOnlyAfterAccessDenied
@@ -6540,7 +6540,7 @@ retry:
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_CONTAINER_FORCED_READ_ONLY"), mountPoint);
- WarningDirect (msg);
+ WarningDirect (msg, hwndDlg);
}
if (mount.VolumeMountedReadOnlyAfterAccessDenied
@@ -6551,7 +6551,7 @@ retry:
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_DEVICE_FORCED_READ_ONLY"), mountPoint);
- WarningDirect (msg);
+ WarningDirect (msg, hwndDlg);
}
if (mount.VolumeMountedReadOnlyAfterDeviceWriteProtected
@@ -6562,11 +6562,11 @@ retry:
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_DEVICE_FORCED_READ_ONLY_WRITE_PROTECTION"), mountPoint);
- WarningDirect (msg);
+ WarningDirect (msg, hwndDlg);
if (CurrentOSMajor >= 6
&& strstr (volumePath, "\\Device\\HarddiskVolume") != volumePath
- && AskNoYes ("ASK_REMOVE_DEVICE_WRITE_PROTECTION") == IDYES)
+ && AskNoYes ("ASK_REMOVE_DEVICE_WRITE_PROTECTION", hwndDlg) == IDYES)
{
RemoveDeviceWriteProtection (hwndDlg, volumePath);
}
@@ -6607,7 +6607,7 @@ retry:
{
if (result == ERR_FILES_OPEN && !Silent)
{
- if (IDYES == AskWarnYesNoTopmost ("UNMOUNT_LOCK_FAILED"))
+ if (IDYES == AskWarnYesNoTopmost ("UNMOUNT_LOCK_FAILED", hwndDlg))
{
forced = TRUE;
goto retry;
@@ -6623,7 +6623,7 @@ retry:
return FALSE;
}
- Error ("UNMOUNT_FAILED");
+ Error ("UNMOUNT_FAILED", hwndDlg);
return FALSE;
}
@@ -6897,7 +6897,7 @@ __int64 GetStatsFreeSpaceOnPartition (const char *devicePath, float *percentFree
if (!silent)
{
handleWin32Error (MainDlg);
- Error ("CANNOT_CALC_SPACE");
+ Error ("CANNOT_CALC_SPACE", MainDlg);
}
return -1;
@@ -6915,7 +6915,7 @@ __int64 GetStatsFreeSpaceOnPartition (const char *devicePath, float *percentFree
if (!silent)
{
handleWin32Error (MainDlg);
- Error ("CANT_GET_VOLSIZE");
+ Error ("CANT_GET_VOLSIZE", MainDlg);
}
return -1;
}
@@ -7958,12 +7958,12 @@ void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *te
// Either of the pointers may be NULL
-void InfoBalloon (char *headingStringId, char *textStringId)
+void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd)
{
if (Silent)
return;
- TaskBarIconDisplayBalloonTooltip (MainDlg,
+ TaskBarIconDisplayBalloonTooltip (hwnd,
headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId),
textStringId == NULL ? L" " : GetString (textStringId),
FALSE);
@@ -7971,12 +7971,12 @@ void InfoBalloon (char *headingStringId, char *textStringId)
// Either of the pointers may be NULL
-void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString)
+void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd)
{
if (Silent)
return;
- TaskBarIconDisplayBalloonTooltip (MainDlg,
+ TaskBarIconDisplayBalloonTooltip (hwnd,
headingString == NULL ? L"VeraCrypt" : headingString,
textString == NULL ? L" " : textString,
FALSE);
@@ -7984,12 +7984,12 @@ void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString)
// Either of the pointers may be NULL
-void WarningBalloon (char *headingStringId, char *textStringId)
+void WarningBalloon (char *headingStringId, char *textStringId, HWND hwnd)
{
if (Silent)
return;
- TaskBarIconDisplayBalloonTooltip (MainDlg,
+ TaskBarIconDisplayBalloonTooltip (hwnd,
headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId),
textStringId == NULL ? L" " : GetString (textStringId),
TRUE);
@@ -7997,190 +7997,190 @@ void WarningBalloon (char *headingStringId, char *textStringId)
// Either of the pointers may be NULL
-void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString)
+void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd)
{
if (Silent)
return;
- TaskBarIconDisplayBalloonTooltip (MainDlg,
+ TaskBarIconDisplayBalloonTooltip (hwnd,
headingString == NULL ? L"VeraCrypt" : headingString,
textString == NULL ? L" " : textString,
TRUE);
}
-int Info (char *stringId)
+int Info (char *stringId, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONINFORMATION);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONINFORMATION);
}
-int InfoTopMost (char *stringId)
+int InfoTopMost (char *stringId, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
}
-int InfoDirect (const wchar_t *msg)
+int InfoDirect (const wchar_t *msg, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, msg, lpszTitle, MB_ICONINFORMATION);
+ return MessageBoxW (hwnd, msg, lpszTitle, MB_ICONINFORMATION);
}
-int Warning (char *stringId)
+int Warning (char *stringId, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING);
}
-int WarningTopMost (char *stringId)
+int WarningTopMost (char *stringId, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
-int WarningDirect (const wchar_t *warnMsg)
+int WarningDirect (const wchar_t *warnMsg, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, warnMsg, lpszTitle, MB_ICONWARNING);
+ return MessageBoxW (hwnd, warnMsg, lpszTitle, MB_ICONWARNING);
}
-int Error (char *stringId)
+int Error (char *stringId, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONERROR);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR);
}
-int ErrorTopMost (char *stringId)
+int ErrorTopMost (char *stringId, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
}
-int ErrorDirect (const wchar_t *errMsg)
+int ErrorDirect (const wchar_t *errMsg, HWND hwnd)
{
if (Silent) return 0;
- return MessageBoxW (MainDlg, errMsg, lpszTitle, MB_ICONERROR);
+ return MessageBoxW (hwnd, errMsg, lpszTitle, MB_ICONERROR);
}
-int AskYesNo (char *stringId)
+int AskYesNo (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1);
}
-int AskYesNoString (const wchar_t *str)
+int AskYesNoString (const wchar_t *str, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, str, lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, str, lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1);
}
-int AskYesNoTopmost (char *stringId)
+int AskYesNoTopmost (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
}
-int AskNoYes (char *stringId)
+int AskNoYes (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
}
-int AskOkCancel (char *stringId)
+int AskOkCancel (char *stringId, HWND hwnd)
{
if (Silent) return IDCANCEL;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_OKCANCEL | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_OKCANCEL | MB_DEFBUTTON1);
}
-int AskWarnYesNo (char *stringId)
+int AskWarnYesNo (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
}
-int AskWarnYesNoString (const wchar_t *string)
+int AskWarnYesNoString (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
}
-int AskWarnYesNoTopmost (char *stringId)
+int AskWarnYesNoTopmost (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
}
-int AskWarnYesNoStringTopmost (const wchar_t *string)
+int AskWarnYesNoStringTopmost (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
}
-int AskWarnNoYes (char *stringId)
+int AskWarnNoYes (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
}
-int AskWarnNoYesString (const wchar_t *string)
+int AskWarnNoYesString (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
+ return MessageBoxW (hwnd, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
}
-int AskWarnNoYesTopmost (char *stringId)
+int AskWarnNoYesTopmost (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 | MB_SETFOREGROUND | MB_TOPMOST);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 | MB_SETFOREGROUND | MB_TOPMOST);
}
-int AskWarnOkCancel (char *stringId)
+int AskWarnOkCancel (char *stringId, HWND hwnd)
{
if (Silent) return IDCANCEL;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON1);
}
-int AskWarnCancelOk (char *stringId)
+int AskWarnCancelOk (char *stringId, HWND hwnd)
{
if (Silent) return IDCANCEL;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2);
}
-int AskErrYesNo (char *stringId)
+int AskErrYesNo (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONERROR | MB_YESNO | MB_DEFBUTTON1);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_YESNO | MB_DEFBUTTON1);
}
-int AskErrNoYes (char *stringId)
+int AskErrNoYes (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
- return MessageBoxW (MainDlg, GetString (stringId), lpszTitle, MB_ICONERROR | MB_YESNO | MB_DEFBUTTON2);
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_YESNO | MB_DEFBUTTON2);
}
@@ -8191,7 +8191,7 @@ int AskErrNoYes (char *stringId)
// in any other cases where a string needs to be resolved before calling this function.
// If the returned value is 0, the user closed the dialog window without making a choice.
// If the user made a choice, the returned value is the ordinal number of the choice (1..MAX_MULTI_CHOICES)
-int AskMultiChoice (void *strings[], BOOL bBold)
+int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd)
{
MULTI_CHOICE_DLGPROC_PARAMS params;
@@ -8199,7 +8199,7 @@ int AskMultiChoice (void *strings[], BOOL bBold)
params.bold = bBold;
return DialogBoxParamW (hInst,
- MAKEINTRESOURCEW (IDD_MULTI_CHOICE_DLG), MainDlg,
+ MAKEINTRESOURCEW (IDD_MULTI_CHOICE_DLG), hwnd,
(DLGPROC) MultiChoiceDialogProc, (LPARAM) &params);
}
@@ -8227,7 +8227,7 @@ BOOL ConfigWriteBegin ()
}
-BOOL ConfigWriteEnd ()
+BOOL ConfigWriteEnd (HWND hwnd)
{
char *xml = ConfigBuffer;
char key[128], value[2048];
@@ -8249,7 +8249,7 @@ BOOL ConfigWriteEnd ()
TCFlushFile (ConfigFileHandle);
- CheckFileStreamWriteErrors (ConfigFileHandle, TC_APPD_FILENAME_CONFIGURATION);
+ CheckFileStreamWriteErrors (hwnd, ConfigFileHandle, TC_APPD_FILENAME_CONFIGURATION);
fclose (ConfigFileHandle);
ConfigFileHandle = NULL;
@@ -8354,7 +8354,7 @@ void OpenPageHelp (HWND hwndDlg, int nPage)
if (r == SE_ERR_NOASSOC)
{
- if (AskYesNo ("HELP_READER_ERROR") == IDYES)
+ if (AskYesNo ("HELP_READER_ERROR", MainDlg) == IDYES)
OpenOnlineHelp ();
}
}
@@ -8835,7 +8835,7 @@ char *RelativePath2Absolute (char *szFileName)
}
-void HandleDriveNotReadyError ()
+void HandleDriveNotReadyError (HWND hwnd)
{
HKEY hkey = 0;
DWORD value = 0, size = sizeof (DWORD);
@@ -8847,12 +8847,12 @@ void HandleDriveNotReadyError ()
if (RegQueryValueEx (hkey, "NoAutoMount", 0, 0, (LPBYTE) &value, &size) == ERROR_SUCCESS
&& value != 0)
{
- Warning ("SYS_AUTOMOUNT_DISABLED");
+ Warning ("SYS_AUTOMOUNT_DISABLED", hwnd);
}
else if (nCurrentOS == WIN_VISTA && CurrentOSServicePack < 1)
- Warning ("SYS_ASSIGN_DRIVE_LETTER");
+ Warning ("SYS_ASSIGN_DRIVE_LETTER", hwnd);
else
- Warning ("DEVICE_NOT_READY_ERROR");
+ Warning ("DEVICE_NOT_READY_ERROR", hwnd);
RegCloseKey (hkey);
}
@@ -9128,7 +9128,7 @@ void CloseVolume (OpenVolumeContext *context)
}
-int ReEncryptVolumeHeader (char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, BOOL wipeMode)
+int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, BOOL wipeMode)
{
CRYPTO_INFO *newCryptoInfo = NULL;
@@ -9139,7 +9139,7 @@ int ReEncryptVolumeHeader (char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Pa
UserEnrichRandomPool (NULL);
- int status = CreateVolumeHeaderInMemory (bBoot,
+ int status = CreateVolumeHeaderInMemory (hwndDlg, bBoot,
buffer,
cryptoInfo->ea,
cryptoInfo->mode,
@@ -9413,7 +9413,7 @@ static BOOL CALLBACK NewSecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPA
if (tokens.empty())
{
- Error ("NO_TOKENS_FOUND");
+ Error ("NO_TOKENS_FOUND", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
@@ -9711,7 +9711,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
throw SystemException ();
}
- Info ("KEYFILE_EXPORTED");
+ Info ("KEYFILE_EXPORTED", hwndDlg);
}
}
catch (Exception &e)
@@ -9724,7 +9724,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
case IDC_DELETE:
{
- if (AskNoYes ("CONFIRM_SEL_FILES_DELETE") == IDNO)
+ if (AskNoYes ("CONFIRM_SEL_FILES_DELETE", hwndDlg) == IDNO)
return 1;
try
@@ -9755,19 +9755,21 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
}
-BOOL InitSecurityTokenLibrary ()
+BOOL InitSecurityTokenLibrary (HWND hwndDlg)
{
if (SecurityTokenLibraryPath[0] == 0)
{
- Error ("NO_PKCS11_MODULE_SPECIFIED");
+ Error ("NO_PKCS11_MODULE_SPECIFIED", hwndDlg);
return FALSE;
}
struct PinRequestHandler : public GetPinFunctor
{
+ HWND m_hwnd;
+ PinRequestHandler(HWND hwnd) : m_hwnd(hwnd) {}
virtual void operator() (string &str)
{
- if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PASSWORD), MainDlg, (DLGPROC) SecurityTokenPasswordDlgProc, (LPARAM) &str) == IDCANCEL)
+ if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PASSWORD), m_hwnd, (DLGPROC) SecurityTokenPasswordDlgProc, (LPARAM) &str) == IDCANCEL)
throw UserAbort (SRC_POS);
if (hCursor != NULL)
@@ -9777,20 +9779,22 @@ BOOL InitSecurityTokenLibrary ()
struct WarningHandler : public SendExceptionFunctor
{
+ HWND m_hwnd;
+ WarningHandler(HWND hwnd) : m_hwnd(hwnd) {}
virtual void operator() (const Exception &e)
{
- e.Show (NULL);
+ e.Show (m_hwnd);
}
};
try
{
- SecurityToken::InitLibrary (SecurityTokenLibraryPath, auto_ptr <GetPinFunctor> (new PinRequestHandler), auto_ptr <SendExceptionFunctor> (new WarningHandler));
+ SecurityToken::InitLibrary (SecurityTokenLibraryPath, auto_ptr <GetPinFunctor> (new PinRequestHandler(hwndDlg)), auto_ptr <SendExceptionFunctor> (new WarningHandler(hwndDlg)));
}
catch (Exception &e)
{
- e.Show (NULL);
- Error ("PKCS11_MODULE_INIT_FAILED");
+ e.Show (hwndDlg);
+ Error ("PKCS11_MODULE_INIT_FAILED", hwndDlg);
return FALSE;
}
@@ -9973,12 +9977,12 @@ BOOL IsFileOnReadOnlyFilesystem (const char *path)
}
-void CheckFilesystem (int driveNo, BOOL fixErrors)
+void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors)
{
wchar_t msg[1024], param[1024], cmdPath[MAX_PATH];
char driveRoot[] = { 'A' + (char) driveNo, ':', 0 };
- if (fixErrors && AskWarnYesNo ("FILESYS_REPAIR_CONFIRM_BACKUP") == IDNO)
+ if (fixErrors && AskWarnYesNo ("FILESYS_REPAIR_CONFIRM_BACKUP", hwndDlg) == IDNO)
return;
StringCbPrintfW (msg, sizeof(msg), GetString (fixErrors ? "REPAIRING_FS" : "CHECKING_FS"), driveRoot);
@@ -10016,18 +10020,18 @@ BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *st
#ifndef SETUP
-int AskNonSysInPlaceEncryptionResume ()
+int AskNonSysInPlaceEncryptionResume (HWND hwndDlg)
{
- if (AskWarnYesNo ("NONSYS_INPLACE_ENC_RESUME_PROMPT") == IDYES)
+ if (AskWarnYesNo ("NONSYS_INPLACE_ENC_RESUME_PROMPT", hwndDlg) == IDYES)
return IDYES;
char *multiChoiceStr[] = { 0, "ASK_NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL", "DO_NOT_PROMPT_ME", "KEEP_PROMPTING_ME", 0 };
- switch (AskMultiChoice ((void **) multiChoiceStr, FALSE))
+ switch (AskMultiChoice ((void **) multiChoiceStr, FALSE, hwndDlg))
{
case 1:
RemoveNonSysInPlaceEncNotifications();
- Warning ("NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL_NOTE");
+ Warning ("NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL_NOTE", hwndDlg);
break;
default:
@@ -10068,7 +10072,7 @@ BOOL RemoveDeviceWriteProtection (HWND hwndDlg, char *devicePath)
fprintf (f, "@diskpart /s \"%s\"\n@pause\n@del \"%s\" \"%s\"", diskpartScript, diskpartScript, cmdBatch);
- CheckFileStreamWriteErrors (f, cmdBatch);
+ CheckFileStreamWriteErrors (hwndDlg, f, cmdBatch);
fclose (f);
f = fopen (diskpartScript, "w");
@@ -10086,7 +10090,7 @@ BOOL RemoveDeviceWriteProtection (HWND hwndDlg, char *devicePath)
fprintf (f, "exit\n");
- CheckFileStreamWriteErrors (f, diskpartScript);
+ CheckFileStreamWriteErrors (hwndDlg, f, diskpartScript);
fclose (f);
ShellExecute (NULL, (!IsAdmin() && IsUacSupported()) ? "runas" : "open", cmdBatch, NULL, NULL, SW_SHOW);
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index b3ec7501..5af52b15 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -285,7 +285,7 @@ BOOL LoadSysEncSettings (HWND hwndDlg);
int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm);
void RemoveNonSysInPlaceEncNotifications (void);
void SavePostInstallTasksSettings (int command);
-void DoPostInstallTasks (void);
+void DoPostInstallTasks (HWND hwndDlg);
void InitOSVersionInfo ();
void InitApp ( HINSTANCE hInstance, char *lpszCommandLine );
void InitHelpFileName (void);
@@ -309,7 +309,7 @@ void ResetCurrentDirectory ();
BOOL BrowseFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter);
BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, char *dirName);
void handleError ( HWND hwndDlg , int code );
-BOOL CheckFileStreamWriteErrors (FILE *file, const char *fileName);
+BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const char *fileName);
void LocalizeDialog ( HWND hwnd, char *stringId );
void OpenVolumeExplorerWindow (int driveNo);
static BOOL CALLBACK CloseVolumeExplorerWindowsEnum( HWND hwnd, LPARAM driveNo);
@@ -374,38 +374,38 @@ char *GetProgramConfigPath (char *fileName);
char GetSystemDriveLetter (void);
void OpenPageHelp (HWND hwndDlg, int nPage);
void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *text, BOOL warning);
-void InfoBalloon (char *headingStringId, char *textStringId);
-void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString);
-void WarningBalloon (char *headingStringId, char *textStringId);
-void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString);
-int Info (char *stringId);
-int InfoTopMost (char *stringId);
-int InfoDirect (const wchar_t *msg);
-int Warning (char *stringId);
-int WarningTopMost (char *stringId);
-int WarningDirect (const wchar_t *warnMsg);
-int Error (char *stringId);
-int ErrorDirect (const wchar_t *errMsg);
-int ErrorTopMost (char *stringId);
-int AskYesNo (char *stringId);
-int AskYesNoString (const wchar_t *str);
-int AskYesNoTopmost (char *stringId);
-int AskNoYes (char *stringId);
-int AskOkCancel (char *stringId);
-int AskWarnYesNo (char *stringId);
-int AskWarnYesNoString (const wchar_t *string);
-int AskWarnYesNoTopmost (char *stringId);
-int AskWarnYesNoStringTopmost (const wchar_t *string);
-int AskWarnNoYes (char *stringId);
-int AskWarnNoYesString (const wchar_t *string);
-int AskWarnNoYesTopmost (char *stringId);
-int AskWarnOkCancel (char *stringId);
-int AskWarnCancelOk (char *stringId);
-int AskErrYesNo (char *stringId);
-int AskErrNoYes (char *stringId);
-int AskMultiChoice (void *strings[], BOOL bBold);
+void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd);
+void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd);
+void WarningBalloon (char *headingStringId, char *textStringId, HWND hwnd);
+void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd);
+int Info (char *stringId, HWND hwnd);
+int InfoTopMost (char *stringId, HWND hwnd);
+int InfoDirect (const wchar_t *msg, HWND hwnd);
+int Warning (char *stringId, HWND hwnd);
+int WarningTopMost (char *stringId, HWND hwnd);
+int WarningDirect (const wchar_t *warnMsg, HWND hwnd);
+int Error (char *stringId, HWND hwnd);
+int ErrorDirect (const wchar_t *errMsg, HWND hwnd);
+int ErrorTopMost (char *stringId, HWND hwnd);
+int AskYesNo (char *stringId, HWND hwnd);
+int AskYesNoString (const wchar_t *str, HWND hwnd);
+int AskYesNoTopmost (char *stringId, HWND hwnd);
+int AskNoYes (char *stringId, HWND hwnd);
+int AskOkCancel (char *stringId, HWND hwnd);
+int AskWarnYesNo (char *stringId, HWND hwnd);
+int AskWarnYesNoString (const wchar_t *string, HWND hwnd);
+int AskWarnYesNoTopmost (char *stringId, HWND hwnd);
+int AskWarnYesNoStringTopmost (const wchar_t *string, HWND hwnd);
+int AskWarnNoYes (char *stringId, HWND hwnd);
+int AskWarnNoYesString (const wchar_t *string, HWND hwnd);
+int AskWarnNoYesTopmost (char *stringId, HWND hwnd);
+int AskWarnOkCancel (char *stringId, HWND hwnd);
+int AskWarnCancelOk (char *stringId, HWND hwnd);
+int AskErrYesNo (char *stringId, HWND hwnd);
+int AskErrNoYes (char *stringId, HWND hwnd);
+int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd);
BOOL ConfigWriteBegin ();
-BOOL ConfigWriteEnd ();
+BOOL ConfigWriteEnd (HWND hwnd);
BOOL ConfigWriteString (char *configKey, char *configValue);
BOOL ConfigWriteInt (char *configKey, int configValue);
int ConfigReadInt (char *configKey, int defaultValue);
@@ -423,7 +423,7 @@ BOOL EnableWow64FsRedirection (BOOL enable);
BOOL RestartComputer (void);
void Applink (char *dest, BOOL bSendOS, char *extraOutput);
char *RelativePath2Absolute (char *szFileName);
-void HandleDriveNotReadyError ();
+void HandleDriveNotReadyError (HWND hwnd);
BOOL CALLBACK CloseTCWindowsEnum( HWND hwnd, LPARAM lParam);
BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam);
BYTE *MapResource (char *resourceType, int resourceId, PDWORD size);
@@ -449,18 +449,18 @@ BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
BOOL DoDriverInstall (HWND hwndDlg);
int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
void CloseVolume (OpenVolumeContext *context);
-int ReEncryptVolumeHeader (char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, BOOL wipeMode);
+int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, BOOL wipeMode);
BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
BOOL IsPagingFileWildcardActive ();
BOOL DisablePagingFile ();
BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-BOOL InitSecurityTokenLibrary ();
+BOOL InitSecurityTokenLibrary (HWND hwndDlg);
BOOL FileHasReadOnlyAttribute (const char *path);
BOOL IsFileOnReadOnlyFilesystem (const char *path);
-void CheckFilesystem (int driveNo, BOOL fixErrors);
+void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors);
BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str);
-int AskNonSysInPlaceEncryptionResume ();
+int AskNonSysInPlaceEncryptionResume (HWND hwndDlg);
BOOL RemoveDeviceWriteProtection (HWND hwndDlg, char *devicePath);
void EnableElevatedCursorChange (HWND parent);
BOOL DisableFileCompression (HANDLE file);
diff --git a/src/Common/Exception.h b/src/Common/Exception.h
index e034404b..e5d4fd4c 100644
--- a/src/Common/Exception.h
+++ b/src/Common/Exception.h
@@ -40,9 +40,9 @@ namespace VeraCrypt
void Show (HWND parent) const
{
if (ErrMsg.empty())
- ::Error (ErrLangId? ErrLangId : "");
+ ::Error (ErrLangId? ErrLangId : "", parent);
else
- ::ErrorDirect (ErrMsg.c_str());
+ ::ErrorDirect (ErrMsg.c_str(), parent);
}
char *ErrLangId;
@@ -65,7 +65,7 @@ namespace VeraCrypt
struct TimeOut : public Exception
{
TimeOut (const char *srcPos) { }
- void Show (HWND parent) const { ErrorDirect (L"Timeout"); }
+ void Show (HWND parent) const { ErrorDirect (L"Timeout", parent); }
};
struct UserAbort : public Exception
diff --git a/src/Common/Fat.c b/src/Common/Fat.c
index 6a2c77db..b6138528 100644
--- a/src/Common/Fat.c
+++ b/src/Common/Fat.c
@@ -253,7 +253,7 @@ static void PutFSInfo (unsigned char *sector, fatparams *ft)
int
-FormatFat (unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat)
+FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat)
{
int write_buf_cnt = 0;
char sector[TC_MAX_VOLUME_SECTOR_SIZE], *write_buf;
@@ -261,6 +261,7 @@ FormatFat (unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INF
int x, n;
int retVal;
char temporaryKey[MASTER_KEYDATA_SIZE];
+ HWND hwndDlg = (HWND) hwndDlgPtr;
LARGE_INTEGER startOffset;
LARGE_INTEGER newOffset;
@@ -281,7 +282,7 @@ FormatFat (unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INF
memset (sector, 0, ft->sector_size);
- RandgetBytes (ft->volume_id, sizeof (ft->volume_id), FALSE);
+ RandgetBytes (hwndDlg, ft->volume_id, sizeof (ft->volume_id), FALSE);
PutBoot (ft, (unsigned char *) sector);
if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
@@ -399,11 +400,11 @@ FormatFat (unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INF
within the volume). */
// Temporary master key
- if (!RandgetBytes (temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE))
+ if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE))
goto fail;
// Temporary secondary key (XTS mode)
- if (!RandgetBytes (cryptoInfo->k2, sizeof cryptoInfo->k2, FALSE))
+ if (!RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof cryptoInfo->k2, FALSE))
goto fail;
retVal = EAInit (cryptoInfo->ea, temporaryKey, cryptoInfo->ks);
diff --git a/src/Common/Fat.h b/src/Common/Fat.h
index 164fe855..59c993b3 100644
--- a/src/Common/Fat.h
+++ b/src/Common/Fat.h
@@ -64,4 +64,4 @@ struct msdos_boot_sector
void GetFatParams ( fatparams *ft );
void PutBoot ( fatparams *ft , unsigned char *boot );
-int FormatFat (unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat);
+int FormatFat (void* hwndDlg, unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat);
diff --git a/src/Common/Format.c b/src/Common/Format.c
index c7198f60..3b7a8127 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -93,6 +93,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
uint64 dataOffset, dataAreaSize;
LARGE_INTEGER offset;
BOOL bFailedRequiredDASD = FALSE;
+ HWND hwndDlg = volParams->hwndDlg;
FormatSectorSize = volParams->sectorSize;
@@ -100,7 +101,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|| FormatSectorSize > TC_MAX_VOLUME_SECTOR_SIZE
|| FormatSectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0)
{
- Error ("SECTOR_SIZE_UNSUPPORTED");
+ Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg);
return ERR_DONT_REPORT;
}
@@ -139,7 +140,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
VirtualLock (header, sizeof (header));
- nStatus = CreateVolumeHeaderInMemory (FALSE,
+ nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
header,
volParams->ea,
FIRST_MODE_OF_OPERATION_ID,
@@ -179,7 +180,7 @@ begin_format:
{
if ((dev = DismountDrive (devName, volParams->volumePath)) == INVALID_HANDLE_VALUE)
{
- Error ("FORMAT_CANT_DISMOUNT_FILESYS");
+ Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto error;
}
@@ -285,7 +286,7 @@ begin_format:
else
{
handleWin32Error (volParams->hwndDlg);
- Error ("CANT_ACCESS_VOL");
+ Error ("CANT_ACCESS_VOL", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto error;
}
@@ -317,7 +318,7 @@ begin_format:
if (DeviceIoControl (dev, FSCTL_IS_VOLUME_MOUNTED, NULL, 0, NULL, 0, &dwResult, NULL))
{
- Error ("FORMAT_CANT_DISMOUNT_FILESYS");
+ Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto error;
}
@@ -474,7 +475,7 @@ begin_format:
goto error;
}
- nStatus = FormatNoFs (startSector, num_sectors, dev, cryptoInfo, volParams->quickFormat);
+ nStatus = FormatNoFs (hwndDlg, startSector, num_sectors, dev, cryptoInfo, volParams->quickFormat);
if (volParams->bDevice)
StopFormatWriteThread();
@@ -507,7 +508,7 @@ begin_format:
goto error;
}
- nStatus = FormatFat (startSector, &ft, (void *) dev, cryptoInfo, volParams->quickFormat);
+ nStatus = FormatFat (hwndDlg, startSector, &ft, (void *) dev, cryptoInfo, volParams->quickFormat);
if (volParams->bDevice)
StopFormatWriteThread();
@@ -531,7 +532,7 @@ begin_format:
goto error;
}
- nStatus = CreateVolumeHeaderInMemory (FALSE,
+ nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
header,
volParams->ea,
FIRST_MODE_OF_OPERATION_ID,
@@ -557,7 +558,7 @@ begin_format:
// Fill reserved header sectors (including the backup header area) with random data
if (!volParams->hiddenVol)
{
- nStatus = WriteRandomDataToReservedHeaderAreas (dev, cryptoInfo, dataAreaSize, FALSE, FALSE);
+ nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, dataAreaSize, FALSE, FALSE);
if (nStatus != ERR_SUCCESS)
goto error;
@@ -643,7 +644,7 @@ error:
if (dataAreaSize <= TC_MAX_FAT_SECTOR_COUNT * FormatSectorSize)
{
- if (AskErrYesNo ("FORMAT_NTFS_FAILED_ASK_FAT") == IDYES)
+ if (AskErrYesNo ("FORMAT_NTFS_FAILED_ASK_FAT", hwndDlg) == IDYES)
{
// NTFS format failed and the user wants to try FAT format immediately
volParams->fileSystem = FILESYS_FAT;
@@ -654,7 +655,7 @@ error:
}
}
else
- Error ("FORMAT_NTFS_FAILED");
+ Error ("FORMAT_NTFS_FAILED", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto fv_end;
@@ -677,7 +678,7 @@ fv_end:
}
-int FormatNoFs (unsigned __int64 startSector, __int64 num_sectors, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat)
+int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat)
{
int write_buf_cnt = 0;
char sector[TC_MAX_VOLUME_SECTOR_SIZE], *write_buf;
@@ -719,11 +720,11 @@ int FormatNoFs (unsigned __int64 startSector, __int64 num_sectors, void * dev, P
deniability of hidden volumes. */
// Temporary master key
- if (!RandgetBytes (temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE))
+ if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE))
goto fail;
// Temporary secondary key (XTS mode)
- if (!RandgetBytes (cryptoInfo->k2, sizeof cryptoInfo->k2, FALSE))
+ if (!RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof cryptoInfo->k2, FALSE))
goto fail;
retVal = EAInit (cryptoInfo->ea, temporaryKey, cryptoInfo->ks);
diff --git a/src/Common/Format.h b/src/Common/Format.h
index 9de90025..3422fecf 100644
--- a/src/Common/Format.h
+++ b/src/Common/Format.h
@@ -51,7 +51,7 @@ extern int FormatWriteBufferSize;
int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams);
BOOL FormatNtfs (int driveNo, int clusterSize);
uint64 GetVolumeDataAreaSize (BOOL hiddenVolume, uint64 volumeSize);
-int FormatNoFs (unsigned __int64 startSector, __int64 num_sectors, void *dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat);
+int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors, void *dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat);
BOOL WriteSector ( void *dev , char *sector , char *write_buf , int *write_buf_cnt , __int64 *nSecNo , PCRYPTO_INFO cryptoInfo );
BOOL FlushFormatWriteBuffer (void *dev, char *write_buf, int *write_buf_cnt, __int64 *nSecNo, PCRYPTO_INFO cryptoInfo);
static BOOL StartFormatWriteThread ();
diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c
index 88ab5ece..cb36a146 100644
--- a/src/Common/Keyfiles.c
+++ b/src/Common/Keyfiles.c
@@ -218,7 +218,7 @@ close:
}
-BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
+BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile)
{
BOOL status = TRUE;
KeyFile kfSubStruct;
@@ -252,8 +252,8 @@ BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
if (keyfileData.empty())
{
SetLastError (ERROR_HANDLE_EOF);
- handleWin32Error (MainDlg);
- Error ("ERR_PROCESS_KEYFILE");
+ handleWin32Error (hwndDlg);
+ Error ("ERR_PROCESS_KEYFILE", hwndDlg);
status = FALSE;
continue;
}
@@ -291,8 +291,8 @@ BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
// Determine whether it's a path or a file
if (stat (kf->FileName, &statStruct) != 0)
{
- handleWin32Error (MainDlg);
- Error ("ERR_PROCESS_KEYFILE");
+ handleWin32Error (hwndDlg);
+ Error ("ERR_PROCESS_KEYFILE", hwndDlg);
status = FALSE;
continue;
}
@@ -305,8 +305,8 @@ BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
StringCbPrintfA (searchPath, sizeof (searchPath), "%s\\*.*", kf->FileName);
if ((searchHandle = _findfirst (searchPath, &fBuf)) == -1)
{
- handleWin32Error (MainDlg);
- Error ("ERR_PROCESS_KEYFILE_PATH");
+ handleWin32Error (hwndDlg);
+ Error ("ERR_PROCESS_KEYFILE_PATH", hwndDlg);
status = FALSE;
continue;
}
@@ -323,8 +323,8 @@ BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
// Determine whether it's a path or a file
if (stat (kfSub->FileName, &statStruct) != 0)
{
- handleWin32Error (MainDlg);
- Error ("ERR_PROCESS_KEYFILE");
+ handleWin32Error (hwndDlg);
+ Error ("ERR_PROCESS_KEYFILE", hwndDlg);
status = FALSE;
continue;
}
@@ -347,8 +347,8 @@ BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
// Apply keyfile to the pool
if (!KeyFileProcess (keyPool, kfSub))
{
- handleWin32Error (MainDlg);
- Error ("ERR_PROCESS_KEYFILE");
+ handleWin32Error (hwndDlg);
+ Error ("ERR_PROCESS_KEYFILE", hwndDlg);
status = FALSE;
}
@@ -359,15 +359,15 @@ BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile)
if (keyfileCount == 0)
{
- ErrorDirect ((wstring (GetString ("ERR_KEYFILE_PATH_EMPTY")) + L"\n\n" + SingleStringToWide (kf->FileName)).c_str());
+ ErrorDirect ((wstring (GetString ("ERR_KEYFILE_PATH_EMPTY")) + L"\n\n" + SingleStringToWide (kf->FileName)).c_str(), hwndDlg);
status = FALSE;
}
}
// Apply keyfile to the pool
else if (!KeyFileProcess (keyPool, kf))
{
- handleWin32Error (MainDlg);
- Error ("ERR_PROCESS_KEYFILE");
+ handleWin32Error (hwndDlg);
+ Error ("ERR_PROCESS_KEYFILE", hwndDlg);
status = FALSE;
}
}
diff --git a/src/Common/Keyfiles.h b/src/Common/Keyfiles.h
index 9ba5b6e8..40441141 100644
--- a/src/Common/Keyfiles.h
+++ b/src/Common/Keyfiles.h
@@ -34,7 +34,7 @@ KeyFile *KeyFileAdd (KeyFile *firstKeyFile, KeyFile *keyFile);
void KeyFileRemoveAll (KeyFile **firstKeyFile);
KeyFile *KeyFileClone (KeyFile *keyFile);
KeyFile *KeyFileCloneAll (KeyFile *firstKeyFile);
-BOOL KeyFilesApply (Password *password, KeyFile *firstKeyFile);
+BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile);
BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *dialogParam);
diff --git a/src/Common/Password.c b/src/Common/Password.c
index e5e9f9d8..db7ad7f7 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -341,7 +341,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, Pas
for (wipePass = 0; wipePass < wipePassCount; wipePass++)
{
// Prepare new volume header
- nStatus = CreateVolumeHeaderInMemory (FALSE,
+ nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
buffer,
cryptoInfo->ea,
cryptoInfo->mode,
@@ -383,7 +383,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, Pas
&& (cryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& (cryptoInfo->HeaderFlags & ~TC_HEADER_FLAG_NONSYS_INPLACE_ENC) == 0)
{
- nStatus = WriteRandomDataToReservedHeaderAreas (dev, cryptoInfo, cryptoInfo->VolumeSize.Value, !backupHeader, backupHeader);
+ nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, cryptoInfo->VolumeSize.Value, !backupHeader, backupHeader);
if (nStatus != ERR_SUCCESS)
goto error;
}
diff --git a/src/Common/Random.c b/src/Common/Random.c
index f7379685..cd85957f 100644
--- a/src/Common/Random.c
+++ b/src/Common/Random.c
@@ -317,14 +317,14 @@ void RandaddBuf (void *buf, int len)
}
}
-BOOL RandpeekBytes (unsigned char *buf, int len)
+BOOL RandpeekBytes (void* hwndDlg, unsigned char *buf, int len)
{
if (!bRandDidInit)
return FALSE;
if (len > RNG_POOL_SIZE)
{
- Error ("ERR_NOT_ENOUGH_RANDOM_DATA");
+ Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
len = RNG_POOL_SIZE;
}
@@ -337,16 +337,16 @@ BOOL RandpeekBytes (unsigned char *buf, int len)
/* Get len random bytes from the pool (max. RNG_POOL_SIZE bytes per a single call) */
-BOOL RandgetBytes (unsigned char *buf, int len, BOOL forceSlowPoll)
+BOOL RandgetBytes (void* hwndDlg, unsigned char *buf, int len, BOOL forceSlowPoll)
{
- return RandgetBytesFull (buf, len, forceSlowPoll, FALSE);
+ return RandgetBytesFull (hwndDlg, buf, len, forceSlowPoll, FALSE);
}
/* Get len random bytes from the pool.
* If allowAnyLength is FALSE, then len must be less or equal to RNG_POOL_SIZE
* If allowAnyLength is TRUE, then len can have any positive value
*/
-BOOL RandgetBytesFull ( unsigned char *buf , int len, BOOL forceSlowPoll , BOOL allowAnyLength)
+BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceSlowPoll , BOOL allowAnyLength)
{
int i, looplen;
BOOL ret = TRUE;
@@ -370,7 +370,7 @@ BOOL RandgetBytesFull ( unsigned char *buf , int len, BOOL forceSlowPoll , BOOL
/* There's never more than RNG_POOL_SIZE worth of randomess */
if ( (!allowAnyLength) && (len > RNG_POOL_SIZE))
{
- Error ("ERR_NOT_ENOUGH_RANDOM_DATA");
+ Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
len = RNG_POOL_SIZE;
LeaveCriticalSection (&critRandProt);
return FALSE;
diff --git a/src/Common/Random.h b/src/Common/Random.h
index 1a3a51d8..72427e07 100644
--- a/src/Common/Random.h
+++ b/src/Common/Random.h
@@ -43,16 +43,16 @@ BOOL Randmix ( void );
void RandaddBuf ( void *buf , int len );
BOOL FastPoll ( void );
BOOL SlowPoll ( void );
-BOOL RandpeekBytes ( unsigned char *buf , int len );
+BOOL RandpeekBytes ( void* hwndDlg, unsigned char *buf , int len );
/* Get len random bytes from the pool (max. RNG_POOL_SIZE bytes per a single call) */
-BOOL RandgetBytes ( unsigned char *buf , int len, BOOL forceSlowPoll );
+BOOL RandgetBytes ( void* hwndDlg, unsigned char *buf , int len, BOOL forceSlowPoll );
/* Get len random bytes from the pool.
* If allowAnyLength is FALSE, then len must be less or equal to RNG_POOL_SIZE
* If allowAnyLength is TRUE, then len can have any positive value
*/
-BOOL RandgetBytesFull ( unsigned char *buf , int len, BOOL forceSlowPoll , BOOL allowAnyLength);
+BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceSlowPoll , BOOL allowAnyLength);
#ifdef _WIN32
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index 061d96fe..e8fb275b 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -701,7 +701,7 @@ namespace VeraCrypt
}
wchar_t err[8192];
wsprintfW (err, L"%s:\n\n%hs%s", GetString ("SECURITY_TOKEN_ERROR"), errorString.c_str(), subjectErrorCode.str().c_str());
- ErrorDirect (err);
+ ErrorDirect (err, parent);
}
else
{
@@ -710,7 +710,7 @@ namespace VeraCrypt
if (SubjectErrorCodeValid)
err += L"\n\nError code" + subjectErrorCode.str();
- ErrorDirect (err.c_str());
+ ErrorDirect (err.c_str(), parent);
}
}
}
diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h
index 8cad17c1..074bc1b9 100644
--- a/src/Common/SecurityToken.h
+++ b/src/Common/SecurityToken.h
@@ -133,22 +133,22 @@ namespace VeraCrypt
struct SecurityTokenLibraryNotInitialized : public Exception
{
- void Show (HWND parent) const { Error (SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED"); }
+ void Show (HWND parent) const { Error (SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED", parent); }
};
struct InvalidSecurityTokenKeyfilePath : public Exception
{
- void Show (HWND parent) const { Error ("INVALID_TOKEN_KEYFILE_PATH"); }
+ void Show (HWND parent) const { Error ("INVALID_TOKEN_KEYFILE_PATH", parent); }
};
struct SecurityTokenKeyfileAlreadyExists : public Exception
{
- void Show (HWND parent) const { Error ("TOKEN_KEYFILE_ALREADY_EXISTS"); }
+ void Show (HWND parent) const { Error ("TOKEN_KEYFILE_ALREADY_EXISTS", parent); }
};
struct SecurityTokenKeyfileNotFound : public Exception
{
- void Show (HWND parent) const { Error ("TOKEN_KEYFILE_NOT_FOUND"); }
+ void Show (HWND parent) const { Error ("TOKEN_KEYFILE_NOT_FOUND", parent); }
};
#endif // !TC_HEADER_Platform_Exception
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index c88e81d8..4e7bd0e3 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -718,7 +718,7 @@ ret:
#endif
// Creates a volume header in memory
-int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Password *password,
+int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, int mode, Password *password,
int pkcs5_prf, char *masterKeydata, PCRYPTO_INFO *retInfo,
unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize,
unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode)
@@ -756,7 +756,7 @@ int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Pass
bytesNeeded = EAGetKeySize (ea) * 2; // Size of primary + secondary key(s)
}
- if (!RandgetBytes (keyInfo.master_keydata, bytesNeeded, TRUE))
+ if (!RandgetBytes (hwndDlg, keyInfo.master_keydata, bytesNeeded, TRUE))
return ERR_CIPHER_INIT_WEAK_KEY;
}
else
@@ -780,7 +780,7 @@ int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Pass
cryptoInfo->mode = mode;
// Salt for header key derivation
- if (!RandgetBytes (keyInfo.salt, PKCS5_SALT_SIZE, !bWipeMode))
+ if (!RandgetBytes (hwndDlg, keyInfo.salt, PKCS5_SALT_SIZE, !bWipeMode))
return ERR_CIPHER_INIT_WEAK_KEY;
// PBKDF2 (PKCS5) is used to derive primary header key(s) and secondary header key(s) (XTS) from the password/keyfiles
@@ -1075,7 +1075,7 @@ BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header)
// Writes randomly generated data to unused/reserved header areas.
// When bPrimaryOnly is TRUE, then only the primary header area (not the backup header area) is filled with random data.
// When bBackupOnly is TRUE, only the backup header area (not the primary header area) is filled with random data.
-int WriteRandomDataToReservedHeaderAreas (HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly)
+int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly)
{
char temporaryKey[MASTER_KEYDATA_SIZE];
char originalK2[MASTER_KEYDATA_SIZE];
@@ -1096,8 +1096,8 @@ int WriteRandomDataToReservedHeaderAreas (HANDLE dev, CRYPTO_INFO *cryptoInfo, u
while (TRUE)
{
// Temporary keys
- if (!RandgetBytes (temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE)
- || !RandgetBytes (cryptoInfo->k2, sizeof (cryptoInfo->k2), FALSE))
+ if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE)
+ || !RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof (cryptoInfo->k2), FALSE))
{
nStatus = ERR_PARAMETER_INCORRECT;
goto final_seq;
diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h
index 18a52692..2d0b7d5d 100644
--- a/src/Common/Volumes.h
+++ b/src/Common/Volumes.h
@@ -133,10 +133,10 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
#endif
#if !defined (DEVICE_DRIVER) && !defined (TC_WINDOWS_BOOT)
-int CreateVolumeHeaderInMemory (BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode);
+int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode);
BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DWORD *bytesRead);
BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header);
-int WriteRandomDataToReservedHeaderAreas (HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly);
+int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly);
#endif
#endif // !TC_HEADER_Volume_VolumeHeader
diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c
index 8c07fd8e..80c6a82e 100644
--- a/src/Format/InPlace.c
+++ b/src/Format/InPlace.c
@@ -87,7 +87,7 @@ static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const char *devicePath, in
}
-BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
+BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath, BOOL silent)
{
NTFS_VOLUME_DATA_BUFFER ntfsVolData;
DWORD nBytesReturned;
@@ -110,7 +110,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
if (CurrentOSMajor < 6)
{
if (!silent)
- ShowInPlaceEncErrMsgWAltSteps ("OS_NOT_SUPPORTED_FOR_NONSYS_INPLACE_ENC", FALSE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "OS_NOT_SUPPORTED_FOR_NONSYS_INPLACE_ENC", FALSE);
return FALSE;
}
@@ -122,7 +122,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
&& sscanf (devicePath, "\\Device\\Harddisk%d\\Partition%d", &driveNumber, &partitionNumber) != 2)
{
if (!silent)
- Error ("INPLACE_ENC_INVALID_PATH");
+ Error ("INPLACE_ENC_INVALID_PATH", hwndDlg);
return FALSE;
}
@@ -130,7 +130,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
if (partitionNumber == 0)
{
if (!silent)
- Warning ("RAW_DEV_NOT_SUPPORTED_FOR_INPLACE_ENC");
+ Warning ("RAW_DEV_NOT_SUPPORTED_FOR_INPLACE_ENC", hwndDlg);
return FALSE;
}
@@ -144,7 +144,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
// status can be ignored). In case the IsAdmin() detection somehow fails, we allow the user to continue.
if (!silent)
- Warning ("ADMIN_PRIVILEGES_WARN_DEVICES");
+ Warning ("ADMIN_PRIVILEGES_WARN_DEVICES", hwndDlg);
}
@@ -165,13 +165,13 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
{
if (!silent)
{
- handleWin32Error (MainDlg);
- Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL");
+ handleWin32Error (hwndDlg);
+ Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL", hwndDlg);
}
return FALSE;
}
- dev = OpenPartitionVolume (devName,
+ dev = OpenPartitionVolume (hwndDlg, devName,
FALSE, // Do not require exclusive access
TRUE, // Require shared access (must be TRUE; otherwise, volume properties will not be possible to obtain)
FALSE, // Do not ask the user to confirm shared access (if exclusive fails)
@@ -205,9 +205,9 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
// is dismounted).
if (IsDeviceMounted (devName))
- ShowInPlaceEncErrMsgWAltSteps ("ONLY_NTFS_SUPPORTED_FOR_NONSYS_INPLACE_ENC", FALSE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "ONLY_NTFS_SUPPORTED_FOR_NONSYS_INPLACE_ENC", FALSE);
else
- Warning ("ONLY_MOUNTED_VOL_SUPPORTED_FOR_NONSYS_INPLACE_ENC");
+ Warning ("ONLY_MOUNTED_VOL_SUPPORTED_FOR_NONSYS_INPLACE_ENC", hwndDlg);
}
CloseHandle (dev);
@@ -222,7 +222,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
{
// Cannot determine whether shrinking is required
if (!silent)
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
CloseHandle (dev);
return FALSE;
@@ -236,7 +236,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
{
// Cannot determine the size of the partition
if (!silent)
- Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL");
+ Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL", hwndDlg);
CloseHandle (dev);
return FALSE;
@@ -247,7 +247,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
// The partition is too small
if (!silent)
{
- ShowInPlaceEncErrMsgWAltSteps ("PARTITION_TOO_SMALL_FOR_NONSYS_INPLACE_ENC", FALSE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "PARTITION_TOO_SMALL_FOR_NONSYS_INPLACE_ENC", FALSE);
}
CloseHandle (dev);
@@ -267,7 +267,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
NULL))
{
if (!silent)
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL", TRUE);
CloseHandle (dev);
return FALSE;
@@ -276,7 +276,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
if (ntfsVolData.FreeClusters.QuadPart * ntfsVolData.BytesPerCluster < TC_TOTAL_VOLUME_HEADERS_SIZE)
{
if (!silent)
- ShowInPlaceEncErrMsgWAltSteps ("NOT_ENOUGH_FREE_FILESYS_SPACE_FOR_SHRINK", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "NOT_ENOUGH_FREE_FILESYS_SPACE_FOR_SHRINK", TRUE);
CloseHandle (dev);
return FALSE;
@@ -289,7 +289,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent)
|| ntfsVolData.BytesPerSector % ENCRYPTION_DATA_UNIT_SIZE != 0)
{
if (!silent)
- ShowInPlaceEncErrMsgWAltSteps ("SECTOR_SIZE_UNSUPPORTED", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "SECTOR_SIZE_UNSUPPORTED", TRUE);
CloseHandle (dev);
return FALSE;
@@ -319,11 +319,12 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
__int64 deviceSize;
LARGE_INTEGER offset;
DWORD dwResult;
+ HWND hwndDlg = volParams->hwndDlg;
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_PREPARING);
- if (!CheckRequirementsForNonSysInPlaceEnc (volParams->volumePath, FALSE))
+ if (!CheckRequirementsForNonSysInPlaceEnc (hwndDlg, volParams->volumePath, FALSE))
return ERR_DONT_REPORT;
@@ -343,7 +344,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
if (deviceSize < TC_NONSYS_INPLACE_ENC_MIN_VOL_SIZE)
{
- ShowInPlaceEncErrMsgWAltSteps ("PARTITION_TOO_SMALL_FOR_NONSYS_INPLACE_ENC", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "PARTITION_TOO_SMALL_FOR_NONSYS_INPLACE_ENC", TRUE);
nStatus = ERR_DONT_REPORT;
goto closing_seq;
}
@@ -364,7 +365,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
if (IsDeviceMounted (devName))
{
- dev = OpenPartitionVolume (devName,
+ dev = OpenPartitionVolume (hwndDlg, devName,
FALSE, // Do not require exclusive access (must be FALSE; otherwise, it will not be possible to dismount the volume or obtain its properties and FSCTL_ALLOW_EXTENDED_DASD_IO will fail too)
TRUE, // Require shared access (must be TRUE; otherwise, it will not be possible to dismount the volume or obtain its properties and FSCTL_ALLOW_EXTENDED_DASD_IO will fail too)
FALSE, // Do not ask the user to confirm shared access (if exclusive fails)
@@ -380,7 +381,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
else
{
// The volume is not mounted so we can't work with the filesystem.
- Error ("ONLY_MOUNTED_VOL_SUPPORTED_FOR_NONSYS_INPLACE_ENC");
+ Error ("ONLY_MOUNTED_VOL_SUPPORTED_FOR_NONSYS_INPLACE_ENC", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto closing_seq;
}
@@ -398,7 +399,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
NULL))
{
handleWin32Error (MainDlg);
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
nStatus = ERR_DONT_REPORT;
goto closing_seq;
}
@@ -414,7 +415,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
if (sizeToShrinkTo == -1)
{
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
nStatus = ERR_DONT_REPORT;
goto closing_seq;
}
@@ -435,8 +436,8 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
&dwResult,
NULL))
{
- handleWin32Error (MainDlg);
- ShowInPlaceEncErrMsgWAltSteps ("CANNOT_RESIZE_FILESYS", TRUE);
+ handleWin32Error (hwndDlg);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "CANNOT_RESIZE_FILESYS", TRUE);
nStatus = ERR_DONT_REPORT;
goto closing_seq;
}
@@ -462,13 +463,13 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
continue;
}
- handleWin32Error (MainDlg);
+ handleWin32Error (hwndDlg);
}
}
else
- handleWin32Error (MainDlg);
+ handleWin32Error (hwndDlg);
- ShowInPlaceEncErrMsgWAltSteps ("CANNOT_RESIZE_FILESYS", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "CANNOT_RESIZE_FILESYS", TRUE);
nStatus = ERR_DONT_REPORT;
goto closing_seq;
}
@@ -481,7 +482,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
/* Gain exclusive access to the volume */
- nStatus = DismountFileSystem (dev,
+ nStatus = DismountFileSystem (hwndDlg, dev,
driveLetter,
TRUE,
TRUE,
@@ -503,7 +504,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
// Prepare the backup header
for (int wipePass = 0; wipePass < (wipeAlgorithm == TC_WIPE_NONE ? 1 : PRAND_HEADER_WIPE_PASSES); wipePass++)
{
- nStatus = CreateVolumeHeaderInMemory (FALSE,
+ nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
header,
volParams->ea,
FIRST_MODE_OF_OPERATION_ID,
@@ -539,7 +540,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
}
// Fill the reserved sectors of the backup header area with random data
- nStatus = WriteRandomDataToReservedHeaderAreas (dev, cryptoInfo, dataAreaSize, FALSE, TRUE);
+ nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, dataAreaSize, FALSE, TRUE);
if (nStatus != ERR_SUCCESS)
goto closing_seq;
@@ -665,6 +666,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
Password *password = volParams->password;
int pkcs5_prf = volParams->pkcs5;
DISK_GEOMETRY driveGeometry;
+ HWND hwndDlg = volParams->hwndDlg;
bInPlaceEncNonSysResumed = TRUE;
@@ -722,7 +724,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
goto closing_seq;
}
- dev = OpenPartitionVolume (devName,
+ dev = OpenPartitionVolume (hwndDlg, devName,
FALSE, // Do not require exclusive access
FALSE, // Do not require shared access
TRUE, // Ask the user to confirm shared access (if exclusive fails)
@@ -814,7 +816,7 @@ inplace_enc_read:
if (!*bTryToCorrectReadErrors)
{
- *bTryToCorrectReadErrors = (AskWarnYesNo ("ENABLE_BAD_SECTOR_ZEROING") == IDYES);
+ *bTryToCorrectReadErrors = (AskWarnYesNo ("ENABLE_BAD_SECTOR_ZEROING", hwndDlg) == IDYES);
}
if (*bTryToCorrectReadErrors)
@@ -980,7 +982,7 @@ inplace_enc_read:
for (int wipePass = 0; wipePass < (wipeAlgorithm == TC_WIPE_NONE ? 1 : PRAND_HEADER_WIPE_PASSES); wipePass++)
{
- nStatus = CreateVolumeHeaderInMemory (FALSE,
+ nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
header,
headerCryptoInfo->ea,
headerCryptoInfo->mode,
@@ -1011,7 +1013,7 @@ inplace_enc_read:
}
// Fill the reserved sectors of the header area with random data
- nStatus = WriteRandomDataToReservedHeaderAreas (dev, headerCryptoInfo, masterCryptoInfo->VolumeSize.Value, TRUE, FALSE);
+ nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, headerCryptoInfo, masterCryptoInfo->VolumeSize.Value, TRUE, FALSE);
if (nStatus != ERR_SUCCESS)
goto closing_seq;
@@ -1103,7 +1105,7 @@ closing_seq:
zeroedSectorCount,
sizeStr);
- WarningDirect (msg);
+ WarningDirect (msg, hwndDlg);
}
if (nStatus != ERR_SUCCESS && nStatus != ERR_USER_ABORT)
@@ -1185,7 +1187,7 @@ closing_seq:
}
-static HANDLE OpenPartitionVolume (const char *devName,
+static HANDLE OpenPartitionVolume (HWND hwndDlg, const char *devName,
BOOL bExclusiveRequired,
BOOL bSharedRequired,
BOOL bSharedRequiresConfirmation,
@@ -1217,12 +1219,12 @@ static HANDLE OpenPartitionVolume (const char *devName,
{
if (!bSilent)
{
- handleWin32Error (MainDlg);
+ handleWin32Error (hwndDlg);
if (bShowAlternativeSteps)
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
else
- Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL");
+ Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL", hwndDlg);
}
return INVALID_HANDLE_VALUE;
}
@@ -1233,7 +1235,7 @@ static HANDLE OpenPartitionVolume (const char *devName,
{
if (bSharedRequiresConfirmation
&& !bSilent
- && AskWarnNoYes ("DEVICE_IN_USE_INPLACE_ENC") == IDNO)
+ && AskWarnNoYes ("DEVICE_IN_USE_INPLACE_ENC", hwndDlg) == IDNO)
{
CloseHandle (dev);
return INVALID_HANDLE_VALUE;
@@ -1246,9 +1248,9 @@ static HANDLE OpenPartitionVolume (const char *devName,
handleWin32Error (MainDlg);
if (bShowAlternativeSteps)
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE);
else
- Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL");
+ Error ("INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL", hwndDlg);
}
return INVALID_HANDLE_VALUE;
}
@@ -1258,7 +1260,7 @@ static HANDLE OpenPartitionVolume (const char *devName,
}
-static int DismountFileSystem (HANDLE dev,
+static int DismountFileSystem (HWND hwndDlg, HANDLE dev,
int driveLetter,
BOOL bForcedAllowed,
BOOL bForcedRequiresConfirmation,
@@ -1284,14 +1286,14 @@ static int DismountFileSystem (HANDLE dev,
if (!bForcedAllowed)
{
if (!bSilent)
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS", TRUE);
return ERR_DONT_REPORT;
}
if (bForcedRequiresConfirmation
&& !bSilent
- && AskWarnYesNo ("VOL_LOCK_FAILED_OFFER_FORCED_DISMOUNT") == IDNO)
+ && AskWarnYesNo ("VOL_LOCK_FAILED_OFFER_FORCED_DISMOUNT", hwndDlg) == IDNO)
{
return ERR_DONT_REPORT;
}
@@ -1311,7 +1313,7 @@ static int DismountFileSystem (HANDLE dev,
if (!bResult)
{
if (!bSilent)
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS", TRUE);
return ERR_DONT_REPORT;
}
@@ -1376,7 +1378,7 @@ static int ConcealNTFS (HANDLE dev)
}
-void ShowInPlaceEncErrMsgWAltSteps (char *iniStrId, BOOL bErr)
+void ShowInPlaceEncErrMsgWAltSteps (HWND hwndDlg, char *iniStrId, BOOL bErr)
{
wchar_t msg[30000];
@@ -1386,9 +1388,9 @@ void ShowInPlaceEncErrMsgWAltSteps (char *iniStrId, BOOL bErr)
StringCbCatW (msg, sizeof(msg), GetString ("INPLACE_ENC_ALTERNATIVE_STEPS"));
if (bErr)
- ErrorDirect (msg);
+ ErrorDirect (msg, hwndDlg);
else
- WarningDirect (msg);
+ WarningDirect (msg, hwndDlg);
}
diff --git a/src/Format/InPlace.h b/src/Format/InPlace.h
index 979af189..90cf5f80 100644
--- a/src/Format/InPlace.h
+++ b/src/Format/InPlace.h
@@ -24,15 +24,15 @@ enum nonsys_inplace_enc_status
NONSYS_INPLACE_ENC_STATUS_ERROR
};
-BOOL CheckRequirementsForNonSysInPlaceEnc (const char *devicePath, BOOL silent);
+BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath, BOOL silent);
int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, volatile HANDLE *outHandle, WipeAlgorithmId wipeAlgorithm);
int EncryptPartitionInPlaceResume (HANDLE dev, volatile FORMAT_VOL_PARAMETERS *volParams, WipeAlgorithmId wipeAlgorithm, volatile BOOL *bTryToCorrectReadErrors);
-void ShowInPlaceEncErrMsgWAltSteps (char *iniStrId, BOOL bErr);
+void ShowInPlaceEncErrMsgWAltSteps (HWND hwndDlg, char *iniStrId, BOOL bErr);
void SetNonSysInplaceEncUIStatus (int nonSysInplaceEncStatus);
int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_INFO *masterCryptoInfo, __int64 deviceSize);
-static HANDLE OpenPartitionVolume (const char *devName, BOOL bExclusiveRequired, BOOL bSharedRequired, BOOL bSharedRequiresConfirmation, BOOL bShowAlternativeSteps, BOOL bSilent);
-static int DismountFileSystem (HANDLE dev, int driveLetter, BOOL bForcedAllowed, BOOL bForcedRequiresConfirmation, BOOL bSilent);
+static HANDLE OpenPartitionVolume (HWND hwndDlg, const char *devName, BOOL bExclusiveRequired, BOOL bSharedRequired, BOOL bSharedRequiresConfirmation, BOOL bShowAlternativeSteps, BOOL bSilent);
+static int DismountFileSystem (HWND hwndDlg, HANDLE dev, int driveLetter, BOOL bForcedAllowed, BOOL bForcedRequiresConfirmation, BOOL bSilent);
static int ConcealNTFS (HANDLE dev);
BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId wipeAlgorithm);
static void ExportProgressStats (__int64 bytesDone, __int64 totalSize);
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index 5eabbf0f..57660cdc 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -273,7 +273,7 @@ static BOOL ElevateWholeWizardProcess (string arguments)
}
else
{
- Error ("UAC_INIT_ERROR");
+ Error ("UAC_INIT_ERROR", MainDlg);
return FALSE;
}
}
@@ -419,7 +419,7 @@ static BOOL SaveSysEncSettings (HWND hwndDlg)
{
if (remove (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION)) != 0)
{
- Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS");
+ Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
return FALSE;
}
@@ -431,7 +431,7 @@ static BOOL SaveSysEncSettings (HWND hwndDlg)
f = fopen (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION), "w");
if (f == NULL)
{
- Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS");
+ Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
handleWin32Error (hwndDlg);
return FALSE;
}
@@ -450,7 +450,7 @@ static BOOL SaveSysEncSettings (HWND hwndDlg)
{
handleWin32Error (hwndDlg);
fclose (f);
- Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS");
+ Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
return FALSE;
}
@@ -488,7 +488,7 @@ static BOOL ChangeHiddenOSCreationPhase (int newPhase)
{
if (!CreateSysEncMutex ())
{
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE;
}
@@ -517,7 +517,7 @@ static BOOL ChangeSystemEncryptionStatus (int newStatus)
{
if (!CreateSysEncMutex ())
{
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE; // Only one instance that has the mutex can modify the system encryption settings
}
@@ -560,7 +560,7 @@ static BOOL ChangeWizardMode (int newWizardMode)
{
if (!CreateSysEncMutex ())
{
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE;
}
}
@@ -637,7 +637,7 @@ static void LoadSettings (HWND hwndDlg)
ConfigReadString ("SecurityTokenLibrary", "", SecurityTokenLibraryPath, sizeof (SecurityTokenLibraryPath) - 1);
if (SecurityTokenLibraryPath[0])
- InitSecurityTokenLibrary();
+ InitSecurityTokenLibrary(hwndDlg);
if (hwndDlg != NULL)
{
@@ -666,7 +666,7 @@ static void SaveSettings (HWND hwndDlg)
if (GetPreferredLangId () != NULL)
ConfigWriteString ("Language", GetPreferredLangId ());
- ConfigWriteEnd ();
+ ConfigWriteEnd (hwndDlg);
NormalCursor ();
}
@@ -764,7 +764,7 @@ BOOL SwitchWizardToSysEncMode (void)
catch (Exception &e)
{
e.Show (MainDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
NormalCursor ();
return FALSE;
}
@@ -772,7 +772,7 @@ BOOL SwitchWizardToSysEncMode (void)
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (!CreateSysEncMutex ())
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
NormalCursor ();
return FALSE;
}
@@ -780,7 +780,7 @@ BOOL SwitchWizardToSysEncMode (void)
// User-mode app may have crashed and its mutex may have gotten lost, so we need to check the driver status too
if (BootEncStatus.SetupInProgress)
{
- if (AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT") == IDYES)
+ if (AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", MainDlg) == IDYES)
{
if (SystemEncryptionStatus != SYSENC_STATUS_ENCRYPTING
&& SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING)
@@ -803,7 +803,7 @@ BOOL SwitchWizardToSysEncMode (void)
else
{
CloseSysEncMutex ();
- Error ("SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS");
+ Error ("SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS", MainDlg);
NormalCursor ();
return FALSE;
}
@@ -815,7 +815,7 @@ BOOL SwitchWizardToSysEncMode (void)
{
if (!SysDriveOrPartitionFullyEncrypted (FALSE)
- && AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT") == IDYES)
+ && AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", MainDlg) == IDYES)
{
if (SystemEncryptionStatus == SYSENC_STATUS_NONE)
{
@@ -840,7 +840,7 @@ BOOL SwitchWizardToSysEncMode (void)
else
{
CloseSysEncMutex ();
- Error ("SETUP_FAILED_BOOT_DRIVE_ENCRYPTED");
+ Error ("SETUP_FAILED_BOOT_DRIVE_ENCRYPTED", MainDlg);
NormalCursor ();
return FALSE;
}
@@ -853,7 +853,7 @@ BOOL SwitchWizardToSysEncMode (void)
{
if (!IsUacSupported())
{
- Warning ("ADMIN_PRIVILEGES_WARN_DEVICES");
+ Warning ("ADMIN_PRIVILEGES_WARN_DEVICES", MainDlg);
}
}
@@ -892,7 +892,7 @@ BOOL SwitchWizardToSysEncMode (void)
{
if (BootEncObj->SystemDriveContainsNonStandardPartitions())
{
- if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str()) == IDYES)
+ if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE;
}
@@ -902,21 +902,21 @@ BOOL SwitchWizardToSysEncMode (void)
{
bWholeSysDrive = FALSE;
- Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS");
+ Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg);
- if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE") == IDNO)
+ if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO)
{
ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE);
return FALSE;
}
}
else
- Warning ("WDE_EXTENDED_PARTITIONS_WARNING");
+ Warning ("WDE_EXTENDED_PARTITIONS_WARNING", MainDlg);
}
}
else if (BootEncObj->SystemPartitionCoversWholeDrive()
&& !bWholeSysDrive)
- bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM") == IDYES);
+ bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", MainDlg) == IDYES);
}
}
@@ -937,7 +937,7 @@ BOOL SwitchWizardToSysEncMode (void)
// In addition, he selected the hidden volume mode.
if (bWholeSysDrive)
- Warning ("HIDDEN_OS_PRECLUDES_SINGLE_KEY_WDE");
+ Warning ("HIDDEN_OS_PRECLUDES_SINGLE_KEY_WDE", MainDlg);
bWholeSysDrive = FALSE;
@@ -1055,7 +1055,7 @@ static BOOL ResolveUnknownSysEncDirection (void)
catch (Exception &e)
{
e.Show (MainDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
return FALSE;
}
@@ -1075,7 +1075,7 @@ static BOOL ResolveUnknownSysEncDirection (void)
"IDCANCEL",
0};
- switch (AskMultiChoice ((void **) tmpStr, FALSE))
+ switch (AskMultiChoice ((void **) tmpStr, FALSE, MainDlg))
{
case 1:
return ChangeSystemEncryptionStatus (SYSENC_STATUS_ENCRYPTING);
@@ -1091,7 +1091,7 @@ static BOOL ResolveUnknownSysEncDirection (void)
}
else
{
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE;
}
}
@@ -1558,7 +1558,7 @@ static void SysEncPause (void)
catch (Exception &e)
{
e.Show (MainDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
return;
}
@@ -1601,7 +1601,7 @@ static void SysEncPause (void)
{
SetTimer (MainDlg, TIMER_ID_SYSENC_PROGRESS, TIMER_INTERVAL_SYSENC_PROGRESS, NULL);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
- Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION");
+ Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION", MainDlg);
return;
}
@@ -1609,7 +1609,7 @@ static void SysEncPause (void)
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
}
else
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
}
@@ -1628,7 +1628,7 @@ static void SysEncResume (void)
catch (Exception &e)
{
e.Show (MainDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
return;
}
@@ -1680,7 +1680,7 @@ static void SysEncResume (void)
SetThreadExecutionState (ES_CONTINUOUS);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
- Error ("FAILED_TO_RESUME_SYSTEM_ENCRYPTION");
+ Error ("FAILED_TO_RESUME_SYSTEM_ENCRYPTION", MainDlg);
return;
}
@@ -1695,7 +1695,7 @@ static void SysEncResume (void)
SetTimer (MainDlg, TIMER_ID_SYSENC_PROGRESS, TIMER_INTERVAL_SYSENC_PROGRESS, NULL);
}
else
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
}
@@ -1955,7 +1955,7 @@ static void InitNonSysInplaceEncProgressBar (void)
}
-void DisplayRandPool (HWND hPoolDisplay, BOOL bShow)
+void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow)
{
unsigned char tmp[4];
unsigned char tmpByte;
@@ -1968,7 +1968,7 @@ void DisplayRandPool (HWND hPoolDisplay, BOOL bShow)
return;
}
- RandpeekBytes (randPool, sizeof (randPool));
+ RandpeekBytes (hwndDlg, randPool, sizeof (randPool));
if (memcmp (lastRandPool, randPool, sizeof(lastRandPool)) != 0)
{
@@ -2060,7 +2060,7 @@ static void WipeAbort (void)
{
SetTimer (MainDlg, TIMER_ID_WIPE_PROGRESS, TIMER_INTERVAL_WIPE_PROGRESS, NULL);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
- Error ("FAILED_TO_INTERRUPT_WIPING");
+ Error ("FAILED_TO_INTERRUPT_WIPING", MainDlg);
return;
}
}
@@ -2101,7 +2101,7 @@ static void WipeStart (void)
if (!bDeviceWipeInProgress)
{
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
- Error ("FAILED_TO_START_WIPING");
+ Error ("FAILED_TO_START_WIPING", MainDlg);
return;
}
}
@@ -2459,12 +2459,12 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
if (bInPlaceEncNonSysResumed)
{
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_PAUSED);
- Error ("INPLACE_ENC_GENERIC_ERR_RESUME");
+ Error ("INPLACE_ENC_GENERIC_ERR_RESUME", hwndDlg);
}
else
{
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_ERROR);
- ShowInPlaceEncErrMsgWAltSteps ("INPLACE_ENC_GENERIC_ERR_ALT_STEPS", TRUE);
+ ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_GENERIC_ERR_ALT_STEPS", TRUE);
}
}
else if (!(bHiddenVolHost && hiddenVolHostDriveNo < 0)) // If the error was not that the hidden volume host could not be mounted (this error has already been reported to the user)
@@ -2500,20 +2500,20 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
bHiddenVolFinished = TRUE;
if (!bHiddenOS)
- Warning ("HIDVOL_FORMAT_FINISHED_HELP");
+ Warning ("HIDVOL_FORMAT_FINISHED_HELP", hwndDlg);
}
else if (bInPlaceEncNonSys)
{
- Warning ("NONSYS_INPLACE_ENC_FINISHED_INFO");
+ Warning ("NONSYS_INPLACE_ENC_FINISHED_INFO", hwndDlg);
HandleOldAssignedDriveLetter ();
}
else
{
- Info("FORMAT_FINISHED_INFO");
+ Info("FORMAT_FINISHED_INFO", hwndDlg);
if (bSparseFileSwitch && quickFormat)
- Warning("SPARSE_FILE_SIZE_NOTE");
+ Warning("SPARSE_FILE_SIZE_NOTE", hwndDlg);
}
}
else
@@ -2841,14 +2841,14 @@ static void LoadPage (HWND hwndDlg, int nPageNo)
CheckCapsLock (hwndDlg, FALSE);
if (CreatingHiddenSysVol())
- Warning ("PASSWORD_HIDDEN_OS_NOTE");
+ Warning ("PASSWORD_HIDDEN_OS_NOTE", MainDlg);
break;
case CIPHER_PAGE:
if (CreatingHiddenSysVol())
- Warning ("HIDDEN_OS_PRE_CIPHER_WARNING");
+ Warning ("HIDDEN_OS_PRE_CIPHER_WARNING", MainDlg);
break;
}
@@ -3109,7 +3109,7 @@ BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display)
|| sectorSize > TC_MAX_VOLUME_SECTOR_SIZE
|| sectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0)
{
- Error ("SECTOR_SIZE_UNSUPPORTED");
+ Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg);
return FALSE;
}
@@ -3237,7 +3237,7 @@ static BOOL FinalPreTransformPrompts (void)
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), deviceName);
wchar_t *tmpStr[] = {L"", tmpMcMsg, tmpMcOption1, tmpMcOptionCancel, 0};
- switch (AskMultiChoice ((void **) tmpStr, TRUE))
+ switch (AskMultiChoice ((void **) tmpStr, TRUE, MainDlg))
{
case 1:
// Proceed
@@ -3421,7 +3421,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Ask the user if he wants to try again (to prevent repeated system freezing, etc.)
char *tmpStr[] = {0, "HIDDEN_SECTOR_DETECTION_FAILED_PREVIOUSLY", "SKIP_HIDDEN_SECTOR_DETECTION", "RETRY_HIDDEN_SECTOR_DETECTION", "IDC_EXIT", 0};
- switch (AskMultiChoice ((void **) tmpStr, FALSE))
+ switch (AskMultiChoice ((void **) tmpStr, FALSE, MainDlg))
{
case 1:
// Do not try again
@@ -3627,7 +3627,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
WaitCursor();
- if (CheckRequirementsForNonSysInPlaceEnc (szDiskFile, TRUE))
+ if (CheckRequirementsForNonSysInPlaceEnc (hwndDlg, szDiskFile, TRUE))
{
bInPlaceEncNonSys = (FileSystemAppearsEmpty (szDiskFile) == 0);
}
@@ -3923,7 +3923,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
- Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
@@ -3934,7 +3934,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (SetTimer (MainDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{
- Error ("CANNOT_SET_TIMER");
+ Error ("CANNOT_SET_TIMER", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
@@ -4038,7 +4038,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SendMessage (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), BM_SETCHECK, showKeys ? BST_CHECKED : BST_UNCHECKED, 0);
- DisplayRandPool (hRandPoolSys, showKeys);
+ DisplayRandPool (hwndDlg, hRandPoolSys, showKeys);
break;
@@ -4211,7 +4211,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
catch (Exception &e)
{
e.Show (hwndDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EndMainDlg (MainDlg);
return 0;
}
@@ -4258,7 +4258,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
else
{
- Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
EndMainDlg (MainDlg);
return 0;
}
@@ -5068,7 +5068,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (SysEncInEffect())
{
- Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION");
+ Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", MainDlg);
return 1;
}
@@ -5265,7 +5265,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
hash_algo = DEFAULT_HASH_ALGORITHM_BOOT;
RandSetHashFunction (DEFAULT_HASH_ALGORITHM_BOOT);
- Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION");
+ Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", MainDlg);
SelectAlgo (GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO), &hash_algo);
}
}
@@ -5279,12 +5279,12 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (bSparseFileSwitch)
{
- if (AskWarnYesNo("CONFIRM_SPARSE_FILE") == IDNO)
+ if (AskWarnYesNo("CONFIRM_SPARSE_FILE", MainDlg) == IDNO)
SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE);
}
else
{
- if (AskWarnYesNo("WARN_QUICK_FORMAT") == IDNO)
+ if (AskWarnYesNo("WARN_QUICK_FORMAT", MainDlg) == IDNO)
SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE);
}
return 1;
@@ -5312,7 +5312,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
&& (nCurPageNo == SYSENC_COLLECTING_RANDOM_DATA_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_RAND_DATA_PAGE))
{
showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISPLAY_POOL_CONTENTS));
- DisplayRandPool (hRandPoolSys, showKeys);
+ DisplayRandPool (hwndDlg, hRandPoolSys, showKeys);
return 1;
}
@@ -5378,7 +5378,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
case IDC_ABORT_BUTTON:
- if (AskWarnNoYes ("CONFIRM_WIPE_ABORT") == IDYES)
+ if (AskWarnNoYes ("CONFIRM_WIPE_ABORT", MainDlg) == IDYES)
WipeAbort();
return 1;
@@ -5444,7 +5444,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
catch (Exception &e)
{
e.Show (hwndDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EndMainDlg (MainDlg);
return 0;
}
@@ -5503,7 +5503,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (WizardMode == WIZARD_MODE_SYS_DEVICE
|| bInPlaceEncNonSys)
{
- DisplayRandPool (hRandPoolSys, showKeys);
+ DisplayRandPool (hwndDlg, hRandPoolSys, showKeys);
}
else
{
@@ -5514,7 +5514,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (!showKeys)
return 1;
- RandpeekBytes (tmp, sizeof (tmp));
+ RandpeekBytes (hwndDlg, tmp, sizeof (tmp));
tmp2[0] = 0;
@@ -5556,7 +5556,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
e.Show (hwndDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
@@ -5591,7 +5591,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
&& SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING
&& (IsDiskReadError (e.ErrorCode)))
{
- bTryToCorrectReadErrors = (AskWarnYesNo ("ENABLE_BAD_SECTOR_ZEROING") == IDYES);
+ bTryToCorrectReadErrors = (AskWarnYesNo ("ENABLE_BAD_SECTOR_ZEROING", MainDlg) == IDYES);
if (bTryToCorrectReadErrors)
{
@@ -5603,7 +5603,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
&& SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING
&& (IsDiskReadError (e.ErrorCode)))
{
- DiscardUnreadableEncryptedSectors = (AskWarnYesNo ("DISCARD_UNREADABLE_ENCRYPTED_SECTORS") == IDYES);
+ DiscardUnreadableEncryptedSectors = (AskWarnYesNo ("DISCARD_UNREADABLE_ENCRYPTED_SECTORS", MainDlg) == IDYES);
if (DiscardUnreadableEncryptedSectors)
{
@@ -5640,7 +5640,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
- Info ("SYSTEM_ENCRYPTION_FINISHED");
+ Info ("SYSTEM_ENCRYPTION_FINISHED", MainDlg);
return 1;
}
break;
@@ -5669,10 +5669,10 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), FALSE);
- Info ("SYSTEM_DECRYPTION_FINISHED");
+ Info ("SYSTEM_DECRYPTION_FINISHED", MainDlg);
// Reboot is required to enable uninstallation and hibernation
- if (AskWarnYesNo ("CONFIRM_RESTART") == IDYES)
+ if (AskWarnYesNo ("CONFIRM_RESTART", MainDlg) == IDYES)
{
EndMainDlg (MainDlg);
@@ -5731,7 +5731,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
- Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
@@ -5785,7 +5785,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
Sleep (1500); // User-friendly GUI
if (bSysEncDriveAnalysisTimeOutOccurred)
- Warning ("SYS_DRIVE_SIZE_PROBE_TIMEOUT");
+ Warning ("SYS_DRIVE_SIZE_PROBE_TIMEOUT", MainDlg);
LoadPage (hwndDlg, SYSENC_DRIVE_ANALYSIS_PAGE + 1);
}
@@ -5866,12 +5866,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), FALSE);
- Info ("WIPE_FINISHED_DECOY_SYSTEM_PARTITION");
+ Info ("WIPE_FINISHED_DECOY_SYSTEM_PARTITION", MainDlg);
TextInfoDialogBox (TC_TBXID_DECOY_OS_INSTRUCTIONS);
if (BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent)
- Warning ("DECOY_OS_VERSION_WARNING");
+ Warning ("DECOY_OS_VERSION_WARNING", MainDlg);
return 1;
}
@@ -5970,7 +5970,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
&& (bVolTransformThreadRunning || bVolTransformThreadToRun || bInPlaceEncNonSysResumed))
{
// Non-system encryption in progress
- if (AskNoYes ("NONSYS_INPLACE_ENC_DEFER_CONFIRM") == IDYES)
+ if (AskNoYes ("NONSYS_INPLACE_ENC_DEFER_CONFIRM", hwndDlg) == IDYES)
{
NonSysInplaceEncPause ();
@@ -5983,7 +5983,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (bVolTransformThreadRunning || bVolTransformThreadToRun)
{
// Format (non-in-place encryption) in progress
- if (AskNoYes ("FORMAT_ABORT") == IDYES)
+ if (AskNoYes ("FORMAT_ABORT", hwndDlg) == IDYES)
{
bVolTransformThreadCancel = TRUE;
@@ -6000,7 +6000,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// System encryption/decryption in progress
if (AskYesNo (SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING ?
- "SYSTEM_DECRYPTION_DEFER_CONFIRM" : "SYSTEM_ENCRYPTION_DEFER_CONFIRM") == IDYES)
+ "SYSTEM_DECRYPTION_DEFER_CONFIRM" : "SYSTEM_ENCRYPTION_DEFER_CONFIRM", MainDlg) == IDYES)
{
if (nCurPageNo == SYSENC_PRETEST_RESULT_PAGE)
TextInfoDialogBox (TC_TBXID_SYS_ENC_RESCUE_DISK);
@@ -6023,7 +6023,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
else
{
- Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION");
+ Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION", MainDlg);
return 1; // Disallow close
}
}
@@ -6038,12 +6038,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
else if (bConfirmQuitSysEncPretest)
{
- if (AskWarnNoYes (bHiddenOS ? "CONFIRM_CANCEL_HIDDEN_OS_CREATION" : "CONFIRM_CANCEL_SYS_ENC_PRETEST") == IDNO)
+ if (AskWarnNoYes (bHiddenOS ? "CONFIRM_CANCEL_HIDDEN_OS_CREATION" : "CONFIRM_CANCEL_SYS_ENC_PRETEST", MainDlg) == IDNO)
return 1; // Disallow close
}
else if (bConfirmQuit)
{
- if (AskWarnNoYes ("CONFIRM_EXIT_UNIVERSAL") == IDNO)
+ if (AskWarnNoYes ("CONFIRM_EXIT_UNIVERSAL", MainDlg) == IDNO)
return 1; // Disallow close
}
@@ -6082,7 +6082,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
static bool warningConfirmed = false;
if (!warningConfirmed)
{
- if (AskWarnYesNo ("CONTAINER_ADMIN_WARNING") == IDYES)
+ if (AskWarnYesNo ("CONTAINER_ADMIN_WARNING", MainDlg) == IDYES)
exit (0);
warningConfirmed = true;
@@ -6140,7 +6140,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
BootEncObj->CheckRequirementsHiddenOS ();
if (CheckGapBetweenSysAndHiddenOS ())
- Warning ("GAP_BETWEEN_SYS_AND_HIDDEN_OS_PARTITION");
+ Warning ("GAP_BETWEEN_SYS_AND_HIDDEN_OS_PARTITION", MainDlg);
}
catch (Exception &e)
{
@@ -6149,7 +6149,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1;
}
- if (AskWarnYesNo ("DECOY_OS_REINSTALL_WARNING") == IDNO)
+ if (AskWarnYesNo ("DECOY_OS_REINSTALL_WARNING", MainDlg) == IDNO)
{
NormalCursor ();
return 1;
@@ -6157,7 +6157,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
WarningDirect ((wstring (GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO"))
+ L"\n\n"
- + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str());
+ + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), MainDlg);
if (!IsAdmin() && IsUacSupported())
{
@@ -6202,7 +6202,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (BootEncObj->SystemDriveContainsNonStandardPartitions())
{
- if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str()) == IDYES)
+ if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE;
}
@@ -6210,20 +6210,20 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (BootEncObj->SystemDriveContainsExtendedPartition())
{
- Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS");
+ Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg);
- if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE") == IDNO)
+ if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO)
return 1;
bWholeSysDrive = FALSE;
}
else
- Warning ("WDE_EXTENDED_PARTITIONS_WARNING");
+ Warning ("WDE_EXTENDED_PARTITIONS_WARNING", hwndDlg);
}
}
if (!bWholeSysDrive && BootEncObj->SystemPartitionCoversWholeDrive())
- bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM") == IDYES);
+ bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", hwndDlg) == IDYES);
}
catch (Exception &e)
{
@@ -6262,14 +6262,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Multi-boot
- if (AskWarnNoYes ("MULTI_BOOT_FOR_ADVANCED_ONLY") == IDNO)
+ if (AskWarnNoYes ("MULTI_BOOT_FOR_ADVANCED_ONLY", hwndDlg) == IDNO)
return 1;
if (bHiddenOS)
{
- if (AskWarnNoYes ("HIDDEN_OS_MULTI_BOOT") == IDNO)
+ if (AskWarnNoYes ("HIDDEN_OS_MULTI_BOOT", hwndDlg) == IDNO)
{
- Error ("UNSUPPORTED_HIDDEN_OS_MULTI_BOOT_CFG");
+ Error ("UNSUPPORTED_HIDDEN_OS_MULTI_BOOT_CFG", hwndDlg);
return 1;
}
}
@@ -6279,14 +6279,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (IsOSAtLeast (WIN_7)
&& BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
- && AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION") == IDNO)
+ && AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO)
{
TextInfoDialogBox (TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS);
NormalCursor ();
return 1;
}
- if (AskWarnYesNo ("DECOY_OS_REQUIREMENTS") == IDNO)
+ if (AskWarnYesNo ("DECOY_OS_REQUIREMENTS", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
@@ -6315,7 +6315,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (!SysEncMultiBootCfg.SystemOnBootDrive)
{
- Error ("SYS_PARTITION_MUST_BE_ON_BOOT_DRIVE");
+ Error ("SYS_PARTITION_MUST_BE_ON_BOOT_DRIVE", hwndDlg);
EndMainDlg (MainDlg);
return 1;
}
@@ -6338,7 +6338,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Whole-system-drive encryption is currently not supported if the drive contains
// more than one system
- Error ("WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE");
+ Error ("WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE", hwndDlg);
return 1;
}
@@ -6354,7 +6354,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Whole-system-drive encryption is currently not supported if the drive contains
// more than one system
- Error ("WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE");
+ Error ("WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE", hwndDlg);
return 1;
}
}
@@ -6366,7 +6366,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (SysEncMultiBootCfg.BootLoaderBrand)
{
// A non-Windows boot manager in the MBR
- Error ("CUSTOM_BOOT_MANAGERS_IN_MBR_UNSUPPORTED");
+ Error ("CUSTOM_BOOT_MANAGERS_IN_MBR_UNSUPPORTED", hwndDlg);
EndMainDlg (MainDlg);
return 1;
}
@@ -6432,7 +6432,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
+ GetString ("NOTE_BEGINNING")
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO")
+ L" "
- + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str());
+ + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), hwndDlg);
NormalCursor ();
return 1;
}
@@ -6456,13 +6456,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bDevice)
{
// Not a valid device path
- Error ("CANNOT_CALC_SPACE");
+ Error ("CANNOT_CALC_SPACE", hwndDlg);
NormalCursor ();
return 1;
}
else
{
- if (AskWarnYesNo ("DEVICE_SELECTED_IN_NON_DEVICE_MODE") == IDNO)
+ if (AskWarnYesNo ("DEVICE_SELECTED_IN_NON_DEVICE_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
@@ -6478,7 +6478,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (IsMountedVolume (szDiskFile))
{
- Error ("ALREADY_MOUNTED");
+ Error ("ALREADY_MOUNTED", hwndDlg);
NormalCursor ();
return 1;
}
@@ -6490,7 +6490,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case 1:
case 2:
case 3:
- if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE") == IDNO)
+ if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
@@ -6514,7 +6514,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
{
if (CheckFileExtension(szFileName)
- && AskWarnNoYes ("EXE_FILE_EXTENSION_CONFIRM") == IDNO)
+ && AskWarnNoYes ("EXE_FILE_EXTENSION_CONFIRM", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
@@ -6550,7 +6550,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (IsSparseFile (hwndDlg))
{
// Hidden volumes must not be created within sparse file containers
- Warning ("HIDDEN_VOL_HOST_SPARSE");
+ Warning ("HIDDEN_VOL_HOST_SPARSE", hwndDlg);
NormalCursor ();
return 1;
}
@@ -6571,7 +6571,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Check requirements for non-system in-place encryption
- if (!CheckRequirementsForNonSysInPlaceEnc (szDiskFile, FALSE))
+ if (!CheckRequirementsForNonSysInPlaceEnc (hwndDlg, szDiskFile, FALSE))
{
return 1;
}
@@ -6585,7 +6585,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1;
}
- if (AskWarnYesNo ("NONSYS_INPLACE_ENC_CONFIRM_BACKUP") == IDNO)
+ if (AskWarnYesNo ("NONSYS_INPLACE_ENC_CONFIRM_BACKUP", hwndDlg) == IDNO)
return 1;
}
nNewPageNo = CIPHER_PAGE - 1;
@@ -6606,11 +6606,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (SysEncInEffect ()
&& EAGetCipherCount (nVolumeEA) > 1) // Cascade?
{
- if (AskWarnNoYes ("CONFIRM_CASCADE_FOR_SYS_ENCRYPTION") == IDNO)
+ if (AskWarnNoYes ("CONFIRM_CASCADE_FOR_SYS_ENCRYPTION", hwndDlg) == IDNO)
return 1;
if (!bHiddenOS)
- Info ("NOTE_CASCADE_FOR_SYS_ENCRYPTION");
+ Info ("NOTE_CASCADE_FOR_SYS_ENCRYPTION", hwndDlg);
}
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETCURSEL, 0, 0);
@@ -6641,7 +6641,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// The host file system is FAT32
if (nUIVolumeSize * nMultiplier >= 4 * BYTES_PER_GB)
{
- Error ("VOLUME_TOO_LARGE_FOR_FAT32");
+ Error ("VOLUME_TOO_LARGE_FOR_FAT32", hwndDlg);
return 1;
}
}
@@ -6651,7 +6651,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (!IsOSAtLeast (WIN_VISTA)
&& nUIVolumeSize * nMultiplier > 2 * BYTES_PER_TB)
{
- Warning ("VOLUME_TOO_LARGE_FOR_WINXP");
+ Warning ("VOLUME_TOO_LARGE_FOR_WINXP", hwndDlg);
}
}
@@ -6662,7 +6662,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (((double) nUIVolumeSize / (nMaximumHiddenVolSize / nMultiplier)) > 0.85) // 85%
{
- if (AskWarnNoYes ("FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME") == IDNO)
+ if (AskWarnNoYes ("FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME", hwndDlg) == IDNO)
return 1;
}
}
@@ -6687,7 +6687,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Password character encoding
if (!CheckPasswordCharEncoding (GetDlgItem (hCurPage, IDC_PASSWORD), NULL))
{
- Error ("UNSUPPORTED_CHARS_IN_PWD");
+ Error ("UNSUPPORTED_CHARS_IN_PWD", hwndDlg);
return 1;
}
// Check password length (do not check if it's for an outer volume).
@@ -6707,7 +6707,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
WaitCursor ();
- if (!KeyFilesApply (&volumePassword, FirstKeyFile))
+ if (!KeyFilesApply (hwndDlg, &volumePassword, FirstKeyFile))
{
NormalCursor ();
return 1;
@@ -6725,7 +6725,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
- Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT");
+ Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg);
else
bKeyboardLayoutChanged = FALSE;
}
@@ -6760,7 +6760,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (KeyFilesEnable)
{
- KeyFilesApply (&volumePassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &volumePassword, FirstKeyFile);
}
if (!bInPlaceEncNonSys)
@@ -6916,7 +6916,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (DeferredNonSysInPlaceEncDevices.empty())
{
- Warning ("FOUND_NO_PARTITION_W_DEFERRED_INPLACE_ENC");
+ Warning ("FOUND_NO_PARTITION_W_DEFERRED_INPLACE_ENC", hwndDlg);
NormalCursor();
return 1;
@@ -6954,7 +6954,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
+ GetString ("NOTE_BEGINNING")
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO")
+ L" "
- + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str());
+ + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), hwndDlg);
return 1;
}
@@ -7038,14 +7038,14 @@ retryCDDriveCheck:
"CD_BURNER_NOT_PRESENT_CONNECTED_NOW",
0 };
- switch (AskMultiChoice ((void **) multiChoiceStr, FALSE))
+ switch (AskMultiChoice ((void **) multiChoiceStr, FALSE, hwndDlg))
{
case 1:
wchar_t msg[8192];
swprintf_s (msg, array_capacity (msg), GetString ("CD_BURNER_NOT_PRESENT_WILL_STORE_ISO_INFO"), SingleStringToWide (szRescueDiskISO).c_str());
- WarningDirect (msg);
+ WarningDirect (msg, hwndDlg);
- Warning ("RESCUE_DISK_BURN_NO_CHECK_WARN");
+ Warning ("RESCUE_DISK_BURN_NO_CHECK_WARN", hwndDlg);
bDontVerifyRescueDisk = TRUE;
nNewPageNo = SYSENC_RESCUE_DISK_VERIFIED_PAGE;
break;
@@ -7062,7 +7062,7 @@ retryCDDriveCheck:
}
if (IsWindowsIsoBurnerAvailable() && !bDontVerifyRescueDisk)
- Info ("RESCUE_DISK_WIN_ISOBURN_PRELAUNCH_NOTE");
+ Info ("RESCUE_DISK_WIN_ISOBURN_PRELAUNCH_NOTE", hwndDlg);
NormalCursor ();
}
@@ -7083,7 +7083,7 @@ retryCDDriveCheck:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("RESCUE_DISK_CHECK_FAILED"),
IsWindowsIsoBurnerAvailable () ? L"" : GetString ("RESCUE_DISK_CHECK_FAILED_SENTENCE_APPENDIX"));
- ErrorDirect (szTmp);
+ ErrorDirect (szTmp, hwndDlg);
NormalCursor ();
#ifndef _DEBUG
@@ -7101,7 +7101,7 @@ retryCDDriveCheck:
}
else
{
- Warning ("RESCUE_DISK_BURN_NO_CHECK_WARN");
+ Warning ("RESCUE_DISK_BURN_NO_CHECK_WARN", hwndDlg);
nNewPageNo = SYSENC_RESCUE_DISK_VERIFIED_PAGE; // Skip irrelevant pages
}
}
@@ -7110,14 +7110,14 @@ retryCDDriveCheck:
|| nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE)
{
if (nWipeMode > 0
- && AskWarnYesNo ("WIPE_MODE_WARN") == IDNO)
+ && AskWarnYesNo ("WIPE_MODE_WARN", hwndDlg) == IDNO)
return 1;
}
else if (nCurPageNo == SYSENC_PRETEST_INFO_PAGE)
{
if (LocalizationActive
- && AskWarnYesNo ("PREBOOT_NOT_LOCALIZED") == IDNO)
+ && AskWarnYesNo ("PREBOOT_NOT_LOCALIZED", hwndDlg) == IDNO)
return 1;
bConfirmQuitSysEncPretest = TRUE;
@@ -7125,7 +7125,7 @@ retryCDDriveCheck:
if (!bHiddenOS) // This text is not tailored to hidden OS
TextInfoDialogBox (TC_TBXID_SYS_ENCRYPTION_PRETEST);
- if (AskWarnYesNo ("CONFIRM_RESTART") == IDNO)
+ if (AskWarnYesNo ("CONFIRM_RESTART", hwndDlg) == IDNO)
return 1;
/* Install the pre-boot authentication component and initiate the system encryption pretest.
@@ -7148,7 +7148,7 @@ retryCDDriveCheck:
catch (Exception &e)
{
e.Show (hwndDlg);
- Error (bHiddenOS ? "CANNOT_INITIATE_HIDDEN_OS_CREATION" : "CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST");
+ Error (bHiddenOS ? "CANNOT_INITIATE_HIDDEN_OS_CREATION" : "CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST", hwndDlg);
NormalCursor ();
return 1;
}
@@ -7178,14 +7178,14 @@ retryCDDriveCheck:
|| !ChangeHiddenOSCreationPhase (TC_HIDDEN_OS_CREATION_PHASE_CLONING))
{
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
- Error ("CANNOT_INITIATE_HIDDEN_OS_CREATION");
+ Error ("CANNOT_INITIATE_HIDDEN_OS_CREATION", hwndDlg);
NormalCursor ();
return 1;
}
}
else if (!ChangeSystemEncryptionStatus (SYSENC_STATUS_PRETEST))
{
- Error ("CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST");
+ Error ("CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST", hwndDlg);
NormalCursor ();
return 1;
}
@@ -7288,10 +7288,10 @@ retryCDDriveCheck:
+ GetString ("NOTE_BEGINNING")
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO")
+ L" "
- + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str());
+ + GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), hwndDlg);
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()
- && AskYesNo("OFFER_FAT_FORMAT_ALTERNATIVE") == IDYES)
+ && AskYesNo("OFFER_FAT_FORMAT_ALTERNATIVE", hwndDlg) == IDYES)
{
fileSystem = FILESYS_FAT;
SelectAlgo (GetDlgItem (hCurPage, IDC_FILESYS), (int *) &fileSystem);
@@ -7299,7 +7299,7 @@ retryCDDriveCheck:
else
{
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) > TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
- Info ("FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME");
+ Info ("FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME", hwndDlg);
bVolTransformThreadToRun = FALSE;
return 1;
@@ -7317,10 +7317,10 @@ retryCDDriveCheck:
if (bHiddenOS
&& (double) nVolumeSize / GetSystemPartitionSize() < MIN_HIDDENOS_DECOY_PARTITION_SIZE_RATIO_NTFS)
{
- Error("OUTER_VOLUME_TOO_SMALL_FOR_HIDDEN_OS_NTFS");
+ Error("OUTER_VOLUME_TOO_SMALL_FOR_HIDDEN_OS_NTFS", hwndDlg);
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()
- && AskYesNo("OFFER_FAT_FORMAT_ALTERNATIVE") == IDYES)
+ && AskYesNo("OFFER_FAT_FORMAT_ALTERNATIVE", hwndDlg) == IDYES)
{
fileSystem = FILESYS_FAT;
SelectAlgo (GetDlgItem (hCurPage, IDC_FILESYS), (int *) &fileSystem);
@@ -7328,7 +7328,7 @@ retryCDDriveCheck:
else
{
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) > TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
- Info ("FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME");
+ Info ("FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME", hwndDlg);
bVolTransformThreadToRun = FALSE;
return 1;
@@ -7339,12 +7339,12 @@ retryCDDriveCheck:
{
if (nCurrentOS == WIN_2000)
{
- Error("HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000");
+ Error("HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000", hwndDlg);
bVolTransformThreadToRun = FALSE;
return 1;
}
else if (GetVolumeDataAreaSize (FALSE, nVolumeSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()
- && AskYesNo("HIDDEN_VOL_HOST_NTFS_ASK") == IDNO)
+ && AskYesNo("HIDDEN_VOL_HOST_NTFS_ASK", hwndDlg) == IDNO)
{
bVolTransformThreadToRun = FALSE;
return 1;
@@ -7362,7 +7362,7 @@ retryCDDriveCheck:
if (fileSystem == FILESYS_FAT
&& nNeedToStoreFilesOver4GB == 1
- && AskWarnNoYes("CONFIRM_FAT_FOR_FILES_OVER_4GB") == IDNO)
+ && AskWarnNoYes("CONFIRM_FAT_FOR_FILES_OVER_4GB", hwndDlg) == IDNO)
{
bVolTransformThreadToRun = FALSE;
return 1;
@@ -7555,7 +7555,7 @@ retryCDDriveCheck:
else if (nCurPageNo == DEVICE_WIPE_PAGE)
{
- if (AskWarnOkCancel (bHiddenOS && IsHiddenOSRunning() ? "CONFIRM_WIPE_START_DECOY_SYS_PARTITION" : "CONFIRM_WIPE_START") == IDOK)
+ if (AskWarnOkCancel (bHiddenOS && IsHiddenOSRunning() ? "CONFIRM_WIPE_START_DECOY_SYS_PARTITION" : "CONFIRM_WIPE_START", hwndDlg) == IDOK)
{
WipeStart ();
ArrowWaitCursor();
@@ -7705,7 +7705,7 @@ ovf_end:
{
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
- Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT");
+ Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg);
else
bKeyboardLayoutChanged = FALSE;
}
@@ -7888,7 +7888,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
}
else
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
@@ -7906,7 +7906,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
}
else
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
@@ -7923,7 +7923,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
}
else
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
@@ -7941,7 +7941,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
}
else
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
@@ -7959,7 +7959,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
}
else
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
@@ -7976,7 +7976,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
}
else
{
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
@@ -8022,9 +8022,9 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
case OptionTokenLib:
if (GetArgumentValue (lpszCommandLineArgs, nArgPos, &i, nNoCommandLineArgs, SecurityTokenLibraryPath, sizeof (SecurityTokenLibraryPath)) == HAS_ARGUMENT)
- InitSecurityTokenLibrary();
+ InitSecurityTokenLibrary(hwndDlg);
else
- Error ("COMMAND_LINE_ERROR");
+ Error ("COMMAND_LINE_ERROR", hwndDlg);
break;
@@ -8123,28 +8123,28 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &volProp, sizeof (volProp), &volProp, sizeof (volProp), &dwResult, NULL) || dwResult == 0)
{
handleWin32Error (hwndDlg);
- Error ("CANT_ACCESS_OUTER_VOL");
+ Error ("CANT_ACCESS_OUTER_VOL", hwndDlg);
goto efsf_error;
}
if (volProp.volFormatVersion < TC_VOLUME_FORMAT_VERSION)
{
// We do not support creating hidden volumes within volumes created by TrueCrypt 5.1a or earlier.
- Error ("ERR_VOL_FORMAT_BAD");
+ Error ("ERR_VOL_FORMAT_BAD", hwndDlg);
return 0;
}
if (volProp.hiddenVolume)
{
// The user entered a password for a hidden volume
- Error ("ERR_HIDDEN_NOT_NORMAL_VOLUME");
+ Error ("ERR_HIDDEN_NOT_NORMAL_VOLUME", hwndDlg);
return 0;
}
if (volProp.volumeHeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC
|| volProp.volumeHeaderFlags & TC_HEADER_FLAG_ENCRYPTED_SYSTEM)
{
- Warning ("ERR_HIDDEN_VOL_HOST_ENCRYPTED_INPLACE");
+ Warning ("ERR_HIDDEN_VOL_HOST_ENCRYPTED_INPLACE", hwndDlg);
return 0;
}
@@ -8206,12 +8206,12 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
if (nCurrentOS == WIN_2000)
{
- Error("HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000");
+ Error("HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000", hwndDlg);
return 0;
}
if (bHiddenVolDirect && GetVolumeDataAreaSize (FALSE, hiddenVolHostSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
- Info ("HIDDEN_VOL_HOST_NTFS");
+ Info ("HIDDEN_VOL_HOST_NTFS", hwndDlg);
if (!GetDiskFreeSpace(szRootPathName,
&dwSectorsPerCluster,
@@ -8220,7 +8220,7 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
&dwTotalNumberOfClusters))
{
handleWin32Error (hwndDlg);
- Error ("CANT_GET_OUTER_VOL_INFO");
+ Error ("CANT_GET_OUTER_VOL_INFO", hwndDlg);
return -1;
};
@@ -8240,7 +8240,7 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
{
// Unsupported file system
- Error ((nCurrentOS == WIN_2000) ? "HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000" : "HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS");
+ Error ((nCurrentOS == WIN_2000) ? "HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000" : "HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS", hwndDlg);
return 0;
}
@@ -8418,7 +8418,7 @@ static void AfterSysEncProgressWMInitTasks (HWND hwndDlg)
WipeHiddenOSCreationConfig(); // For extra conservative security
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
- Info ("SYSTEM_ENCRYPTION_FINISHED");
+ Info ("SYSTEM_ENCRYPTION_FINISHED", hwndDlg);
EndMainDlg (MainDlg);
return;
}
@@ -8472,7 +8472,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
{
if (IsHiddenOSRunning())
{
- Warning ("CANNOT_DECRYPT_HIDDEN_OS");
+ Warning ("CANNOT_DECRYPT_HIDDEN_OS", hwndDlg);
AbortProcessSilent();
}
@@ -8517,7 +8517,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
// system partition and then pressed Esc in the boot loader screen. 3) Corrupted or stale config
// file. 4) Damaged system.
- Warning ("SYSTEM_ENCRYPTION_SCHEDULED_BUT_PBA_FAILED");
+ Warning ("SYSTEM_ENCRYPTION_SCHEDULED_BUT_PBA_FAILED", hwndDlg);
EndMainDlg (MainDlg);
return;
}
@@ -8542,7 +8542,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
case SYSENC_COMMAND_STARTUP_SEQ_RESUME:
if (bDirectSysEncModeCommand == SYSENC_COMMAND_STARTUP_SEQ_RESUME
- && AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT") == IDNO)
+ && AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", hwndDlg) == IDNO)
{
EndMainDlg (MainDlg);
return;
@@ -8570,7 +8570,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
else
{
// Nothing to resume
- Warning ("NOTHING_TO_RESUME");
+ Warning ("NOTHING_TO_RESUME", hwndDlg);
EndMainDlg (MainDlg);
return;
@@ -8581,7 +8581,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
if (SysDriveOrPartitionFullyEncrypted (FALSE))
{
- Info ("SYS_PARTITION_OR_DRIVE_APPEARS_FULLY_ENCRYPTED");
+ Info ("SYS_PARTITION_OR_DRIVE_APPEARS_FULLY_ENCRYPTED", hwndDlg);
EndMainDlg (MainDlg);
return;
}
@@ -8636,7 +8636,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
if (CreateSysEncMutex ()) // If no other instance is currently taking care of system encryption
{
- if (AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT") == IDYES)
+ if (AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", hwndDlg) == IDYES)
{
bDirectSysEncMode = TRUE;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
@@ -8708,7 +8708,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
catch (Exception &e)
{
e.Show (hwndDlg);
- Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
+ Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", hwndDlg);
EndMainDlg (MainDlg);
return;
}
@@ -8780,7 +8780,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
{
// Pretest failed (no hidden operating system involved)
- if (AskWarnYesNo ("BOOT_PRETEST_FAILED_RETRY") == IDYES)
+ if (AskWarnYesNo ("BOOT_PRETEST_FAILED_RETRY", hwndDlg) == IDYES)
{
// User wants to retry the pretest
bAnswerTerminate = FALSE;
@@ -8804,7 +8804,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
"HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_ASK_LATER",
0};
- switch (AskMultiChoice ((void **) tmpStr, FALSE))
+ switch (AskMultiChoice ((void **) tmpStr, FALSE, hwndDlg))
{
case 1:
// User wants to restart and continue/retry
@@ -8843,7 +8843,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
e.Show (NULL);
}
- if (AskWarnYesNo ("CONFIRM_RESTART") == IDYES)
+ if (AskWarnYesNo ("CONFIRM_RESTART", hwndDlg) == IDYES)
{
EndMainDlg (MainDlg);
@@ -8935,7 +8935,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
if (NonSysInplaceEncInProgressElsewhere ())
AbortProcessSilent ();
- if (AskNonSysInPlaceEncryptionResume() == IDYES)
+ if (AskNonSysInPlaceEncryptionResume(hwndDlg) == IDYES)
SwitchWizardToNonSysInplaceEncResumeMode();
else
AbortProcessSilent ();
@@ -8944,7 +8944,7 @@ static void AfterWMInitTasks (HWND hwndDlg)
}
else if (bInPlaceEncNonSysPending
&& !NonSysInplaceEncInProgressElsewhere ()
- && AskNonSysInPlaceEncryptionResume() == IDYES)
+ && AskNonSysInPlaceEncryptionResume(hwndDlg) == IDYES)
{
SwitchWizardToNonSysInplaceEncResumeMode();
return;
diff --git a/src/Format/Tcformat.h b/src/Format/Tcformat.h
index e8b790cf..cea36ccd 100644
--- a/src/Format/Tcformat.h
+++ b/src/Format/Tcformat.h
@@ -47,7 +47,7 @@ void AddCipher ( HWND hComboBox , char *lpszCipher , int nCipher );
BOOL CALLBACK PageDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK MainDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
void ExtractCommandLine ( HWND hwndDlg , char *lpszCommandLine );
-void DisplayRandPool (HWND hPoolDisplay, BOOL bShow);
+void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow);
void DisplayPortionsOfKeys (HWND headerKeyHandle, HWND masterKeyHandle, char *headerKeyStr, char *masterKeyStr, BOOL hideKeys);
int DetermineMaxHiddenVolSize (HWND hwndDlg);
BOOL IsSparseFile (HWND hwndDlg);
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index 93d9c648..a1a469bc 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -91,7 +91,7 @@ namespace VeraCrypt
&& IsVolumeDeviceHosted (favorite.Path.c_str())
&& favorite.Path.find ("\\\\?\\Volume{") != 0)
{
- Warning (favorite.Path.find ("\\Partition0") == string::npos ? "FAVORITE_ADD_PARTITION_TYPE_WARNING" : "FAVORITE_ADD_DRIVE_DEV_WARNING");
+ Warning (favorite.Path.find ("\\Partition0") == string::npos ? "FAVORITE_ADD_PARTITION_TYPE_WARNING" : "FAVORITE_ADD_DRIVE_DEV_WARNING", hwndDlg);
}
return OrganizeFavoriteVolumes (hwndDlg, systemFavorites, favorite);
@@ -255,7 +255,7 @@ namespace VeraCrypt
if (SelectedItem != -1 && !Favorites.empty())
SetFavoriteVolume (hwndDlg, Favorites[SelectedItem], SystemFavoritesMode);
- if (SaveFavoriteVolumes (Favorites, SystemFavoritesMode))
+ if (SaveFavoriteVolumes (hwndDlg, Favorites, SystemFavoritesMode))
{
if (!SystemFavoritesMode)
{
@@ -276,7 +276,7 @@ namespace VeraCrypt
{
if (favorite.MountOnArrival)
{
- Warning ("FAVORITE_ARRIVAL_MOUNT_BACKGROUND_TASK_ERR");
+ Warning ("FAVORITE_ARRIVAL_MOUNT_BACKGROUND_TASK_ERR", hwndDlg);
break;
}
}
@@ -291,7 +291,7 @@ namespace VeraCrypt
SystemFavoriteVolumes = Favorites;
OnFavoriteVolumesUpdated();
- LoadDriveLetters (GetDlgItem (MainDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (hwndDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), 0);
EndDialog (hwndDlg, IDOK);
}
@@ -344,10 +344,10 @@ namespace VeraCrypt
if (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_OPEN_EXPLORER_WIN_ON_MOUNT))
{
- WarningDirect ((wstring (GetString ("SYS_FAVORITES_KEYBOARD_WARNING")) + L"\n\n" + GetString ("BOOT_PASSWORD_CACHE_KEYBOARD_WARNING")).c_str());
+ WarningDirect ((wstring (GetString ("SYS_FAVORITES_KEYBOARD_WARNING")) + L"\n\n" + GetString ("BOOT_PASSWORD_CACHE_KEYBOARD_WARNING")).c_str(), hwndDlg);
if (!IsServerOS() && !IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_DISABLE_HOTKEY))
- Info ("SYS_FAVORITES_ADMIN_ONLY_INFO");
+ Info ("SYS_FAVORITES_ADMIN_ONLY_INFO", hwndDlg);
}
}
return 1;
@@ -358,9 +358,9 @@ namespace VeraCrypt
// DISABLE_NONADMIN_SYS_FAVORITES_ACCESS
if (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_DISABLE_HOTKEY))
- WarningDirect ((wstring (GetString ("SYS_FAVORITES_ADMIN_ONLY_WARNING")) + L"\n\n" + GetString ("SETTING_REQUIRES_REBOOT")).c_str());
+ WarningDirect ((wstring (GetString ("SYS_FAVORITES_ADMIN_ONLY_WARNING")) + L"\n\n" + GetString ("SETTING_REQUIRES_REBOOT")).c_str(), hwndDlg);
else
- Warning ("SETTING_REQUIRES_REBOOT");
+ Warning ("SETTING_REQUIRES_REBOOT", hwndDlg);
}
return 1;
@@ -647,7 +647,7 @@ namespace VeraCrypt
}
- static bool SaveFavoriteVolumes (const vector <FavoriteVolume> &favorites, bool systemFavorites)
+ static bool SaveFavoriteVolumes (HWND hwndDlg, const vector <FavoriteVolume> &favorites, bool systemFavorites)
{
FILE *f;
int cnt = 0;
@@ -667,7 +667,7 @@ namespace VeraCrypt
char tq[2048];
if (systemFavorites && favorite.Path.find ("\\\\") == 0 && favorite.Path.find ("Volume{") == string::npos)
- Warning ("SYSTEM_FAVORITE_NETWORK_PATH_ERR");
+ Warning ("SYSTEM_FAVORITE_NETWORK_PATH_ERR", hwndDlg);
XmlQuoteText (!favorite.VolumePathId.empty() ? favorite.VolumePathId.c_str() : favorite.Path.c_str(), tq, sizeof (tq));
@@ -706,7 +706,7 @@ namespace VeraCrypt
fputws (L"\n\t</favorites>", f);
XmlWriteFooterW (f);
- if (!CheckFileStreamWriteErrors (f, systemFavorites ? TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES : TC_APPD_FILENAME_FAVORITE_VOLUMES))
+ if (!CheckFileStreamWriteErrors (hwndDlg, f, systemFavorites ? TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES : TC_APPD_FILENAME_FAVORITE_VOLUMES))
{
fclose (f);
return false;
@@ -734,7 +734,7 @@ namespace VeraCrypt
bootEnc.CopyFileAdmin (GetConfigPath (TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES), GetServiceConfigPath (TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES).c_str());
if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES))
- Info ("SYS_FAVORITE_VOLUMES_SAVED");
+ Info ("SYS_FAVORITE_VOLUMES_SAVED", hwndDlg);
}
}
catch (Exception &e)
@@ -834,20 +834,20 @@ namespace VeraCrypt
if (!favorite.Label.empty())
{
- ErrorDirect ((GetString (partition ? "FAVORITE_LABEL_PARTITION_TYPE_ERR" : "FAVORITE_LABEL_DEVICE_PATH_ERR") + wstring (L"\n\n") + SingleStringToWide (favorite.Path)).c_str());
+ ErrorDirect ((GetString (partition ? "FAVORITE_LABEL_PARTITION_TYPE_ERR" : "FAVORITE_LABEL_DEVICE_PATH_ERR") + wstring (L"\n\n") + SingleStringToWide (favorite.Path)).c_str(), hwndDlg);
favorite.Label.clear();
}
if (favorite.MountOnArrival)
{
- ErrorDirect ((GetString (partition ? "FAVORITE_ARRIVAL_MOUNT_PARTITION_TYPE_ERR" : "FAVORITE_ARRIVAL_MOUNT_DEVICE_PATH_ERR") + wstring (L"\n\n") + SingleStringToWide (favorite.Path)).c_str());
+ ErrorDirect ((GetString (partition ? "FAVORITE_ARRIVAL_MOUNT_PARTITION_TYPE_ERR" : "FAVORITE_ARRIVAL_MOUNT_DEVICE_PATH_ERR") + wstring (L"\n\n") + SingleStringToWide (favorite.Path)).c_str(), hwndDlg);
favorite.MountOnArrival = false;
}
}
if (favorite.MountOnArrival && favorite.Path.find ("\\\\") == 0 && favorite.Path.find ("Volume{") == string::npos)
{
- Error ("FAVORITE_ARRIVAL_MOUNT_NETWORK_PATH_ERR");
+ Error ("FAVORITE_ARRIVAL_MOUNT_NETWORK_PATH_ERR", hwndDlg);
favorite.MountOnArrival = false;
}
}
diff --git a/src/Mount/Favorites.h b/src/Mount/Favorites.h
index 248a4f08..f91905d8 100644
--- a/src/Mount/Favorites.h
+++ b/src/Mount/Favorites.h
@@ -65,7 +65,7 @@ namespace VeraCrypt
void LoadFavoriteVolumes (vector <FavoriteVolume> &favorites, bool systemFavorites, bool noUacElevation = false);
static void OnFavoriteVolumesUpdated ();
BOOL OrganizeFavoriteVolumes (HWND hwndDlg, bool systemFavorites, const FavoriteVolume &newFavorite = FavoriteVolume());
- static bool SaveFavoriteVolumes (const vector <FavoriteVolume> &favorites, bool systemFavorites);
+ static bool SaveFavoriteVolumes (HWND hwndDlg, const vector <FavoriteVolume> &favorites, bool systemFavorites);
static void SetControls (HWND hwndDlg, const FavoriteVolume &favorite, bool systemFavoritesMode, bool enable = true);
static void SetFavoriteVolume (HWND hwndDlg, FavoriteVolume &favorite, bool systemFavoritesMode);
void UpdateDeviceHostedFavoriteVolumes ();
diff --git a/src/Mount/Hotkeys.c b/src/Mount/Hotkeys.c
index 34f980eb..0848155e 100644
--- a/src/Mount/Hotkeys.c
+++ b/src/Mount/Hotkeys.c
@@ -398,7 +398,7 @@ BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
// Check if it's not already assigned
if (ShortcutInUse (currentVKeyCode, modifiers, tmpHotkeys))
{
- Error ("SHORTCUT_ALREADY_IN_USE");
+ Error ("SHORTCUT_ALREADY_IN_USE", hwndDlg);
return 1;
}
@@ -410,7 +410,7 @@ BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
/* F1 is help and F12 is reserved for use by the debugger at all times */
if (modifiers == 0)
{
- Error ("CANNOT_USE_RESERVED_KEY");
+ Error ("CANNOT_USE_RESERVED_KEY", hwndDlg);
return 1;
}
break;
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 17ca77cf..92c79dd9 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -238,7 +238,7 @@ void RefreshMainDlg (HWND hwndDlg)
int drive = (char) (HIWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))));
MoveEditToCombo (GetDlgItem (hwndDlg, IDC_VOLUME), bHistory);
- LoadDriveLetters (GetDlgItem (hwndDlg, IDC_DRIVELIST), drive);
+ LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), drive);
EnableDisableButtons (hwndDlg);
}
@@ -347,7 +347,7 @@ static void InitMainDialog (HWND hwndDlg)
0, 0, 0, 0, FALSE, TRUE);
}
- BuildTree (GetDlgItem (hwndDlg, IDC_DRIVELIST));
+ BuildTree (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST));
if (*szDriveLetter != 0)
{
@@ -516,7 +516,7 @@ void LoadSettings (HWND hwndDlg)
ConfigReadString ("SecurityTokenLibrary", "", SecurityTokenLibraryPath, sizeof (SecurityTokenLibraryPath) - 1);
if (SecurityTokenLibraryPath[0])
- InitSecurityTokenLibrary();
+ InitSecurityTokenLibrary(hwndDlg);
// Hotkeys
bPlaySoundOnSuccessfulHkDismount = ConfigReadInt ("PlaySoundOnHotkeyMountDismount", TRUE);
@@ -630,7 +630,7 @@ void SaveSettings (HWND hwndDlg)
// PKCS#11 Library Path
ConfigWriteString ("SecurityTokenLibrary", SecurityTokenLibraryPath[0] ? SecurityTokenLibraryPath : "");
- ConfigWriteEnd ();
+ ConfigWriteEnd (hwndDlg);
// History
DumpCombo (GetDlgItem (hwndDlg, IDC_VOLUME), IsButtonChecked (GetDlgItem (hwndDlg, IDC_NO_HISTORY)));
@@ -816,7 +816,7 @@ static void PopulateSysEncContextMenu (HMENU popup, BOOL bToolsOnly)
// mounting a partition (as a regular volume) that is within key scope of system encryption.
// Returns TRUE if the partition can be mounted as a partition within key scope of inactive system encryption.
// If devicePath is empty, the currently selected partition in the GUI is checked.
-BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
+BOOL CheckSysEncMountWithoutPBA (HWND hwndDlg, const char *devicePath, BOOL quiet)
{
BOOL tmpbDevice;
char szDevicePath [TC_MAX_PATH+1];
@@ -830,7 +830,7 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
if (!tmpbDevice)
{
if (!quiet)
- Warning ("NO_SYSENC_PARTITION_SELECTED");
+ Warning ("NO_SYSENC_PARTITION_SELECTED", hwndDlg);
return FALSE;
}
@@ -838,7 +838,7 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
if (LOWORD (GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST))) != TC_MLIST_ITEM_FREE)
{
if (!quiet)
- Warning ("SELECT_FREE_DRIVE");
+ Warning ("SELECT_FREE_DRIVE", hwndDlg);
return FALSE;
}
@@ -853,7 +853,7 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
{
// Only partitions are supported (not whole drives)
if (!quiet)
- Warning ("NO_SYSENC_PARTITION_SELECTED");
+ Warning ("NO_SYSENC_PARTITION_SELECTED", hwndDlg);
return FALSE;
}
@@ -871,7 +871,7 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
if (sscanf (szDevicePath, "\\Device\\Harddisk%d\\Partition", &driveNo) != 1)
{
if (!quiet)
- Error ("INVALID_PATH");
+ Error ("INVALID_PATH", hwndDlg);
return FALSE;
}
@@ -896,7 +896,7 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
// The partition is located on active system drive
if (!quiet)
- Warning ("MOUNT_WITHOUT_PBA_VOL_ON_ACTIVE_SYSENC_DRIVE");
+ Warning ("MOUNT_WITHOUT_PBA_VOL_ON_ACTIVE_SYSENC_DRIVE", hwndDlg);
return FALSE;
}
@@ -907,7 +907,7 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
catch (Exception &e)
{
NormalCursor();
- e.Show (MainDlg);
+ e.Show (hwndDlg);
}
return FALSE;
@@ -1014,7 +1014,7 @@ static void LaunchVolCreationWizard (HWND hwndDlg, const char *arg)
StringCbCatA (t, sizeof(t), "\\VeraCrypt Format.exe\"");
if (!FileExists(t))
- Error ("VOL_CREATION_WIZARD_NOT_FOUND"); // Display a user-friendly error message and advise what to do
+ Error ("VOL_CREATION_WIZARD_NOT_FOUND", hwndDlg); // Display a user-friendly error message and advise what to do
if (strlen (arg) > 0)
{
@@ -1037,7 +1037,7 @@ static void LaunchVolCreationWizard (HWND hwndDlg, const char *arg)
// Fills drive list
// drive>0 = update only the corresponding drive subitems
-void LoadDriveLetters (HWND hTree, int drive)
+void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive)
{
// Remember the top-most visible item
int lastTopMostVisibleItem = ListView_GetTopIndex (hTree);
@@ -1091,7 +1091,7 @@ void LoadDriveLetters (HWND hTree, int drive)
LastKnownLogicalDrives = dwUsedDrives = GetLogicalDrives ();
if (dwUsedDrives == 0)
- Warning ("DRIVELETTERS");
+ Warning ("DRIVELETTERS", hwndDlg);
if(drive == 0)
ListView_DeleteAllItems(hTree);
@@ -1627,7 +1627,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
- Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 0;
}
@@ -1646,7 +1646,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{
- Error ("CANNOT_SET_TIMER");
+ Error ("CANNOT_SET_TIMER", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 0;
}
@@ -1694,7 +1694,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
- Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
@@ -1760,7 +1760,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
if (bSysEncPwdChangeDlgMode)
{
- Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION");
+ Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", hwndDlg);
return 1;
}
@@ -1792,7 +1792,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
if (bSysEncPwdChangeDlgMode)
{
- Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION");
+ Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", hwndDlg);
return 1;
}
@@ -1855,7 +1855,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (new_hash_algo_id != 0 && !HashForSystemEncryption(new_hash_algo_id))
{
int new_hash_algo_id = DEFAULT_HASH_ALGORITHM_BOOT;
- Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION");
+ Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", hwndDlg);
SelectAlgo (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), &new_hash_algo_id);
}
}
@@ -1908,7 +1908,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (!CheckPasswordCharEncoding (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL))
{
- Error ("UNSUPPORTED_CHARS_IN_PWD");
+ Error ("UNSUPPORTED_CHARS_IN_PWD", hwndDlg);
return 1;
}
@@ -1945,11 +1945,11 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
WaitCursor ();
if (KeyFilesEnable)
- KeyFilesApply (&oldPassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &oldPassword, FirstKeyFile);
if (newKeyFilesParam.EnableKeyFiles)
{
- if (!KeyFilesApply (&newPassword, pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF ? FirstKeyFile : newKeyFilesParam.FirstKeyFile))
+ if (!KeyFilesApply (hwndDlg, &newPassword, pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF ? FirstKeyFile : newKeyFilesParam.FirstKeyFile))
{
nStatus = ERR_DONT_REPORT;
goto err;
@@ -2116,14 +2116,14 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
- Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{
- Error ("CANNOT_SET_TIMER");
+ Error ("CANNOT_SET_TIMER", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
@@ -2162,7 +2162,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
- Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
@@ -2235,7 +2235,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDOK)
{
if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles)
- KeyFilesApply (&mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
+ KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
GetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), (LPSTR) szXPwd->Text, MAX_PASSWORD + 1);
szXPwd->Length = strlen ((char *) szXPwd->Text);
@@ -2262,7 +2262,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
- Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT");
+ Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg);
}
EndDialog (hwndDlg, lw);
@@ -2434,7 +2434,7 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (lw == IDC_PREF_BKG_TASK_ENABLE && !IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_BKG_TASK_ENABLE)))
{
- if (AskWarnNoYes ("CONFIRM_BACKGROUND_TASK_DISABLED") == IDNO)
+ if (AskWarnNoYes ("CONFIRM_BACKGROUND_TASK_DISABLED", hwndDlg) == IDNO)
SetCheckBox (hwndDlg, IDC_PREF_BKG_TASK_ENABLE, TRUE);
}
@@ -2457,7 +2457,7 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
if (lw == IDC_PREF_FORCE_AUTO_DISMOUNT && (i || l || sl || p || s))
{
- if (AskWarnNoYes ("CONFIRM_NO_FORCED_AUTODISMOUNT") == IDNO)
+ if (AskWarnNoYes ("CONFIRM_NO_FORCED_AUTODISMOUNT", hwndDlg) == IDNO)
SetCheckBox (hwndDlg, IDC_PREF_FORCE_AUTO_DISMOUNT, TRUE);
}
else if ((lw == IDC_PREF_DISMOUNT_INACTIVE && i
@@ -2465,11 +2465,11 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|| lw == IDC_PREF_DISMOUNT_SESSION_LOCKED && sl
|| lw == IDC_PREF_DISMOUNT_POWERSAVING && p
|| lw == IDC_PREF_DISMOUNT_SCREENSAVER && s))
- Warning ("WARN_PREF_AUTO_DISMOUNT");
+ Warning ("WARN_PREF_AUTO_DISMOUNT", hwndDlg);
}
if (p && lw == IDC_PREF_DISMOUNT_POWERSAVING)
- Warning ("WARN_PREF_AUTO_DISMOUNT_ON_POWER");
+ Warning ("WARN_PREF_AUTO_DISMOUNT_ON_POWER", hwndDlg);
}
if (lw == IDCANCEL)
@@ -2724,7 +2724,7 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), tmp);
if ((mountOptions->ProtectHiddenVolume && !bEnableBkgTask)
- && (AskWarnYesNo ("HIDVOL_PROT_BKG_TASK_WARNING") == IDYES))
+ && (AskWarnYesNo ("HIDVOL_PROT_BKG_TASK_WARNING", hwndDlg) == IDYES))
{
bEnableBkgTask = TRUE;
TaskBarIconAdd (MainDlg);
@@ -3195,7 +3195,7 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
&& (lw == IDC_AUTORUN_MOUNT || lw == IDC_AUTORUN_START))
{
bAutoRunWarningDisplayed = TRUE;
- Warning ("AUTORUN_MAY_NOT_ALWAYS_WORK");
+ Warning ("AUTORUN_MAY_NOT_ALWAYS_WORK", hwndDlg);
}
return 1;
@@ -3366,7 +3366,7 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
fwprintf (af, L"shell\\start=%s\nshell\\start\\command=VeraCrypt\\VeraCrypt.exe\n", GetString ("IDC_PREF_LOGON_START"));
fwprintf (af, L"shell\\dismount=%s\nshell\\dismount\\command=VeraCrypt\\VeraCrypt.exe /q /d\n", GetString ("DISMOUNT_ALL_TC_VOLUMES"));
- CheckFileStreamWriteErrors (af, dstPath);
+ CheckFileStreamWriteErrors (hwndDlg, af, dstPath);
fclose (af);
}
MessageBoxW (hwndDlg, GetString ("TRAVELER_DISK_CREATED"), lpszTitle, MB_ICONINFORMATION);
@@ -3381,7 +3381,7 @@ stop:
return 0;
}
-void BuildTree (HWND hTree)
+void BuildTree (HWND hwndDlg, HWND hTree)
{
HIMAGELIST hList;
HBITMAP hBitmap, hBitmapMask;
@@ -3470,7 +3470,7 @@ void BuildTree (HWND hTree)
ListView_SetImageList (hTree, hList, LVSIL_NORMAL);
ListView_SetImageList (hTree, hList, LVSIL_SMALL);
- LoadDriveLetters (hTree, 0);
+ LoadDriveLetters (hwndDlg, hTree, 0);
}
LPARAM GetSelectedLong (HWND hTree)
@@ -3564,7 +3564,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
if (IsMountedVolume (szFileName))
{
- Warning ("VOL_ALREADY_MOUNTED");
+ Warning ("VOL_ALREADY_MOUNTED", hwndDlg);
status = FALSE;
goto ret;
}
@@ -3591,7 +3591,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
Password emptyPassword;
emptyPassword.Length = 0;
- KeyFilesApply (&emptyPassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile);
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, CmdVolumePkcs5, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
if (mounted)
VolumePkcs5 = CmdVolumePkcs5;
@@ -3610,7 +3610,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
// Check for problematic file extensions (exe, dll, sys)
if (CheckFileExtension(szFileName))
- Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING");
+ Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg);
}
while (mounted == 0)
@@ -3637,18 +3637,18 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
WaitCursor ();
if (KeyFilesEnable)
- KeyFilesApply (&VolumePassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, bCacheInDriver, bForceMount, &mountOptions, Silent, !Silent);
NormalCursor ();
// Check for legacy non-ASCII passwords
if (mounted > 0 && !KeyFilesEnable && !CheckPasswordCharEncoding (NULL, &VolumePassword))
- Warning ("UNSUPPORTED_CHARS_IN_PWD_RECOM");
+ Warning ("UNSUPPORTED_CHARS_IN_PWD_RECOM", hwndDlg);
// Check for problematic file extensions (exe, dll, sys)
if (mounted > 0 && CheckFileExtension (szFileName))
- Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING");
+ Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg);
if (!MultipleMountOperationInProgress)
{
@@ -3680,7 +3680,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
}
if (mountOptions.ProtectHiddenVolume)
- Info ("HIDVOL_PROT_WARN_AFTER_MOUNT");
+ Info ("HIDVOL_PROT_WARN_AFTER_MOUNT", hwndDlg);
}
ret:
@@ -3727,7 +3727,7 @@ static BOOL Dismount (HWND hwndDlg, int nDosDriveNo)
RefreshMainDlg (hwndDlg);
if (nCurrentOS == WIN_2000 && RemoteSession && !IsAdmin ())
- LoadDriveLetters (GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
}
NormalCursor ();
@@ -3822,7 +3822,7 @@ retry:
RefreshMainDlg (hwndDlg);
if (nCurrentOS == WIN_2000 && RemoteSession && !IsAdmin ())
- LoadDriveLetters (GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
NormalCursor();
@@ -3833,7 +3833,7 @@ retry:
if (unmount.nReturnCode == ERR_FILES_OPEN)
{
- if (interact && IDYES == AskWarnYesNoTopmost ("UNMOUNTALL_LOCK_FAILED"))
+ if (interact && IDYES == AskWarnYesNoTopmost ("UNMOUNTALL_LOCK_FAILED", hwndDlg))
{
forceUnmount = TRUE;
goto retry;
@@ -3914,9 +3914,9 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
WaitCursor();
if (FirstCmdKeyFile)
- KeyFilesApply (&VolumePassword, FirstCmdKeyFile);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstCmdKeyFile);
else if (KeyFilesEnable)
- KeyFilesApply (&VolumePassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
}
@@ -3972,7 +3972,7 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
if (mounted == 2)
shared = TRUE;
- LoadDriveLetters (driveList, (HIWORD (GetItemLong (GetDlgItem (hwndDlg, IDC_DRIVELIST), selDrive))));
+ LoadDriveLetters (hwndDlg, driveList, (HIWORD (GetItemLong (GetDlgItem (hwndDlg, IDC_DRIVELIST), selDrive))));
selDrive++;
if (bExplore)
@@ -4035,7 +4035,7 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
bHeaderBakRetry = FALSE;
if (!Silent)
- Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK");
+ Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK", hwndDlg);
}
if (!bHeaderBakRetry)
@@ -4053,14 +4053,14 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
ResetWrongPwdRetryCount ();
if (shared)
- Warning ("DEVICE_IN_USE_INFO");
+ Warning ("DEVICE_IN_USE_INFO", hwndDlg);
if (mountOptions.ProtectHiddenVolume)
{
if (mountedVolCount > 1)
- Info ("HIDVOL_PROT_WARN_AFTER_MOUNT_PLURAL");
+ Info ("HIDVOL_PROT_WARN_AFTER_MOUNT_PLURAL", hwndDlg);
else if (mountedVolCount == 1)
- Info ("HIDVOL_PROT_WARN_AFTER_MOUNT");
+ Info ("HIDVOL_PROT_WARN_AFTER_MOUNT", hwndDlg);
}
// Check for legacy non-ASCII passwords
@@ -4068,7 +4068,7 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
&& !FirstCmdKeyFile
&& mountedVolCount > 0
&& !CheckPasswordCharEncoding (NULL, &VolumePassword))
- Warning ("UNSUPPORTED_CHARS_IN_PWD_RECOM");
+ Warning ("UNSUPPORTED_CHARS_IN_PWD_RECOM", hwndDlg);
if (status && CloseSecurityTokenSessionsAfterMount)
SecurityToken::CloseAllSessions();
@@ -4102,7 +4102,7 @@ static void ChangePassword (HWND hwndDlg)
GetWindowText (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName, sizeof (szFileName));
if (IsMountedVolume (szFileName))
{
- Warning (pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF ? "MOUNTED_NO_PKCS5_PRF_CHANGE" : "MOUNTED_NOPWCHANGE");
+ Warning (pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF ? "MOUNTED_NO_PKCS5_PRF_CHANGE" : "MOUNTED_NOPWCHANGE", hwndDlg);
return;
}
@@ -4122,17 +4122,17 @@ static void ChangePassword (HWND hwndDlg)
switch (pwdChangeDlgMode)
{
case PCDM_CHANGE_PKCS5_PRF:
- Info ("PKCS5_PRF_CHANGED");
+ Info ("PKCS5_PRF_CHANGED", hwndDlg);
break;
case PCDM_ADD_REMOVE_VOL_KEYFILES:
case PCDM_REMOVE_ALL_KEYFILES_FROM_VOL:
- Info ("KEYFILE_CHANGED");
+ Info ("KEYFILE_CHANGED", hwndDlg);
break;
case PCDM_CHANGE_PASSWORD:
default:
- Info ("PASSWORD_CHANGED");
+ Info ("PASSWORD_CHANGED", hwndDlg);
}
}
}
@@ -4154,14 +4154,14 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF)
&& !BootEncStatus.VolumeHeaderPresent
&& !SysEncryptionOrDecryptionRequired ())
{
- Warning ("SYS_DRIVE_NOT_ENCRYPTED");
+ Warning ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg);
return;
}
if (SysEncryptionOrDecryptionRequired ()
|| BootEncStatus.SetupInProgress)
{
- Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED");
+ Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED", hwndDlg);
return;
}
@@ -4185,7 +4185,7 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF)
{
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
- Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT");
+ Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg);
else
bKeyboardLayoutChanged = FALSE;
}
@@ -4197,12 +4197,12 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF)
switch (pwdChangeDlgMode)
{
case PCDM_CHANGE_PKCS5_PRF:
- Info ("PKCS5_PRF_CHANGED");
+ Info ("PKCS5_PRF_CHANGED", hwndDlg);
if (!IsHiddenOSRunning())
{
- if (AskWarnYesNo ("SYS_HKD_ALGO_CHANGED_ASK_RESCUE_DISK") == IDYES)
- CreateRescueDisk ();
+ if (AskWarnYesNo ("SYS_HKD_ALGO_CHANGED_ASK_RESCUE_DISK", hwndDlg) == IDYES)
+ CreateRescueDisk (hwndDlg);
}
break;
@@ -4214,12 +4214,12 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF)
case PCDM_CHANGE_PASSWORD:
default:
- Info ("PASSWORD_CHANGED");
+ Info ("PASSWORD_CHANGED", hwndDlg);
if (!IsHiddenOSRunning())
{
- if (AskWarnYesNo ("SYS_PASSWORD_CHANGED_ASK_RESCUE_DISK") == IDYES)
- CreateRescueDisk ();
+ if (AskWarnYesNo ("SYS_PASSWORD_CHANGED_ASK_RESCUE_DISK", hwndDlg) == IDYES)
+ CreateRescueDisk (hwndDlg);
}
}
}
@@ -4227,11 +4227,11 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF)
CloseSysEncMutex ();
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
}
// Initiates or resumes encryption of the system partition/drive
-static void EncryptSystemDevice (void)
+static void EncryptSystemDevice (HWND hwndDlg)
{
try
{
@@ -4253,7 +4253,7 @@ static void EncryptSystemDevice (void)
LaunchVolCreationWizard (MainDlg, "/sysenc");
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
return;
}
@@ -4267,18 +4267,18 @@ static void EncryptSystemDevice (void)
LaunchVolCreationWizard (MainDlg, "/sysenc");
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
}
else if (SysDriveOrPartitionFullyEncrypted (FALSE))
{
// System partition/drive appears to be fully encrypted
- Info ("SYS_PARTITION_OR_DRIVE_APPEARS_FULLY_ENCRYPTED");
+ Info ("SYS_PARTITION_OR_DRIVE_APPEARS_FULLY_ENCRYPTED", hwndDlg);
return;
}
}
// Initiates decryption of the system partition/drive
-static void DecryptSystemDevice (void)
+static void DecryptSystemDevice (HWND hwndDlg)
{
try
{
@@ -4295,20 +4295,20 @@ static void DecryptSystemDevice (void)
&& !BootEncStatus.VolumeHeaderPresent
&& !SysEncryptionOrDecryptionRequired ())
{
- Warning ("SYS_DRIVE_NOT_ENCRYPTED");
+ Warning ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg);
return;
}
if (IsHiddenOSRunning())
{
- Warning ("CANNOT_DECRYPT_HIDDEN_OS");
+ Warning ("CANNOT_DECRYPT_HIDDEN_OS", hwndDlg);
return;
}
- if (AskNoYes ("CONFIRM_DECRYPT_SYS_DEVICE") == IDNO)
+ if (AskNoYes ("CONFIRM_DECRYPT_SYS_DEVICE", hwndDlg) == IDNO)
return;
- if (AskWarnNoYes ("CONFIRM_DECRYPT_SYS_DEVICE_CAUTION") == IDNO)
+ if (AskWarnNoYes ("CONFIRM_DECRYPT_SYS_DEVICE_CAUTION", hwndDlg) == IDNO)
return;
if (CreateSysEncMutex ()) // If no instance of the wizard is currently taking care of system encryption
@@ -4339,7 +4339,7 @@ static void DecryptSystemDevice (void)
if (BootEncStatus.SetupInProgress)
{
CloseSysEncMutex ();
- Error ("SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS");
+ Error ("SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS", hwndDlg);
return;
}
@@ -4347,34 +4347,34 @@ static void DecryptSystemDevice (void)
LaunchVolCreationWizard (MainDlg, "/dsysenc");
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
}
// Initiates the process of creation of a hidden operating system
-static void CreateHiddenOS (void)
+static void CreateHiddenOS (HWND hwndDlg)
{
// Display brief information as to what a hidden operating system is and what it's good for. This needs to be
// done, because if the system partition/drive is currently encrypted, the wizard will not display any
// such information, but will exit (displaying only an error meessage).
- Info("HIDDEN_OS_PREINFO");
+ Info("HIDDEN_OS_PREINFO", hwndDlg);
LaunchVolCreationWizard (MainDlg, "/isysenc");
}
// Blindly attempts (without any checks) to instruct the wizard to resume whatever system encryption process
// had been interrupted or not started but scheduled or exptected to start.
-static void ResumeInterruptedSysEncProcess (void)
+static void ResumeInterruptedSysEncProcess (HWND hwndDlg)
{
if (!MutexExistsOnSystem (TC_MUTEX_NAME_SYSENC)) // If no instance of the wizard is currently taking care of system encryption
{
LaunchVolCreationWizard (MainDlg, "/csysenc");
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
}
-void CreateRescueDisk (void)
+void CreateRescueDisk (HWND hwndDlg)
{
try
{
@@ -4387,7 +4387,7 @@ void CreateRescueDisk (void)
if (IsHiddenOSRunning())
{
- Warning ("CANNOT_CREATE_RESCUE_DISK_ON_HIDDEN_OS");
+ Warning ("CANNOT_CREATE_RESCUE_DISK_ON_HIDDEN_OS", hwndDlg);
return;
}
@@ -4396,14 +4396,14 @@ void CreateRescueDisk (void)
&& !BootEncStatus.VolumeHeaderPresent
&& !SysEncryptionOrDecryptionRequired ())
{
- Warning ("SYS_DRIVE_NOT_ENCRYPTED");
+ Warning ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg);
return;
}
if (SysEncryptionOrDecryptionRequired ()
|| BootEncStatus.SetupInProgress)
{
- Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED");
+ Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED", hwndDlg);
return;
}
@@ -4414,7 +4414,7 @@ void CreateRescueDisk (void)
wchar_t szTmp [8096];
char szRescueDiskISO [TC_MAX_PATH+1];
- if (AskOkCancel ("RESCUE_DISK_NON_WIZARD_CREATION_SELECT_PATH") != IDOK)
+ if (AskOkCancel ("RESCUE_DISK_NON_WIZARD_CREATION_SELECT_PATH", hwndDlg) != IDOK)
{
CloseSysEncMutex ();
return;
@@ -4423,7 +4423,7 @@ void CreateRescueDisk (void)
char initialDir[MAX_PATH];
SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, 0, initialDir);
- if (!BrowseFilesInDir (MainDlg, "OPEN_TITLE", initialDir, szRescueDiskISO, FALSE, TRUE, NULL, L"VeraCrypt Rescue Disk.iso", L"iso"))
+ if (!BrowseFilesInDir (hwndDlg, "OPEN_TITLE", initialDir, szRescueDiskISO, FALSE, TRUE, NULL, L"VeraCrypt Rescue Disk.iso", L"iso"))
{
CloseSysEncMutex ();
return;
@@ -4438,26 +4438,26 @@ void CreateRescueDisk (void)
if (IsWindowsIsoBurnerAvailable())
{
- if (AskYesNoString (szTmp) == IDYES)
+ if (AskYesNoString (szTmp, hwndDlg) == IDYES)
LaunchWindowsIsoBurner (MainDlg, szRescueDiskISO);
}
else
- InfoDirect (szTmp);
+ InfoDirect (szTmp, hwndDlg);
}
catch (Exception &e)
{
- e.Show (MainDlg);
- Error ("ERROR_CREATING_RESCUE_DISK");
+ e.Show (hwndDlg);
+ Error ("ERROR_CREATING_RESCUE_DISK", hwndDlg);
}
CloseSysEncMutex ();
NormalCursor ();
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
}
-static void VerifyRescueDisk (void)
+static void VerifyRescueDisk (HWND hwndDlg)
{
try
{
@@ -4473,14 +4473,14 @@ static void VerifyRescueDisk (void)
&& !BootEncStatus.VolumeHeaderPresent
&& !SysEncryptionOrDecryptionRequired ())
{
- Warning ("SYS_DRIVE_NOT_ENCRYPTED");
+ Warning ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg);
return;
}
if (SysEncryptionOrDecryptionRequired ()
|| BootEncStatus.SetupInProgress)
{
- Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED");
+ Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED", hwndDlg);
return;
}
@@ -4488,7 +4488,7 @@ static void VerifyRescueDisk (void)
{
try
{
- if (AskOkCancel ("RESCUE_DISK_NON_WIZARD_CHECK_INSERT") != IDOK)
+ if (AskOkCancel ("RESCUE_DISK_NON_WIZARD_CHECK_INSERT", hwndDlg) != IDOK)
{
CloseSysEncMutex ();
return;
@@ -4499,24 +4499,24 @@ static void VerifyRescueDisk (void)
WaitCursor();
if (!BootEncObj->VerifyRescueDisk ())
- Error ("RESCUE_DISK_NON_WIZARD_CHECK_FAILED");
+ Error ("RESCUE_DISK_NON_WIZARD_CHECK_FAILED", hwndDlg);
else
- Info ("RESCUE_DISK_NON_WIZARD_CHECK_PASSED");
+ Info ("RESCUE_DISK_NON_WIZARD_CHECK_PASSED", hwndDlg);
}
catch (Exception &e)
{
e.Show (MainDlg);
- Error ("RESCUE_DISK_NON_WIZARD_CHECK_FAILED");
+ Error ("RESCUE_DISK_NON_WIZARD_CHECK_FAILED", hwndDlg);
}
CloseSysEncMutex ();
NormalCursor ();
}
else
- Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
+ Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
}
-static void ShowSystemEncryptionStatus (void)
+static void ShowSystemEncryptionStatus (HWND hwndDlg)
{
try
{
@@ -4552,12 +4552,12 @@ static void ShowSystemEncryptionStatus (void)
if (!BootEncStatus.DriveEncrypted && !BootEncStatus.DriveMounted)
{
- Info ("SYS_DRIVE_NOT_ENCRYPTED");
+ Info ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg);
return;
}
DialogBoxParamW (hInst,
- MAKEINTRESOURCEW (IDD_VOLUME_PROPERTIES), MainDlg,
+ MAKEINTRESOURCEW (IDD_VOLUME_PROPERTIES), hwndDlg,
(DLGPROC) VolumePropertiesDlgProc, (LPARAM) TRUE);
}
@@ -4612,7 +4612,7 @@ static void WipeCache (HWND hwndDlg, BOOL silent)
EnableDisableButtons (hwndDlg);
if (!silent)
- InfoBalloon ("PASSWORD_CACHE_WIPED_SHORT", "PASSWORD_CACHE_WIPED");
+ InfoBalloon ("PASSWORD_CACHE_WIPED_SHORT", "PASSWORD_CACHE_WIPED", hwndDlg);
}
}
@@ -4623,7 +4623,7 @@ static void Benchmark (HWND hwndDlg)
}
-static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
+static BOOL CheckMountList (HWND hwndDlg, BOOL bForceTaskBarUpdate)
{
MOUNT_LIST_STRUCT current;
static BootEncryptionStatus newBootEncStatus;
@@ -4655,7 +4655,7 @@ static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
LastKnownMountList = current;
selDrive = (char) HIWORD (GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST)));
- LoadDriveLetters (GetDlgItem (MainDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (hwndDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), 0);
NormalCursor ();
if (selDrive != -1 && (current.ulMountedDrives & (1 << (selDrive - 'A'))) == 0 && !IsDriveAvailable (selDrive - 'A'))
@@ -4705,7 +4705,7 @@ static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
}
selDrive = (char) HIWORD (GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST)));
- LoadDriveLetters (GetDlgItem (MainDlg, IDC_DRIVELIST), driveLetterToRefresh);
+ LoadDriveLetters (hwndDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), driveLetterToRefresh);
RecentBootEncStatus = newBootEncStatus;
@@ -4730,9 +4730,9 @@ static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
RecentBootEncStatus.HibernationPreventionCount = newBootEncStatus.HibernationPreventionCount;
if (IsHiddenOSRunning() && BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent)
- WarningTopMost ("HIDDEN_OS_HIBERNATION_PREVENTED");
+ WarningTopMost ("HIDDEN_OS_HIBERNATION_PREVENTED", hwndDlg);
else
- WarningTopMost ("SYS_ENC_HIBERNATION_PREVENTED");
+ WarningTopMost ("SYS_ENC_HIBERNATION_PREVENTED", hwndDlg);
}
// Write mode prevention (hidden OS leak protection)
@@ -4748,14 +4748,14 @@ static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
case TC_HIDDEN_OS_READ_ONLY_NOTIF_MODE_COMPACT:
{
char *tmp[] = {0, "HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO", "SHOW_MORE_INFORMATION", "DO_NOT_SHOW_THIS_AGAIN", "CONTINUE", 0};
- switch (AskMultiChoice ((void **) tmp, FALSE))
+ switch (AskMultiChoice ((void **) tmp, FALSE, hwndDlg))
{
case 1:
InfoDirect ((wstring (GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO"))
+ L"\n\n"
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")
+ L"\n\n\n"
- + GetString ("DECOY_TO_HIDDEN_OS_DATA_TRANSFER_HOWTO")).c_str());
+ + GetString ("DECOY_TO_HIDDEN_OS_DATA_TRANSFER_HOWTO")).c_str(), hwndDlg);
break;
case 2:
@@ -4790,7 +4790,7 @@ static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
+ L"\n\n"
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")
+ L"\n\n\n"
- + GetString ("DECOY_TO_HIDDEN_OS_DATA_TRANSFER_HOWTO")).c_str());
+ + GetString ("DECOY_TO_HIDDEN_OS_DATA_TRANSFER_HOWTO")).c_str(), hwndDlg);
// Further warnings will not include the explanation (and will allow disabling)
@@ -4892,12 +4892,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (IsHiddenOSRunning())
{
if (BootEncObj->GetInstalledBootLoaderVersion() > VERSION_NUM)
- Warning ("UPDATE_TC_IN_HIDDEN_OS_TOO");
+ Warning ("UPDATE_TC_IN_HIDDEN_OS_TOO", hwndDlg);
}
else if (SysDriveOrPartitionFullyEncrypted (TRUE)
&& BootEncObj->GetInstalledBootLoaderVersion() != VERSION_NUM)
{
- Warning ("BOOT_LOADER_VERSION_DIFFERENT_FROM_DRIVER_VERSION");
+ Warning ("BOOT_LOADER_VERSION_DIFFERENT_FROM_DRIVER_VERSION", hwndDlg);
}
}
catch (...) { }
@@ -4950,7 +4950,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
BOOL reportBadPasswd = CmdVolumePassword.Length > 0;
if (FirstCmdKeyFile)
- KeyFilesApply (&CmdVolumePassword, FirstCmdKeyFile);
+ KeyFilesApply (hwndDlg, &CmdVolumePassword, FirstCmdKeyFile);
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A',
szFileName, &CmdVolumePassword, CmdVolumePkcs5, bCacheInDriver, bForceMount,
@@ -4983,7 +4983,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
WaitCursor ();
if (KeyFilesEnable && FirstKeyFile)
- KeyFilesApply (&VolumePassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A', szFileName, &VolumePassword, VolumePkcs5, bCacheInDriver, bForceMount, &mountOptions, FALSE, TRUE);
@@ -5015,7 +5015,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Check for problematic file extensions (exe, dll, sys)
if (CheckFileExtension (szFileName))
- Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING");
+ Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg);
}
}
else
@@ -5024,7 +5024,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (bExplore && GetMountedVolumeDriveNo (szFileName) != -1)
OpenVolumeExplorerWindow (GetMountedVolumeDriveNo (szFileName));
else if (szFileName[0] != 0 && IsMountedVolume (szFileName))
- Warning ("VOL_ALREADY_MOUNTED");
+ Warning ("VOL_ALREADY_MOUNTED", hwndDlg);
if (!Quit)
RefreshMainDlg(hwndDlg);
@@ -5066,7 +5066,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &bytesReturned, NULL)
&& (mountList.ulMountedDrives & (1 << cmdUnmountDrive)) == 0)
{
- Error ("NO_VOLUME_MOUNTED_TO_DRIVE");
+ Error ("NO_VOLUME_MOUNTED_TO_DRIVE", hwndDlg);
exitCode = 1;
}
else if (!Dismount (hwndDlg, cmdUnmountDrive))
@@ -5137,7 +5137,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Register hot keys
if (!RegisterAllHotkeys (hwndDlg, Hotkeys)
&& TaskBarIconMutex != NULL) // Warn only if we are the first instance of TrueCrypt
- Warning("HOTKEY_REGISTRATION_ERROR");
+ Warning("HOTKEY_REGISTRATION_ERROR", hwndDlg);
Silent = FALSE;
@@ -5159,7 +5159,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// We shouldn't block the mutex at this point
if (SystemEncryptionStatus == SYSENC_STATUS_PRETEST
- || AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT") == IDYES)
+ || AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", hwndDlg) == IDYES)
{
// The wizard was not launched during the system startup seq, or the user may have forgotten
// to resume the encryption/decryption process.
@@ -5172,7 +5172,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bInPlaceEncNonSysPending && !NonSysInplaceEncInProgressElsewhere())
{
- if (AskNonSysInPlaceEncryptionResume() == IDYES)
+ if (AskNonSysInPlaceEncryptionResume(hwndDlg) == IDYES)
ResumeInterruptedNonSysInplaceEncProcess ();
}
}
@@ -5229,7 +5229,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (TaskBarIconMutex != NULL)
RegisterWtsNotification(hwndDlg);
- DoPostInstallTasks ();
+ DoPostInstallTasks (hwndDlg);
ResetCurrentDirectory ();
}
return 0;
@@ -5319,7 +5319,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case WM_TIMER:
{
// Check mount list and update GUI if needed
- CheckMountList (FALSE);
+ CheckMountList (hwndDlg, FALSE);
// Cache status
if (IsPasswordCacheEmpty() == IsWindowEnabled (GetDlgItem (hwndDlg, IDC_WIPE_CACHE)))
@@ -5331,10 +5331,10 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (DeviceIoControl (hDriver, TC_IOCTL_GET_WARNING_FLAGS, NULL, 0, &warnings, sizeof (warnings), &bytesOut, NULL))
{
if (warnings.SystemFavoriteVolumeDirty)
- WarningTopMost ("SYS_FAVORITE_VOLUME_DIRTY");
+ WarningTopMost ("SYS_FAVORITE_VOLUME_DIRTY", hwndDlg);
if (warnings.PagingFileCreationPrevented)
- WarningTopMost ("PAGING_FILE_CREATION_PREVENTED");
+ WarningTopMost ("PAGING_FILE_CREATION_PREVENTED", hwndDlg);
}
if (TaskBarIconMutex != NULL)
@@ -5350,14 +5350,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
ShowWindow (hwndDlg, SW_SHOW);
ShowWindow (hwndDlg, SW_RESTORE);
- if (AskYesNoTopmost ("SYSTEM_CRASHED_ASK_REPORT") == IDYES)
+ if (AskYesNoTopmost ("SYSTEM_CRASHED_ASK_REPORT", hwndDlg) == IDYES)
{
if (!IsAdmin() && IsUacSupported())
UacAnalyzeKernelMiniDump (hwndDlg);
else
AnalyzeKernelMiniDump (hwndDlg);
}
- else if (AskYesNoTopmost ("ASK_KEEP_DETECTING_SYSTEM_CRASH") == IDNO)
+ else if (AskYesNoTopmost ("ASK_KEEP_DETECTING_SYSTEM_CRASH", hwndDlg) == IDNO)
{
DisableSystemCrashDetection = TRUE;
SaveSettings (hwndDlg);
@@ -5595,14 +5595,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
else if (sel >= TRAYICON_MENU_DRIVE_OFFSET + 26 && sel < TRAYICON_MENU_DRIVE_OFFSET + 26*2)
{
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
{
if (Dismount (hwndDlg, sel - TRAYICON_MENU_DRIVE_OFFSET - 26))
{
wchar_t txt [2048];
StringCbPrintfW (txt, sizeof(txt), GetString ("VOLUME_MOUNTED_AS_DRIVE_LETTER_X_DISMOUNTED"), sel - TRAYICON_MENU_DRIVE_OFFSET - 26 + L'A');
- InfoBalloonDirect (GetString ("SUCCESSFULLY_DISMOUNTED"), txt);
+ InfoBalloonDirect (GetString ("SUCCESSFULLY_DISMOUNTED"), txt, hwndDlg);
}
}
}
@@ -5618,7 +5618,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if ((LastKnownMountList.ulMountedDrives == 0
&& !SysEncDeviceActive (TRUE))
- || AskWarnNoYes ("CONFIRM_EXIT") == IDYES)
+ || AskWarnNoYes ("CONFIRM_EXIT", hwndDlg) == IDYES)
{
// Close all other TC windows
EnumWindows (CloseTCWindowsEnum, 0);
@@ -5689,7 +5689,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (vol[1] == L':' && i == (vol[0] - (vol[0] <= L'Z' ? L'A' : L'a')))
{
UnmountVolume (hwndDlg, m, TRUE);
- WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN");
+ WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg);
}
}
}
@@ -5717,7 +5717,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (!OpenDevice (volp, &ots, FALSE))
{
UnmountVolume (hwndDlg, m, TRUE);
- WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN");
+ WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg);
}
}
}
@@ -5740,7 +5740,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (width != LastDriveListVolumeColumnWidth)
{
LastDriveListVolumeColumnWidth = width;
- LoadDriveLetters (GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
}
return 0;
}
@@ -5778,10 +5778,10 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1;
if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles)
- KeyFilesApply (&mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
+ KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
}
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
_beginthread(mountThreadFunction, 0, hwndDlg);
}
return 1;
@@ -5872,12 +5872,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
LPARAM lLetter = GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST));
if (LOWORD (lLetter) != 0xffff)
- CheckFilesystem ((char) HIWORD (lLetter) - 'A', menuItem == IDPM_REPAIR_FILESYS);
+ CheckFilesystem (hwndDlg, (char) HIWORD (lLetter) - 'A', menuItem == IDPM_REPAIR_FILESYS);
}
break;
case IDM_UNMOUNT_VOLUME:
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
Dismount (hwndDlg, 0);
break;
@@ -5901,14 +5901,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_MOUNT_VOLUME:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
mountOptions = defaultMountOptions;
bPrebootPasswordDlgMode = FALSE;
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
_beginthread(mountThreadFunction, 0, hwndDlg);
}
break;
@@ -5961,11 +5961,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (lw == IDM_UNMOUNT_VOLUME && LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) != TC_MLIST_ITEM_NONSYS_VOL)
{
- Warning ("SELECT_A_MOUNTED_VOLUME");
+ Warning ("SELECT_A_MOUNTED_VOLUME", hwndDlg);
return 1;
}
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
Dismount (hwndDlg, 0);
return 1;
}
@@ -5988,7 +5988,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (DismountAll (hwndDlg, bForceUnmount, TRUE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY)
&& lw == IDM_UNMOUNTALL) // If initiated via the systray menu
{
- InfoBalloon ("SUCCESSFULLY_DISMOUNTED", "MOUNTED_VOLUMES_DISMOUNTED");
+ InfoBalloon ("SUCCESSFULLY_DISMOUNTED", "MOUNTED_VOLUMES_DISMOUNTED", hwndDlg);
}
return 1;
@@ -6017,19 +6017,19 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
switch (lw)
{
case IDM_ENCRYPT_SYSTEM_DEVICE:
- EncryptSystemDevice ();
+ EncryptSystemDevice (hwndDlg);
break;
case IDM_PERMANENTLY_DECRYPT_SYS:
- DecryptSystemDevice ();
+ DecryptSystemDevice (hwndDlg);
break;
case IDM_CREATE_HIDDEN_OS:
- CreateHiddenOS ();
+ CreateHiddenOS (hwndDlg);
break;
case IDM_SYSENC_RESUME:
- ResumeInterruptedSysEncProcess ();
+ ResumeInterruptedSysEncProcess (hwndDlg);
break;
case IDM_SYSTEM_ENCRYPTION_STATUS:
- ShowSystemEncryptionStatus ();
+ ShowSystemEncryptionStatus (hwndDlg);
break;
case IDM_CHANGE_SYS_PASSWORD:
ChangeSysEncPassword (hwndDlg, FALSE);
@@ -6038,20 +6038,20 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
ChangeSysEncPassword (hwndDlg, TRUE);
break;
case IDM_CREATE_RESCUE_DISK:
- CreateRescueDisk ();
+ CreateRescueDisk (hwndDlg);
break;
case IDM_VERIFY_RESCUE_DISK:
- VerifyRescueDisk ();
+ VerifyRescueDisk (hwndDlg);
break;
case IDM_MOUNT_SYSENC_PART_WITHOUT_PBA:
- if (CheckSysEncMountWithoutPBA ("", FALSE))
+ if (CheckSysEncMountWithoutPBA (hwndDlg, "", FALSE))
{
mountOptions = defaultMountOptions;
mountOptions.PartitionInInactiveSysEncScope = TRUE;
bPrebootPasswordDlgMode = TRUE;
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
_beginthread(mountThreadFunction, 0, hwndDlg);
bPrebootPasswordDlgMode = FALSE;
@@ -6101,7 +6101,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_CHANGE_PASSWORD:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6113,7 +6113,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_CHANGE_HEADER_KEY_DERIV_ALGO:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6125,7 +6125,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_ADD_REMOVE_VOL_KEYFILES:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6137,7 +6137,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_REMOVE_ALL_KEYFILES_FROM_VOL:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6149,7 +6149,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_BACKUP_VOL_HEADER:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6169,7 +6169,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDM_RESTORE_VOL_HEADER:
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6197,7 +6197,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6218,7 +6218,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6258,7 +6258,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6272,7 +6272,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6297,7 +6297,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SecurityToken::CloseAllSessions();
}
- InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED");
+ InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED", hwndDlg);
return 1;
}
@@ -6433,7 +6433,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (LOWORD (selectedDrive) != TC_MLIST_ITEM_NONSYS_VOL
&& !(VolumeSelected (hwndDlg) && IsMountedVolume (volPathLower)))
{
- Warning ("SELECT_A_MOUNTED_VOLUME");
+ Warning ("SELECT_A_MOUNTED_VOLUME", hwndDlg);
return 1;
}
@@ -6460,7 +6460,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &prop, sizeof (prop), &prop, sizeof (prop), &dwResult, NULL) || dwResult == 0)
{
- Warning ("SELECT_A_MOUNTED_VOLUME");
+ Warning ("SELECT_A_MOUNTED_VOLUME", hwndDlg);
return 1;
}
@@ -6496,7 +6496,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
tmp[3] = (wchar_t *) volPathLowerWStr.c_str();
tmp[4] = GetString ("IDCANCEL");
- switch (AskMultiChoice ((void **) tmp, FALSE))
+ switch (AskMultiChoice ((void **) tmp, FALSE, hwndDlg))
{
case 1:
driveNo = HIWORD (selectedDrive) - 'A';
@@ -6568,7 +6568,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6592,7 +6592,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else
{
@@ -6650,7 +6650,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
BroadcastDeviceChange (DBT_DEVICEARRIVAL, 0, driveMap);
}
- LoadDriveLetters (GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0);
if (nSelectedDriveIndex >= 0)
{
@@ -6782,7 +6782,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
TaskBarIconRemove (hwndDlg);
TaskBarIconAdd (hwndDlg);
- CheckMountList(TRUE);
+ CheckMountList(hwndDlg, TRUE);
return 1;
}
}
@@ -7038,9 +7038,9 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
case OptionTokenLib:
if (GetArgumentValue (lpszCommandLineArgs, nArgPos, &i, nNoCommandLineArgs, SecurityTokenLibraryPath, sizeof (SecurityTokenLibraryPath)) == HAS_ARGUMENT)
- InitSecurityTokenLibrary();
+ InitSecurityTokenLibrary(hwndDlg);
else
- Error ("COMMAND_LINE_ERROR");
+ Error ("COMMAND_LINE_ERROR", hwndDlg);
break;
@@ -7071,12 +7071,12 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
else
{
CmdVolumePkcs5 = 0;
- Error ("COMMAND_LINE_ERROR");
+ Error ("COMMAND_LINE_ERROR", hwndDlg);
}
}
else
- Error ("COMMAND_LINE_ERROR");
+ Error ("COMMAND_LINE_ERROR", hwndDlg);
}
break;
@@ -7520,7 +7520,7 @@ skipMount:
SetVolumeMountPoint (mountPoint.c_str(), prevVolumeAtMountPoint);
}
- LoadDriveLetters (GetDlgItem (MainDlg, IDC_DRIVELIST), 0);
+ LoadDriveLetters (MainDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), 0);
MountVolumesAsSystemFavorite = FALSE;
@@ -7533,7 +7533,7 @@ skipMount:
}
}
else if (!systemFavorites && !favoriteVolumeToMount.Path.empty())
- Error ("DRIVE_LETTER_UNAVAILABLE");
+ Error ("DRIVE_LETTER_UNAVAILABLE", MainDlg);
}
MultipleMountOperationInProgress = FALSE;
@@ -7567,7 +7567,7 @@ void __cdecl mountFavoriteVolumeThreadFunction (void *pArg)
}
-static void SaveDefaultKeyFilesParam (void)
+static void SaveDefaultKeyFilesParam (HWND hwnd)
{
if (defaultKeyFilesParam.FirstKeyFile == NULL)
{
@@ -7604,7 +7604,7 @@ static void SaveDefaultKeyFilesParam (void)
XmlWriteFooter (f);
- CheckFileStreamWriteErrors (f, TC_APPD_FILENAME_DEFAULT_KEYFILES);
+ CheckFileStreamWriteErrors (hwnd, f, TC_APPD_FILENAME_DEFAULT_KEYFILES);
fclose (f);
return;
}
@@ -7622,14 +7622,14 @@ static void KeyfileDefaultsDlg (HWND hwndDlg)
MAKEINTRESOURCEW (IDD_KEYFILES), hwndDlg,
(DLGPROC) KeyFilesDlgProc, (LPARAM) &param) == IDOK)
{
- if (!param.EnableKeyFiles || AskWarnYesNo ("CONFIRM_SAVE_DEFAULT_KEYFILES") == IDYES)
+ if (!param.EnableKeyFiles || AskWarnYesNo ("CONFIRM_SAVE_DEFAULT_KEYFILES", hwndDlg) == IDYES)
{
KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile);
defaultKeyFilesParam.EnableKeyFiles = param.EnableKeyFiles;
defaultKeyFilesParam.FirstKeyFile = param.FirstKeyFile;
RestoreDefaultKeyFilesParam ();
- SaveDefaultKeyFilesParam ();
+ SaveDefaultKeyFilesParam (hwndDlg);
}
}
}
@@ -7655,7 +7655,7 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam)
if (DismountAll (hwndDlg, FALSE, TRUE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY))
{
if (bDisplayBalloonOnSuccessfulHkDismount)
- InfoBalloon ("SUCCESSFULLY_DISMOUNTED", (wParam == HK_DISMOUNT_ALL_AND_WIPE ? "VOLUMES_DISMOUNTED_CACHE_WIPED" : "MOUNTED_VOLUMES_DISMOUNTED"));
+ InfoBalloon ("SUCCESSFULLY_DISMOUNTED", (wParam == HK_DISMOUNT_ALL_AND_WIPE ? "VOLUMES_DISMOUNTED_CACHE_WIPED" : "MOUNTED_VOLUMES_DISMOUNTED"), hwndDlg);
if (bPlaySoundOnSuccessfulHkDismount)
MessageBeep (0xFFFFFFFF);
@@ -7674,7 +7674,7 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam)
if (success)
{
if (bDisplayBalloonOnSuccessfulHkDismount)
- InfoBalloon ("SUCCESSFULLY_DISMOUNTED", "VOLUMES_DISMOUNTED_CACHE_WIPED");
+ InfoBalloon ("SUCCESSFULLY_DISMOUNTED", "VOLUMES_DISMOUNTED_CACHE_WIPED", hwndDlg);
if (bPlaySoundOnSuccessfulHkDismount)
MessageBeep (0xFFFFFFFF);
@@ -7687,7 +7687,7 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam)
if (success)
{
if (bDisplayBalloonOnSuccessfulHkDismount)
- InfoBalloon ("SUCCESSFULLY_DISMOUNTED", "VOLUMES_DISMOUNTED_CACHE_WIPED");
+ InfoBalloon ("SUCCESSFULLY_DISMOUNTED", "VOLUMES_DISMOUNTED_CACHE_WIPED", hwndDlg);
if (bPlaySoundOnSuccessfulHkDismount)
MessageBeep (0xFFFFFFFF);
@@ -7715,7 +7715,7 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam)
case HK_CLOSE_SECURITY_TOKEN_SESSIONS:
SecurityToken::CloseAllSessions();
- InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED");
+ InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED", hwndDlg);
break;
}
@@ -7761,15 +7761,15 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
{
case 1:
case 2:
- if (AskErrNoYes ("BACKUP_HEADER_NOT_FOR_SYS_DEVICE") == IDYES)
- CreateRescueDisk ();
+ if (AskErrNoYes ("BACKUP_HEADER_NOT_FOR_SYS_DEVICE", hwndDlg) == IDYES)
+ CreateRescueDisk (hwndDlg);
return 0;
}
if (IsMountedVolume (lpszVolume))
{
- Warning ("DISMOUNT_FIRST");
+ Warning ("DISMOUNT_FIRST", hwndDlg);
goto ret;
}
@@ -7779,7 +7779,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
goto ret;
}
- Info ("EXTERNAL_VOL_HEADER_BAK_FIRST_INFO");
+ Info ("EXTERNAL_VOL_HEADER_BAK_FIRST_INFO", hwndDlg);
WaitCursor();
@@ -7801,7 +7801,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
WaitCursor();
if (KeyFilesEnable && FirstKeyFile)
- KeyFilesApply (askPassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, askPassword, FirstKeyFile);
nStatus = OpenVolume (askVol, lpszVolume, askPassword, VolumePkcs5, FALSE, bPreserveTimestamp, FALSE);
@@ -7823,7 +7823,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
{
// Ask the user if there is a hidden volume
char *volTypeChoices[] = {0, "DOES_VOLUME_CONTAIN_HIDDEN", "VOLUME_CONTAINS_HIDDEN", "VOLUME_DOES_NOT_CONTAIN_HIDDEN", "IDCANCEL", 0};
- switch (AskMultiChoice ((void **) volTypeChoices, FALSE))
+ switch (AskMultiChoice ((void **) volTypeChoices, FALSE, hwndDlg))
{
case 1:
break;
@@ -7894,8 +7894,8 @@ noHidden:
WaitCursor();
// Temporary keys
- if (!RandgetBytes (temporaryKey, EAGetKeySize (volume.CryptoInfo->ea), TRUE)
- || !RandgetBytes (volume.CryptoInfo->k2, sizeof (volume.CryptoInfo->k2), FALSE))
+ if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (volume.CryptoInfo->ea), TRUE)
+ || !RandgetBytes (hwndDlg, volume.CryptoInfo->k2, sizeof (volume.CryptoInfo->k2), FALSE))
{
nStatus = ERR_PARAMETER_INCORRECT;
goto error;
@@ -7917,13 +7917,13 @@ noHidden:
}
// Store header encrypted with a new key
- nStatus = ReEncryptVolumeHeader ((char *) backup, FALSE, volume.CryptoInfo, &VolumePassword, FALSE);
+ nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup, FALSE, volume.CryptoInfo, &VolumePassword, FALSE);
if (nStatus != ERR_SUCCESS)
goto error;
if (hiddenVolume.VolumeIsOpen)
{
- nStatus = ReEncryptVolumeHeader ((char *) backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE),
+ nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE),
FALSE, hiddenVolume.CryptoInfo, &hiddenVolPassword, FALSE);
if (nStatus != ERR_SUCCESS)
@@ -7937,7 +7937,7 @@ noHidden:
}
/* Backup has been successfully created */
- Warning("VOL_HEADER_BACKED_UP");
+ Warning("VOL_HEADER_BACKED_UP", hwndDlg);
ret:
nStatus = ERR_SUCCESS;
@@ -7999,8 +7999,8 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
{
case 1:
case 2:
- if (AskErrNoYes ("RESTORE_HEADER_NOT_FOR_SYS_DEVICE") == IDYES)
- CreateRescueDisk ();
+ if (AskErrNoYes ("RESTORE_HEADER_NOT_FOR_SYS_DEVICE", hwndDlg) == IDYES)
+ CreateRescueDisk (hwndDlg);
return 0;
@@ -8016,7 +8016,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
if (IsMountedVolume (lpszVolume))
{
- Warning ("DISMOUNT_FIRST");
+ Warning ("DISMOUNT_FIRST", hwndDlg);
return 0;
}
@@ -8030,7 +8030,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
// Ask the user to select the type of backup (internal/external)
char *volTypeChoices[] = {0, "HEADER_RESTORE_EXTERNAL_INTERNAL", "HEADER_RESTORE_INTERNAL", "HEADER_RESTORE_EXTERNAL", "IDCANCEL", 0};
- switch (AskMultiChoice ((void **) volTypeChoices, FALSE))
+ switch (AskMultiChoice ((void **) volTypeChoices, FALSE, hwndDlg))
{
case 1:
restoreInternalBackup = TRUE;
@@ -8067,7 +8067,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
WaitCursor();
if (KeyFilesEnable && FirstKeyFile)
- KeyFilesApply (&VolumePassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, TRUE, bPreserveTimestamp, TRUE);
@@ -8084,7 +8084,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
if (volume.CryptoInfo->LegacyVolume)
{
- Error ("VOLUME_HAS_NO_BACKUP_HEADER");
+ Error ("VOLUME_HAS_NO_BACKUP_HEADER", hwndDlg);
nStatus = ERROR_SUCCESS;
goto error;
}
@@ -8092,7 +8092,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
// Create a new header with a new salt
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
- nStatus = ReEncryptVolumeHeader (buffer, FALSE, volume.CryptoInfo, &VolumePassword, FALSE);
+ nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, volume.CryptoInfo, &VolumePassword, FALSE);
if (nStatus != 0)
goto error;
@@ -8252,7 +8252,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
break;
default:
- Error ("HEADER_BACKUP_SIZE_INCORRECT");
+ Error ("HEADER_BACKUP_SIZE_INCORRECT", hwndDlg);
nStatus = ERR_SUCCESS;
goto error;
}
@@ -8267,7 +8267,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
}
if (KeyFilesEnable && FirstKeyFile)
- KeyFilesApply (&VolumePassword, FirstKeyFile);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
// Decrypt volume header
headerOffsetBackupFile = 0;
@@ -8305,7 +8305,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
WaitCursor();
// Restore header encrypted with a new key
- nStatus = ReEncryptVolumeHeader (buffer, FALSE, restoredCryptoInfo, &VolumePassword, FALSE);
+ nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, restoredCryptoInfo, &VolumePassword, FALSE);
if (nStatus != ERR_SUCCESS)
goto error;
@@ -8324,7 +8324,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
if (!restoredCryptoInfo->LegacyVolume)
{
// Restore backup header encrypted with a new key
- nStatus = ReEncryptVolumeHeader (buffer, FALSE, restoredCryptoInfo, &VolumePassword, FALSE);
+ nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, restoredCryptoInfo, &VolumePassword, FALSE);
if (nStatus != ERR_SUCCESS)
goto error;
@@ -8345,7 +8345,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
/* Volume header has been successfully restored */
- Info("VOL_HEADER_RESTORED");
+ Info("VOL_HEADER_RESTORED", hwndDlg);
ret:
nStatus = ERR_SUCCESS;
@@ -8457,7 +8457,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
{
if (IsNonInstallMode())
{
- Error ("FEATURE_REQUIRES_INSTALLATION");
+ Error ("FEATURE_REQUIRES_INSTALLATION", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
@@ -8484,7 +8484,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig, &customUserMessage, &bootLoaderVersion);
if (bootLoaderVersion != VERSION_NUM)
- Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES");
+ Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES", hwndDlg);
if (disableHW)
userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION;
@@ -8513,7 +8513,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
if (ReadEncryptionThreadPoolFreeCpuCountLimit() != cpuFreeCount)
{
BootEncObj->WriteLocalMachineRegistryDwordValue ("SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_ENCRYPTION_FREE_CPU_COUNT_REG_VALUE_NAME, cpuFreeCount);
- Warning ("SETTING_REQUIRES_REBOOT");
+ Warning ("SETTING_REQUIRES_REBOOT", hwndDlg);
}
EndDialog (hwndDlg, lw);
@@ -8528,7 +8528,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
case IDC_ENABLE_HARDWARE_ENCRYPTION:
if (!IsDlgButtonChecked (hwndDlg, IDC_ENABLE_HARDWARE_ENCRYPTION)
- && AskWarnYesNo ("CONFIRM_SETTING_DEGRADES_PERFORMANCE") == IDNO)
+ && AskWarnYesNo ("CONFIRM_SETTING_DEGRADES_PERFORMANCE", hwndDlg) == IDNO)
{
CheckDlgButton (hwndDlg, IDC_ENABLE_HARDWARE_ENCRYPTION, BST_CHECKED);
}
@@ -8536,14 +8536,14 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
case IDC_LIMIT_ENC_THREAD_POOL:
if (IsDlgButtonChecked (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL)
- && AskWarnYesNo ("CONFIRM_SETTING_DEGRADES_PERFORMANCE") == IDNO)
+ && AskWarnYesNo ("CONFIRM_SETTING_DEGRADES_PERFORMANCE", hwndDlg) == IDNO)
{
CheckDlgButton (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL, BST_UNCHECKED);
}
else
{
SendMessage (GetDlgItem (hwndDlg, IDC_ENCRYPTION_FREE_CPU_COUNT), CB_SETCURSEL, 0, 0);
- Warning ("SETTING_REQUIRES_REBOOT"); // Warn the user before he thinks about benchmarking
+ Warning ("SETTING_REQUIRES_REBOOT", hwndDlg); // Warn the user before he thinks about benchmarking
}
EnableWindow (GetDlgItem (hwndDlg, IDC_ENCRYPTION_FREE_CPU_COUNT), IsDlgButtonChecked (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL));
@@ -8613,7 +8613,7 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP
StringCbCopyA (prevSecurityTokenLibraryPath, sizeof(prevSecurityTokenLibraryPath), SecurityTokenLibraryPath);
StringCbCopyA (SecurityTokenLibraryPath, sizeof(SecurityTokenLibraryPath), securityTokenLibraryPath);
- if (!InitSecurityTokenLibrary())
+ if (!InitSecurityTokenLibrary(hwndDlg))
{
StringCbCopyA (SecurityTokenLibraryPath, sizeof(SecurityTokenLibraryPath), prevSecurityTokenLibraryPath);
return 1;
@@ -8688,7 +8688,7 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP
NormalCursor();
if (!found)
- Warning ("PKCS11_MODULE_AUTO_DETECTION_FAILED");
+ Warning ("PKCS11_MODULE_AUTO_DETECTION_FAILED", hwndDlg);
return 1;
}
@@ -8699,7 +8699,7 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP
char systemDir[MAX_PATH];
wchar_t browseFilter[1024];
- Info ("SELECT_PKCS11_MODULE_HELP");
+ Info ("SELECT_PKCS11_MODULE_HELP", hwndDlg);
StringCbPrintfW (browseFilter, sizeof(browseFilter), L"%ls (*.dll)%c*.dll%c%c", GetString ("DLL_FILES"), 0, 0, 0);
GetSystemDirectory (systemDir, sizeof (systemDir));
@@ -8732,7 +8732,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
{
if (!BootEncObj->GetStatus().DriveMounted)
{
- Warning ("SYS_DRIVE_NOT_ENCRYPTED");
+ Warning ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
@@ -8749,7 +8749,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig, &customUserMessage, &bootLoaderVersion);
if (bootLoaderVersion != VERSION_NUM)
- Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES");
+ Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES", hwndDlg);
SendMessage (GetDlgItem (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE), EM_LIMITTEXT, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, 0);
SetDlgItemText (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage.c_str());
@@ -8826,7 +8826,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
case IDC_DISABLE_BOOT_LOADER_OUTPUT:
if ((IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT))
- && AskWarnYesNo ("CUSTOM_BOOT_LOADER_MESSAGE_PROMPT") == IDNO)
+ && AskWarnYesNo ("CUSTOM_BOOT_LOADER_MESSAGE_PROMPT", hwndDlg) == IDNO)
{
CheckDlgButton (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT, BST_UNCHECKED);
}
@@ -8835,7 +8835,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
case IDC_BOOT_LOADER_CACHE_PASSWORD:
if (IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD))
- Warning ("BOOT_PASSWORD_CACHE_KEYBOARD_WARNING");
+ Warning ("BOOT_PASSWORD_CACHE_KEYBOARD_WARNING", hwndDlg);
break;
}
@@ -8850,7 +8850,7 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions)
{
if (!VolumeSelected(hwndDlg))
{
- Warning ("NO_VOLUME_SELECTED");
+ Warning ("NO_VOLUME_SELECTED", hwndDlg);
}
else if (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) == TC_MLIST_ITEM_FREE)
{
@@ -8865,14 +8865,14 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions)
return;
if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles)
- KeyFilesApply (&mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
+ KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
}
- if (CheckMountList (FALSE))
+ if (CheckMountList (hwndDlg, FALSE))
_beginthread (mountThreadFunction, 0, hwndDlg);
}
else
- Warning ("SELECT_FREE_DRIVE");
+ Warning ("SELECT_FREE_DRIVE", hwndDlg);
}
@@ -8931,7 +8931,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
string dumpPath = FindLatestFileOrDirectory (string (winDir) + "\\Minidump", "*.dmp", false, true);
if (dumpPath.empty())
{
- Error ("NO_MINIDUMP_FOUND");
+ Error ("NO_MINIDUMP_FOUND", hwndDlg);
return;
}
@@ -8971,7 +8971,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
{
if (!finally_arg.empty())
{
- if (AskYesNo ("ASK_DELETE_KERNEL_CRASH_DUMP") == IDYES)
+ if (AskYesNo ("ASK_DELETE_KERNEL_CRASH_DUMP", MainDlg) == IDYES)
DeleteFile (finally_arg.c_str());
else
MoveFile (finally_arg.c_str(), finally_arg2.c_str());
@@ -8987,7 +8987,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
if (!IsApplicationInstalled (Is64BitOs() ? "Debugging Tools for Windows (x64)" : "Debugging Tools for Windows (x86)"))
{
string sDbgCmd;
- if (AskOkCancel ("ASK_DEBUGGER_INSTALL") != IDOK)
+ if (AskOkCancel ("ASK_DEBUGGER_INSTALL", hwndDlg) != IDOK)
return;
if (Is64BitOs())
@@ -9016,7 +9016,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
return;
}
- if (AskOkCancel ("SYSTEM_CRASH_ANALYSIS_INFO") == IDCANCEL)
+ if (AskOkCancel ("SYSTEM_CRASH_ANALYSIS_INFO", hwndDlg) == IDCANCEL)
return;
ZeroMemory (&startupInfo, sizeof (startupInfo));
@@ -9083,7 +9083,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
if (!kdRunning)
{
handleWin32Error (hwndDlg);
- Error ("DEBUGGER_NOT_FOUND");
+ Error ("DEBUGGER_NOT_FOUND", hwndDlg);
CloseHandle (procInfo.hProcess);
CloseHandle (procInfo.hThread);
CloseHandle (hChildStdoutRead);
@@ -9124,7 +9124,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
p = output.find ("Bugcheck code ");
if (p == string::npos)
{
- Error ("ERR_PARAMETER_INCORRECT");
+ Error ("ERR_PARAMETER_INCORRECT", hwndDlg);
return;
}
@@ -9132,7 +9132,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
int n = sscanf (output.substr (p + 14, 8).c_str(), "%I64uX", &bugcheckCode);
if (n != 1)
{
- Error ("ERR_PARAMETER_INCORRECT");
+ Error ("ERR_PARAMETER_INCORRECT", hwndDlg);
return;
}
@@ -9142,7 +9142,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
n = sscanf (output.substr (p + 10, (Is64BitOs() ? 17 : 9) * 4).c_str(), "%I64uX %I64uX %I64uX %I64uX", &bugcheckArgs[0], &bugcheckArgs[1], &bugcheckArgs[2], &bugcheckArgs[3]);
if (n != 4)
{
- Error ("ERR_PARAMETER_INCORRECT");
+ Error ("ERR_PARAMETER_INCORRECT", hwndDlg);
return;
}
@@ -9161,7 +9161,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
p = output.find ("STACK_TEXT:");
if (p == string::npos)
{
- Error ("ERR_PARAMETER_INCORRECT");
+ Error ("ERR_PARAMETER_INCORRECT", hwndDlg);
return;
}
@@ -9251,7 +9251,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg)
msg += L"\n\n";
}
- InfoDirect(msg.c_str());
+ InfoDirect(msg.c_str(), hwndDlg);
/*
string urlStr = string (url) + "&drvver=" + (imageVersion.empty() ? "-" : imageVersion) + stackTraceArgs.str();
diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h
index 9b320a8c..753678ed 100644
--- a/src/Mount/Mount.h
+++ b/src/Mount/Mount.h
@@ -69,11 +69,11 @@ BOOL VolumeSelected (HWND hwndDlg );
void LoadSettings ( HWND hwndDlg );
void SaveSettings ( HWND hwndDlg );
BOOL SelectItem ( HWND hTree , char nLetter );
-void LoadDriveLetters ( HWND hTree, int drive );
+void LoadDriveLetters ( HWND hwndDlg, HWND hTree, int drive );
BOOL CALLBACK PasswordChangeDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK PasswordDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void BuildTree ( HWND hTree );
+void BuildTree ( HWND hwndDlg, HWND hTree );
LPARAM GetSelectedLong ( HWND hTree );
LPARAM GetItemLong ( HWND hTree, int itemNo );
BOOL CALLBACK CommandHelpDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
@@ -85,20 +85,20 @@ BOOL TaskBarIconAdd (HWND hwnd);
BOOL TaskBarIconRemove (HWND hwnd);
BOOL TaskBarIconChange (HWND hwnd, int iconId);
void DismountIdleVolumes ();
-static void SaveDefaultKeyFilesParam (void);
+static void SaveDefaultKeyFilesParam (HWND hwnd);
static BOOL Dismount (HWND hwndDlg, int nDosDriveNo);
static BOOL DismountAll (HWND hwndDlg, BOOL forceUnmount, BOOL interact, int dismountMaxRetries, int dismountAutoRetryDelay);
static void KeyfileDefaultsDlg (HWND hwndDlg);
static void HandleHotKey (HWND hwndDlg, WPARAM wParam);
-static BOOL CheckMountList (BOOL bForceTaskBarUpdate);
+static BOOL CheckMountList (HWND hwndDlg, BOOL bForceTaskBarUpdate);
int GetCipherBlockSizeByDriveNo (int nDosDriveNo);
int GetModeOfOperationByDriveNo (int nDosDriveNo);
void ChangeMainWindowVisibility ();
void LaunchVolCreationWizard (HWND hwndDlg);
BOOL WholeSysDriveEncryption (BOOL bSilent);
-BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet);
+BOOL CheckSysEncMountWithoutPBA (HWND hwndDlg, const char *devicePath, BOOL quiet);
BOOL TCBootLoaderOnInactiveSysEncDrive (void);
-void CreateRescueDisk (void);
+void CreateRescueDisk (HWND hwndDlg);
int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lpszVolume);
int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume);
void SecurityTokenPreferencesDialog (HWND hwndDlg);
diff --git a/src/Setup/SelfExtract.c b/src/Setup/SelfExtract.c
index 55f14114..cb3740eb 100644
--- a/src/Setup/SelfExtract.c
+++ b/src/Setup/SelfExtract.c
@@ -466,7 +466,7 @@ BOOL VerifyPackageIntegrity (void)
fileDataEndPos = (int) FindStringInFile (path, MagEndMarker, strlen (MagEndMarker));
if (fileDataEndPos < 0)
{
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
return FALSE;
}
fileDataEndPos--;
@@ -474,7 +474,7 @@ BOOL VerifyPackageIntegrity (void)
fileDataStartPos = (int) FindStringInFile (path, MAG_START_MARKER, strlen (MAG_START_MARKER));
if (fileDataStartPos < 0)
{
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
return FALSE;
}
fileDataStartPos += strlen (MAG_START_MARKER);
@@ -482,7 +482,7 @@ BOOL VerifyPackageIntegrity (void)
if (!LoadInt32 (path, &crc, fileDataEndPos + strlen (MagEndMarker) + 1))
{
- Error ("CANT_VERIFY_PACKAGE_INTEGRITY");
+ Error ("CANT_VERIFY_PACKAGE_INTEGRITY", NULL);
return FALSE;
}
@@ -491,7 +491,7 @@ BOOL VerifyPackageIntegrity (void)
if (tmpBuffer == NULL)
{
- Error ("CANT_VERIFY_PACKAGE_INTEGRITY");
+ Error ("CANT_VERIFY_PACKAGE_INTEGRITY", NULL);
return FALSE;
}
@@ -501,7 +501,7 @@ BOOL VerifyPackageIntegrity (void)
if (crc != GetCrc32 (tmpBuffer, fileDataEndPos + 1 + strlen (MagEndMarker)))
{
free (tmpBuffer);
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
return FALSE;
}
@@ -562,7 +562,7 @@ BOOL SelfExtractInMemory (char *path)
fileDataEndPos = (int) FindStringInFile (path, MagEndMarker, strlen (MagEndMarker));
if (fileDataEndPos < 0)
{
- Error ("CANNOT_READ_FROM_PACKAGE");
+ Error ("CANNOT_READ_FROM_PACKAGE", NULL);
return FALSE;
}
@@ -571,7 +571,7 @@ BOOL SelfExtractInMemory (char *path)
fileDataStartPos = (int) FindStringInFile (path, MAG_START_MARKER, strlen (MAG_START_MARKER));
if (fileDataStartPos < 0)
{
- Error ("CANNOT_READ_FROM_PACKAGE");
+ Error ("CANNOT_READ_FROM_PACKAGE", NULL);
return FALSE;
}
@@ -582,7 +582,7 @@ BOOL SelfExtractInMemory (char *path)
// Read the stored total size of the uncompressed data
if (!LoadInt32 (path, &uncompressedLen, filePos))
{
- Error ("CANNOT_READ_FROM_PACKAGE");
+ Error ("CANNOT_READ_FROM_PACKAGE", NULL);
return FALSE;
}
@@ -591,7 +591,7 @@ BOOL SelfExtractInMemory (char *path)
// Read the stored total size of the compressed data
if (!LoadInt32 (path, &compressedLen, filePos))
{
- Error ("CANNOT_READ_FROM_PACKAGE");
+ Error ("CANNOT_READ_FROM_PACKAGE", NULL);
return FALSE;
}
@@ -599,13 +599,13 @@ BOOL SelfExtractInMemory (char *path)
if (compressedLen != fileDataEndPos - fileDataStartPos - 8 + 1)
{
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
}
DecompressedData = malloc (uncompressedLen + 524288); // + 512K reserve
if (DecompressedData == NULL)
{
- Error ("ERR_MEM_ALLOC");
+ Error ("ERR_MEM_ALLOC", NULL);
return FALSE;
}
@@ -619,14 +619,14 @@ BOOL SelfExtractInMemory (char *path)
free (DecompressedData);
DecompressedData = NULL;
- Error ("CANNOT_READ_FROM_PACKAGE");
+ Error ("CANNOT_READ_FROM_PACKAGE", NULL);
return FALSE;
}
// Decompress the data
if (DecompressBuffer (DecompressedData, compressedData, compressedLen) != uncompressedLen)
{
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
goto sem_end;
}
@@ -653,7 +653,7 @@ BOOL SelfExtractInMemory (char *path)
if (Decompressed_Files[fileNo].crc
!= GetCrc32 (Decompressed_Files[fileNo].fileContent, Decompressed_Files[fileNo].fileLength))
{
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
goto sem_end;
}
@@ -662,7 +662,7 @@ BOOL SelfExtractInMemory (char *path)
if (fileNo < NBR_COMPRESSED_FILES)
{
- Error ("DIST_PACKAGE_CORRUPTED");
+ Error ("DIST_PACKAGE_CORRUPTED", NULL);
goto sem_end;
}
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 9f202578..0e404431 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -661,7 +661,7 @@ error:
if (bOK == FALSE)
{
handleWin32Error (hwndDlg);
- Error ("REG_INSTALL_FAILED");
+ Error ("REG_INSTALL_FAILED", hwndDlg);
}
// Register COM servers for UAC
@@ -669,7 +669,7 @@ error:
{
if (!RegisterComServers (szDir))
{
- Error ("COM_REG_FAILED");
+ Error ("COM_REG_FAILED", hwndDlg);
return FALSE;
}
}
@@ -955,7 +955,7 @@ BOOL DoDriverUnload (HWND hwndDlg)
{
if (bootEnc.GetInstalledBootLoaderVersion() != VERSION_NUM)
{
- if (AskWarnNoYes ("UPDATE_TC_IN_DECOY_OS_FIRST") == IDNO)
+ if (AskWarnNoYes ("UPDATE_TC_IN_DECOY_OS_FIRST", hwndDlg) == IDNO)
AbortProcessSilent ();
}
}
@@ -971,7 +971,7 @@ BOOL DoDriverUnload (HWND hwndDlg)
}
else if (bUninstallInProgress || bDowngrade)
{
- Error (bDowngrade ? "SETUP_FAILED_BOOT_DRIVE_ENCRYPTED_DOWNGRADE" : "SETUP_FAILED_BOOT_DRIVE_ENCRYPTED");
+ Error (bDowngrade ? "SETUP_FAILED_BOOT_DRIVE_ENCRYPTED_DOWNGRADE" : "SETUP_FAILED_BOOT_DRIVE_ENCRYPTED", hwndDlg);
return FALSE;
}
else
@@ -1083,7 +1083,7 @@ BOOL UpgradeBootLoader (HWND hwndDlg)
bootEnc.InstallBootLoader (true);
if (bootEnc.GetInstalledBootLoaderVersion() <= TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION)
- Info (IsHiddenOSRunning() ? "BOOT_LOADER_UPGRADE_OK_HIDDEN_OS" : "BOOT_LOADER_UPGRADE_OK");
+ Info (IsHiddenOSRunning() ? "BOOT_LOADER_UPGRADE_OK_HIDDEN_OS" : "BOOT_LOADER_UPGRADE_OK", hwndDlg);
}
return TRUE;
}
@@ -1093,7 +1093,7 @@ BOOL UpgradeBootLoader (HWND hwndDlg)
}
catch (...) { }
- Error ("BOOT_LOADER_UPGRADE_FAILED");
+ Error ("BOOT_LOADER_UPGRADE_FAILED", hwndDlg);
return FALSE;
}
@@ -1249,7 +1249,7 @@ BOOL DoShortcutsInstall (HWND hwndDlg, char *szDestDir, BOOL bProgGroup, BOOL bD
{
fprintf (f, "[InternetShortcut]\nURL=%s\n", TC_APPLINK);
- CheckFileStreamWriteErrors (f, szTmp2);
+ CheckFileStreamWriteErrors (hwndDlg, f, szTmp2);
fclose (f);
}
else
@@ -1315,9 +1315,9 @@ void OutcomePrompt (HWND hwndDlg, BOOL bOK)
if (bDevm)
PostMessage (MainDlg, WM_CLOSE, 0, 0);
else if (bPossiblyFirstTimeInstall || bRepairMode || (!bUpgrade && !bDowngrade))
- Info ("INSTALL_OK");
+ Info ("INSTALL_OK", hwndDlg);
else
- Info ("SETUP_UPDATE_OK");
+ Info ("SETUP_UPDATE_OK", hwndDlg);
}
else
{
@@ -1330,9 +1330,9 @@ void OutcomePrompt (HWND hwndDlg, BOOL bOK)
else
{
if (bUninstall == FALSE)
- Error ("INSTALL_FAILED");
+ Error ("INSTALL_FAILED", hwndDlg);
else
- Error ("UNINSTALL_FAILED");
+ Error ("UNINSTALL_FAILED", hwndDlg);
}
}
@@ -1456,7 +1456,7 @@ void DoUninstall (void *arg)
UninstallBatch
);
- CheckFileStreamWriteErrors (f, UninstallBatch);
+ CheckFileStreamWriteErrors (hwndDlg, f, UninstallBatch);
fclose (f);
}
}
@@ -1501,7 +1501,7 @@ void DoInstall (void *arg)
handleWin32Error (hwndDlg);
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CANT_CREATE_FOLDER"), InstallationPath);
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONHAND);
- Error ("INSTALL_FAILED");
+ Error ("INSTALL_FAILED", hwndDlg);
PostMessage (MainDlg, TC_APPMSG_INSTALL_FAILURE, 0, 0);
return;
}
@@ -1524,7 +1524,7 @@ void DoInstall (void *arg)
)
{
NormalCursor ();
- Error ("CLOSE_TC_FIRST");
+ Error ("CLOSE_TC_FIRST", hwndDlg);
PostMessage (MainDlg, TC_APPMSG_INSTALL_FAILURE, 0, 0);
return;
}
@@ -1542,7 +1542,7 @@ void DoInstall (void *arg)
if (!DisablePagingFile())
{
handleWin32Error (hwndDlg);
- Error ("FAILED_TO_DISABLE_PAGING_FILES");
+ Error ("FAILED_TO_DISABLE_PAGING_FILES", hwndDlg);
}
else
bRestartRequired = TRUE;
@@ -1630,7 +1630,7 @@ void DoInstall (void *arg)
}
else
{
- Warning ("SYS_ENC_UPGRADE_FAILED");
+ Warning ("SYS_ENC_UPGRADE_FAILED", hwndDlg);
}
}
@@ -1750,7 +1750,7 @@ void SetInstallationPath (HWND hwndDlg)
// We know that VeraCrypt is installed but don't know where. It's not safe to continue installing
// over the old version.
- Error ("UNINSTALL_OLD_VERSION_FIRST");
+ Error ("UNINSTALL_OLD_VERSION_FIRST", hwndDlg);
len = strrchr (rv, '/') - rv - 1;
StringCbCopyNA (InstallationPath, sizeof(InstallationPath), rv, len); // Path and filename of the uninstaller
@@ -1896,7 +1896,7 @@ BOOL CALLBACK UninstallDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (bUninstallInProgress)
{
NormalCursor();
- if (AskNoYes("CONFIRM_EXIT_UNIVERSAL") == IDNO)
+ if (AskNoYes("CONFIRM_EXIT_UNIVERSAL", hwndDlg) == IDNO)
{
return 1;
}
@@ -2001,7 +2001,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm
char *tmpStr[] = {0, "SELECT_AN_ACTION", "REPAIR_REINSTALL", "UNINSTALL", "EXIT", 0};
// Ask the user to select either Repair or Unistallation
- switch (AskMultiChoice ((void **) tmpStr, FALSE))
+ switch (AskMultiChoice ((void **) tmpStr, FALSE, NULL))
{
case 1:
bRepairMode = TRUE;
diff --git a/src/Setup/Wizard.c b/src/Setup/Wizard.c
index 5bf2da6b..c6cb5468 100644
--- a/src/Setup/Wizard.c
+++ b/src/Setup/Wizard.c
@@ -231,7 +231,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
else
{
- Error("CANNOT_DISPLAY_LICENSE");
+ Error("CANNOT_DISPLAY_LICENSE", hwndDlg);
exit (1);
}
@@ -904,14 +904,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (nCurrentOS == WIN_2000)
{
- WarningDirect (L"Warning: Please note that this may be the last version of VeraCrypt that supports Windows 2000. If you want to be able to upgrade to future versions of VeraCrypt (which is highly recommended), you will need to upgrade to Windows XP or a later version of Windows.\n\nNote: Microsoft stopped issuing security updates for Windows 2000 to the general public on 7/13/2010 (the last non-security update for Windows 2000 was issued to the general public in 2005).");
+ WarningDirect (L"Warning: Please note that this may be the last version of VeraCrypt that supports Windows 2000. If you want to be able to upgrade to future versions of VeraCrypt (which is highly recommended), you will need to upgrade to Windows XP or a later version of Windows.\n\nNote: Microsoft stopped issuing security updates for Windows 2000 to the general public on 7/13/2010 (the last non-security update for Windows 2000 was issued to the general public in 2005).", hwndDlg);
HKEY hkey;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Updates\\Windows 2000\\SP5\\Update Rollup 1", 0, KEY_READ, &hkey) != ERROR_SUCCESS)
{
- ErrorDirect (L"VeraCrypt requires Update Rollup 1 for Windows 2000 SP4 to be installed.\n\nFor more information, see http://support.microsoft.com/kb/891861");
+ ErrorDirect (L"VeraCrypt requires Update Rollup 1 for Windows 2000 SP4 to be installed.\n\nFor more information, see http://support.microsoft.com/kb/891861", hwndDlg);
AbortProcessSilent ();
}
@@ -923,10 +923,10 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_WIZARD_MODE_EXTRACT_ONLY)))
{
- Info ("TRAVELER_LIMITATIONS_NOTE");
+ Info ("TRAVELER_LIMITATIONS_NOTE", hwndDlg);
if (IsUacSupported()
- && AskWarnYesNo ("TRAVELER_UAC_NOTE") == IDNO)
+ && AskWarnYesNo ("TRAVELER_UAC_NOTE", hwndDlg) == IDNO)
{
return 1;
}
@@ -1114,7 +1114,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
RefreshUIGFX ();
- Info ("EXTRACTION_FINISHED_INFO");
+ Info ("EXTRACTION_FINISHED_INFO", hwndDlg);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_NEXT), GetString ("FINALIZE"));
@@ -1146,7 +1146,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
RefreshUIGFX();
- Error ("EXTRACTION_FAILED");
+ Error ("EXTRACTION_FAILED", hwndDlg);
return 1;
@@ -1157,7 +1157,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bInProgress)
{
NormalCursor();
- if (AskNoYes("CONFIRM_EXIT_UNIVERSAL") == IDNO)
+ if (AskNoYes("CONFIRM_EXIT_UNIVERSAL", hwndDlg) == IDNO)
{
return 1;
}
@@ -1171,7 +1171,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
{
if (bPromptReleaseNotes
- && AskYesNo ("AFTER_UPGRADE_RELEASE_NOTES") == IDYES)
+ && AskYesNo ("AFTER_UPGRADE_RELEASE_NOTES", hwndDlg) == IDYES)
{
Applink ("releasenotes", TRUE, "");
}
@@ -1179,7 +1179,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
bPromptReleaseNotes = FALSE;
if (bPromptTutorial
- && AskYesNo ("AFTER_INSTALL_TUTORIAL") == IDYES)
+ && AskYesNo ("AFTER_INSTALL_TUTORIAL", hwndDlg) == IDYES)
{
Applink ("beginnerstutorial", TRUE, "");
}
@@ -1188,7 +1188,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
if (bRestartRequired
- && AskYesNo (bUpgrade ? "UPGRADE_OK_REBOOT_REQUIRED" : "CONFIRM_RESTART") == IDYES)
+ && AskYesNo (bUpgrade ? "UPGRADE_OK_REBOOT_REQUIRED" : "CONFIRM_RESTART", hwndDlg) == IDYES)
{
RestartComputer();
}