From 0f2d32f01145f82fa83806e08ddde6cdce8a496d Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 28 Apr 2015 23:47:59 +0200 Subject: 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. --- src/Boot/Windows/BootMain.cpp | 11 +++++++++-- src/ExpandVolume/WinMain.cpp | 1 - src/Format/Tcformat.c | 1 - src/Mount/Mount.c | 3 --- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Boot/Windows/BootMain.cpp b/src/Boot/Windows/BootMain.cpp index b29d3ff8..334762ea 100644 --- a/src/Boot/Windows/BootMain.cpp +++ b/src/Boot/Windows/BootMain.cpp @@ -60,6 +60,7 @@ static void PrintMainMenu () return; Print (" Keyboard Controls:\r\n"); + Print (" [F5] Hide/Show Password\r\n"); Print (" [Esc] "); #ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE @@ -149,6 +150,7 @@ static byte AskPassword (Password &password) size_t pos = 0; byte scanCode; byte asciiCode; + byte hidePassword = 1; Print ("Enter password"); Print (PreventNormalSystemBoot ? " for hidden system:\r\n" : ": "); @@ -178,6 +180,10 @@ static byte AskPassword (Password &password) } continue; + case TC_BIOS_KEY_F5: + hidePassword ^= 0x01; + continue; + default: if (scanCode == TC_BIOS_KEY_ESC || IsMenuKey (scanCode)) { @@ -196,10 +202,11 @@ static byte AskPassword (Password &password) } password.Text[pos++] = asciiCode; + if (hidePassword) asciiCode = '*'; if (pos < MAX_PASSWORD) - PrintChar ('*'); + PrintChar (asciiCode); else - PrintCharAtCursor ('*'); + PrintCharAtCursor (asciiCode); } } diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 19c5abe7..658f89ec 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -534,7 +534,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD), FALSE); SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0); InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE); diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 2bff1963..1c0edd82 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -3932,7 +3932,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa 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) { diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 0aafbf60..f27c2d50 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -1744,8 +1744,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR 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 */ 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); - EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD), FALSE); SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0); InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE); -- cgit v1.2.3