From: lgao4 Date: Thu, 14 May 2009 12:37:02 +0000 (+0000) Subject: Update HiiDataBase to fix parsing Hii package error. Some HiiPackages have no varstor... X-Git-Tag: edk2-stable201903~17958 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=76c2425177bc419d8aa03749a57ece4ecde22066 Update HiiDataBase to fix parsing Hii package error. Some HiiPackages have no varstore and question, they has no the built in default value. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8314 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h index 3054a9b9c9..81fdaabd47 100644 --- a/MdeModulePkg/Include/Library/HiiLib.h +++ b/MdeModulePkg/Include/Library/HiiLib.h @@ -286,18 +286,17 @@ HiiConstructConfigHdr ( ); /** - It has the many same logic to HiiValidateSetting API. - Reset the default value specified by DefaultId to the driver configuration got by Request string. - NULL request string support depends on the ExtractConfig interface of + + NULL request string support depends on the ExportConfig interface of HiiConfigRouting protocol in UEFI specification. - @param EFI_STRING Request A null-terminated Unicode string in - format. It can be NULL. - If it is NULL, all configuration for the - entirety of the current HII database will be reset. - @param UINT16 DefaultId Specifies the type of defaults to retrieve. + @param Request A null-terminated Unicode string in + format. It can be NULL. + If it is NULL, all configuration for the + entirety of the current HII database will be reset. + @param DefaultId Specifies the type of defaults to retrieve. @retval TURE The default value is set successfully. @retval FALSE The default value can't be found and set. @@ -311,15 +310,14 @@ HiiSetToDefaults ( /** Validate the current configuration by parsing HII form IFR opcode. - It can share the most logic with HiiSetToDefaults. NULL request string support depends on the ExtractConfig interface of HiiConfigRouting protocol in UEFI specification. - @param EFI_STRING Request A null-terminated Unicode string in - format. It can be NULL. - If it is NULL, all current configuration for the - entirety of the current HII database will be validated. + @param Request A null-terminated Unicode string in + format. It can be NULL. + If it is NULL, all current configuration for the + entirety of the current HII database will be validated. @retval TURE Current configuration is valid. @retval FALSE Current configuration is invalid. diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index de7cb3f46e..b9323706a6 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -1177,6 +1177,11 @@ InternalHiiValidateCurrentSetting ( } Link = Link->ForwardLink; } + + if (IsListEmpty (&CurrentBlockArray->Entry)) { + Status = EFI_SUCCESS; + goto Done; + } // // 2. Check IFR value is in block data, then Validate Vaule @@ -1233,7 +1238,7 @@ InternalHiiValidateCurrentSetting ( // Check the matched VarStoreId is found. // if (IfrVarStore == NULL) { - Status = EFI_NOT_FOUND; + Status = EFI_SUCCESS; goto Done; } break; @@ -1580,7 +1585,7 @@ BOOLEAN EFIAPI InternalHiiIfrValueAction ( IN CONST EFI_STRING Request, OPTIONAL - IN UINT16 DefaultId, + IN UINT16 DefaultId, IN UINT8 ActionType ) { @@ -1738,6 +1743,7 @@ InternalHiiIfrValueAction ( // Its default value and validating can't execute by parsing IFR data. // Directly jump into the next ConfigAltResp string for another pair Guid, Name, and Path. // + Status = EFI_SUCCESS; goto NextConfigAltResp; } @@ -1819,7 +1825,8 @@ InternalHiiIfrValueAction ( // Not found the matched default string ID // if (EFI_ERROR (Status)) { - goto Done; + Status = EFI_SUCCESS; + goto NextConfigAltResp; } } @@ -1838,7 +1845,8 @@ InternalHiiIfrValueAction ( ); if (EFI_ERROR (Status)) { - goto Done; + Status = EFI_SUCCESS; + goto NextConfigAltResp; } // @@ -1861,6 +1869,7 @@ InternalHiiIfrValueAction ( goto Done; } +NextConfigAltResp: // // Free the allocated pacakge buffer and the got ConfigResp string. // @@ -1868,11 +1877,12 @@ InternalHiiIfrValueAction ( FreePool (HiiPackageList); HiiPackageList = NULL; } + + if (ConfigResp != NULL) { + FreePool (ConfigResp); + ConfigResp = NULL; + } - FreePool (ConfigResp); - ConfigResp = NULL; - -NextConfigAltResp: // // Free the allocated buffer. // diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 87ffac8279..254f7f9581 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -418,6 +418,7 @@ ExtractConfig ( if (Request == NULL) { FreePool (ConfigRequest); + *Progress = NULL; } return Status; diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 6b278afe17..2761be1018 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -1728,6 +1728,13 @@ GetFullStringFromHiiFormPackages ( PackageOffset += PacakgeHeader.Length; } + + // + // No requested varstore in IFR data and directly return + // + if (VarStorageData->Size == 0) { + goto Done; + } // // 3. Construct Request Element (Block Name) for 2.1 and 2.2 case. @@ -2204,6 +2211,13 @@ HiiConfigRoutingExtractConfig ( if (EFI_ERROR (Status)) { goto Done; } + // + // Not any request block is found. + // + if (StrStr (ConfigRequest, L"&OFFSET=") == NULL) { + AccessResults = AllocateCopyPool (StrSize (ConfigRequest), ConfigRequest); + goto NextConfigString; + } } // @@ -2261,7 +2275,8 @@ HiiConfigRoutingExtractConfig ( FreePool (DefaultResults); DefaultResults = NULL; } - + +NextConfigString: if (!FirstElement) { Status = AppendToMultiString (Results, L"&"); ASSERT_EFI_ERROR (Status); @@ -2292,6 +2307,7 @@ HiiConfigRoutingExtractConfig ( Done: if (EFI_ERROR (Status)) { FreePool (*Results); + *Results = NULL; } if (ConfigRequest != NULL) { @@ -2783,7 +2799,7 @@ HiiBlockToConfig ( StringPtr++; } if (*StringPtr == 0) { - *Progress = StringPtr; + *Progress = StringPtr - 1; Status = EFI_INVALID_PARAMETER; goto Exit; } @@ -2792,7 +2808,7 @@ HiiBlockToConfig ( StringPtr++; } if (*StringPtr == 0) { - *Progress = StringPtr; + *Progress = StringPtr - 1; Status = EFI_INVALID_PARAMETER; goto Exit; } @@ -2947,7 +2963,10 @@ HiiBlockToConfig ( return EFI_SUCCESS; Exit: - FreePool (*Config); + if (*Config != NULL) { + FreePool (*Config); + *Config = NULL; + } if (ValueStr != NULL) { FreePool (ValueStr); } @@ -3401,7 +3420,7 @@ HiiGetAltCfg ( Status = EFI_NOT_FOUND; Exit: - + *AltCfgResp = NULL; if (!EFI_ERROR (Status) && (Result != NULL)) { // // Copy the and