#include <inifile.h>
#include "registry.h"
-#include "hwdetect.h"
#define NDEBUG
PARTITION_TABLE_ENTRY PartitionTableEntry;
U32 rosPartition;
+ BOOL TextHive = FALSE;
//
// Open the operating system section
DbgPrint((DPRINT_REACTOS, "low_mem = %d\n", mb_info.mem_lower));
DbgPrint((DPRINT_REACTOS, "high_mem = %d\n", mb_info.mem_upper));
+ /*
+ * Initialize the registry
+ */
+ RegInitializeRegistry();
+
/*
* Make sure the system path is set in the .ini file
*/
((char *)(&mb_info.boot_device))[0] = (char)BootDrive;
((char *)(&mb_info.boot_device))[1] = (char)BootPartition;
- /* recalculate the boot partition for freeldr */
+ /* recalculate the boot partition for freeldr */
i = 0;
- rosPartition = 0;
- while (1)
+ rosPartition = 0;
+ while (1)
{
- if (!DiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
+ if (!DiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
{
BootPartition = 0;
break;
}
- if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
+ if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
{
if (++rosPartition == BootPartition)
{
UiMessageBox(MsgBuffer);
return;
}
-
+
/* copy ARC path into kernel command line */
strcpy(multiboot_kernel_cmdline, value);
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
+
UiDrawBackdrop();
+ UiDrawStatusText("Detecting Hardware...");
+
+ /*
+ * Detect hardware
+ */
+ DetectHardware();
+
+
UiDrawStatusText("Loading...");
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
return;
/*
- * Find the System hive image name
- * and try to load it off the disk
+ * Load the System hive from disk
*/
- if(IniReadSettingByName(SectionId, "SystemHive", value, 1024))
- {
- /*
- * Set the name and
- */
- if (value[0] == '\\')
- {
- strcpy(szFileName, value);
- }
- else
- {
- strcpy(szFileName, szBootPath);
- strcat(szFileName, "SYSTEM32\\CONFIG\\");
- strcat(szFileName, value);
- }
- }
- else
- {
- strcpy(value, "SYSTEM.HIV");
- strcpy(szFileName, szBootPath);
- strcat(szFileName, "SYSTEM32\\CONFIG\\");
- strcat(szFileName, value);
- }
+ strcpy(szFileName, szBootPath);
+ strcat(szFileName, "SYSTEM32\\CONFIG\\SYSTEM");
DbgPrint((DPRINT_REACTOS, "SystemHive: '%s'", szFileName));
FilePointer = FsOpenFile(szFileName);
if (FilePointer == NULL)
{
- strcat(value, " not found.");
- UiMessageBox(value);
- return;
+ strcpy(szFileName, szBootPath);
+ strcat(szFileName, "SYSTEM32\\CONFIG\\SYSTEM.HIV");
+
+ DbgPrint((DPRINT_REACTOS, "SystemHive: '%s'", szFileName));
+
+ FilePointer = FsOpenFile(szFileName);
+ if (FilePointer == NULL)
+ {
+ UiMessageBox("Could not find the System hive!");
+ return;
+ }
+ else
+ {
+ TextHive = TRUE;
+ }
}
/*
UiDrawStatusText(name);
/*
- * Load the system hive
+ * Load the System hive
*/
Base = MultiBootLoadModule(FilePointer, szFileName, &Size);
- RegInitializeRegistry();
- RegImportHive(Base, Size);
-
- UiDrawProgressBarCenter(15, 100, "Loading ReactOS...");
+ if (Base == NULL || Size == 0)
+ {
+ UiMessageBox("Could not load the System hive!\n");
+ return;
+ }
DbgPrint((DPRINT_REACTOS, "SystemHive loaded at 0x%x size %u", (unsigned)Base, (unsigned)Size));
/*
- * Retrieve hardware information and create the hardware hive
+ * Import the loaded system hive
*/
- DetectHardware();
-#if 0
- Base = MultiBootCreateModule(HARDWARE.HIV);
- RegExportHive("\\Registry\\Machine\\HARDWARE", Base, &Size);
- MultiBootCloseModule(Base, Size);
-#endif
- UiDrawProgressBarCenter(20, 100, "Loading ReactOS...");
+ if (TextHive)
+ {
+ RegImportTextHive(Base, Size);
+ }
+ else
+ {
+ RegImportBinaryHive(Base, Size);
+ }
/*
- * Initialize the 'currentControlSet' link
+ * Initialize the 'CurrentControlSet' link
*/
RegInitCurrentControlSet(FALSE);
+ UiDrawProgressBarCenter(15, 100, "Loading ReactOS...");
+
+ /*
+ * Export the hardware hive
+ */
+ Base = MultiBootCreateModule ("HARDWARE");
+ RegExportBinaryHive ("\\Registry\\Machine\\HARDWARE", Base, &Size);
+ MultiBootCloseModule (Base, Size);
+
+ UiDrawProgressBarCenter(20, 100, "Loading ReactOS...");
+
/*
* Load NLS files
*/
#if 0
if (!LoadNlsFiles(szBootPath))
{
- MessageBox("Failed to load NLS files\n");
+ UiMessageBox("Failed to load NLS files\n");
return;
}
#endif
- LoadSymbolFile(szBootPath, szKernelName, 25);
- LoadSymbolFile(szBootPath, szHalName, 25);
+ LoadSymbolFile(szBootPath, szKernelName, 25);
+ LoadSymbolFile(szBootPath, szHalName, 25);
UiDrawProgressBarCenter(25, 100, "Loading ReactOS...");
UiDrawBackdrop();
UiDrawStatusText("Press any key to boot");
+#if 0
/*
* Wait for user
*/
strcpy(name, "Kernel and Drivers loaded.\nPress any key to boot ");
strcat(name, OperatingSystemName);
strcat(name, ".");
- //MessageBox(name);
-
+ MessageBox(name);
+#endif
UiUnInitialize("Booting ReactOS...");