📄 setupldr.c
字号:
1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
{
LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024;
}
#if 0
printf("start: %x\t size: %x\t type %d\n",
reactos_memory_map[i].base_addr_low,
reactos_memory_map[i].length_low,
reactos_memory_map[i].type);
#endif
}
}
#if 0
printf("low_mem = %d\n", LoaderBlock.MemLower);
printf("high_mem = %d\n", LoaderBlock.MemHigher);
MachConsGetCh();
#endif
#ifdef USE_UI
SetupUiInitialize();
UiDrawStatusText("");
#endif
extern BOOLEAN FrLdrBootType;
FrLdrBootType = TRUE;
/* Initialize registry */
RegInitializeRegistry();
/* Detect hardware */
#ifdef USE_UI
UiDrawStatusText("Detecting hardware...");
#else
printf("Detecting hardware...\n\n");
#endif
MachHwDetect();
#ifdef USE_UI
UiDrawStatusText("");
#endif
/* set boot device */
MachDiskGetBootDevice(&LoaderBlock.BootDevice);
/* Open boot drive */
if (!FsOpenBootVolume())
{
#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
#else
printf("Failed to open boot drive.");
#endif
return;
}
/* Open 'txtsetup.sif' */
if (!InfOpenFile (&InfHandle,
MachDiskBootingFromFloppy() ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
&ErrorLine))
{
printf("Failed to open 'txtsetup.sif'\n");
return;
}
/* Get load options */
if (!InfFindFirstLine (InfHandle,
"SetupData",
"OsLoadOptions",
&InfContext))
{
printf("Failed to find 'SetupData/OsLoadOptions'\n");
return;
}
if (!InfGetDataField (&InfContext,
1,
&LoadOptions))
{
printf("Failed to get load options\n");
return;
}
#if 0
printf("LoadOptions: '%s'\n", LoadOptions);
#endif
if (MachDiskBootingFromFloppy())
{
/* Boot from floppy disk */
SourcePath = "\\";
}
else
{
/* Boot from cdrom */
SourcePath = "\\reactos";
}
/* Set kernel command line */
MachDiskGetBootPath(reactos_kernel_cmdline, sizeof(reactos_kernel_cmdline));
strcat(strcat(strcat(reactos_kernel_cmdline, SourcePath), " "),
LoadOptions);
/* Setup the boot path and kernel path */
strcpy(szBootPath, SourcePath);
strcpy(szKernelName, szBootPath);
strcat(szKernelName, "\\ntoskrnl.exe");
/* Setup the HAL path */
strcpy(szHalName, szBootPath);
strcat(szHalName, "\\hal.dll");
/* Load the kernel */
if (!FrLdrLoadKernel(szKernelName, 5)) return;
/* Create ntoskrnl.sym */
LoadKernelSymbols(SourcePath, "ntoskrnl.exe");
/* Export the hardware hive */
Base = FrLdrCreateModule ("HARDWARE");
RegExportBinaryHive (L"\\Registry\\Machine\\HARDWARE", (PVOID)Base, &Size);
FrLdrCloseModule (Base, Size);
#if 0
printf("Base: %x\n", Base);
printf("Size: %u\n", Size);
printf("*** System stopped ***\n");
for(;;);
#endif
/* Insert boot disk 2 */
if (MachDiskBootingFromFloppy())
{
#ifdef USE_UI
UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER");
#else
printf("\n\n Please insert \"ReactOS Boot Disk 2\" and press ENTER\n");
MachConsGetCh();
#endif
/* Open boot drive */
if (!FsOpenBootVolume())
{
#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
#else
printf("Failed to open boot drive.");
#endif
return;
}
/* FIXME: check volume label or disk marker file */
}
/* Get ANSI codepage file */
if (!InfFindFirstLine (InfHandle,
"NLS",
"AnsiCodepage",
&InfContext))
{
printf("Failed to find 'NLS/AnsiCodepage'\n");
return;
}
if (!InfGetDataField (&InfContext,
1,
&LoadOptions))
{
printf("Failed to get load options\n");
return;
}
/* Load ANSI codepage file */
if (!LoadNlsFile(SourcePath, LoadOptions, "ansi.nls"))
{
#ifdef USE_UI
UiMessageBox("Failed to load the ANSI codepage file.");
#else
printf("Failed to load the ANSI codepage file.");
#endif
return;
}
/* Get OEM codepage file */
if (!InfFindFirstLine (InfHandle,
"NLS",
"OemCodepage",
&InfContext))
{
printf("Failed to find 'NLS/AnsiCodepage'\n");
return;
}
if (!InfGetDataField (&InfContext,
1,
&LoadOptions))
{
printf("Failed to get load options\n");
return;
}
/* Load OEM codepage file */
if (!LoadNlsFile(SourcePath, LoadOptions, "oem.nls"))
{
#ifdef USE_UI
UiMessageBox("Failed to load the OEM codepage file.");
#else
printf("Failed to load the OEM codepage file.");
#endif
return;
}
/* Get Unicode Casemap file */
if (!InfFindFirstLine (InfHandle,
"NLS",
"UnicodeCasetable",
&InfContext))
{
printf("Failed to find 'NLS/AnsiCodepage'\n");
return;
}
if (!InfGetDataField (&InfContext,
1,
&LoadOptions))
{
printf("Failed to get load options\n");
return;
}
/* Load Unicode casemap file */
if (!LoadNlsFile(SourcePath, LoadOptions, "casemap.nls"))
{
#ifdef USE_UI
UiMessageBox("Failed to load the Unicode casemap file.");
#else
printf("Failed to load the Unicode casemap file.");
#endif
return;
}
#if 0
/* Load acpi.sys */
if (!LoadDriver(SourcePath, "acpi.sys"))
return;
#endif
#if 0
/* Load isapnp.sys */
if (!LoadDriver(SourcePath, "isapnp.sys"))
return;
#endif
#if 0
/* Load pci.sys */
if (!LoadDriver(SourcePath, "pci.sys"))
return;
#endif
/* Load scsiport.sys */
if (!LoadDriver(SourcePath, "scsiport.sys"))
return;
/* Load atapi.sys (depends on hardware detection) */
if (!LoadDriver(SourcePath, "atapi.sys"))
return;
/* Load buslogic.sys (depends on hardware detection) */
if (!LoadDriver(SourcePath, "buslogic.sys"))
return;
/* Load class2.sys */
if (!LoadDriver(SourcePath, "class2.sys"))
return;
/* Load cdrom.sys */
if (!LoadDriver(SourcePath, "cdrom.sys"))
return;
/* Load cdfs.sys */
if (!LoadDriver(SourcePath, "cdfs.sys"))
return;
/* Load disk.sys */
if (!LoadDriver(SourcePath, "disk.sys"))
return;
/* Load floppy.sys */
if (!LoadDriver(SourcePath, "floppy.sys"))
return;
/* Load vfatfs.sys (could be loaded by the setup prog!) */
if (!LoadDriver(SourcePath, "vfatfs.sys"))
return;
/* Load keyboard driver */
#if 0
if (!LoadDriver(SourcePath, "keyboard.sys"))
return;
#endif
if (!LoadDriver(SourcePath, "i8042prt.sys"))
return;
if (!LoadDriver(SourcePath, "kbdclass.sys"))
return;
/* Load screen driver */
if (!LoadDriver(SourcePath, "blue.sys"))
return;
#ifdef USE_UI
UiUnInitialize("Booting ReactOS...");
#endif
/* Now boot the kernel */
DiskStopFloppyMotor();
MachVideoPrepareForReactOS();
FrLdrStartup(0x2badb002);
}
/* EOF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -