mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 22:54:51 +02:00
MdePkg/DxeServicesLib: Return NULL GetFileBufferByFilePath reads directory
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17655 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
35bc88dddc
commit
93e8630a8d
@ -2,7 +2,7 @@
|
|||||||
MDE DXE Services Library provides functions that simplify the development of DXE Drivers.
|
MDE DXE Services Library provides functions that simplify the development of DXE Drivers.
|
||||||
These functions help access data from sections of FFS files or from file path.
|
These functions help access data from sections of FFS files or from file path.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -796,18 +796,20 @@ GetFileBufferByFilePath (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && (FileInfo != NULL)) {
|
if (!EFI_ERROR (Status) && (FileInfo != NULL)) {
|
||||||
//
|
if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == 0) {
|
||||||
// Allocate space for the file
|
|
||||||
//
|
|
||||||
ImageBuffer = AllocatePool ((UINTN)FileInfo->FileSize);
|
|
||||||
if (ImageBuffer == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
} else {
|
|
||||||
//
|
//
|
||||||
// Read the file into the buffer we allocated
|
// Allocate space for the file
|
||||||
//
|
//
|
||||||
ImageBufferSize = (UINTN)FileInfo->FileSize;
|
ImageBuffer = AllocatePool ((UINTN)FileInfo->FileSize);
|
||||||
Status = FileHandle->Read (FileHandle, &ImageBufferSize, ImageBuffer);
|
if (ImageBuffer == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Read the file into the buffer we allocated
|
||||||
|
//
|
||||||
|
ImageBufferSize = (UINTN)FileInfo->FileSize;
|
||||||
|
Status = FileHandle->Read (FileHandle, &ImageBufferSize, ImageBuffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user