diff options
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Include/Library/ShellLib.h | 49 | ||||
-rw-r--r-- | ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c | 8 | ||||
-rw-r--r-- | ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c | 2 | ||||
-rw-r--r-- | ShellPkg/Library/UefiShellLib/UefiShellLib.c | 57 |
4 files changed, 73 insertions, 43 deletions
diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h index 6bf4e6ec9b..1018b35a8b 100644 --- a/ShellPkg/Include/Library/ShellLib.h +++ b/ShellPkg/Include/Library/ShellLib.h @@ -47,7 +47,7 @@ ShellGetFileInfo ( @param FileInfo The infotmation to set.
- @retval EFI_SUCCESS The information was set.
+ @retval EFI_SUCCESS The information was set.
@retval EFI_UNSUPPORTED The InformationType is not known.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_DEVICE_ERROR The device reported an error.
@@ -115,22 +115,22 @@ ShellOpenFileByDevicePath( @param OpenMode the mode to open the file with.
@param Attributes the file's file attributes.
- @retval EFI_SUCCESS The information was set.
+ @retval EFI_SUCCESS The information was set.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Could not open the file path.
+ @retval EFI_UNSUPPORTED Could not open the file path.
@retval EFI_NOT_FOUND The specified file could not be found on the
device or the file system could not be found
on the device.
- @retval EFI_NO_MEDIA The device has no medium.
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
medium is no longer supported.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
file.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
@@ -157,16 +157,16 @@ ShellOpenFileByName( @retval EFI_NOT_FOUND The specified file could not be found on the
device or the file system could not be found
on the device.
- @retval EFI_NO_MEDIA The device has no medium.
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
medium is no longer supported.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
file.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
@@ -198,11 +198,11 @@ ShellCreateDirectory( @param Buffer the buffer to put read data into.
- @retval EFI_SUCCESS Data was read.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
+ @retval EFI_SUCCESS Data was read.
+ @retval EFI_NO_MEDIA The device has no media.
+ @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+ @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
size.
**/
@@ -232,13 +232,13 @@ ShellReadFile( @param Buffer the buffer containing data to write is stored.
@retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
+ @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
@retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The device is write-protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_ACCESS_DENIED The file was open for read only.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
@@ -606,6 +606,7 @@ typedef enum { TypeFlag = 0,
TypeValue,
TypePosition,
+ TypeStart,
TypeMax,
} ParamType;
diff --git a/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c b/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c index 9136b9c200..d04a797bdf 100644 --- a/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c +++ b/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c @@ -714,7 +714,7 @@ StrnCatGrowLeft ( *Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16));
}
- *Destination = CopyMem(*Destination+StrLen(Source), *Destination, StrSize(*Destination));
+ *Destination = CopyMem((*Destination)+StrLen(Source), *Destination, StrSize(*Destination));
*Destination = CopyMem(*Destination, Source, StrLen(Source));
return (*Destination);
}
@@ -798,7 +798,7 @@ FileHandleGetFileName ( }
if (EFI_ERROR(Status) && *FullFileName != NULL) {
- FreePool(FullFileName);
+ FreePool(*FullFileName);
}
return (Status);
@@ -808,8 +808,8 @@ FileHandleGetFileName ( Function to read a single line (up to but not including the \n) from a file.
@param[in] Handle FileHandle to read from
- @param[in,out] Buffer pointer to buffer to read into
- @param[in,out] Size pointer to number of bytes in buffer
+ @param[in,out] Buffer pointer to buffer to read into
+ @param[in,out] Size pointer to number of bytes in buffer
@param[in[ Truncate if TRUE then allows for truncation of the line to fit.
if FALSE will reset the position to the begining of the
line if the buffer is not large enough.
diff --git a/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c b/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c index 43d429e6a5..80f56c0014 100644 --- a/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c +++ b/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c @@ -50,7 +50,7 @@ ShellCEntryLib ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- INT32 ReturnFromMain;
+ INTN ReturnFromMain;
EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol;
EFI_SHELL_INTERFACE *EfiShellInterface;
EFI_STATUS Status;
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 20805725fc..7b7533a327 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -79,9 +79,7 @@ ShellFindSE2 ( //
// look for the mEfiShellEnvironment2 protocol at a higher level
//
- if (EFI_ERROR (Status) || !(CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid) != FALSE &&
- (mEfiShellEnvironment2->MajorVersion > EFI_SHELL_MAJOR_VER ||
- (mEfiShellEnvironment2->MajorVersion == EFI_SHELL_MAJOR_VER && mEfiShellEnvironment2->MinorVersion >= EFI_SHELL_MINOR_VER)))) {
+ if (EFI_ERROR (Status) || !(CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid) != FALSE)){
//
// figure out how big of a buffer we need.
//
@@ -113,9 +111,7 @@ ShellFindSE2 ( NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
- if (CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid) != FALSE &&
- (mEfiShellEnvironment2->MajorVersion > EFI_SHELL_MAJOR_VER ||
- (mEfiShellEnvironment2->MajorVersion == EFI_SHELL_MAJOR_VER && mEfiShellEnvironment2->MinorVersion >= EFI_SHELL_MINOR_VER))) {
+ if (CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid) != FALSE) {
mEfiShellEnvironment2Handle = Buffer[HandleIndex];
Status = EFI_SUCCESS;
break;
@@ -1484,9 +1480,13 @@ InternalIsOnCheckList ( //
for (TempListItem = (SHELL_PARAM_ITEM*)CheckList ; TempListItem->Name != NULL ; TempListItem++) {
//
- // If the Name matches set the type and return TRUE
+ // If the Type is TypeStart only check the first characters of the passed in param
+ // If it matches set the type and return TRUE
//
- if (StrCmp(Name, TempListItem->Name) == 0) {
+ if (TempListItem->Type == TypeStart && StrnCmp(Name, TempListItem->Name, StrLen(TempListItem->Name)) == 0) {
+ *Type = TempListItem->Type;
+ return (TRUE);
+ } else if (StrCmp(Name, TempListItem->Name) == 0) {
*Type = TempListItem->Type;
return (TRUE);
}
@@ -1767,7 +1767,10 @@ ShellCommandLineFreeVarList ( //
// for each node in the list
//
- for (Node = GetFirstNode(CheckPackage); Node != CheckPackage ; Node = GetFirstNode(CheckPackage)) {
+ for ( Node = GetFirstNode(CheckPackage)
+ ; Node != CheckPackage
+ ; Node = GetFirstNode(CheckPackage)
+ ){
//
// Remove it from the list
//
@@ -1835,12 +1838,22 @@ ShellCommandLineGetFlag ( //
// enumerate through the list of parametrs
//
- for (Node = GetFirstNode(CheckPackage) ; !IsNull (CheckPackage, Node) ; Node = GetNextNode(CheckPackage, Node) ) {
+ for ( Node = GetFirstNode(CheckPackage)
+ ; !IsNull (CheckPackage, Node)
+ ; Node = GetNextNode(CheckPackage, Node)
+ ){
//
// If the Name matches, return TRUE (and there may be NULL name)
//
if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) {
- if (StrCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
+ //
+ // If Type is TypeStart then only compare the begining of the strings
+ //
+ if ( ((SHELL_PARAM_PACKAGE*)Node)->Type == TypeStart
+ && StrnCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name, StrLen(KeyString)) == 0
+ ){
+ return (TRUE);
+ } else if (StrCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
return (TRUE);
}
}
@@ -1879,12 +1892,28 @@ ShellCommandLineGetValue ( //
// enumerate through the list of parametrs
//
- for (Node = GetFirstNode(CheckPackage) ; !IsNull (CheckPackage, Node) ; Node = GetNextNode(CheckPackage, Node) ) {
+ for ( Node = GetFirstNode(CheckPackage)
+ ; !IsNull (CheckPackage, Node)
+ ; Node = GetNextNode(CheckPackage, Node)
+ ){
//
// If the Name matches, return the value (name can be NULL)
//
if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) {
- if (StrCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
+ //
+ // If Type is TypeStart then only compare the begining of the strings
+ //
+ if ( ((SHELL_PARAM_PACKAGE*)Node)->Type == TypeStart
+ && StrnCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name, StrLen(KeyString)) == 0
+ ){
+ //
+ // return the string part after the flag
+ //
+ return (((SHELL_PARAM_PACKAGE*)Node)->Name + StrLen(KeyString));
+ } else if (StrCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
+ //
+ // return the value
+ //
return (((SHELL_PARAM_PACKAGE*)Node)->Value);
}
}
@@ -1981,7 +2010,7 @@ CopyReplace( while (*SourceString != L'\0') {
if (StrnCmp(SourceString, FindTarget, StrLen(FindTarget)) == 0) {
SourceString += StrLen(FindTarget);
- if (StrSize(NewString) + (StrLen(ReplaceWith)*sizeof(CHAR16)) > NewSize) {
+ if ((StrSize(NewString) + (StrLen(ReplaceWith)*sizeof(CHAR16))) > NewSize) {
return (EFI_BUFFER_TOO_SMALL);
}
StrCat(NewString, ReplaceWith);
|