From 33d41385e32425a25da13bdfbfb81f30f226ec18 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Mon, 23 May 2011 14:13:08 +0000 Subject: [PATCH] Fixed SCT test failed caused by driver sample. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11693 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/DriverSampleDxe/DriverSample.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 618aa92dc9..83e669b9da 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -444,7 +444,10 @@ CreateAltCfgString ( EFI_STRING TmpStr; UINTN NewLen; - NewLen = (((1 + StrLen (ConfigHdr) + 8 + 4) + (8 + 4 + 7 + 4 + 7 + 4)) * 2 + StrLen (Result)) * sizeof (CHAR16); + // + // String Len = ConfigResp + AltConfig + AltConfig + 1("\0") + // + NewLen = (StrLen (Result) + ((1 + StrLen (ConfigHdr) + 8 + 4) + (8 + 4 + 7 + 4 + 7 + 4)) * 2 + 1) * sizeof (CHAR16); StringPtr = AllocateZeroPool (NewLen); if (StringPtr == NULL) { return NULL; @@ -599,8 +602,8 @@ AppendAltCfgString ( } if (Offset <= ValueOffset && Offset + Width >= ValueOffset + ValueWidth) { - *RequestResult = CreateAltCfgString(*RequestResult, ConfigRequestHdr, Offset, Width); - return; + *RequestResult = CreateAltCfgString(*RequestResult, ConfigRequestHdr, ValueOffset, ValueWidth); + return; } } } @@ -829,8 +832,10 @@ ExtractConfig ( Results, Progress ); - ConfigRequestHdr = HiiConstructConfigHdr (&mFormSetGuid, VariableName, PrivateData->DriverHandle[0]); - AppendAltCfgString(Results, ConfigRequestHdr); + if (!EFI_ERROR (Status)) { + ConfigRequestHdr = HiiConstructConfigHdr (&mFormSetGuid, VariableName, PrivateData->DriverHandle[0]); + AppendAltCfgString(Results, ConfigRequestHdr); + } } //