diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-01-09 16:45:40 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-01-11 10:07:06 +0800 |
commit | 0e88348e4b252cd68b88e1d87085208be2293651 (patch) | |
tree | 54751d31e0e66e4e7069dc3138bec83280435977 /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | |
parent | d4ec9a5725d67bb1770008513f4c6f1dce2c9b43 (diff) | |
download | edk2-0e88348e4b252cd68b88e1d87085208be2293651.zip edk2-0e88348e4b252cd68b88e1d87085208be2293651.tar.gz edk2-0e88348e4b252cd68b88e1d87085208be2293651.tar.bz2 |
ShellPkg/HandleParsingLib: Return NULL name for unknown GUID
GetStringNameFromGuid() returns NULL for unknown GUID, instead of
returning "UnknownDevice".
The behavior change matches ShellProtocol.GetGuidName().
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c')
-rw-r--r-- | ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 1049dea..780c458 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -933,25 +933,22 @@ AdapterInformationDumpInformation ( } else {
GuidStr = GetStringNameFromGuid (&InfoTypesBuffer[GuidIndex], NULL);
+ if (GuidStr == NULL) {
+ TempRetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType");
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
- if (GuidStr != NULL) {
- if (StrCmp(GuidStr, L"UnknownDevice") == 0) {
- TempRetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType");
- SHELL_FREE_NON_NULL (RetVal);
- RetVal = TempRetVal;
-
- SHELL_FREE_NON_NULL (TempStr);
- SHELL_FREE_NON_NULL(GuidStr);
- //
- // So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP
- //
- continue;
- } else {
- TempRetVal = CatSPrint (RetVal, TempStr, GuidStr);
- SHELL_FREE_NON_NULL (RetVal);
- RetVal = TempRetVal;
- SHELL_FREE_NON_NULL(GuidStr);
- }
+ SHELL_FREE_NON_NULL (TempStr);
+ SHELL_FREE_NON_NULL(GuidStr);
+ //
+ // So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP
+ //
+ continue;
+ } else {
+ TempRetVal = CatSPrint (RetVal, TempStr, GuidStr);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+ SHELL_FREE_NON_NULL(GuidStr);
}
}
@@ -1500,7 +1497,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = { {STRING_TOKEN(STR_WINNT_THUNK), (EFI_GUID*)&WinNtThunkProtocolGuid, NULL},
{STRING_TOKEN(STR_WINNT_DRIVER_IO), (EFI_GUID*)&WinNtIoProtocolGuid, NULL},
{STRING_TOKEN(STR_WINNT_SERIAL_PORT), (EFI_GUID*)&WinNtSerialPortGuid, NULL},
- {STRING_TOKEN(STR_UNKNOWN_DEVICE), NULL, NULL},
+ {0, NULL, NULL},
};
STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
@@ -1816,7 +1813,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { //
// terminator
//
- {STRING_TOKEN(STR_UNKNOWN_DEVICE), NULL, NULL},
+ {0, NULL, NULL},
};
/**
@@ -1964,7 +1961,10 @@ GetStringNameFromGuid( HandleParsingHiiInit();
Id = InternalShellGetNodeFromGuid(Guid);
- return (HiiGetString(mHandleParsingHiiHandle, Id==NULL?STRING_TOKEN(STR_UNKNOWN_DEVICE):Id->StringId, Lang));
+ if (Id == NULL) {
+ return NULL;
+ }
+ return HiiGetString (mHandleParsingHiiHandle, Id->StringId, Lang);
}
/**
|