mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
5caec787e1
commit
d595d4b13a
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue