Hi Michael,

You should be able to use the Read function to retrieve the FileInfo for 
the files contained in the directory pointed to by the current 
EFI_FILE_PROTOCOL.

An example code snippet is below:


    EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *SimpleFs = NULL;
    EFI_FILE_PROTOCOL *RootFs = NULL;
    EFI_STATUS Status = EFI_INVALID_PARAMETER;
    EFI_FILE_INFO *FileInfo = NULL;
    UINTN FileInfoSize = 0;

    Status = SimpleFs->OpenVolume(SimpleFs, &RootFs);
    if(Fs != NULL)
    {
        do 
        {
            Status = RootFs->Read(RootFs, &FileInfoSize, FileInfo);
            // Quirk about the Read function, when you reach the end of 
the files in the current directory, it returns success
            //  without any fileinfo
            if(Status == EFI_SUCCESS)
                break;
            else if(Status == EFI_BUFFER_TOO_SMALL)
            {
                Status = gBS->AllocatePool(EfiBootServicesData, 
FileInfoSize, &FileInfo);
                if(!EFI_ERROR(Status))
                {
                    Status = RootFs->Read(RootFs, &FileInfoSize, 
FileInfo);



Best Regards,
Aaron



From:   Michael Zimmermann <[email protected]>
To:     [email protected], 
Date:   09/15/2015 10:10 AM
Subject:        [edk2]  Listing files in a directory
Sent by:        "edk2-devel" <[email protected]>



Hi,

this sound somewhat trivial but I can't find a way to list the files of a
directory.
the EFI_FILE_PROTOCOL just allows to open a (sub-) file/directory but not
to get a list of all child nodes.

Michael
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to