From c44501b313b3d2a28255d9ef5f8bc9644745859e Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 6 Sep 2019 23:15:42 +0200 Subject: [PATCH] ShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE The UefiShell*CommandsLib instances have constructor functions that do something like: gHiiHandle = HiiAddPackages (...); ... ShellCommandRegisterCommandName (..., gHiiHandle, ...); and destructor functions that implement the following pattern: HiiRemovePackages (gHiiHandle); The -- semantic, not functional -- problem is that "gHiiHandle" is declared with type EFI_HANDLE, and not EFI_HII_HANDLE, in all of these library instances, even though HiiAddPackages() correctly returns EFI_HII_HANDLE, and HiiRemovePackages() takes EFI_HII_HANDLE. Once we fix the type of "gHiiHandle", it causes sort of a butterfly effect, because it is passed around widely. Track down and update all of those locations. The DynamicCommand lib instances use a similar pattern, so they are affected too. NOTE: in practice, this patch is a no-op, as both EFI_HII_HANDLE and EFI_HANDLE are typedefs to (VOID*). However, we shouldn't use EFI_HANDLE where semantically EFI_HII_HANDLE is passed around. Cc: Jaben Carsey Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Zhichao Gao --- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 6 +++--- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h | 4 ++-- ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 6 +++--- ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h | 4 ++-- ShellPkg/Include/Library/ShellCommandLib.h | 2 +- ShellPkg/Include/Library/ShellLib.h | 4 ++-- .../Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 2 +- .../UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 2 +- ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 2 +- ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h | 2 +- .../UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c | 2 +- .../UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h | 2 +- .../UefiShellDriver1CommandsLib.c | 2 +- .../UefiShellDriver1CommandsLib.h | 2 +- .../UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c | 2 +- .../UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h | 2 +- .../UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c | 2 +- .../UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h | 2 +- .../UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c | 2 +- .../UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h | 2 +- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 4 ++-- .../UefiShellNetwork1CommandsLib.c | 2 +- .../UefiShellNetwork1CommandsLib.h | 2 +- .../UefiShellNetwork2CommandsLib.c | 2 +- .../UefiShellNetwork2CommandsLib.h | 2 +- 25 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index 735cdcbcc0..4ec4c18348 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -36,7 +36,7 @@ typedef struct { #pragma pack() -EFI_HANDLE mDpHiiHandle; +EFI_HII_HANDLE mDpHiiHandle; typedef struct { EFI_HANDLE Handle; @@ -924,14 +924,14 @@ Done: @return HII handle. **/ -EFI_HANDLE +EFI_HII_HANDLE InitializeHiiPackage ( EFI_HANDLE ImageHandle ) { EFI_STATUS Status; EFI_HII_PACKAGE_LIST_HEADER *PackageList; - EFI_HANDLE HiiHandle; + EFI_HII_HANDLE HiiHandle; // // Retrieve HII package list from ImageHandle diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h index 43aa4505ee..e446cccde9 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h @@ -36,7 +36,7 @@ #include #include -extern EFI_HANDLE mDpHiiHandle; +extern EFI_HII_HANDLE mDpHiiHandle; #define DP_MAJOR_VERSION 2 #define DP_MINOR_VERSION 5 @@ -133,7 +133,7 @@ RunDp ( @return HII handle. **/ -EFI_HANDLE +EFI_HII_HANDLE InitializeHiiPackage ( EFI_HANDLE ImageHandle ); diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index 607899032e..f28da9af72 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -11,7 +11,7 @@ #include "Tftp.h" #define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32 -EFI_HANDLE mTftpHiiHandle; +EFI_HII_HANDLE mTftpHiiHandle; /* Constant strings and definitions related to the message indicating the amount of @@ -1087,14 +1087,14 @@ CheckPacket ( @return HII handle. **/ -EFI_HANDLE +EFI_HII_HANDLE InitializeHiiPackage ( EFI_HANDLE ImageHandle ) { EFI_STATUS Status; EFI_HII_PACKAGE_LIST_HEADER *PackageList; - EFI_HANDLE HiiHandle; + EFI_HII_HANDLE HiiHandle; // // Retrieve HII package list from ImageHandle diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h index 7a9ed4724e..4cd7784368 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h @@ -30,7 +30,7 @@ #include #include -extern EFI_HANDLE mTftpHiiHandle; +extern EFI_HII_HANDLE mTftpHiiHandle; typedef struct { UINTN FileSize; @@ -62,7 +62,7 @@ RunTftp ( @return HII handle. **/ -EFI_HANDLE +EFI_HII_HANDLE InitializeHiiPackage ( EFI_HANDLE ImageHandle ); diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h index 287bc0eba7..63fcac82a2 100644 --- a/ShellPkg/Include/Library/ShellCommandLib.h +++ b/ShellPkg/Include/Library/ShellCommandLib.h @@ -136,7 +136,7 @@ ShellCommandRegisterCommandName ( IN UINT32 ShellMinSupportLevel, IN CONST CHAR16 *ProfileName, IN CONST BOOLEAN CanAffectLE, - IN CONST EFI_HANDLE HiiHandle, + IN CONST EFI_HII_HANDLE HiiHandle, IN CONST EFI_STRING_ID ManFormatHelp ); diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h index 31594796cd..1dc41f2cc1 100644 --- a/ShellPkg/Include/Library/ShellLib.h +++ b/ShellPkg/Include/Library/ShellLib.h @@ -965,7 +965,7 @@ ShellPrintHiiEx( IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, - IN CONST EFI_HANDLE HiiFormatHandle, + IN CONST EFI_HII_HANDLE HiiFormatHandle, ... ); @@ -1260,7 +1260,7 @@ EFIAPI ShellPromptForResponseHii ( IN SHELL_PROMPT_REQUEST_TYPE Type, IN CONST EFI_STRING_ID HiiFormatStringId, - IN CONST EFI_HANDLE HiiFormatHandle, + IN CONST EFI_HII_HANDLE HiiFormatHandle, IN OUT VOID **Response ); diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index f179c41092..f62d30ef67 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -14,7 +14,7 @@ #include #include -EFI_HANDLE mHandleParsingHiiHandle = NULL; +EFI_HII_HANDLE mHandleParsingHiiHandle = NULL; HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0}; GUID_INFO_BLOCK *mGuidList; UINTN mGuidListCount; diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index e8b48b4990..f8bcaebe46 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -38,7 +38,7 @@ #include STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; -STATIC EFI_HANDLE gShellBcfgHiiHandle = NULL; +STATIC EFI_HII_HANDLE gShellBcfgHiiHandle = NULL; typedef enum { BcfgTargetBootOrder = 0, diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c index 826ced30a8..4c48b65fbc 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c @@ -554,7 +554,7 @@ ShellCommandRegisterCommandName ( IN UINT32 ShellMinSupportLevel, IN CONST CHAR16 *ProfileName, IN CONST BOOLEAN CanAffectLE, - IN CONST EFI_HANDLE HiiHandle, + IN CONST EFI_HII_HANDLE HiiHandle, IN CONST EFI_STRING_ID ManFormatHelp ) { diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h index 36fe628a8c..8ecc2f6bf5 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h @@ -46,7 +46,7 @@ typedef struct{ SHELL_GET_MAN_FILENAME GetManFileName; SHELL_RUN_COMMAND CommandHandler; BOOLEAN LastError; - EFI_HANDLE HiiHandle; + EFI_HII_HANDLE HiiHandle; EFI_STRING_ID ManFormatHelp; } SHELL_COMMAND_INTERNAL_LIST_ENTRY; diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c index ddce3bef5a..f918867f47 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c @@ -10,7 +10,7 @@ #include STATIC CONST CHAR16 mFileName[] = L"Debug1Commands"; -EFI_HANDLE gShellDebug1HiiHandle = NULL; +EFI_HII_HANDLE gShellDebug1HiiHandle = NULL; /** Gets the debug file name. This will be used if HII is not working. diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h index 32a933b9f0..082d488cb2 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h @@ -52,7 +52,7 @@ #include -extern EFI_HANDLE gShellDebug1HiiHandle; +extern EFI_HII_HANDLE gShellDebug1HiiHandle; /** Function returns a system configuration table that is stored in the diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c index 4a05fa9942..e2219c62ec 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c @@ -9,7 +9,7 @@ #include "UefiShellDriver1CommandsLib.h" STATIC CONST CHAR16 mFileName[] = L"Driver1Commands"; -EFI_HANDLE gShellDriver1HiiHandle = NULL; +EFI_HII_HANDLE gShellDriver1HiiHandle = NULL; BOOLEAN gInReconnect = FALSE; /** diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h index 7e0b8b0940..ee795c4ce0 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h @@ -58,7 +58,7 @@ #include -extern EFI_HANDLE gShellDriver1HiiHandle; +extern EFI_HII_HANDLE gShellDriver1HiiHandle; extern BOOLEAN gInReconnect; /** diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c index ecbee99e3b..88cddd88dd 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c @@ -10,7 +10,7 @@ #include "UefiShellLevel1CommandsLib.h" STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; -EFI_HANDLE gShellLevel1HiiHandle = NULL; +EFI_HII_HANDLE gShellLevel1HiiHandle = NULL; /** Return the help text filename. Only used if no HII information found. diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h index 55acdd2b1f..f2f9cc5dcf 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h @@ -33,7 +33,7 @@ #include #include -extern EFI_HANDLE gShellLevel1HiiHandle; +extern EFI_HII_HANDLE gShellLevel1HiiHandle; /** Function for 'stall' command. diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c index c2a0bb492f..69427637bb 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c @@ -29,7 +29,7 @@ #include "UefiShellLevel2CommandsLib.h" CONST CHAR16 mFileName[] = L"ShellCommands"; -EFI_HANDLE gShellLevel2HiiHandle = NULL; +EFI_HII_HANDLE gShellLevel2HiiHandle = NULL; /** Get the filename to get help text from if not using HII. diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h index 6d522d4bb4..77be6f1a12 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h @@ -43,7 +43,7 @@ #include extern CONST CHAR16 mFileName[]; -extern EFI_HANDLE gShellLevel2HiiHandle; +extern EFI_HII_HANDLE gShellLevel2HiiHandle; /** Function for 'attrib' command. diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c index 7d2cc4a483..ce4afd117a 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c @@ -9,7 +9,7 @@ #include "UefiShellLevel3CommandsLib.h" CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands"; -EFI_HANDLE gShellLevel3HiiHandle = NULL; +EFI_HII_HANDLE gShellLevel3HiiHandle = NULL; /** return the filename to get help from is not using HII. diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h index 2d97ae4d3c..c095b9275e 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h @@ -32,7 +32,7 @@ #include #include -extern EFI_HANDLE gShellLevel3HiiHandle; +extern EFI_HII_HANDLE gShellLevel3HiiHandle; /** Function for 'type' command. diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 5be530092e..835d0f88ca 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -2997,7 +2997,7 @@ ShellPrintHiiEx( IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, - IN CONST EFI_HANDLE HiiFormatHandle, + IN CONST EFI_HII_HANDLE HiiFormatHandle, ... ) { @@ -3609,7 +3609,7 @@ EFIAPI ShellPromptForResponseHii ( IN SHELL_PROMPT_REQUEST_TYPE Type, IN CONST EFI_STRING_ID HiiFormatStringId, - IN CONST EFI_HANDLE HiiFormatHandle, + IN CONST EFI_HII_HANDLE HiiFormatHandle, IN OUT VOID **Response ) { diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c index 7e823cabd2..9a2b23fdc5 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c @@ -8,7 +8,7 @@ #include "UefiShellNetwork1CommandsLib.h" CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands"; -EFI_HANDLE gShellNetwork1HiiHandle = NULL; +EFI_HII_HANDLE gShellNetwork1HiiHandle = NULL; /** return the file name of the help text file if not using HII. diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h index d4ed8c0465..fddada2efa 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h @@ -38,7 +38,7 @@ #include #include -extern EFI_HANDLE gShellNetwork1HiiHandle; +extern EFI_HII_HANDLE gShellNetwork1HiiHandle; /** Function for 'ping' command. diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c index 5a7ffbfa19..4aab4295c1 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c @@ -8,7 +8,7 @@ #include "UefiShellNetwork2CommandsLib.h" CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands"; -EFI_HANDLE gShellNetwork2HiiHandle = NULL; +EFI_HII_HANDLE gShellNetwork2HiiHandle = NULL; /** return the file name of the help text file if not using HII. diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h index 9a5db32f2b..9ea42cf26d 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h @@ -27,7 +27,7 @@ #include #include -extern EFI_HANDLE gShellNetwork2HiiHandle; +extern EFI_HII_HANDLE gShellNetwork2HiiHandle; /** Function for 'ping6' command. -- 2.39.2