aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2021-06-22 21:20:37 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2021-06-22 21:20:37 +0300
commitf12b3ee2debdcc7a673b6612fd16a5c8dcc0e786 (patch)
tree5b33a6c7ff4c2a0ad26186a288bb290ae850112c
parentd0cc477ee23e19be08a600d3b9d9a238dcb39f32 (diff)
downloadUEFI-Lessons-f12b3ee2debdcc7a673b6612fd16a5c8dcc0e786.tar.gz
UEFI-Lessons-f12b3ee2debdcc7a673b6612fd16a5c8dcc0e786.tar.bz2
UEFI-Lessons-f12b3ee2debdcc7a673b6612fd16a5c8dcc0e786.zip
Add some info about UefiShellCEntryLib.c
-rw-r--r--Lesson_13/README.md24
1 files changed, 23 insertions, 1 deletions
diff --git a/Lesson_13/README.md b/Lesson_13/README.md
index 5ba6fb3..0d42005 100644
--- a/Lesson_13/README.md
+++ b/Lesson_13/README.md
@@ -58,9 +58,31 @@ ShellAppMain (
IN CHAR16 **Argv
);
```
+You can look at the source code of `ShellAppMain` at the https://github.com/tianocore/edk2/blob/master/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c
+If you look at the source you could see that istead of a `HandleProtocol` API that we've used:
+```
+Status = gBS->HandleProtocol(
+ ImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID **) &ShellParameters
+);
+```
+it uses `OpenProtocol` API: (I've modified a code a little bit to make it comparable to our version)
+```
+Status = gBS->OpenProtocol(
+ ImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID **)&ShellParameters,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
+```
+According to the UEFI spec `HandleProtocol` API is outdated and `OpenProtocol` should be used instead.
+`OpenProtocol` API is a more general call that can cover more cases. It all would matter when you start develop UEFI drivers. You can read UEFI spec for more information. Right now just accept a fact that for the UEFI app these two calls are the same.
-To find the necessary `ShellCEntryLib` library class search as usual:
+Let's go back to our code. To find the necessary `ShellCEntryLib` library class search as usual:
```
$ grep ShellCEntryLib -r ./ --include=*.inf | grep LIBRARY_CLASS
./ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf: LIBRARY_CLASS = ShellCEntryLib|UEFI_APPLICATION UEFI_DRIVER