Implement BlpLoadConfigurationFile() routine
This commit is contained in:
parent
e1be0e56ea
commit
40e7b29af8
@ -9,6 +9,63 @@
|
|||||||
#include <xtldr.h>
|
#include <xtldr.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads configuration file from the specified directory on the FS0:/ drive.
|
||||||
|
*
|
||||||
|
* @param ConfigDirectory
|
||||||
|
* Specifies a path to the directory containing the configuration file.
|
||||||
|
*
|
||||||
|
* @param ConfigFile
|
||||||
|
* Specifies the name of the configuration file.
|
||||||
|
*
|
||||||
|
* @param ConfigData
|
||||||
|
* Provides a buffer to store the data read from the configuration file.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlpLoadConfigurationFile(IN CONST PWCHAR ConfigDirectory,
|
||||||
|
IN CONST PWCHAR ConfigFile,
|
||||||
|
OUT PCHAR *ConfigData)
|
||||||
|
{
|
||||||
|
PEFI_FILE_HANDLE DirHandle, FsHandle;
|
||||||
|
EFI_HANDLE DiskHandle;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
SIZE_T FileSize;
|
||||||
|
|
||||||
|
/* Open EFI volume */
|
||||||
|
Status = BlOpenVolume(NULL, &DiskHandle, &FsHandle);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to open a volume */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open specified directory, containing the configuration file and close the FS immediately */
|
||||||
|
Status = FsHandle->Open(FsHandle, &DirHandle, ConfigDirectory, EFI_FILE_MODE_READ, 0);
|
||||||
|
FsHandle->Close(FsHandle);
|
||||||
|
|
||||||
|
/* Check if directory opened successfully */
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to open directory */
|
||||||
|
BlCloseVolume(DiskHandle);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read configuration file */
|
||||||
|
Status = BlReadFile(DirHandle, ConfigFile, (PVOID *)ConfigData, &FileSize);
|
||||||
|
|
||||||
|
/* Close EFI volume */
|
||||||
|
BlCloseVolume(DiskHandle);
|
||||||
|
|
||||||
|
/* Return read status */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses command line arguments and updates global configuration.
|
* Parses command line arguments and updates global configuration.
|
||||||
*
|
*
|
||||||
|
@ -141,6 +141,12 @@ BlpFindParentBlockDevice(IN PLIST_ENTRY BlockDevices,
|
|||||||
IN PEFI_BLOCK_DEVICE_DATA ChildNode,
|
IN PEFI_BLOCK_DEVICE_DATA ChildNode,
|
||||||
OUT PEFI_BLOCK_DEVICE_DATA ParentNode);
|
OUT PEFI_BLOCK_DEVICE_DATA ParentNode);
|
||||||
|
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlpLoadConfigurationFile(IN CONST PWCHAR ConfigDirectory,
|
||||||
|
IN CONST PWCHAR ConfigFile,
|
||||||
|
OUT PCHAR *ConfigData);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlpParseCommandLineOptions(VOID);
|
BlpParseCommandLineOptions(VOID);
|
||||||
|
Loading…
Reference in New Issue
Block a user