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 <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
This commit is contained in:
Laszlo Ersek 2019-09-06 23:15:42 +02:00
parent 61d505dfc1
commit c44501b313
25 changed files with 33 additions and 33 deletions

View File

@ -36,7 +36,7 @@ typedef struct {
#pragma pack() #pragma pack()
EFI_HANDLE mDpHiiHandle; EFI_HII_HANDLE mDpHiiHandle;
typedef struct { typedef struct {
EFI_HANDLE Handle; EFI_HANDLE Handle;
@ -924,14 +924,14 @@ Done:
@return HII handle. @return HII handle.
**/ **/
EFI_HANDLE EFI_HII_HANDLE
InitializeHiiPackage ( InitializeHiiPackage (
EFI_HANDLE ImageHandle EFI_HANDLE ImageHandle
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HII_PACKAGE_LIST_HEADER *PackageList; EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_HANDLE HiiHandle; EFI_HII_HANDLE HiiHandle;
// //
// Retrieve HII package list from ImageHandle // Retrieve HII package list from ImageHandle

View File

@ -36,7 +36,7 @@
#include <Library/UefiHiiServicesLib.h> #include <Library/UefiHiiServicesLib.h>
#include <Library/PerformanceLib.h> #include <Library/PerformanceLib.h>
extern EFI_HANDLE mDpHiiHandle; extern EFI_HII_HANDLE mDpHiiHandle;
#define DP_MAJOR_VERSION 2 #define DP_MAJOR_VERSION 2
#define DP_MINOR_VERSION 5 #define DP_MINOR_VERSION 5
@ -133,7 +133,7 @@ RunDp (
@return HII handle. @return HII handle.
**/ **/
EFI_HANDLE EFI_HII_HANDLE
InitializeHiiPackage ( InitializeHiiPackage (
EFI_HANDLE ImageHandle EFI_HANDLE ImageHandle
); );

View File

@ -11,7 +11,7 @@
#include "Tftp.h" #include "Tftp.h"
#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32 #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 Constant strings and definitions related to the message indicating the amount of
@ -1087,14 +1087,14 @@ CheckPacket (
@return HII handle. @return HII handle.
**/ **/
EFI_HANDLE EFI_HII_HANDLE
InitializeHiiPackage ( InitializeHiiPackage (
EFI_HANDLE ImageHandle EFI_HANDLE ImageHandle
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HII_PACKAGE_LIST_HEADER *PackageList; EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_HANDLE HiiHandle; EFI_HII_HANDLE HiiHandle;
// //
// Retrieve HII package list from ImageHandle // Retrieve HII package list from ImageHandle

View File

@ -30,7 +30,7 @@
#include <Library/PrintLib.h> #include <Library/PrintLib.h>
#include <Library/UefiHiiServicesLib.h> #include <Library/UefiHiiServicesLib.h>
extern EFI_HANDLE mTftpHiiHandle; extern EFI_HII_HANDLE mTftpHiiHandle;
typedef struct { typedef struct {
UINTN FileSize; UINTN FileSize;
@ -62,7 +62,7 @@ RunTftp (
@return HII handle. @return HII handle.
**/ **/
EFI_HANDLE EFI_HII_HANDLE
InitializeHiiPackage ( InitializeHiiPackage (
EFI_HANDLE ImageHandle EFI_HANDLE ImageHandle
); );

View File

@ -136,7 +136,7 @@ ShellCommandRegisterCommandName (
IN UINT32 ShellMinSupportLevel, IN UINT32 ShellMinSupportLevel,
IN CONST CHAR16 *ProfileName, IN CONST CHAR16 *ProfileName,
IN CONST BOOLEAN CanAffectLE, IN CONST BOOLEAN CanAffectLE,
IN CONST EFI_HANDLE HiiHandle, IN CONST EFI_HII_HANDLE HiiHandle,
IN CONST EFI_STRING_ID ManFormatHelp IN CONST EFI_STRING_ID ManFormatHelp
); );

View File

@ -965,7 +965,7 @@ ShellPrintHiiEx(
IN INT32 Row OPTIONAL, IN INT32 Row OPTIONAL,
IN CONST CHAR8 *Language OPTIONAL, IN CONST CHAR8 *Language OPTIONAL,
IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_STRING_ID HiiFormatStringId,
IN CONST EFI_HANDLE HiiFormatHandle, IN CONST EFI_HII_HANDLE HiiFormatHandle,
... ...
); );
@ -1260,7 +1260,7 @@ EFIAPI
ShellPromptForResponseHii ( ShellPromptForResponseHii (
IN SHELL_PROMPT_REQUEST_TYPE Type, IN SHELL_PROMPT_REQUEST_TYPE Type,
IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_STRING_ID HiiFormatStringId,
IN CONST EFI_HANDLE HiiFormatHandle, IN CONST EFI_HII_HANDLE HiiFormatHandle,
IN OUT VOID **Response IN OUT VOID **Response
); );

View File

@ -14,7 +14,7 @@
#include <PiDxe.h> #include <PiDxe.h>
#include <Protocol/FirmwareVolume2.h> #include <Protocol/FirmwareVolume2.h>
EFI_HANDLE mHandleParsingHiiHandle = NULL; EFI_HII_HANDLE mHandleParsingHiiHandle = NULL;
HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0}; HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0};
GUID_INFO_BLOCK *mGuidList; GUID_INFO_BLOCK *mGuidList;
UINTN mGuidListCount; UINTN mGuidListCount;

View File

@ -38,7 +38,7 @@
#include <Library/UefiBootManagerLib.h> #include <Library/UefiBootManagerLib.h>
STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
STATIC EFI_HANDLE gShellBcfgHiiHandle = NULL; STATIC EFI_HII_HANDLE gShellBcfgHiiHandle = NULL;
typedef enum { typedef enum {
BcfgTargetBootOrder = 0, BcfgTargetBootOrder = 0,

View File

@ -554,7 +554,7 @@ ShellCommandRegisterCommandName (
IN UINT32 ShellMinSupportLevel, IN UINT32 ShellMinSupportLevel,
IN CONST CHAR16 *ProfileName, IN CONST CHAR16 *ProfileName,
IN CONST BOOLEAN CanAffectLE, IN CONST BOOLEAN CanAffectLE,
IN CONST EFI_HANDLE HiiHandle, IN CONST EFI_HII_HANDLE HiiHandle,
IN CONST EFI_STRING_ID ManFormatHelp IN CONST EFI_STRING_ID ManFormatHelp
) )
{ {

View File

@ -46,7 +46,7 @@ typedef struct{
SHELL_GET_MAN_FILENAME GetManFileName; SHELL_GET_MAN_FILENAME GetManFileName;
SHELL_RUN_COMMAND CommandHandler; SHELL_RUN_COMMAND CommandHandler;
BOOLEAN LastError; BOOLEAN LastError;
EFI_HANDLE HiiHandle; EFI_HII_HANDLE HiiHandle;
EFI_STRING_ID ManFormatHelp; EFI_STRING_ID ManFormatHelp;
} SHELL_COMMAND_INTERNAL_LIST_ENTRY; } SHELL_COMMAND_INTERNAL_LIST_ENTRY;

View File

@ -10,7 +10,7 @@
#include <Library/BcfgCommandLib.h> #include <Library/BcfgCommandLib.h>
STATIC CONST CHAR16 mFileName[] = L"Debug1Commands"; 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. Gets the debug file name. This will be used if HII is not working.

View File

@ -52,7 +52,7 @@
#include <Library/HandleParsingLib.h> #include <Library/HandleParsingLib.h>
extern EFI_HANDLE gShellDebug1HiiHandle; extern EFI_HII_HANDLE gShellDebug1HiiHandle;
/** /**
Function returns a system configuration table that is stored in the Function returns a system configuration table that is stored in the

View File

@ -9,7 +9,7 @@
#include "UefiShellDriver1CommandsLib.h" #include "UefiShellDriver1CommandsLib.h"
STATIC CONST CHAR16 mFileName[] = L"Driver1Commands"; STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
EFI_HANDLE gShellDriver1HiiHandle = NULL; EFI_HII_HANDLE gShellDriver1HiiHandle = NULL;
BOOLEAN gInReconnect = FALSE; BOOLEAN gInReconnect = FALSE;
/** /**

View File

@ -58,7 +58,7 @@
#include <Library/HandleParsingLib.h> #include <Library/HandleParsingLib.h>
extern EFI_HANDLE gShellDriver1HiiHandle; extern EFI_HII_HANDLE gShellDriver1HiiHandle;
extern BOOLEAN gInReconnect; extern BOOLEAN gInReconnect;
/** /**

View File

@ -10,7 +10,7 @@
#include "UefiShellLevel1CommandsLib.h" #include "UefiShellLevel1CommandsLib.h"
STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; 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. Return the help text filename. Only used if no HII information found.

View File

@ -33,7 +33,7 @@
#include <Library/HiiLib.h> #include <Library/HiiLib.h>
#include <Library/FileHandleLib.h> #include <Library/FileHandleLib.h>
extern EFI_HANDLE gShellLevel1HiiHandle; extern EFI_HII_HANDLE gShellLevel1HiiHandle;
/** /**
Function for 'stall' command. Function for 'stall' command.

View File

@ -29,7 +29,7 @@
#include "UefiShellLevel2CommandsLib.h" #include "UefiShellLevel2CommandsLib.h"
CONST CHAR16 mFileName[] = L"ShellCommands"; 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. Get the filename to get help text from if not using HII.

View File

@ -43,7 +43,7 @@
#include <Library/FileHandleLib.h> #include <Library/FileHandleLib.h>
extern CONST CHAR16 mFileName[]; extern CONST CHAR16 mFileName[];
extern EFI_HANDLE gShellLevel2HiiHandle; extern EFI_HII_HANDLE gShellLevel2HiiHandle;
/** /**
Function for 'attrib' command. Function for 'attrib' command.

View File

@ -9,7 +9,7 @@
#include "UefiShellLevel3CommandsLib.h" #include "UefiShellLevel3CommandsLib.h"
CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands"; 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. return the filename to get help from is not using HII.

View File

@ -32,7 +32,7 @@
#include <Library/HiiLib.h> #include <Library/HiiLib.h>
#include <Library/FileHandleLib.h> #include <Library/FileHandleLib.h>
extern EFI_HANDLE gShellLevel3HiiHandle; extern EFI_HII_HANDLE gShellLevel3HiiHandle;
/** /**
Function for 'type' command. Function for 'type' command.

View File

@ -2997,7 +2997,7 @@ ShellPrintHiiEx(
IN INT32 Row OPTIONAL, IN INT32 Row OPTIONAL,
IN CONST CHAR8 *Language OPTIONAL, IN CONST CHAR8 *Language OPTIONAL,
IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_STRING_ID HiiFormatStringId,
IN CONST EFI_HANDLE HiiFormatHandle, IN CONST EFI_HII_HANDLE HiiFormatHandle,
... ...
) )
{ {
@ -3609,7 +3609,7 @@ EFIAPI
ShellPromptForResponseHii ( ShellPromptForResponseHii (
IN SHELL_PROMPT_REQUEST_TYPE Type, IN SHELL_PROMPT_REQUEST_TYPE Type,
IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_STRING_ID HiiFormatStringId,
IN CONST EFI_HANDLE HiiFormatHandle, IN CONST EFI_HII_HANDLE HiiFormatHandle,
IN OUT VOID **Response IN OUT VOID **Response
) )
{ {

View File

@ -8,7 +8,7 @@
#include "UefiShellNetwork1CommandsLib.h" #include "UefiShellNetwork1CommandsLib.h"
CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands"; 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. return the file name of the help text file if not using HII.

View File

@ -38,7 +38,7 @@
#include <Library/DevicePathLib.h> #include <Library/DevicePathLib.h>
#include <Library/PrintLib.h> #include <Library/PrintLib.h>
extern EFI_HANDLE gShellNetwork1HiiHandle; extern EFI_HII_HANDLE gShellNetwork1HiiHandle;
/** /**
Function for 'ping' command. Function for 'ping' command.

View File

@ -8,7 +8,7 @@
#include "UefiShellNetwork2CommandsLib.h" #include "UefiShellNetwork2CommandsLib.h"
CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands"; 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. return the file name of the help text file if not using HII.

View File

@ -27,7 +27,7 @@
#include <Library/HiiLib.h> #include <Library/HiiLib.h>
#include <Library/NetLib.h> #include <Library/NetLib.h>
extern EFI_HANDLE gShellNetwork2HiiHandle; extern EFI_HII_HANDLE gShellNetwork2HiiHandle;
/** /**
Function for 'ping6' command. Function for 'ping6' command.