X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FHiiDatabaseDxe%2FDatabase.c;h=ec56795ebb1924942403472a062cc3129aecbc8c;hp=c80f1db055b856d16acc00afece35a07ea742cf4;hb=4d5b08684f08db04ee95cf94f913135e1eecd0f7;hpb=e5eed7d3641d71d7ea539e5379ea9c6a5cd97004 diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index c80f1db055..ec56795ebb 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -1,7 +1,7 @@ /** @file Implementation for EFI_HII_DATABASE_PROTOCOL. -Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -15,12 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "HiiDatabase.h" -// -// Global variables -// -EFI_GUID mHiiDatabaseNotifyGuid = HII_DATABASE_NOTIFY_GUID; - - /** This function generates a HII_DATABASE_RECORD node and adds into hii database. This is a internal function. @@ -86,7 +80,7 @@ GenerateHiiDatabaseRecord ( // Backup the number of Hii handles // Private->HiiHandleCount++; - HiiHandle->Key = Private->HiiHandleCount; + HiiHandle->Key = (UINTN) Private->HiiHandleCount; // // Insert the handle to hii handle list of the whole database. // @@ -804,7 +798,7 @@ InsertStringPackage ( if (Language == NULL) { return EFI_OUT_OF_RESOURCES; } - AsciiStrCpy (Language, (CHAR8 *) PackageHdr + HeaderSize - LanguageSize); + AsciiStrCpyS (Language, LanguageSize / sizeof (CHAR8), (CHAR8 *) PackageHdr + HeaderSize - LanguageSize); for (Link = PackageList->StringPkgHdr.ForwardLink; Link != &PackageList->StringPkgHdr; Link = Link->ForwardLink) { StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE); if (HiiCompareLanguage (Language, StringPackage->StringPkgHdr->Language)) { @@ -856,7 +850,7 @@ InsertStringPackage ( // // Collect all font block info // - Status = FindStringBlock (Private, StringPackage, (EFI_STRING_ID) (-1), NULL, NULL, NULL, &StringPackage->MaxStringId); + Status = FindStringBlock (Private, StringPackage, (EFI_STRING_ID) (-1), NULL, NULL, NULL, &StringPackage->MaxStringId, NULL); if (EFI_ERROR (Status)) { return Status; } @@ -1188,7 +1182,7 @@ InsertFontPackage ( } FontInfo->FontStyle = FontPkgHdr->FontStyle; FontInfo->FontSize = FontPkgHdr->Cell.Height; - StrCpy (FontInfo->FontName, FontPkgHdr->FontFamily); + StrCpyS (FontInfo->FontName, (FontInfoSize - OFFSET_OF(EFI_FONT_INFO,FontName)) / sizeof (CHAR16), FontPkgHdr->FontFamily); if (IsFontInfoExisted (Private, FontInfo, NULL, NULL, NULL)) { Status = EFI_UNSUPPORTED; @@ -2423,8 +2417,14 @@ AddPackages ( // // Initialize Variables // - StringPkgIsAdd = FALSE; - FontPackage = NULL; + StringPkgIsAdd = FALSE; + FontPackage = NULL; + StringPackage = NULL; + GuidPackage = NULL; + FormPackage = NULL; + ImagePackage = NULL; + SimpleFontPackage = NULL; + KeyboardLayoutPackage = NULL; // // Process the package list header @@ -2511,6 +2511,7 @@ AddPackages ( if (EFI_ERROR (Status)) { return Status; } + ASSERT (StringPackage != NULL); Status = InvokeRegisteredFunction ( Private, NotifyType, @@ -3106,17 +3107,18 @@ HiiUpdatePackageList ( @param Handle An array of EFI_HII_HANDLE instances returned. @retval EFI_SUCCESS The matching handles are outputed successfully. - HandleBufferLength is updated with the actual length. + HandleBufferLength is updated with the actual length. @retval EFI_BUFFER_TO_SMALL The HandleBufferLength parameter indicates that Handle is too small to support the number of handles. HandleBufferLength is updated with a value that will enable the data to fit. @retval EFI_NOT_FOUND No matching handle could not be found in database. - @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL. - + @retval EFI_INVALID_PARAMETER HandleBufferLength was NULL. + @retval EFI_INVALID_PARAMETER The value referenced by HandleBufferLength was not + zero and Handle was NULL. @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but - PackageGuid is not NULL, PackageType is a EFI_HII_ - PACKAGE_TYPE_GUID but PackageGuid is NULL. + PackageGuid is not NULL, PackageType is a EFI_HII_ + PACKAGE_TYPE_GUID but PackageGuid is NULL. **/ EFI_STATUS @@ -3269,7 +3271,9 @@ HiiListPackageLists ( value that will enable the data to fit. @retval EFI_NOT_FOUND The specifiecd Handle could not be found in the current database. - @retval EFI_INVALID_PARAMETER Handle or Buffer or BufferSize was NULL. + @retval EFI_INVALID_PARAMETER BufferSize was NULL. + @retval EFI_INVALID_PARAMETER The value referenced by BufferSize was not zero + and Buffer was NULL. **/ EFI_STATUS @@ -3287,13 +3291,13 @@ HiiExportPackageLists ( HII_DATABASE_RECORD *Node; UINTN UsedSize; - if (This == NULL || BufferSize == NULL || Handle == NULL) { + if (This == NULL || BufferSize == NULL) { return EFI_INVALID_PARAMETER; } if (*BufferSize > 0 && Buffer == NULL) { return EFI_INVALID_PARAMETER; } - if (!IsHiiHandleValid (Handle)) { + if ((Handle != NULL) && (!IsHiiHandleValid (Handle))) { return EFI_NOT_FOUND; } @@ -3419,7 +3423,7 @@ HiiRegisterPackageNotify ( // Status = gBS->InstallMultipleProtocolInterfaces ( &Notify->NotifyHandle, - &mHiiDatabaseNotifyGuid, + &gEfiCallerIdGuid, NULL, NULL ); @@ -3477,7 +3481,7 @@ HiiUnregisterPackageNotify ( Status = gBS->OpenProtocol ( NotificationHandle, - &mHiiDatabaseNotifyGuid, + &gEfiCallerIdGuid, NULL, NULL, NULL, @@ -3498,7 +3502,7 @@ HiiUnregisterPackageNotify ( RemoveEntryList (&Notify->DatabaseNotifyEntry); Status = gBS->UninstallMultipleProtocolInterfaces ( Notify->NotifyHandle, - &mHiiDatabaseNotifyGuid, + &gEfiCallerIdGuid, NULL, NULL ); @@ -3531,7 +3535,9 @@ HiiUnregisterPackageNotify ( number of GUIDs. KeyGuidBufferLength is updated with a value that will enable the data to fit. - @retval EFI_INVALID_PARAMETER The KeyGuidBuffer or KeyGuidBufferLength was NULL. + @retval EFI_INVALID_PARAMETER The KeyGuidBufferLength is NULL. + @retval EFI_INVALID_PARAMETER The value referenced by KeyGuidBufferLength is not + zero and KeyGuidBuffer is NULL. @retval EFI_NOT_FOUND There was no keyboard layout. **/