From: <Jim.Dailey@dell.com>
To: <jaben.carsey@intel.com>, <ruiyu.ni@intel.com>
Cc: <edk2-devel@lists.01.org>
Subject: UEFI Shell Lib Constructor and Shell Parameters Protocol
Date: Wed, 5 Apr 2017 14:07:26 +0000 [thread overview]
Message-ID: <f9ed04ffccee42968ee7caabb09d5c0a@ausx13mps335.AMER.DELL.COM> (raw)
A question or two for all shell experts:
In the UEFI Shell Lib constructor code, if the Shell protocol cannot
be opened, then an attempt is made to locate it before "giving up".
However, if the Shell parameters protocol cannot be opened, no attempt
is made to locate it---the code simply leaves the parameters protocol
pointer set to NULL. Can anyone explain why this is?
I came across an app that crashes because of this behavior, but if I
add code to try and locate the parameters protocol, then the app works
as designed WRT accessing command line parameters. Is there some
lurking issue if an attempt to locate the parameters protocol is made
and is successful?
Thanks,
Jim
-------
Here is the relevant code:
EFI_STATUS
ShellLibConstructorWorker (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
//
// UEFI 2.0 shell interfaces (used preferentially)
//
Status = gBS->OpenProtocol(
ImageHandle,
&gEfiShellProtocolGuid,
(VOID **)&gEfiShellProtocol,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
//
// Search for the shell protocol
//
Status = gBS->LocateProtocol(
&gEfiShellProtocolGuid,
NULL,
(VOID **)&gEfiShellProtocol
);
if (EFI_ERROR(Status)) {
gEfiShellProtocol = NULL;
}
}
Status = gBS->OpenProtocol(
ImageHandle,
&gEfiShellParametersProtocolGuid,
(VOID **)&gEfiShellParametersProtocol,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
#if 1 // _Dell_ : Search for the parameters protocol too!
//
// Search for the shell parameters protocol
//
Status = gBS->LocateProtocol(
&gEfiShellParametersProtocolGuid,
NULL,
(VOID **)&gEfiShellParametersProtocol
);
if (EFI_ERROR(Status)) {
gEfiShellParametersProtocol = NULL;
}
#else
gEfiShellParametersProtocol = NULL;
#endif
}
...
next reply other threads:[~2017-04-05 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 14:07 Jim.Dailey [this message]
2017-04-05 15:08 ` UEFI Shell Lib Constructor and Shell Parameters Protocol Carsey, Jaben
2017-04-05 15:21 ` Jim.Dailey
2017-04-05 16:08 ` Carsey, Jaben
2017-04-05 16:39 ` Tim Lewis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f9ed04ffccee42968ee7caabb09d5c0a@ausx13mps335.AMER.DELL.COM \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox