TianoCore EDK2
master
Loading...
Searching...
No Matches
UefiShellCEntryLib.c
Go to the documentation of this file.
1
9
#include <Base.h>
10
11
#include <
Protocol/SimpleFileSystem.h
>
12
#include <
Protocol/LoadedImage.h
>
13
#include <
Protocol/EfiShellInterface.h
>
14
#include <
Protocol/ShellParameters.h
>
15
16
#include <
Library/ShellCEntryLib.h
>
17
#include <
Library/DebugLib.h
>
18
38
EFI_STATUS
39
EFIAPI
40
ShellCEntryLib
(
41
IN
EFI_HANDLE
ImageHandle,
42
IN
EFI_SYSTEM_TABLE
*SystemTable
43
)
44
{
45
INTN
ReturnFromMain;
46
EFI_SHELL_PARAMETERS_PROTOCOL
*EfiShellParametersProtocol;
47
EFI_SHELL_INTERFACE
*EfiShellInterface;
48
EFI_STATUS
Status;
49
50
ReturnFromMain = -1;
51
EfiShellParametersProtocol =
NULL
;
52
EfiShellInterface =
NULL
;
53
54
Status = SystemTable->BootServices->OpenProtocol (
55
ImageHandle,
56
&gEfiShellParametersProtocolGuid,
57
(VOID **)&EfiShellParametersProtocol,
58
ImageHandle,
59
NULL
,
60
EFI_OPEN_PROTOCOL_GET_PROTOCOL
61
);
62
if
(!EFI_ERROR (Status)) {
63
//
64
// use shell 2.0 interface
65
//
66
ReturnFromMain =
ShellAppMain
(
67
EfiShellParametersProtocol->
Argc
,
68
EfiShellParametersProtocol->
Argv
69
);
70
}
else
{
71
//
72
// try to get shell 1.0 interface instead.
73
//
74
Status = SystemTable->BootServices->OpenProtocol (
75
ImageHandle,
76
&gEfiShellInterfaceGuid,
77
(VOID **)&EfiShellInterface,
78
ImageHandle,
79
NULL
,
80
EFI_OPEN_PROTOCOL_GET_PROTOCOL
81
);
82
if
(!EFI_ERROR (Status)) {
83
//
84
// use shell 1.0 interface
85
//
86
ReturnFromMain =
ShellAppMain
(
87
EfiShellInterface->Argc,
88
EfiShellInterface->Argv
89
);
90
}
else
{
91
ASSERT (
FALSE
);
92
}
93
}
94
95
return
ReturnFromMain;
96
}
INTN
INT64 INTN
Definition:
ProcessorBind.h:118
EfiShellInterface.h
ShellAppMain
INTN EFIAPI ShellAppMain(IN UINTN Argc, IN CHAR16 **Argv)
Definition:
EnrollDefaultKeys.c:602
LoadedImage.h
NULL
#define NULL
Definition:
Base.h:319
FALSE
#define FALSE
Definition:
Base.h:307
IN
#define IN
Definition:
Base.h:279
DebugLib.h
ShellCEntryLib.h
ShellParameters.h
SimpleFileSystem.h
EFI_STATUS
RETURN_STATUS EFI_STATUS
Definition:
UefiBaseType.h:29
EFI_HANDLE
VOID * EFI_HANDLE
Definition:
UefiBaseType.h:33
ShellCEntryLib
EFI_STATUS EFIAPI ShellCEntryLib(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition:
UefiShellCEntryLib.c:40
_EFI_SHELL_PARAMETERS_PROTOCOL
Definition:
ShellParameters.h:19
_EFI_SHELL_PARAMETERS_PROTOCOL::Argv
CHAR16 ** Argv
Definition:
ShellParameters.h:26
_EFI_SHELL_PARAMETERS_PROTOCOL::Argc
UINTN Argc
Definition:
ShellParameters.h:31
EFI_SHELL_INTERFACE
Definition:
EfiShellInterface.h:49
EFI_SYSTEM_TABLE
Definition:
UefiSpec.h:2028
ShellPkg
Library
UefiShellCEntryLib
UefiShellCEntryLib.c
Generated on Fri Nov 15 2024 18:01:24 for TianoCore EDK2 by
1.9.6