Allow to read XTLDR data from alternative arch-specific directory; this allows to prepare combined 32 & 64 bit disk
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 29s
Builds / ExectOS (i686) (push) Successful in 29s

This commit is contained in:
Rafal Kupiec 2024-01-05 23:28:12 +01:00
parent 2864fdd790
commit f49966b462
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
3 changed files with 29 additions and 2 deletions

View File

@ -14,6 +14,19 @@
#include <hltypes.h> #include <hltypes.h>
/* Architecture specific definitions */
#if defined(__i386__) || defined(__i686__)
#define XTBL_ARCH_LOADER_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR32\\"
#define XTBL_ARCH_MODULES_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR32\\MODULES\\"
#define XTBL_ARCH_THEMES_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR32\\THEMES\\"
#elif defined(__amd64__) || defined(__x86_64__)
#define XTBL_ARCH_LOADER_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR64\\"
#define XTBL_ARCH_MODULES_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR64\\MODULES\\"
#define XTBL_ARCH_THEMES_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR64\\THEMES\\"
#else
#error Unknown architecture
#endif
/* XTLDR directories */ /* XTLDR directories */
#define XTBL_LOADER_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR\\" #define XTBL_LOADER_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR\\"
#define XTBL_MODULES_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR\\MODULES\\" #define XTBL_MODULES_DIRECTORY_PATH L"\\EFI\\BOOT\\XTLDR\\MODULES\\"

View File

@ -123,6 +123,13 @@ BlpLoadConfiguration()
/* Read data from configuration file */ /* Read data from configuration file */
Status = BlpReadConfigFile(XTBL_LOADER_DIRECTORY_PATH, L"XTLDR.INI", &ConfigData); Status = BlpReadConfigFile(XTBL_LOADER_DIRECTORY_PATH, L"XTLDR.INI", &ConfigData);
if(Status != STATUS_EFI_SUCCESS) if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to read config file, try with architecture specific directory */
Status = BlpReadConfigFile(XTBL_ARCH_LOADER_DIRECTORY_PATH, L"XTLDR.INI", &ConfigData);
}
/* Check if configuration was read successfully */
if(Status != STATUS_EFI_SUCCESS)
{ {
/* Failed to load configuration */ /* Failed to load configuration */
BlDebugPrint(L"Failed to load configuration file (FS0:/EFI/BOOT/XTLDR.INI)\n"); BlDebugPrint(L"Failed to load configuration file (FS0:/EFI/BOOT/XTLDR.INI)\n");

View File

@ -133,11 +133,18 @@ BlLoadModule(IN PWCHAR ModuleName)
return Status; return Status;
} }
/* Open XTLDR modules directory and close the FS immediately */ /* Open XTLDR modules common directory */
Status = FsHandle->Open(FsHandle, &DirHandle, XTBL_MODULES_DIRECTORY_PATH, EFI_FILE_MODE_READ, 0); Status = FsHandle->Open(FsHandle, &DirHandle, XTBL_MODULES_DIRECTORY_PATH, EFI_FILE_MODE_READ, 0);
if(Status != STATUS_EFI_SUCCESS)
{
/* Modules directory not found, attempt to open XTLDR architecture specific modules directory */
Status = FsHandle->Open(FsHandle, &DirHandle, XTBL_ARCH_MODULES_DIRECTORY_PATH, EFI_FILE_MODE_READ, 0);
}
/* Close FS handle */
FsHandle->Close(FsHandle); FsHandle->Close(FsHandle);
/* Check if directory opened successfully */ /* Check if modules directory opened successfully */
if(Status != STATUS_EFI_SUCCESS) if(Status != STATUS_EFI_SUCCESS)
{ {
/* Failed to open directory */ /* Failed to open directory */