summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-16 17:24:16 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-16 17:24:16 +0000
commitd595d4b13a272fb2cee55b5a30bb826a42ddfad5 (patch)
tree965d07951ca72e3cacb1828b3b06e1cdf4805085 /ShellPkg
parent5caec787e13503450030036e3cc725e87a031ac8 (diff)
downloadedk2-d595d4b13a272fb2cee55b5a30bb826a42ddfad5.zip
edk2-d595d4b13a272fb2cee55b5a30bb826a42ddfad5.tar.gz
edk2-d595d4b13a272fb2cee55b5a30bb826a42ddfad5.tar.bz2
fixed operation of GetFirst and GetNext for files...
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8957 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c b/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c
index 3200385..808ac74 100644
--- a/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c
+++ b/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c
@@ -541,14 +541,6 @@ FileHandleFindNextFile(
ASSERT (DirHandle != NULL);
ASSERT (Buffer != NULL);
ASSERT (NoFile != NULL);
-
- //
- // verify that DirHandle is a directory
- //
- Status = FileHandleIsDirectory(DirHandle);
- if (EFI_ERROR(Status)) {
- return (Status);
- }
//
// This BufferSize MUST stay equal to the originally allocated one in GetFirstFile
@@ -698,7 +690,7 @@ StrnCatGrowLeft (
// Append all of Source?
//
if (Count == 0) {
- Count = StrLen(Source);
+ Count = StrSize(Source);
}
//
@@ -706,18 +698,18 @@ StrnCatGrowLeft (
//
if (CurrentSize != NULL) {
NewSize = *CurrentSize;
- while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) {
- NewSize += 2 * Count * sizeof(CHAR16);
+ while (NewSize < (DestinationStartSize + Count)) {
+ NewSize += 2 * Count;
}
*Destination = ReallocatePool(*CurrentSize, NewSize, *Destination);
*CurrentSize = NewSize;
} else {
- *Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16));
+ *Destination = AllocateZeroPool(Count+sizeof(CHAR16));
}
CopySize = StrSize(*Destination);
- *Destination = CopyMem((*Destination)+StrLen(Source), *Destination, CopySize);
- *Destination = CopyMem(*Destination, Source, StrLen(Source));
+ *Destination = CopyMem(*Destination+Count-sizeof(CHAR16), *Destination, CopySize);
+ *Destination = CopyMem(*Destination, Source, Count);
return (*Destination);
}
@@ -749,7 +741,6 @@ FileHandleGetFileName (
EFI_FILE_INFO *FileInfo;
Size = 0;
- *FullFileName = NULL;
//
// Check our parameters
@@ -758,6 +749,8 @@ FileHandleGetFileName (
return (EFI_INVALID_PARAMETER);
}
+ *FullFileName = NULL;
+
Status = Handle->Open(Handle, &CurrentHandle, L".", EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR(Status)) {
//
@@ -773,12 +766,12 @@ FileHandleGetFileName (
// We got info... do we have a name? if yes preceed the current path with it...
//
if (StrLen (FileInfo->FileName) == 0) {
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);
+ *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"/", 0);
FreePool(FileInfo);
break;
} else {
*FullFileName = StrnCatGrowLeft(FullFileName, &Size, FileInfo->FileName, 0);
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);
+ *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"/", 0);
FreePool(FileInfo);
}
}