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

Windows: enable showing/hiding password for system encryption in Windows UI and in the bootloader (F5 key). This will be helpful to diagnose issues with non-US versions of Windows.

This commit is contained in:
Mounir IDRASSI
2015-04-28 23:47:59 +02:00
parent a1f1e34789
commit 0f2d32f011
4 changed files with 9 additions and 7 deletions

View File

@@ -60,6 +60,7 @@ static void PrintMainMenu ()
return; return;
Print (" Keyboard Controls:\r\n"); Print (" Keyboard Controls:\r\n");
Print (" [F5] Hide/Show Password\r\n");
Print (" [Esc] "); Print (" [Esc] ");
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE #ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
@@ -149,6 +150,7 @@ static byte AskPassword (Password &password)
size_t pos = 0; size_t pos = 0;
byte scanCode; byte scanCode;
byte asciiCode; byte asciiCode;
byte hidePassword = 1;
Print ("Enter password"); Print ("Enter password");
Print (PreventNormalSystemBoot ? " for hidden system:\r\n" : ": "); Print (PreventNormalSystemBoot ? " for hidden system:\r\n" : ": ");
@@ -178,6 +180,10 @@ static byte AskPassword (Password &password)
} }
continue; continue;
case TC_BIOS_KEY_F5:
hidePassword ^= 0x01;
continue;
default: default:
if (scanCode == TC_BIOS_KEY_ESC || IsMenuKey (scanCode)) if (scanCode == TC_BIOS_KEY_ESC || IsMenuKey (scanCode))
{ {
@@ -196,10 +202,11 @@ static byte AskPassword (Password &password)
} }
password.Text[pos++] = asciiCode; password.Text[pos++] = asciiCode;
if (hidePassword) asciiCode = '*';
if (pos < MAX_PASSWORD) if (pos < MAX_PASSWORD)
PrintChar ('*'); PrintChar (asciiCode);
else else
PrintCharAtCursor ('*'); PrintCharAtCursor (asciiCode);
} }
} }

View File

@@ -534,7 +534,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
} }
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE); SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD), FALSE);
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0); SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0);
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE); InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);

View File

@@ -3932,7 +3932,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
bKeyboardLayoutChanged = TRUE; bKeyboardLayoutChanged = TRUE;
} }
ShowWindow(GetDlgItem(hwndDlg, IDC_SHOW_PASSWORD), SW_HIDE);
if (SetTimer (MainDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0) if (SetTimer (MainDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{ {

View File

@@ -1744,8 +1744,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
bKeyboardLayoutChanged = TRUE; bKeyboardLayoutChanged = TRUE;
} }
ShowWindow(GetDlgItem(hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_SHOW_PASSWORD_CHPWD_ORI), SW_HIDE);
/* for system encryption, we can't change the PRF */ /* for system encryption, we can't change the PRF */
EnableWindow (GetDlgItem (hwndDlg, IDT_PKCS5_PRF), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDT_PKCS5_PRF), FALSE);
@@ -2279,7 +2277,6 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
} }
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE); SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD), FALSE);
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0); SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0);
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE); InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);