X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellDebug1CommandsLib%2FUefiShellDebug1CommandsLib.c;h=5f8f8a9dd95991bfb896f7bbbdb6e5dce0881ff0;hb=ec8a502e66fe190a77546e82820e921cfa9d05e0;hp=cccec126b4d9dc20be22752c3a706d9e53daa04a;hpb=33c031ee2092282a069ce07d30202082ceaf61fe;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c index cccec126b4..5f8f8a9dd9 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c @@ -13,13 +13,10 @@ **/ #include "UefiShellDebug1CommandsLib.h" +#include STATIC CONST CHAR16 mFileName[] = L"Debug1Commands"; EFI_HANDLE gShellDebug1HiiHandle = NULL; -CONST EFI_GUID gShellDebug1HiiGuid = \ - { \ - 0x25f200aa, 0xd3cb, 0x470a, { 0xbf, 0x51, 0xe7, 0xd1, 0x62, 0xd2, 0x2e, 0x6f } \ - }; /** Gets the debug file name. This will be used if HII is not working. @@ -56,7 +53,7 @@ UefiShellDebug1CommandsLibConstructor ( // check our bit of the profiles mask // if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) { - return (EFI_UNSUPPORTED); + return (EFI_SUCCESS); } // @@ -88,18 +85,10 @@ UefiShellDebug1CommandsLibConstructor ( ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) ); ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) ); - // - // check install profile bit of the profiles mask is set - // - if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) { - ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG) ); - } - - - - ShellCommandRegisterAlias(L"dmem", L"mem"); + BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1"); + return (EFI_SUCCESS); } @@ -119,6 +108,8 @@ UefiShellDebug1CommandsLibDestructor ( if (gShellDebug1HiiHandle != NULL) { HiiRemovePackages(gShellDebug1HiiHandle); } + + BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable); return (EFI_SUCCESS); } @@ -150,7 +141,6 @@ STATIC CONST CHAR8 Hex[] = { @param[in] UserData The data to print out. **/ VOID -EFIAPI DumpHex ( IN UINTN Indent, IN UINTN Offset, @@ -185,7 +175,7 @@ DumpHex ( Val[Index * 3] = 0; Str[Index] = 0; - ShellPrintEx(-1, -1, L"%*a%02X: %-.48a *%a*\r\n", Indent, "", Offset, Val, Str); + ShellPrintEx(-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str); Data += Size; Offset += Size; @@ -227,8 +217,8 @@ CharToUpper ( Function returns a system configuration table that is stored in the EFI System Table based on the provided GUID. - @param[in] TableGuid A pointer to the table's GUID type. - @param[in,out] Table On exit, a pointer to a system configuration table. + @param[in] TableGuid A pointer to the table's GUID type. + @param[in, out] Table On exit, a pointer to a system configuration table. @retval EFI_SUCCESS A configuration table matching TableGuid was found. @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found. @@ -282,8 +272,8 @@ HexCharToUintn ( /** Convert a string representation of a guid to a Guid value. - @param[in] StringGuid The pointer to the string of a guid. - @param[in,out] Guid The pointer to the GUID structure to populate. + @param[in] StringGuid The pointer to the string of a guid. + @param[in, out] Guid The pointer to the GUID structure to populate. @retval EFI_INVALID_PARAMETER A parameter was invalid. @retval EFI_SUCCESS The conversion was successful. @@ -308,6 +298,9 @@ ConvertStringToGuid ( } TempCopy = NULL; TempCopy = StrnCatGrow(&TempCopy, NULL, StringGuid, 0); + if (TempCopy == NULL) { + return (EFI_OUT_OF_RESOURCES); + } Walker = TempCopy; TempSpot = StrStr(Walker, L"-"); if (TempSpot != NULL) { @@ -369,52 +362,6 @@ ConvertStringToGuid ( return (EFI_SUCCESS); } -CHAR16 TempBufferCatSPrint[1000]; -/** - Appends a formatted Unicode string to a Null-terminated Unicode string - - This function appends a formatted Unicode string to the Null-terminated - Unicode string specified by String. String is optional and may be NULL. - Storage for the formatted Unicode string returned is allocated using - AllocateZeroPool(). The pointer to the appended string is returned. The caller - is responsible for freeing the returned string. - - If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). - If Format is NULL, then ASSERT(). - If Format is not aligned on a 16-bit boundary, then ASSERT(). - - @param String A null-terminated Unicode string. - @param FormatString A null-terminated Unicode format string. - @param ... The variable argument list whose contents are accessed based - on the format string specified by Format. - - @retval NULL There was not enough available memory. - @return Null terminated Unicode string is that is the formatted - string appended to String. - @sa CatVSPrint -**/ -CHAR16* -EFIAPI -CatSPrint ( - IN CONST CHAR16 *String OPTIONAL, - IN CONST CHAR16 *FormatString, - ... - ) -{ - VA_LIST Marker; - UINTN StringLength; - if (String != NULL) { - StrCpy(TempBufferCatSPrint, String); - } else { - *TempBufferCatSPrint = CHAR_NULL; - } - VA_START (Marker, FormatString); - StringLength = StrLen(TempBufferCatSPrint); - - UnicodeVSPrint(TempBufferCatSPrint+StrLen(TempBufferCatSPrint), 1000-StringLength, FormatString, Marker); - return (AllocateCopyPool(StrSize(TempBufferCatSPrint), TempBufferCatSPrint)); -} - /** Clear the line at the specified Row. @@ -473,7 +420,7 @@ IsValidFileNameChar ( // // See if there are any illegal characters within the name // - if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|' || Ch == L' ') { + if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|') { return FALSE; } @@ -538,11 +485,9 @@ EditGetDefaultFileName ( { EFI_STATUS Status; UINTN Suffix; - BOOLEAN FoundNewFile; CHAR16 *FileNameTmp; Suffix = 0; - FoundNewFile = FALSE; do { FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension);