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>
33 IN EFI_HANDLE ImageHandle
,
34 IN EFI_SYSTEM_TABLE
*SystemTable
37 EFI_SHELL_PARAMETERS_PROTOCOL
*EfiShellParametersProtocol
;
38 EFI_SHELL_INTERFACE
*EfiShellInterface
;
42 EfiShellParametersProtocol
= NULL
;
43 EfiShellInterface
= NULL
;
45 Status
= SystemTable
->BootServices
->OpenProtocol(ImageHandle
,
46 &gEfiShellParametersProtocolGuid
,
47 (VOID
**)&EfiShellParametersProtocol
,
50 EFI_OPEN_PROTOCOL_GET_PROTOCOL
52 if (!EFI_ERROR(Status
)) {
54 // use shell 2.0 interface
56 ReturnFromMain
= main(EfiShellInterface
->Argc
, EfiShellInterface
->Argv
);
59 // try to get shell 1.0 interface instead.
61 Status
= SystemTable
->BootServices
->OpenProtocol(ImageHandle
,
62 &gEfiShellInterfaceGuid
,
63 (VOID
**)&EfiShellInterface
,
66 EFI_OPEN_PROTOCOL_GET_PROTOCOL
68 if (!EFI_ERROR(Status
)) {
70 // use shell 1.0 interface
72 ReturnFromMain
= main(EfiShellParametersProtocol
->Argc
, EfiShellParametersProtocol
->Argv
);
77 if (ReturnFromMain
== 0) {
80 return (EFI_UNSUPPORTED
);