Windows: Allow system encrypted devices to be mounted from WindowsPE - even if changing the keyboard layout failed (#539)

When my system broke and I had to use WindowsPE to rescue some files the password dialog always closed immediately. There was no chance to mount the system device using the GUI. It took me a while to realize that I could try using the CLI by passing the password as a parameter (which might not be so obvious for not advanced users).

Signed-off-by: Sven Strickroth <email@cs-ware.de>
This commit is contained in:
csware 2019-11-12 22:02:57 +01:00 committed by Mounir IDRASSI
parent f5aea06281
commit 34a9e118b6

View File

@ -3019,11 +3019,16 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (keybLayout != 0x00000409 && keybLayout != 0x04090409) if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{ {
Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg);
EndDialog (hwndDlg, IDCANCEL); /* don't be too agressive on enforcing an English keyboard layout. E.g. on WindowsPE this call fails and
return 1; * then the user can only mount a system encrypted device using the command line by passing the password as a parameter
* (which might not be obvious for not so advanced users).
*
* Now, we informed the user that English keyboard is required, if it is not available the volume can just not be mounted.
* There should be no other drawback (as e.g., on the change password dialog, when you might change to a password which won't
* work on the pre-start environment.
*/
} }
else if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{ {
Error ("CANNOT_SET_TIMER", hwndDlg); Error ("CANNOT_SET_TIMER", hwndDlg);
EndDialog (hwndDlg, IDCANCEL); EndDialog (hwndDlg, IDCANCEL);