Re: Examples opening and reading/writing a file with EDK2

Gao, Zhichao

Hi Alejadro,

I am trying to answer your questions. If anything missed, please feel free to let me know.

1. First I think CapsuleApp is a good example to consume the file protocol.
2. File handle like the standard C's file pointer, it has multi required protocol install on it, such as device path protocol, simple file protocol and so on.
We can do some operation on the file thru the file handle.
3. We can use DevicePathFromHandle to get the file's path from the file handle. And use ConvertDevicePathToText to convert the path to text mode to view.

All the above can be found in the CapsuleApp.


-----Original Message-----
From: [] On Behalf Of
Sent: Friday, November 22, 2019 9:54 AM
Subject: [edk2-discuss] Examples opening and reading/writing a file with EDK2

Hi, I'm making a little UEFI app, just for check basic functionality of the firmware.
inside this app I want to load, read and write a file, binary or text. However I
can't find a "complete explanation" or examples about the use of the
procedures (EFI_FILE_PROTOCOL.Open(), EFI_FILE_PROTOCOL.Read()) from the
UEFI API (steps, what to check). The only thing I found was some little Uefi Shell
apps doing this using the shell API. However I would like to do it using the "bare
firmware" instead of loading the shell. For me, the most confusing part, is when
the program has to check the handle database to find the particular handle of
the file that is being opened. Also I have some doubts about how to check,
without the shell, what volume or partition would have the exact file I'm looking
for (i.e. what if 2 volumes have simmilar, or even identical root directories).

Thanks in advance

Join to automatically receive all group messages.