TianoCore EDK2 master
Loading...
Searching...
No Matches
VariablePolicyDynamicCommand.c
Go to the documentation of this file.
1
12#include "VariablePolicy.h"
13
14#include <Library/BaseLib.h>
15#include <Library/DebugLib.h>
16#include <Library/HiiLib.h>
17#include <Library/ShellLib.h>
20
22
23extern EFI_HII_HANDLE mVarPolicyShellCommandHiiHandle;
24
42EFIAPI
45 IN EFI_SYSTEM_TABLE *SystemTable,
46 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
48 )
49{
50 gEfiShellParametersProtocol = ShellParameters;
51 gEfiShellProtocol = Shell;
52
53 return RunVarPolicy (gImageHandle, SystemTable);
54}
55
70CHAR16 *
71EFIAPI
74 IN CONST CHAR8 *Language
75 )
76{
77 return HiiGetString (
78 mVarPolicyShellCommandHiiHandle,
79 STRING_TOKEN (STR_GET_HELP_VAR_POLICY),
80 Language
81 );
82}
83
84STATIC EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mVarPolicyDynamicCommand = {
85 VAR_POLICY_COMMAND_NAME,
88};
89
104EFIAPI
106 IN EFI_HANDLE ImageHandle,
107 IN EFI_SYSTEM_TABLE *SystemTable
108 )
109{
110 EFI_STATUS Status;
111
112 mVarPolicyShellCommandHiiHandle = InitializeHiiPackage (ImageHandle);
113 if (mVarPolicyShellCommandHiiHandle == NULL) {
114 return EFI_ABORTED;
115 }
116
117 Status = gBS->InstallProtocolInterface (
118 &ImageHandle,
119 &gEfiShellDynamicCommandProtocolGuid,
121 &mVarPolicyDynamicCommand
122 );
123 ASSERT_EFI_ERROR (Status);
124
125 return Status;
126}
127
138EFIAPI
140 IN EFI_HANDLE ImageHandle
141 )
142{
143 EFI_STATUS Status;
144
145 Status = gBS->UninstallProtocolInterface (
146 ImageHandle,
147 &gEfiShellDynamicCommandProtocolGuid,
148 &mVarPolicyDynamicCommand
149 );
150 if (EFI_ERROR (Status)) {
151 return Status;
152 }
153
154 HiiRemovePackages (mVarPolicyShellCommandHiiHandle);
155
156 return EFI_SUCCESS;
157}
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:211
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
STATIC EFI_HII_HANDLE InitializeHiiPackage(EFI_HANDLE ImageHandle)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
SHELL_STATUS
Definition: Shell.h:21
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
#define STRING_TOKEN(t)
VOID * EFI_HII_HANDLE
@ EFI_NATIVE_INTERFACE
Definition: UefiSpec.h:1193
SHELL_STATUS EFIAPI RunVarPolicy(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI VarPolicyCommandHandler(IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN EFI_SYSTEM_TABLE *SystemTable, IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN EFI_SHELL_PROTOCOL *Shell)
EFI_STATUS EFIAPI VariablePolicyDynamicCommandEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC CHAR16 *EFIAPI VarPolicyCommandGetHelp(IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN CONST CHAR8 *Language)
EFI_STATUS EFIAPI VariablePolicyDynamicCommandUnload(IN EFI_HANDLE ImageHandle)
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL protocol structure.