1 | /** @file
|
---|
2 | Functionality specific for standalone UEFI application support.
|
---|
3 |
|
---|
4 | This application can provide detailed UEFI variable policy configuration
|
---|
5 | information in the UEFI shell.
|
---|
6 |
|
---|
7 | Copyright (c) Microsoft Corporation.
|
---|
8 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
9 |
|
---|
10 | **/
|
---|
11 |
|
---|
12 | #include "VariablePolicy.h"
|
---|
13 |
|
---|
14 | #include <Library/BaseLib.h>
|
---|
15 | #include <Library/HiiLib.h>
|
---|
16 |
|
---|
17 | extern EFI_HII_HANDLE mVarPolicyShellCommandHiiHandle;
|
---|
18 |
|
---|
19 | //
|
---|
20 | // String token ID of help message text.
|
---|
21 | // Shell supports finding the help message in the resource section of an
|
---|
22 | // application image if a .MAN file is not found. This global variable is added
|
---|
23 | // to make the build tool recognize that the help string is consumed by the user and
|
---|
24 | // then the build tool will add the string into the resource section. Thus the
|
---|
25 | // application can use '-?' option to show help message in Shell.
|
---|
26 | //
|
---|
27 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_VAR_POLICY);
|
---|
28 |
|
---|
29 | /**
|
---|
30 | Entry of the UEFI variable policy application.
|
---|
31 |
|
---|
32 | @param ImageHandle The image handle of the process.
|
---|
33 | @param SystemTable The EFI System Table pointer.
|
---|
34 |
|
---|
35 | @retval EFI_SUCCESS The application successfully initialized.
|
---|
36 | @retval EFI_ABORTED The application failed to initialize.
|
---|
37 | @retval Others A different error occurred.
|
---|
38 |
|
---|
39 | **/
|
---|
40 | EFI_STATUS
|
---|
41 | EFIAPI
|
---|
42 | VariablePolicyAppInitialize (
|
---|
43 | IN EFI_HANDLE ImageHandle,
|
---|
44 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
45 | )
|
---|
46 | {
|
---|
47 | EFI_STATUS Status;
|
---|
48 |
|
---|
49 | mVarPolicyShellCommandHiiHandle = InitializeHiiPackage (ImageHandle);
|
---|
50 | if (mVarPolicyShellCommandHiiHandle == NULL) {
|
---|
51 | return EFI_ABORTED;
|
---|
52 | }
|
---|
53 |
|
---|
54 | Status = (EFI_STATUS)RunVarPolicy (ImageHandle, SystemTable);
|
---|
55 |
|
---|
56 | HiiRemovePackages (mVarPolicyShellCommandHiiHandle);
|
---|
57 |
|
---|
58 | return Status;
|
---|
59 | }
|
---|