mirror of https://github.com/acidanthera/audk.git
Comment's added and fixed.
Pointer's checked for NULL before access and after memory allocations. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11499 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5f2915f593
commit
ae724571be
|
@ -1547,7 +1547,7 @@ FileInterfaceFileGetInfo(
|
|||
/**
|
||||
Set information about a file
|
||||
|
||||
@param File Protocol instance pointer.
|
||||
@param This Protocol instance pointer.
|
||||
@param InformationType Type of information in Buffer.
|
||||
@param BufferSize Size of buffer.
|
||||
@param Buffer The data to write.
|
||||
|
|
|
@ -415,6 +415,14 @@ CleanUpShellParametersProtocol (
|
|||
return (Status);
|
||||
}
|
||||
|
||||
/**
|
||||
Determin if a file name represents a unicode file.
|
||||
|
||||
@param[in] FileName Pointer to the filename to open.
|
||||
|
||||
@retval EFI_SUCCESS The file is a unicode file.
|
||||
@return An error upon failure.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IsUnicodeFile(
|
||||
|
|
|
@ -1191,7 +1191,7 @@ ShellPromptForResponse (
|
|||
to prevent invalid answers to question.
|
||||
@param[in] HiiFormatStringId The format string Id for getting from Hii.
|
||||
@param[in] HiiFormatHandle The format string Handle for getting from Hii.
|
||||
@param[out] Response The pointer to Response, which will be populated upon return.
|
||||
@param[in,out] Response The pointer to Response, which will be populated upon return.
|
||||
|
||||
@retval EFI_SUCCESS The operation was sucessful.
|
||||
@return other The operation failed.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#ifndef __SHELL_BASE__
|
||||
#define __SHELL_BASE__
|
||||
|
||||
#define ABS(a) (a<0)?(-(a)):(a)
|
||||
#define ABS(a) ((a<0)?(-(a)):(a))
|
||||
|
||||
typedef VOID *SHELL_FILE_HANDLE;
|
||||
|
||||
|
|
|
@ -237,8 +237,7 @@ FreeMemory (
|
|||
}
|
||||
|
||||
/**
|
||||
Initialize String Info Log data structures
|
||||
|
||||
Initialize String Info Log data structures.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
|
@ -1043,8 +1042,7 @@ WritePTLen (
|
|||
}
|
||||
|
||||
/**
|
||||
Outputs the code length array for Char&Length Set
|
||||
|
||||
Outputs the code length array for Char&Length Set.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
|
|
|
@ -357,7 +357,7 @@ FileBufferRestoreMousePosition (
|
|||
CurrentLine = FileBuffer.CurrentLine;
|
||||
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
||||
|
||||
if (FColumn > Line->Size) {
|
||||
if (Line == NULL || FColumn > Line->Size) {
|
||||
HasCharacter = FALSE;
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ GetNewLine (
|
|||
Change a Unicode string to an ASCII string.
|
||||
|
||||
@param[in] UStr The Unicode string.
|
||||
@param[in] Lenght The maximum size of AStr.
|
||||
@param[in] Length The maximum size of AStr.
|
||||
@param[out] AStr ASCII string to pass out.
|
||||
|
||||
@return The actuall length.
|
||||
|
@ -1621,7 +1621,7 @@ FileBufferSave (
|
|||
//
|
||||
// now everything is ready , you can set the new file name to filebuffer
|
||||
//
|
||||
if (StrCmp (FileName, FileBuffer.FileName) != 0) {
|
||||
if (FileName != NULL && FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) != 0) {
|
||||
//
|
||||
// not the same
|
||||
//
|
||||
|
|
|
@ -91,7 +91,7 @@ MainCommandSearch (
|
|||
VOID
|
||||
);
|
||||
|
||||
/*
|
||||
/**
|
||||
search string in file buffer, and replace it with another str
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
|
@ -589,8 +589,8 @@ MainCommandSearch (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
search string in file buffer, and replace it with another str
|
||||
/**
|
||||
Search string in file buffer, and replace it with another str.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
|
||||
|
@ -1589,7 +1589,6 @@ GetTextY (
|
|||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_NOT_FOUND There was no mouse support found.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MainEditorHandleMouseInput (
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -188,10 +188,15 @@ HBufferImageReplace (
|
|||
UINTN
|
||||
);
|
||||
|
||||
/**
|
||||
Free the current image.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
HBufferImageFree (
|
||||
VOID
|
||||
) ;
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
HBufferImageDeleteCharacterFromBuffer (
|
||||
|
|
|
@ -489,7 +489,8 @@ Returns:
|
|||
//
|
||||
// now everything is ready , you can set the new file name to filebuffer
|
||||
//
|
||||
if (BufferTypeBackup != FileTypeFileBuffer || StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0) {
|
||||
if ((BufferTypeBackup != FileTypeFileBuffer && FileName != NULL) ||
|
||||
(FileName != NULL && HFileImage.FileName != NULL && StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)){
|
||||
//
|
||||
// not the same
|
||||
//
|
||||
|
|
|
@ -135,8 +135,8 @@ ShellCommandRunHexEdit (
|
|||
Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2));
|
||||
}
|
||||
}
|
||||
if (WhatToDo == FileTypeNone && ShellCommandLineGetRawValue(Package, 1) != NULL) {
|
||||
Name = ShellCommandLineGetRawValue(Package, 1);
|
||||
if (WhatToDo == FileTypeNone && Name != NULL) {
|
||||
if (!IsValidFileName(Name)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Name);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
|
|
@ -1868,9 +1868,9 @@ Returns:
|
|||
|| ReadChange ) {
|
||||
|
||||
MainTitleBarRefresh (
|
||||
HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL,
|
||||
HMainEditor.BufferImage->BufferType == FileTypeFileBuffer&&HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Name:NULL,
|
||||
HMainEditor.BufferImage->BufferType,
|
||||
HMainEditor.BufferImage->FileImage->ReadOnly,
|
||||
(BOOLEAN)(HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->ReadOnly:FALSE),
|
||||
HMainEditor.BufferImage->Modified,
|
||||
HMainEditor.ScreenSize.Column,
|
||||
HMainEditor.ScreenSize.Row,
|
||||
|
|
|
@ -2969,7 +2969,7 @@ QueryTable (
|
|||
//
|
||||
if (High > Low && Key >= Low && Key <= High) {
|
||||
StrnCpy (Info, Table[Index].Info, InfoLen-1);
|
||||
StrCat (Info, L"\n");
|
||||
StrnCat (Info, L"\n", InfoLen - StrLen(Info));
|
||||
return Key;
|
||||
}
|
||||
//
|
||||
|
@ -2977,7 +2977,7 @@ QueryTable (
|
|||
//
|
||||
if (Table[Index].Key == Key) {
|
||||
StrnCpy (Info, Table[Index].Info, InfoLen-1);
|
||||
StrCat (Info, L"\n");
|
||||
StrnCat (Info, L"\n", InfoLen - StrLen(Info));
|
||||
return Key;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ ShellCommandRunEndFor (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN Found;
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
|
@ -86,6 +87,7 @@ ShellCommandRunEndFor (
|
|||
Found = MoveToTag(GetPreviousNode, L"for", L"endfor", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE);
|
||||
|
||||
if (!Found) {
|
||||
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
|
@ -94,9 +96,9 @@ ShellCommandRunEndFor (
|
|||
gShellLevel1HiiHandle,
|
||||
L"For",
|
||||
L"EndFor",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
return (SHELL_NOT_FOUND);
|
||||
}
|
||||
return (SHELL_SUCCESS);
|
||||
|
@ -421,7 +423,16 @@ ShellCommandRunFor (
|
|||
Info->CurrentValue = NULL;
|
||||
ArgSetWalker = ArgSet;
|
||||
if (ArgSetWalker[0] != L'(') {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
ArgSet,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
TempSpot = StrStr(ArgSetWalker, L")");
|
||||
|
@ -437,7 +448,15 @@ ShellCommandRunFor (
|
|||
}
|
||||
}
|
||||
if (TempSpot == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
*TempSpot = CHAR_NULL;
|
||||
|
@ -446,7 +465,16 @@ ShellCommandRunFor (
|
|||
ArgSetWalker++;
|
||||
}
|
||||
if (!ShellIsValidForNumber(ArgSetWalker)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
ArgSet,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (ArgSetWalker[0] == L'-') {
|
||||
|
@ -459,7 +487,16 @@ ShellCommandRunFor (
|
|||
ArgSetWalker++;
|
||||
}
|
||||
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
ArgSet,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (ArgSetWalker[0] == L'-') {
|
||||
|
@ -479,7 +516,16 @@ ShellCommandRunFor (
|
|||
}
|
||||
if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) {
|
||||
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
ArgSet,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (*ArgSetWalker == L')') {
|
||||
|
@ -492,7 +538,16 @@ ShellCommandRunFor (
|
|||
}
|
||||
|
||||
if (StrStr(ArgSetWalker, L" ") != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
ArgSet,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +567,16 @@ ShellCommandRunFor (
|
|||
}
|
||||
CurrentScriptFile->CurrentCommand->Data = Info;
|
||||
} else {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
|
||||
gShellLevel1HiiHandle,
|
||||
ArgSet,
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
} else {
|
||||
|
@ -553,7 +617,17 @@ ShellCommandRunFor (
|
|||
// find the matching endfor (we're done with the loop)
|
||||
//
|
||||
if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"EndFor", L"For", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_SYNTAX_NO_MATCHING),
|
||||
gShellLevel1HiiHandle,
|
||||
L"EndFor",
|
||||
L"For",
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_DEVICE_ERROR;
|
||||
}
|
||||
if (Info->RemoveSubstAlias) {
|
||||
|
@ -611,7 +685,17 @@ ShellCommandRunFor (
|
|||
// find the matching endfor (we're done with the loop)
|
||||
//
|
||||
if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"EndFor", L"For", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_SYNTAX_NO_MATCHING),
|
||||
gShellLevel1HiiHandle,
|
||||
L"EndFor",
|
||||
L"For",
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_DEVICE_ERROR;
|
||||
}
|
||||
if (Info->RemoveSubstAlias) {
|
||||
|
|
|
@ -33,6 +33,7 @@ ShellCommandRunGoto (
|
|||
SHELL_STATUS ShellStatus;
|
||||
CHAR16 *CompareString;
|
||||
UINTN Size;
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
CompareString = NULL;
|
||||
|
@ -79,6 +80,7 @@ ShellCommandRunGoto (
|
|||
// 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,
|
||||
|
@ -87,9 +89,9 @@ ShellCommandRunGoto (
|
|||
gShellLevel1HiiHandle,
|
||||
CompareString,
|
||||
L"Goto",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
FreePool(CompareString);
|
||||
|
|
|
@ -825,7 +825,7 @@ ShellCommandRunIf (
|
|||
BOOLEAN CurrentValue;
|
||||
END_TAG_TYPE Ending;
|
||||
END_TAG_TYPE PreviousEnding;
|
||||
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
|
@ -843,7 +843,8 @@ ShellCommandRunIf (
|
|||
//
|
||||
// Make sure that an End exists.
|
||||
//
|
||||
if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, ShellCommandGetCurrentScriptFile(), TRUE, TRUE, FALSE)) {
|
||||
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
|
||||
if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
|
@ -852,9 +853,9 @@ ShellCommandRunIf (
|
|||
gShellLevel1HiiHandle,
|
||||
L"EnfIf",
|
||||
L"If",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
return (SHELL_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
|
@ -928,7 +929,18 @@ ShellCommandRunIf (
|
|||
// build up the next statement for analysis
|
||||
//
|
||||
if (!BuildNextStatement(CurrentParameter, &EndParameter, &Ending)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"Then", L"If", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_SYNTAX_NO_MATCHING),
|
||||
gShellLevel1HiiHandle,
|
||||
L"Then",
|
||||
L"If",
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
//
|
||||
|
@ -979,6 +991,7 @@ ShellCommandRunElse (
|
|||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
ASSERT_EFI_ERROR(CommandInit());
|
||||
|
||||
if (gEfiShellParametersProtocol->Argc > 1) {
|
||||
|
@ -991,8 +1004,9 @@ ShellCommandRunElse (
|
|||
return (SHELL_UNSUPPORTED);
|
||||
}
|
||||
|
||||
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
|
||||
|
||||
if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {
|
||||
if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
|
@ -1001,12 +1015,12 @@ ShellCommandRunElse (
|
|||
gShellLevel1HiiHandle,
|
||||
L"If",
|
||||
L"Else",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
return (SHELL_DEVICE_ERROR);
|
||||
}
|
||||
if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {
|
||||
if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
|
@ -1015,13 +1029,13 @@ ShellCommandRunElse (
|
|||
gShellLevel1HiiHandle,
|
||||
L"If",
|
||||
L"Else",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
return (SHELL_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE)) {
|
||||
if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, FALSE, FALSE, FALSE)) {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
|
@ -1030,9 +1044,9 @@ ShellCommandRunElse (
|
|||
gShellLevel1HiiHandle,
|
||||
L"EndIf",
|
||||
"Else",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
return (SHELL_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
|
@ -1052,6 +1066,7 @@ ShellCommandRunEndIf (
|
|||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
ASSERT_EFI_ERROR(CommandInit());
|
||||
|
||||
if (gEfiShellParametersProtocol->Argc > 1) {
|
||||
|
@ -1064,7 +1079,8 @@ ShellCommandRunEndIf (
|
|||
return (SHELL_UNSUPPORTED);
|
||||
}
|
||||
|
||||
if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {
|
||||
CurrentScriptFile = ShellCommandGetCurrentScriptFile();
|
||||
if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
|
@ -1073,9 +1089,9 @@ ShellCommandRunEndIf (
|
|||
gShellLevel1HiiHandle,
|
||||
L"If",
|
||||
L"EndIf",
|
||||
ShellCommandGetCurrentScriptFile()!=NULL
|
||||
&&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
|
||||
?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
|
||||
CurrentScriptFile!=NULL
|
||||
&& CurrentScriptFile->CurrentCommand!=NULL
|
||||
? CurrentScriptFile->CurrentCommand->Line:0);
|
||||
return (SHELL_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
|
|
|
@ -650,7 +650,7 @@ PerformMappingDisplay(
|
|||
&BufferSize,
|
||||
HandleBuffer);
|
||||
}
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR(Status) && HandleBuffer != NULL) {
|
||||
//
|
||||
// Get the map name(s) for each one.
|
||||
//
|
||||
|
|
|
@ -30,7 +30,7 @@ EFIAPI
|
|||
HandleVol(
|
||||
IN CONST CHAR16 *Path,
|
||||
IN CONST BOOLEAN Delete,
|
||||
IN CONST CHAR16 *Name
|
||||
IN CONST CHAR16 *Name OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -45,6 +45,7 @@ HandleVol(
|
|||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
if (
|
||||
Name != NULL && (
|
||||
StrStr(Name, L"%") != NULL ||
|
||||
StrStr(Name, L"^") != NULL ||
|
||||
StrStr(Name, L"*") != NULL ||
|
||||
|
@ -60,7 +61,7 @@ HandleVol(
|
|||
StrStr(Name, L">") != NULL ||
|
||||
StrStr(Name, L"?") != NULL ||
|
||||
StrStr(Name, L"/") != NULL ||
|
||||
StrStr(Name, L" ") != NULL
|
||||
StrStr(Name, L" ") != NULL )
|
||||
){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, Name);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
|
@ -151,6 +152,8 @@ HandleVol(
|
|||
|
||||
gEfiShellProtocol->CloseFile(ShellFileHandle);
|
||||
|
||||
ASSERT(SysInfo != NULL);
|
||||
|
||||
//
|
||||
// print VolumeInfo table
|
||||
//
|
||||
|
@ -200,6 +203,7 @@ ShellCommandRunVol (
|
|||
CHAR16 *FullPath;
|
||||
CHAR16 *TempSpot;
|
||||
UINTN Length;
|
||||
CONST CHAR16 *NewName;
|
||||
|
||||
Length = 0;
|
||||
ProblemParam = NULL;
|
||||
|
@ -266,20 +270,21 @@ ShellCommandRunVol (
|
|||
StrnCatGrow(&FullPath, &Length, PathName, 0);
|
||||
StrnCatGrow(&FullPath, &Length, L":\\", 0);
|
||||
DeleteMode = ShellCommandLineGetFlag(Package, L"-d");
|
||||
NewName = ShellCommandLineGetValue(Package, L"-n");
|
||||
if (DeleteMode && ShellCommandLineGetFlag(Package, L"-n")) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-n") && ShellCommandLineGetValue(Package, L"-n") == NULL) {
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-n") && NewName == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"-n");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetValue(Package, L"-n") != NULL && StrLen(ShellCommandLineGetValue(Package, L"-n")) > 11) {
|
||||
} else if (NewName != NULL && StrLen(NewName) > 11) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-n");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellStatus == SHELL_SUCCESS) {
|
||||
ShellStatus = HandleVol(
|
||||
FullPath,
|
||||
DeleteMode,
|
||||
ShellCommandLineGetValue(Package, L"-n")
|
||||
NewName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -781,9 +781,14 @@ IfconfigSetNicAddrByHii (
|
|||
if (ConfigHdr != NULL) {
|
||||
Length = StrLen (ConfigHdr);
|
||||
} else {
|
||||
Length = 0;
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
ConfigResp = AllocateZeroPool ((Length + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16));
|
||||
if (ConfigResp == NULL) {
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
if (ConfigHdr != NULL) {
|
||||
StrCpy (ConfigResp, ConfigHdr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue