TianoCore EDK2 master
Loading...
Searching...
No Matches
UefiShellCEntryLib.c
Go to the documentation of this file.
1
9#include <Base.h>
10
15
17#include <Library/DebugLib.h>
18
39EFIAPI
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}
INT64 INTN
INTN EFIAPI ShellAppMain(IN UINTN Argc, IN CHAR16 **Argv)
#define NULL
Definition: Base.h:319
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_STATUS EFIAPI ShellCEntryLib(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)