2 Provides application point extension for "C" style main funciton
4 Copyright (c) 2009, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Protocol/SimpleFileSystem.h>
18 #include <Protocol/EfiShellInterface.h>
19 #include <Protocol/EfiShellParameters.h>
21 #include <Library/ShellCEntryLib.h>
22 #include <Library/DebugLib.h>
25 UEFI entry point for an application that will in turn call the
26 ShellAppMain function which has parameters similar to a standard C
29 An application that uses UefiShellCEntryLib must have a ShellAppMain
30 function as prototyped in Include/Library/ShellCEntryLib.h.
32 @param ImageHandle The image handle of the UEFI Application.
33 @param SystemTable A pointer to the EFI System Table.
35 @retval EFI_SUCCESS The application exited normally.
36 @retval Other An error occurred.
42 IN EFI_HANDLE ImageHandle
,
43 IN EFI_SYSTEM_TABLE
*SystemTable
47 EFI_SHELL_PARAMETERS_PROTOCOL
*EfiShellParametersProtocol
;
48 EFI_SHELL_INTERFACE
*EfiShellInterface
;
52 EfiShellParametersProtocol
= NULL
;
53 EfiShellInterface
= NULL
;
55 Status
= SystemTable
->BootServices
->OpenProtocol(ImageHandle
,
56 &gEfiShellParametersProtocolGuid
,
57 (VOID
**)&EfiShellParametersProtocol
,
60 EFI_OPEN_PROTOCOL_GET_PROTOCOL
62 if (!EFI_ERROR(Status
)) {
64 // use shell 2.0 interface
66 ReturnFromMain
= ShellAppMain (
67 EfiShellParametersProtocol
->Argc
,
68 EfiShellParametersProtocol
->Argv
72 // try to get shell 1.0 interface instead.
74 Status
= SystemTable
->BootServices
->OpenProtocol(ImageHandle
,
75 &gEfiShellInterfaceGuid
,
76 (VOID
**)&EfiShellInterface
,
79 EFI_OPEN_PROTOCOL_GET_PROTOCOL
81 if (!EFI_ERROR(Status
)) {
83 // use shell 1.0 interface
85 ReturnFromMain
= ShellAppMain (
86 EfiShellInterface
->Argc
,
87 EfiShellInterface
->Argv
93 if (ReturnFromMain
== 0) {
96 return (EFI_UNSUPPORTED
);