mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user