2 Provides application point extension for "C" style main funciton
4 Copyright (c) 2009, Intel Corporation
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/DebugLib.h>
31 UEFI entry point for an application that will in turn call a C
32 style ShellAppMain function.
34 This application must have a function defined as follows:
46 IN EFI_HANDLE ImageHandle
,
47 IN EFI_SYSTEM_TABLE
*SystemTable
51 EFI_SHELL_PARAMETERS_PROTOCOL
*EfiShellParametersProtocol
;
52 EFI_SHELL_INTERFACE
*EfiShellInterface
;
56 EfiShellParametersProtocol
= NULL
;
57 EfiShellInterface
= NULL
;
59 Status
= SystemTable
->BootServices
->OpenProtocol(ImageHandle
,
60 &gEfiShellParametersProtocolGuid
,
61 (VOID
**)&EfiShellParametersProtocol
,
64 EFI_OPEN_PROTOCOL_GET_PROTOCOL
66 if (!EFI_ERROR(Status
)) {
68 // use shell 2.0 interface
70 ReturnFromMain
= ShellAppMain (
71 EfiShellInterface
->Argc
,
72 EfiShellInterface
->Argv
76 // try to get shell 1.0 interface instead.
78 Status
= SystemTable
->BootServices
->OpenProtocol(ImageHandle
,
79 &gEfiShellInterfaceGuid
,
80 (VOID
**)&EfiShellInterface
,
83 EFI_OPEN_PROTOCOL_GET_PROTOCOL
85 if (!EFI_ERROR(Status
)) {
87 // use shell 1.0 interface
89 ReturnFromMain
= ShellAppMain (
90 EfiShellParametersProtocol
->Argc
,
91 EfiShellParametersProtocol
->Argv
97 if (ReturnFromMain
== 0) {
100 return (EFI_UNSUPPORTED
);