本文整理汇总了C++中ShellInitialize函数的典型用法代码示例。如果您正苦于以下问题:C++ ShellInitialize函数的具体用法?C++ ShellInitialize怎么用?C++ ShellInitialize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShellInitialize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShellAppMain
INTN
EFIAPI
ShellAppMain (
IN UINTN Argc,
IN CHAR16 **Argv
)
{
EFI_STATUS Status;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize ( );
if ( !EFI_ERROR ( Status )) {
//
// Run the application
//
Status = GpioEg20tMain ( Argc, Argv );
}
//
// Return the command status
//
return (INTN)Status;
}
示例2: Image
/**
Function for 'stall' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunStall (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
UINT64 Intermediate;
ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Status = ShellConvertStringToUint64(ShellCommandLineGetRawValue(Package, 1), &Intermediate, FALSE, FALSE);
if (EFI_ERROR(Status) || ((UINT64)(UINTN)(Intermediate)) != Intermediate) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel1HiiHandle, ShellCommandLineGetRawValue(Package, 1));
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Status = gBS->Stall((UINTN)Intermediate);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_STALL_FAILED), gShellLevel1HiiHandle, Status);
ShellStatus = SHELL_DEVICE_ERROR;
}
}
}
ShellCommandLineFreeVarList (Package);
}
return (ShellStatus);
}
示例3: ShellDynCmdDumpFdtHandler
/**
This is the shell command "dumpfdt" handler function. This function handles
the command when it is invoked in the shell.
@param[in] This The instance of the
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
@param[in] SystemTable The pointer to the UEFI system table.
@param[in] ShellParameters The parameters associated with the command.
@param[in] Shell The instance of the shell protocol used in the
context of processing this command.
@return SHELL_SUCCESS The operation was successful.
@return SHELL_ABORTED Operation aborted due to internal error.
@return SHELL_NOT_FOUND Failed to locate the Device Tree into the EFI Configuration Table
@return SHELL_OUT_OF_RESOURCES A memory allocation failed.
**/
SHELL_STATUS
EFIAPI
ShellDynCmdDumpFdtHandler (
IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
IN EFI_SHELL_PROTOCOL *Shell
)
{
SHELL_STATUS ShellStatus;
EFI_STATUS Status;
VOID *FdtBlob;
ShellStatus = SHELL_SUCCESS;
//
// Install the Shell and Shell Parameters Protocols on the driver
// image. This is necessary for the initialisation of the Shell
// Library to succeed in the next step.
//
Status = gBS->InstallMultipleProtocolInterfaces (
&gImageHandle,
&gEfiShellProtocolGuid, Shell,
&gEfiShellParametersProtocolGuid, ShellParameters,
NULL
);
if (EFI_ERROR (Status)) {
return SHELL_ABORTED;
}
//
// Initialise the Shell Library as we are going to use it.
// Assert that the return code is EFI_SUCCESS as it should.
// To anticipate any change is the codes returned by
// ShellInitialize(), leave in case of error.
//
Status = ShellInitialize ();
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return SHELL_ABORTED;
}
Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, &FdtBlob);
if (EFI_ERROR (Status)) {
Print (L"ERROR: Did not find the Fdt Blob.\n");
return EfiCodeToShellCode (Status);
}
DumpFdt (FdtBlob);
gBS->UninstallMultipleProtocolInterfaces (
gImageHandle,
&gEfiShellProtocolGuid, Shell,
&gEfiShellParametersProtocolGuid, ShellParameters,
NULL
);
return ShellStatus;
}
示例4: Image
/**
Function for 'reconnect' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunReconnect (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
SHELL_STATUS ShellStatus;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
EFI_STATUS Status;
gInReconnect = TRUE;
ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, "reconnect", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable);
if (ShellStatus == SHELL_SUCCESS) {
if (ShellCommandLineGetFlag(Package, L"-r")) {
ConnectAllConsoles();
}
ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable);
}
}
gInReconnect = FALSE;
return (ShellStatus);
}
示例5: Image
/**
Function for 'mv' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunMv (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
CHAR16 *Cwd;
UINTN CwdSize;
SHELL_STATUS ShellStatus;
UINTN ParamCount;
UINTN LoopCounter;
EFI_SHELL_FILE_INFO *FileList;
VOID *Response;
ProblemParam = NULL;
ShellStatus = SHELL_SUCCESS;
ParamCount = 0;
FileList = NULL;
Response = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mv", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
//
// check for "-?"
//
if (ShellCommandLineGetFlag(Package, L"-?")) {
ASSERT(FALSE);
}
switch (ParamCount = ShellCommandLineGetCount(Package)) {
case 0:
case 1:
//
// we have insufficient parameters
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mv");
ShellStatus = SHELL_INVALID_PARAMETER;
break;
case 2:
//
// must have valid CWD for single parameter...
//
if (ShellGetCurrentDir(NULL) == NULL){
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"mv");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, 1));
ShellStatus = SHELL_NOT_FOUND;
} else {
//
// ValidateAndMoveFiles will report errors to the screen itself
//
CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);
Cwd = AllocateZeroPool(CwdSize);
ASSERT (Cwd != NULL);
StrCpyS(Cwd, CwdSize/sizeof(CHAR16), ShellGetCurrentDir(NULL));
StrCatS(Cwd, CwdSize/sizeof(CHAR16), L"\\");
ShellStatus = ValidateAndMoveFiles(FileList, &Response, Cwd);
FreePool(Cwd);
}
}
break;
default:
///@todo make sure this works with error half way through and continues...
for (ParamCount--, LoopCounter = 1 ; LoopCounter < ParamCount ; LoopCounter++) {
if (ShellGetExecutionBreakFlag()) {
break;
}
Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) {
//.........这里部分代码省略.........
示例6: Image
/**
Function for 'for' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunFor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
SHELL_STATUS ShellStatus;
SCRIPT_FILE *CurrentScriptFile;
CHAR16 *ArgSet;
CHAR16 *ArgSetWalker;
UINTN ArgSize;
UINTN LoopVar;
SHELL_FOR_INFO *Info;
CHAR16 *TempString;
CHAR16 *TempSpot;
BOOLEAN FirstPass;
EFI_SHELL_FILE_INFO *Node;
EFI_SHELL_FILE_INFO *FileList;
UINTN NewSize;
ArgSet = NULL;
ArgSize = 0;
ShellStatus = SHELL_SUCCESS;
ArgSetWalker = NULL;
TempString = NULL;
FirstPass = FALSE;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
if (!gEfiShellProtocol->BatchIsActive()) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"For");
return (SHELL_UNSUPPORTED);
}
if (gEfiShellParametersProtocol->Argc < 4) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle);
return (SHELL_INVALID_PARAMETER);
}
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
ASSERT(CurrentScriptFile != NULL);
if (CurrentScriptFile->CurrentCommand->Data == NULL) {
FirstPass = TRUE;
//
// Make sure that an End exists.
//
if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
ShellPrintHiiEx(
-1,
-1,
NULL,
STRING_TOKEN (STR_SYNTAX_NO_MATCHING),
gShellLevel1HiiHandle,
L"EndFor",
L"For",
CurrentScriptFile->CurrentCommand!=NULL
?CurrentScriptFile->CurrentCommand->Line:0);
return (SHELL_DEVICE_ERROR);
}
//
// Process the line.
//
if (gEfiShellParametersProtocol->Argv[1][0] != L'%' || gEfiShellParametersProtocol->Argv[1][2] != CHAR_NULL
||!((gEfiShellParametersProtocol->Argv[1][1] >= L'a' && gEfiShellParametersProtocol->Argv[1][1] <= L'z')
||(gEfiShellParametersProtocol->Argv[1][1] >= L'A' && gEfiShellParametersProtocol->Argv[1][1] <= L'Z'))
) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_VAR), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[1]);
return (SHELL_INVALID_PARAMETER);
}
if (gUnicodeCollation->StriColl(
gUnicodeCollation,
L"in",
gEfiShellParametersProtocol->Argv[2]) == 0) {
for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
if (StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"*") != NULL
||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"?") != NULL
||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"[") != NULL
||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"]") != NULL) {
FileList = NULL;
Status = ShellOpenFileMetaArg ((CHAR16*)gEfiShellParametersProtocol->Argv[LoopVar], EFI_FILE_MODE_READ, &FileList);
//.........这里部分代码省略.........
示例7: Image
/**
Function for 'timezone' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunTimeZone (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
//
// non interactive
//
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
UINT8 LoopVar;
EFI_TIME TheTime;
BOOLEAN Found;
UINTN TzMinutes;
ShellStatus = SHELL_SUCCESS;
ProblemParam = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
if (PcdGet8(PcdShellSupportLevel) == 2) {
Status = ShellCommandLineParse (TimeZoneParamList2, &Package, &ProblemParam, TRUE);
} else {
ASSERT(PcdGet8(PcdShellSupportLevel) == 3);
Status = ShellCommandLineParseEx (TimeZoneParamList3, &Package, &ProblemParam, TRUE, TRUE);
}
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
//
// check for "-?"
//
if (ShellCommandLineGetCount(Package) > 1) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetFlag(Package, L"-?")) {
ASSERT(FALSE);
} else if (ShellCommandLineGetFlag(Package, L"-s")) {
if ((ShellCommandLineGetFlag(Package, L"-l")) || (ShellCommandLineGetFlag(Package, L"-f"))) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"-l or -f");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(PcdGet8(PcdShellSupportLevel) == 3);
if (ShellCommandLineGetValue(Package, L"-s") == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"-s");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Set the time zone
//
ShellStatus = CheckAndSetTimeZone(ShellCommandLineGetValue(Package, L"-s"));
if (ShellStatus != SHELL_SUCCESS) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ShellCommandLineGetValue(Package, L"-s"));
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
}
} else if (ShellCommandLineGetFlag(Package, L"-l")) {
//
// Print a list of all time zones
//
for ( LoopVar = 0
; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0])
; LoopVar++
){
ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle);
}
} else {
//
// Get Current Time Zone Info
//
Status = gRT->GetTime(&TheTime, NULL);
ASSERT_EFI_ERROR(Status);
if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
Found = FALSE;
for ( LoopVar = 0
//.........这里部分代码省略.........
示例8: Image
/**
Function for 'ls' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunLs (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
CONST CHAR16 *Attribs;
SHELL_STATUS ShellStatus;
UINT64 RequiredAttributes;
CONST CHAR16 *PathName;
CONST CHAR16 *CurDir;
UINTN Count;
CHAR16 *FullPath;
UINTN Size;
EFI_TIME TheTime;
CHAR16 *SearchString;
Size = 0;
FullPath = NULL;
ProblemParam = NULL;
Attribs = NULL;
ShellStatus = SHELL_SUCCESS;
RequiredAttributes = 0;
PathName = NULL;
SearchString = NULL;
CurDir = NULL;
Count = 0;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
//
// Fix local copies of the protocol pointers
//
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (LsParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"ls", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
//
// check for "-?"
//
if (ShellCommandLineGetFlag(Package, L"-?")) {
ASSERT(FALSE);
}
if (ShellCommandLineGetCount(Package) > 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"ls");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// check for -a
//
if (ShellCommandLineGetFlag(Package, L"-a")) {
for ( Attribs = ShellCommandLineGetValue(Package, L"-a")
; Attribs != NULL && *Attribs != CHAR_NULL && ShellStatus == SHELL_SUCCESS
; Attribs++
){
switch (*Attribs) {
case L'a':
case L'A':
RequiredAttributes |= EFI_FILE_ARCHIVE;
Count++;
continue;
case L's':
case L'S':
RequiredAttributes |= EFI_FILE_SYSTEM;
Count++;
continue;
case L'h':
case L'H':
RequiredAttributes |= EFI_FILE_HIDDEN;
Count++;
continue;
case L'r':
case L'R':
//.........这里部分代码省略.........
示例9: Image
/**
Function for 'mode' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunMode (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
UINTN NewCol;
UINTN NewRow;
UINTN Col;
UINTN Row;
CONST CHAR16 *Temp;
BOOLEAN Done;
INT32 LoopVar;
ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
if (ShellCommandLineGetCount(Package) > 3) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetCount(Package) == 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetCount(Package) == 3) {
Temp = ShellCommandLineGetRawValue(Package, 1);
if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
}
NewCol = ShellStrToUintn(Temp);
Temp = ShellCommandLineGetRawValue(Package, 2);
if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
}
NewRow = ShellStrToUintn(Temp);
for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) {
Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row);
if (EFI_ERROR(Status)) {
continue;
}
if (Col == NewCol && Row == NewRow) {
Status = gST->ConOut->SetMode(gST->ConOut, LoopVar);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, Status);
ShellStatus = SHELL_DEVICE_ERROR;
} else {
// worked fine...
Done = TRUE;
}
break;
}
}
if (!Done) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else if (ShellCommandLineGetCount(Package) == 1) {
//
// print out valid
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_HEAD), gShellDebug1HiiHandle);
for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) {
Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row);
//.........这里部分代码省略.........
示例10: Image
/**
Function for 'hexedit' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunHexEdit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
CHAR16 *Buffer;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
LIST_ENTRY *Package;
CHAR16 *NewName;
CONST CHAR16 *Name;
UINTN Offset;
UINTN Size;
EDIT_FILE_TYPE WhatToDo;
Buffer = NULL;
ShellStatus = SHELL_SUCCESS;
NewName = NULL;
Buffer = NULL;
Name = NULL;
Offset = 0;
Size = 0;
WhatToDo = FileTypeNone;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
// ASSERT_EFI_ERROR(Status);
Status = CommandInit();
// ASSERT_EFI_ERROR(Status);
if (EFI_ERROR(Status)) {
return SHELL_UNSUPPORTED;
}
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"hexedit", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} /* else {
ASSERT(FALSE);
} */
} else {
//
// Check for -d
//
if (ShellCommandLineGetFlag(Package, L"-d")){
if (ShellCommandLineGetCount(Package) < 4) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetCount(Package) > 4) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
WhatToDo = FileTypeDiskBuffer;
Name = ShellCommandLineGetRawValue(Package, 1);
Offset = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2));
Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 3));
}
if (Offset == (UINTN)-1 || Size == (UINTN)-1) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"hexedit", L"-d");
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
//
// check for -f
//
if (ShellCommandLineGetFlag(Package, L"-f") && (WhatToDo == FileTypeNone)){
if (ShellCommandLineGetCount(Package) < 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetCount(Package) > 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Name = ShellCommandLineGetRawValue(Package, 1);
if (Name == NULL || !IsValidFileName(Name)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
WhatToDo = FileTypeFileBuffer;
}
}
//.........这里部分代码省略.........
示例11: Image
/**
Function for 'devices' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunDevices (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
CHAR8 *Language;
EFI_HANDLE *HandleList;
EFI_HANDLE *HandleListWalker;
CHAR16 Type;
BOOLEAN Cfg;
BOOLEAN Diag;
UINTN Parents;
UINTN Devices;
UINTN Children;
CHAR16 *Name;
CONST CHAR16 *Lang;
BOOLEAN SfoFlag;
ShellStatus = SHELL_SUCCESS;
Language = NULL;
SfoFlag = FALSE;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
// ASSERT_EFI_ERROR(Status);
Status = CommandInit();
// ASSERT_EFI_ERROR(Status);
if (EFI_ERROR(Status)) {
return SHELL_UNSUPPORTED;
}
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devices", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} /* else {
ASSERT(FALSE);
} */
} else {
//
// if more than 0 'value' parameters we have too many parameters
//
if (ShellCommandLineGetRawValue(Package, 1) != NULL){
//
// error for too many parameters
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devices");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// get the language if necessary
//
Lang = ShellCommandLineGetValue(Package, L"-l");
if (Lang != NULL) {
Language = AllocateZeroPool(StrSize(Lang));
AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
} else if (!ShellCommandLineGetFlag(Package, L"-l")){
ASSERT(Language == NULL);
// Language = AllocateZeroPool(10);
// AsciiSPrint(Language, 10, "en-us");
} else {
ASSERT(Language == NULL);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devices", L"-l");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
//
// Print Header
//
if (ShellCommandLineGetFlag (Package, L"-sfo")) {
ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDriver1HiiHandle, L"devices");
SfoFlag = TRUE;
} else {
ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle);
}
//.........这里部分代码省略.........
示例12: Image
/**
Function for 'memmap' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunMemMap (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
UINTN Size;
EFI_MEMORY_DESCRIPTOR *Buffer;
UINTN MapKey;
UINTN ItemSize;
UINT32 Version;
UINT8 *Walker;
UINT64 ReservedPages;
UINT64 LoadCodePages;
UINT64 LoadDataPages;
UINT64 BSCodePages;
UINT64 BSDataPages;
UINT64 RTDataPages;
UINT64 RTCodePages;
UINT64 AvailPages;
UINT64 TotalPages;
UINT64 ReservedPagesSize;
UINT64 LoadCodePagesSize;
UINT64 LoadDataPagesSize;
UINT64 BSCodePagesSize;
UINT64 BSDataPagesSize;
UINT64 RTDataPagesSize;
UINT64 RTCodePagesSize;
UINT64 AvailPagesSize;
UINT64 TotalPagesSize;
UINT64 AcpiReclaimPages;
UINT64 AcpiNvsPages;
UINT64 MmioSpacePages;
UINT64 AcpiReclaimPagesSize;
UINT64 AcpiNvsPagesSize;
UINT64 MmioSpacePagesSize;
UINT64 MmioPortPages;
UINT64 MmioPortPagesSize;
UINT64 UnusableMemoryPages;
UINT64 UnusableMemoryPagesSize;
UINT64 PalCodePages;
UINT64 PalCodePagesSize;
BOOLEAN Sfo;
AcpiReclaimPages = 0;
AcpiNvsPages = 0;
MmioSpacePages = 0;
TotalPages = 0;
ReservedPages = 0;
LoadCodePages = 0;
LoadDataPages = 0;
BSCodePages = 0;
BSDataPages = 0;
RTDataPages = 0;
RTCodePages = 0;
AvailPages = 0;
MmioPortPages = 0;
UnusableMemoryPages = 0;
PalCodePages = 0;
Size = 0;
Buffer = NULL;
ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
if (ShellCommandLineGetCount(Package) > 1) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
//.........这里部分代码省略.........
示例13: Image
/**
Function for 'goto' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunGoto (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
CHAR16 *CompareString;
UINTN Size;
SCRIPT_FILE *CurrentScriptFile;
ShellStatus = SHELL_SUCCESS;
CompareString = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
if (!gEfiShellProtocol->BatchIsActive()) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Goto");
return (SHELL_UNSUPPORTED);
}
//
// parse the command line
//
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"goto", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"goto");
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"goto");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Size = 0;
ASSERT((CompareString == NULL && Size == 0) || (CompareString != NULL));
CompareString = StrnCatGrow(&CompareString, &Size, L":", 0);
CompareString = StrnCatGrow(&CompareString, &Size, ShellCommandLineGetRawValue(Package, 1), 0);
//
// Check forwards and then backwards for a label...
//
if (!MoveToTag(GetNextNode, L"endfor", L"for", CompareString, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, TRUE)) {
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
ShellPrintHiiEx(
-1,
-1,
NULL,
STRING_TOKEN (STR_SYNTAX_NO_MATCHING),
gShellLevel1HiiHandle,
CompareString,
L"Goto",
CurrentScriptFile!=NULL
&& CurrentScriptFile->CurrentCommand!=NULL
? CurrentScriptFile->CurrentCommand->Line:0);
ShellStatus = SHELL_NOT_FOUND;
}
FreePool(CompareString);
}
ShellCommandLineFreeVarList (Package);
}
return (ShellStatus);
}
示例14: Image
/**
Function for 'setvar' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunSetVar (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
RETURN_STATUS RStatus;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
CONST CHAR16 *VariableName;
EFI_GUID Guid;
CONST CHAR16 *StringGuid;
UINT32 Attributes;
VOID *Buffer;
UINTN Size;
UINTN LoopVar;
ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS;
Buffer = NULL;
Size = 0;
Attributes = 0;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
// ASSERT_EFI_ERROR(Status);
Status = CommandInit();
// ASSERT_EFI_ERROR(Status);
if (EFI_ERROR(Status)) {
return SHELL_UNSUPPORTED;
}
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"setvar", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} /* else {
ASSERT(FALSE);
} */
} else if (ShellCommandLineCheckDuplicate (Package,&ProblemParam) != EFI_SUCCESS) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DUPLICATE), gShellDebug1HiiHandle, L"setvar", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (ShellCommandLineGetCount(Package) < 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setvar");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
VariableName = ShellCommandLineGetRawValue(Package, 1);
if (!ShellCommandLineGetFlag(Package, L"-guid")){
CopyGuid(&Guid, &gEfiGlobalVariableGuid);
} else {
StringGuid = ShellCommandLineGetValue(Package, L"-guid");
RStatus = StrToGuid (StringGuid, &Guid);
if (RETURN_ERROR (RStatus) || (StringGuid[GUID_STRING_LENGTH] != L'\0')) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", StringGuid);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
if (ShellCommandLineGetCount(Package) == 2) {
//
// Display
//
Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
Buffer = AllocateZeroPool(Size);
Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);
}
if (!EFI_ERROR(Status) && Buffer != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_SETVAR_PRINT), gShellDebug1HiiHandle, &Guid, VariableName, Size);
for (LoopVar = 0; LoopVar < Size; LoopVar++) {
ShellPrintEx(-1, -1, L"%02x ", ((UINT8*)Buffer)[LoopVar]);
}
ShellPrintEx(-1, -1, L"\r\n");
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_GET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName);
ShellStatus = SHELL_ACCESS_DENIED;
}
} else {
//
// Create, Delete or Modify.
//.........这里部分代码省略.........
示例15: Image
/**
Function for 'time' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunTime (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
LIST_ENTRY *Package;
EFI_TIME TheTime;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
INT16 Tz;
UINT8 Daylight;
CONST CHAR16 *TempLocation;
UINTN TzMinutes;
//
// Initialize variables
//
ShellStatus = SHELL_SUCCESS;
ProblemParam = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
if (PcdGet8(PcdShellSupportLevel) == 2) {
Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE);
} else {
ASSERT(PcdGet8(PcdShellSupportLevel) == 3);
Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE);
}
if (EFI_ERROR(Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
//
// check for "-?"
//
Status = gRT->GetTime(&TheTime, NULL);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
if (ShellCommandLineGetFlag(Package, L"-?")) {
ASSERT(FALSE);
} else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// If there are no parameters, then print the current time
//
if (ShellCommandLineGetRawValue(Package, 1) == NULL
&& !ShellCommandLineGetFlag(Package, L"-d")
&& !ShellCommandLineGetFlag(Package, L"-tz")) {
//
// ShellPrintEx the current time
//
if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {
TzMinutes = 0;
} else {
TzMinutes = (ABS(TheTime.TimeZone)) % 60;
}
if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_TIME_FORMAT),
gShellLevel2HiiHandle,
TheTime.Hour,
TheTime.Minute,
TheTime.Second,
(TheTime.TimeZone > 0?L"-":L"+"),
((ABS(TheTime.TimeZone)) / 60),
TzMinutes
);
} else {
ShellPrintHiiEx (
-1,
//.........这里部分代码省略.........