*BootVariable = mGetVariable(Name, &gEfiGlobalVariableGuid, &BootVariableSize, NULL);Ptr = (BootVariable+3); Print(L" %s",(CHAR16 *)(Ptr)); DevicePath =AllocateZeroPool (*FilePathListLength) ; Ptr+= StrSize((CHAR16 *)Ptr); CopyMem (DevicePath, Ptr, *FilePathListLength);* As Carsey suggested i used the same Math in order to get DevicePath but in my case it is not working
As documentation this data structure is not aligned so i am assuming that just after description there should be FilePathList ,so if i CopyMem * (**FilePathListLength) bytes to DevicePath i should get the right value but i am getting garbage. On Thu, Oct 20, 2016 at 1:41 AM, Carsey, Jaben <[email protected]> wrote: > Have you examined the BCFG command in the UEFI Shell? > > It does this exact behavior and the code is at: ShellPkg\Library\ > UefiBcfgCommandLib\bcfg.c. > > -Jaben > > > -----Original Message----- > > From: edk2-devel [mailto:[email protected]] On Behalf Of > > Saqib Khan > > Sent: Wednesday, October 19, 2016 11:18 AM > > To: Andrew Fish <[email protected]> > > Cc: [email protected]; Laszlo Ersek <[email protected]> > > Subject: Re: [edk2] How to get BBS_BBS_DEVICE_PATH from BOOTXXXX > > variable > > > > Hi, so i have parsed the structure as follow : > > > > > > > > > > > > > > > > *BootVariable = mGetVariable(Name, &gEfiGlobalVariableGuid, > > &BootVariableSize, NULL);LDAttr = BootVariable[0];FilePathListLength = > > (BootVariable+2);Ptr = (BootVariable+3); // for description * > > > > > > > > *for FilePathList[] Ptr+= StrSize((CHAR16 *)Ptr); CopyMem (Ptr, > > DevicePath, *FilePathListLength);* > > > > > > I am able to get LDAttr ,FilePathListLength and description but > > > > when i try to check DevicePath->Type it always return 0x01( Hardware > Device > > Path) for each device . > > > > > > I have hard drive with legacy OS(BBS_DEVICE_PATH). So it should not > always > > return 0x01 .What i am doing wrong in parsing ? > > > > Thanks > > > > On Tue, Oct 18, 2016 at 11:37 PM, Andrew Fish <[email protected]> wrote: > > > > > > > > > On Oct 18, 2016, at 10:40 AM, Laszlo Ersek <[email protected]> > wrote: > > > > > > > > On 10/18/16 19:18, Saqib Khan wrote: > > > >> Hi, > > > >> I can not find structure of BOOTXXXX variable, Can any one help how > to > > > >> extract device path from BOOTXXXX variable. > > > > > > > > In UEFI-related questions, the UEFI specification has a fair chance > to > > > > provide useful information. > > > > > > > > Please refer to "3.1.3 Load Options" in the UEFI v2.6 spec, available > > > > for download from <http://www.uefi.org/specifications>. > > > > > > > > Locating the matching structure definition in the edk2 tree is left > as > > > > an exercise to the reader ;) > > > > > > > > > > Chapter 3 Boot Manager. > > > > > > The structure is EFI_LOAD_OPTION but some of the fields are variable > > > length so you have to do math to figure stuff out. > > > > > > Thanks, > > > > > > Andrew Fish > > > > > > > > > > Laszlo > > > > > > > > _______________________________________________ > > > > edk2-devel mailing list > > > > [email protected] > > > > https://lists.01.org/mailman/listinfo/edk2-devel > > > > > > > > > > > > -- > > Regards > > Saqib Ahmed Khanzada > > _______________________________________________ > > edk2-devel mailing list > > [email protected] > > https://lists.01.org/mailman/listinfo/edk2-devel > -- Regards Saqib Ahmed Khanzada _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

