From 09db6bd29bdcd65eb5e124c58db5a36cf60cbfb2 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 28 Jan 2019 19:01:40 +0100 Subject: Add specific handling when user cancel password prompt with ESC so that original Windows loader is called in this case --- DcsBoot/DcsBoot.c | 5 +++++ DcsCfg/DcsCfgCrypt.c | 4 ++-- DcsInt/DcsInt.c | 6 +++--- Include/Library/CommonLib.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/DcsBoot/DcsBoot.c b/DcsBoot/DcsBoot.c index d4f4d56..18fb005 100644 --- a/DcsBoot/DcsBoot.c +++ b/DcsBoot/DcsBoot.c @@ -183,6 +183,11 @@ DcsBootMain( { EfiCpuHalt(); } + else if (res == EFI_DCS_USER_CANCELED) + { + /* If user cancels password prompt, call original Windows loader */ + res = EfiExec(NULL, gEfiExecCmdDefault); + } return res; } diff --git a/DcsCfg/DcsCfgCrypt.c b/DcsCfg/DcsCfgCrypt.c index 2d5497b..53e03a1 100644 --- a/DcsCfg/DcsCfgCrypt.c +++ b/DcsCfg/DcsCfgCrypt.c @@ -167,7 +167,7 @@ ChangePassword( ZeroMem(&confirmPassword, sizeof(newPassword)); VCAskPwd(AskPwdNew, &newPassword); if (gAuthPwdCode == AskPwdRetCancel) { - return EFI_NOT_READY; + return EFI_DCS_USER_CANCELED; } if (gAuthPwdCode == AskPwdRetTimeout) { return EFI_TIMEOUT; @@ -175,7 +175,7 @@ ChangePassword( VCAskPwd(AskPwdConfirm, &confirmPassword); if (gAuthPwdCode == AskPwdRetCancel) { MEM_BURN(&newPassword, sizeof(newPassword)); - return EFI_NOT_READY; + return EFI_DCS_USER_CANCELED; } if (gAuthPwdCode == AskPwdRetTimeout) { MEM_BURN(&newPassword, sizeof(newPassword)); diff --git a/DcsInt/DcsInt.c b/DcsInt/DcsInt.c index 8b6c803..8133726 100644 --- a/DcsInt/DcsInt.c +++ b/DcsInt/DcsInt.c @@ -563,7 +563,7 @@ SecRegionChangePwd() { ZeroMem(&confirmPassword, sizeof(newPassword)); VCAskPwd(AskPwdNew, &newPassword); if (gAuthPwdCode == AskPwdRetCancel) { - return EFI_NOT_READY; + return EFI_DCS_USER_CANCELED; } if (gAuthPwdCode == AskPwdRetTimeout) { return EFI_TIMEOUT; @@ -571,7 +571,7 @@ SecRegionChangePwd() { VCAskPwd(AskPwdConfirm, &confirmPassword); if (gAuthPwdCode == AskPwdRetCancel) { MEM_BURN(&newPassword, sizeof(newPassword)); - return EFI_NOT_READY; + return EFI_DCS_USER_CANCELED; } if (gAuthPwdCode == AskPwdRetTimeout) { MEM_BURN(&newPassword, sizeof(newPassword)); @@ -682,7 +682,7 @@ SecRegionTryDecrypt() SecRegionOffset = 0; VCAuthAsk(); if (gAuthPwdCode == AskPwdRetCancel) { - return EFI_NOT_READY; + return EFI_DCS_USER_CANCELED; } if (gAuthPwdCode == AskPwdRetTimeout) { return EFI_TIMEOUT; diff --git a/Include/Library/CommonLib.h b/Include/Library/CommonLib.h index d0db41f..4d207ca 100644 --- a/Include/Library/CommonLib.h +++ b/Include/Library/CommonLib.h @@ -31,6 +31,7 @@ https://opensource.org/licenses/LGPL-3.0 #define EFI_DCS_SHUTDOWN_REQUESTED ENCODE_ERROR(0xDC50001) #define EFI_DCS_REBOOT_REQUESTED ENCODE_ERROR(0xDC50002) #define EFI_DCS_HALT_REQUESTED ENCODE_ERROR(0xDC50003) +#define EFI_DCS_USER_CANCELED ENCODE_ERROR(0xDC50004) ////////////////////////////////////////////////////////////////////////// // Check error -- cgit v1.2.3