#define NDEBUG
#include <debug.h>
-#define IsRecognizedPartition(P) \
- ((P) == PARTITION_FAT_12 || \
- (P) == PARTITION_FAT_16 || \
- (P) == PARTITION_HUGE || \
- (P) == PARTITION_IFS || \
- (P) == PARTITION_EXT2 || \
- (P) == PARTITION_FAT32 || \
- (P) == PARTITION_FAT32_XINT13 || \
- (P) == PARTITION_XINT13)
-
BOOL
STDCALL
FrLdrLoadKernel(PCHAR szFileName,
PFILE FilePointer;
CHAR name[1024];
CHAR value[1024];
+ CHAR SystemPath[1024];
CHAR szKernelName[1024];
CHAR szHalName[1024];
CHAR szFileName[1024];
ULONG_PTR Base;
ULONG Size;
-
- PARTITION_TABLE_ENTRY PartitionTableEntry;
- ULONG rosPartition;
extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd;
/*
* Make sure the system path is set in the .ini file
*/
- if (!IniReadSettingByName(SectionId, "SystemPath", value, 1024))
+ if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath)))
{
UiMessageBox("System path not specified for selected operating system.");
return;
/*
* Special case for Live CD.
*/
- if (!stricmp(value, "LiveCD"))
+ if (!stricmp(SystemPath, "LiveCD"))
{
- strcpy(szBootPath, "\\reactos");
-
- /* Set kernel command line */
- sprintf(multiboot_kernel_cmdline,
- "multi(0)disk(0)cdrom(%u)\\reactos /MININT",
- (unsigned int)BootDrive);
+ /* Normalize */
+ MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
+ strcat(SystemPath, "\\reactos");
+ strcat(strcpy(multiboot_kernel_cmdline, SystemPath),
+ " /MININT");
}
else
{
- /*
- * Verify system path
- */
- if (!DissectArcPath(value, szBootPath, &BootDrive, &BootPartition))
- {
- sprintf(MsgBuffer,"Invalid system path: '%s'", value);
- UiMessageBox(MsgBuffer);
- return;
- }
-
- /* recalculate the boot partition for freeldr */
- i = 0;
- rosPartition = 0;
- while (1)
- {
- if (!MachDiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
- {
- BootPartition = 0;
- break;
- }
- if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
- {
- if (++rosPartition == BootPartition)
- {
- BootPartition = i;
- break;
- }
- }
- }
-
- if (BootPartition == 0)
- {
- sprintf(MsgBuffer,"Invalid system path: '%s'", value);
- UiMessageBox(MsgBuffer);
- return;
- }
-
- /* copy ARC path into kernel command line */
- strcpy(multiboot_kernel_cmdline, value);
+ /* copy system path into kernel command line */
+ strcpy(multiboot_kernel_cmdline, SystemPath);
}
- /* Set boot drive and partition */
- ((LPSTR )(&LoaderBlock.BootDevice))[0] = (CHAR)BootDrive;
- ((LPSTR )(&LoaderBlock.BootDevice))[1] = (CHAR)BootPartition;
-
/*
* Read the optional kernel parameters (if any)
*/
strcat(multiboot_kernel_cmdline, value);
}
- /* append a backslash */
- if ((strlen(szBootPath)==0) ||
- szBootPath[strlen(szBootPath)] != '\\')
- strcat(szBootPath, "\\");
-
- DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
-
UiDrawBackdrop();
UiDrawStatusText("Detecting Hardware...");
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
/*
- * Try to open boot drive
+ * Try to open system drive
*/
- if (!FsOpenVolume(BootDrive, BootPartition))
+ if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
{
UiMessageBox("Failed to open boot drive.");
return;
}
+ /* append a backslash */
+ if ((strlen(szBootPath)==0) ||
+ szBootPath[strlen(szBootPath)] != '\\')
+ strcat(szBootPath, "\\");
+
+ DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
+
/*
* Find the kernel image name
* and try to load the kernel off the disk