diff options
author | Jaben Carsey <Jaben.carsey@intel.com> | 2014-03-31 21:06:13 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-03-31 21:06:13 +0000 |
commit | d0a5723f505aaad41115aff8138bc9df5cda8468 (patch) | |
tree | e92222723aa9267b6ea5056605eb4d91b7e4a634 /ShellPkg | |
parent | 4b5168d852be0d641be73e8399622704998c183f (diff) | |
download | edk2-platforms-d0a5723f505aaad41115aff8138bc9df5cda8468.tar.xz |
ShellPkg: Allow opening of root drive nodes
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15424 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Application/Shell/ShellProtocol.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index c702a35914..9cc4ca38c1 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -1898,7 +1898,7 @@ CreateAndPopulateShellFileInfo( TempString = StrnCatGrow(&TempString, &Size, BasePath, 0);
if (TempString == NULL) {
FreePool((VOID*)ShellFileListItem->FileName);
- FreePool(ShellFileListItem->Info);
+ SHELL_FREE_NON_NULL(ShellFileListItem->Info);
FreePool(ShellFileListItem);
return (NULL);
}
@@ -2105,6 +2105,7 @@ ShellSearchHandle( EFI_SHELL_FILE_INFO *ShellInfo;
EFI_SHELL_FILE_INFO *ShellInfoNode;
EFI_SHELL_FILE_INFO *NewShellNode;
+ EFI_FILE_INFO *FileInfo;
BOOLEAN Directory;
CHAR16 *NewFullName;
UINTN Size;
@@ -2132,30 +2133,44 @@ ShellSearchHandle( if (CurrentFilePattern[0] == CHAR_NULL
&&NextFilePatternStart[0] == CHAR_NULL
- ){
+ ){
//
- // Add the current parameter FileHandle to the list, then end...
+ // we want the parent or root node (if no parent)
//
if (ParentNode == NULL) {
- Status = EFI_INVALID_PARAMETER;
+ //
+ // We want the root node. create the node.
+ //
+ FileInfo = FileHandleGetInfo(FileHandle);
+ NewShellNode = CreateAndPopulateShellFileInfo(
+ L":",
+ EFI_SUCCESS,
+ L"\\",
+ FileHandle,
+ FileInfo
+ );
+ SHELL_FREE_NON_NULL(FileInfo);
} else {
+ //
+ // Add the current parameter FileHandle to the list, then end...
+ //
NewShellNode = InternalDuplicateShellFileInfo((EFI_SHELL_FILE_INFO*)ParentNode, TRUE);
- if (NewShellNode == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- } else {
- NewShellNode->Handle = NULL;
- if (*FileList == NULL) {
- *FileList = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
- InitializeListHead(&((*FileList)->Link));
- }
+ }
+ if (NewShellNode == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ } else {
+ NewShellNode->Handle = NULL;
+ if (*FileList == NULL) {
+ *FileList = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ InitializeListHead(&((*FileList)->Link));
+ }
- //
- // Add to the returning to use list
- //
- InsertTailList(&(*FileList)->Link, &NewShellNode->Link);
+ //
+ // Add to the returning to use list
+ //
+ InsertTailList(&(*FileList)->Link, &NewShellNode->Link);
- Status = EFI_SUCCESS;
- }
+ Status = EFI_SUCCESS;
}
} else {
Status = EfiShellFindFilesInDir(FileHandle, &ShellInfo);
|