*/
#include <freeldr.h>
-
-#define NDEBUG
#include <debug.h>
-LOADER_PARAMETER_BLOCK LoaderBlock;
+extern ULONG PageDirectoryStart;
+extern ULONG PageDirectoryEnd;
+
+ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
char reactos_kernel_cmdline[255]; // Command line passed to kernel
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
char reactos_module_strings[64][256]; // Array to hold module names
-unsigned long reactos_memory_map_descriptor_size;
-memory_map_t reactos_memory_map[32]; // Memory map
-
+// Make this a single struct to guarantee that these elements are nearby in
+// memory.
+reactos_mem_data_t reactos_mem_data;
+ARC_DISK_SIGNATURE reactos_arc_disk_info[32]; // ARC Disk Information
+char reactos_arc_strings[32][256];
+unsigned long reactos_disk_count = 0;
+char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE] = {0};
+
+CHAR szHalName[255];
+CHAR szBootPath[255];
+CHAR SystemRoot[255];
static CHAR szLoadingMsg[] = "Loading ReactOS...";
+BOOLEAN FrLdrBootType;
+ULONG_PTR KernelBase;
+ROS_KERNEL_ENTRY_POINT KernelEntryPoint;
-static BOOL
-STDCALL
-FrLdrLoadKernel(PCHAR szFileName,
+BOOLEAN
+FrLdrLoadDriver(PCHAR szFileName,
INT nPos)
{
PFILE FilePointer;
- PCHAR szShortName;
- CHAR szBuffer[256];
+ CHAR value[256], *FinalSlash;
+ LPSTR p;
- /* Extract Kernel filename without path */
- szShortName = strrchr(szFileName, '\\');
- if (szShortName == NULL) {
+ if (!_stricmp(szFileName, "hal.dll"))
+ {
+ /* Use the boot.ini name instead */
+ szFileName = szHalName;
+ }
- /* No path, leave it alone */
- szShortName = szFileName;
+ FinalSlash = strrchr(szFileName, '\\');
+ if(FinalSlash)
+ szFileName = FinalSlash + 1;
- } else {
+ /* Open the Driver */
+ FilePointer = FsOpenFile(szFileName);
- /* Skip the path */
- szShortName = szShortName + 1;
+ /* Try under the system root in the main dir and drivers */
+ if (FilePointer == NULL)
+ {
+ strcpy(value, SystemRoot);
+ if(value[strlen(value)-1] != '\\')
+ strcat(value, "\\");
+ strcat(value, szFileName);
+ FilePointer = FsOpenFile(value);
}
- /* Open the Kernel */
- FilePointer = FsOpenFile(szFileName);
+ if (FilePointer == NULL)
+ {
+ strcpy(value, SystemRoot);
+ if(value[strlen(value)-1] != '\\')
+ strcat(value, "\\");
+ strcat(value, "SYSTEM32\\");
+ strcat(value, szFileName);
+ FilePointer = FsOpenFile(value);
+ }
+
+ if (FilePointer == NULL)
+ {
+ strcpy(value, SystemRoot);
+ if(value[strlen(value)-1] != '\\')
+ strcat(value, "\\");
+ strcat(value, "SYSTEM32\\DRIVERS\\");
+ strcat(value, szFileName);
+ FilePointer = FsOpenFile(value);
+ }
- /* Make sure it worked */
+ /* Make sure we did */
if (FilePointer == NULL) {
- /* Return failure on the short name */
- strcpy(szBuffer, szShortName);
- strcat(szBuffer, " not found.");
- UiMessageBox(szBuffer);
+ /* Fail if file wasn't opened */
+ strcpy(value, szFileName);
+ strcat(value, " not found.");
return(FALSE);
}
/* Update the status bar with the current file */
- strcpy(szBuffer, "Reading ");
- strcat(szBuffer, szShortName);
- UiDrawStatusText(szBuffer);
+ strcpy(value, "Reading ");
+ p = strrchr(szFileName, '\\');
+ if (p == NULL) {
- /* Do the actual loading */
- FrLdrMapKernel(FilePointer);
+ strcat(value, szFileName);
- /* Update Processbar and return success */
- UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);
- return(TRUE);
-}
+ } else {
-static VOID
-FreeldrFreeMem(PVOID Area)
-{
- MmFreeMemory(Area);
-}
+ strcat(value, p + 1);
-static PVOID
-FreeldrAllocMem(ULONG_PTR Size)
-{
- return MmAllocateMemory((ULONG) Size);
-}
+ }
+ UiDrawStatusText(value);
-static BOOLEAN
-FreeldrReadFile(PVOID FileContext, PVOID Buffer, ULONG Size)
-{
- ULONG BytesRead;
+ /* Load the driver */
+ FrLdrMapImage(FilePointer, szFileName, 0);
- return FsReadFile((PFILE) FileContext, (ULONG) Size, &BytesRead, Buffer)
- && Size == BytesRead;
+ /* Update status and return */
+ UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);
+ return(TRUE);
}
-static BOOLEAN
-FreeldrSeekFile(PVOID FileContext, ULONG_PTR Position)
+PVOID
+NTAPI
+FrLdrLoadImage(IN PCHAR szFileName,
+ IN INT nPos,
+ IN ULONG ImageType)
{
- FsSetFilePointer((PFILE) FileContext, (ULONG) Position);
- return TRUE;
-}
+ PFILE FilePointer;
+ PCHAR szShortName;
+ CHAR szBuffer[256], szFullPath[256];
+ PVOID LoadBase;
-static BOOL
-LoadKernelSymbols(PCHAR szKernelName, int nPos)
-{
- static ROSSYM_CALLBACKS FreeldrCallbacks =
+ /* Extract filename without path */
+ szShortName = strrchr(szFileName, '\\');
+ if (!szShortName)
{
- FreeldrAllocMem,
- FreeldrFreeMem,
- FreeldrReadFile,
- FreeldrSeekFile
- };
- PFILE FilePointer;
- PROSSYM_INFO RosSymInfo;
- ULONG Size;
- ULONG_PTR Base;
-
- RosSymInit(&FreeldrCallbacks);
-
- FilePointer = FsOpenFile(szKernelName);
- if (FilePointer == NULL)
+ /* No path, leave it alone */
+ szShortName = szFileName;
+
+ /* Which means we need to build a path now */
+ strcpy(szBuffer, szFileName);
+ strcpy(szFullPath, szBootPath);
+ if (!FrLdrBootType)
+ {
+ strcat(szFullPath, "SYSTEM32\\DRIVERS\\");
+ }
+ else
+ {
+ strcat(szFullPath, "\\");
+ }
+ strcat(szFullPath, szBuffer);
+ szFileName = szFullPath;
+ }
+ else
{
- return FALSE;
+ /* Skip the path */
+ szShortName = szShortName + 1;
}
- if (! RosSymCreateFromFile(FilePointer, &RosSymInfo))
+
+ /* Open the image */
+ FilePointer = FsOpenFile(szFileName);
+ if (!FilePointer)
{
- return FALSE;
+ /* Return failure on the short name */
+ strcpy(szBuffer, szShortName);
+ strcat(szBuffer, " not found.");
+ UiMessageBox(szBuffer);
+ return FALSE;
}
- Base = FrLdrCreateModule("NTOSKRNL.SYM");
- Size = RosSymGetRawDataLength(RosSymInfo);
- RosSymGetRawData(RosSymInfo, (PVOID)Base);
- FrLdrCloseModule(Base, Size);
- RosSymDelete(RosSymInfo);
- return TRUE;
+
+ /* Update the status bar with the current file */
+ strcpy(szBuffer, "Reading ");
+ strcat(szBuffer, szShortName);
+ UiDrawStatusText(szBuffer);
+
+ /* Do the actual loading */
+ LoadBase = FrLdrMapImage(FilePointer, szShortName, ImageType);
+
+ /* Update Processbar and return success */
+ if (!FrLdrBootType) UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);
+ return LoadBase;
}
-static BOOL
+static BOOLEAN
FrLdrLoadNlsFile(PCSTR szFileName,
PCSTR szModuleName)
{
return(TRUE);
}
-static BOOL
+static BOOLEAN
FrLdrLoadNlsFiles(PCHAR szSystemRoot,
PCHAR szErrorOut)
{
return(TRUE);
}
-static BOOL
-FrLdrLoadDriver(PCHAR szFileName,
- INT nPos)
-{
- PFILE FilePointer;
- CHAR value[256];
- LPSTR p;
-
- /* Open the Driver */
- FilePointer = FsOpenFile(szFileName);
-
- /* Make sure we did */
- if (FilePointer == NULL) {
-
- /* Fail if file wasn't opened */
- strcpy(value, szFileName);
- strcat(value, " not found.");
- UiMessageBox(value);
- return(FALSE);
- }
-
- /* Update the status bar with the current file */
- strcpy(value, "Reading ");
- p = strrchr(szFileName, '\\');
- if (p == NULL) {
-
- strcat(value, szFileName);
-
- } else {
-
- strcat(value, p + 1);
-
- }
- UiDrawStatusText(value);
-
- /* Load the driver */
- FrLdrLoadModule(FilePointer, szFileName, NULL);
-
- /* Update status and return */
- UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);
- return(TRUE);
-}
-
static VOID
FrLdrLoadBootDrivers(PCHAR szSystemRoot,
INT nPos)
if (rc != ERROR_SUCCESS) OrderList[0] = 0;
/* enumerate all drivers */
- for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
+ for (TagIndex = 1; TagIndex <= SWAPD(OrderList[0]); TagIndex++) {
Index = 0;
/* Update the position if needed */
if (nPos < 100) nPos += 5;
- FrLdrLoadDriver(ImagePath, nPos);
+ FrLdrLoadImage(ImagePath, nPos, 2);
} else {
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
+ if (rc == ERROR_SUCCESS)
+ {
+ /* Read the Start Value */
+ ValueSize = sizeof(ULONG);
+ rc = RegQueryValue(hDriverKey, L"Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
+ if (rc != ERROR_SUCCESS) StartValue = (ULONG)-1;
+ DbgPrint((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
+
+ /* Read the Tag */
+ ValueSize = sizeof(ULONG);
+ rc = RegQueryValue(hDriverKey, L"Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize);
+ if (rc != ERROR_SUCCESS) TagValue = (ULONG)-1;
+ DbgPrint((DPRINT_REACTOS, " Tag: %x \n", (int)TagValue));
+
+ /* Read the driver's group */
+ DriverGroupSize = sizeof(DriverGroup);
+ rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
+ DbgPrint((DPRINT_REACTOS, " Group: '%S' \n", DriverGroup));
+
+ for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
+ if (TagValue == OrderList[TagIndex]) break;
+ }
- /* Read the Start Value */
- ValueSize = sizeof(ULONG);
- rc = RegQueryValue(hDriverKey, L"Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
- if (rc != ERROR_SUCCESS) StartValue = (ULONG)-1;
- DbgPrint((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
-
- /* Read the Tag */
- ValueSize = sizeof(ULONG);
- rc = RegQueryValue(hDriverKey, L"Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize);
- if (rc != ERROR_SUCCESS) TagValue = (ULONG)-1;
- DbgPrint((DPRINT_REACTOS, " Tag: %x \n", (int)TagValue));
-
- /* Read the driver's group */
- DriverGroupSize = sizeof(DriverGroup);
- rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
- DbgPrint((DPRINT_REACTOS, " Group: '%S' \n", DriverGroup));
-
- for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
- if (TagValue == OrderList[TagIndex]) break;
- }
+ if ((StartValue == 0) &&
+ (TagIndex > OrderList[0]) &&
+ (_wcsicmp(DriverGroup, GroupName) == 0)) {
- if ((StartValue == 0) &&
- (TagIndex > OrderList[0]) &&
- (_wcsicmp(DriverGroup, GroupName) == 0)) {
-
- ValueSize = sizeof(TempImagePath);
- rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
- if (rc != ERROR_SUCCESS) {
- DbgPrint((DPRINT_REACTOS, " ImagePath: not found\n"));
- sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", szSystemRoot, ServiceName);
- } else if (TempImagePath[0] != L'\\') {
- sprintf(ImagePath, "%s%S", szSystemRoot, TempImagePath);
- } else {
- sprintf(ImagePath, "%S", TempImagePath);
- DbgPrint((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
- }
- DbgPrint((DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath));
+ ValueSize = sizeof(TempImagePath);
+ rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
+ if (rc != ERROR_SUCCESS) {
+ DbgPrint((DPRINT_REACTOS, " ImagePath: not found\n"));
+ sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", szSystemRoot, ServiceName);
+ } else if (TempImagePath[0] != L'\\') {
+ sprintf(ImagePath, "%s%S", szSystemRoot, TempImagePath);
+ } else {
+ sprintf(ImagePath, "%S", TempImagePath);
+ DbgPrint((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
+ }
+ DbgPrint((DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath));
- if (nPos < 100) nPos += 5;
+ if (nPos < 100) nPos += 5;
- FrLdrLoadDriver(ImagePath, nPos);
+ FrLdrLoadImage(ImagePath, nPos, 2);
- } else {
+ } else {
- DbgPrint((DPRINT_REACTOS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current group '%S')\n",
- ServiceName, StartValue, TagValue, DriverGroup, GroupName));
+ DbgPrint((DPRINT_REACTOS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current group '%S')\n",
+ ServiceName, StartValue, TagValue, DriverGroup, GroupName));
+ }
}
Index++;
LoadAndBootReactOS(PCSTR OperatingSystemName)
{
PFILE FilePointer;
- CHAR name[1024];
- CHAR value[1024];
- CHAR SystemPath[1024];
- CHAR szKernelName[1024];
- CHAR szHalName[1024];
- CHAR szFileName[1024];
- CHAR szBootPath[256];
- UINT i;
+ CHAR name[255];
+ CHAR value[255];
+ CHAR SystemPath[255];
+ CHAR szKernelName[255];
+ CHAR szFileName[255];
CHAR MsgBuffer[256];
ULONG SectionId;
-
+ PIMAGE_NT_HEADERS NtHeader;
+ PVOID LoadBase;
ULONG_PTR Base;
ULONG Size;
- extern ULONG PageDirectoryStart;
- extern ULONG PageDirectoryEnd;
- extern BOOLEAN AcpiPresent;
-
//
// Open the operating system section
// specified in the .ini file
/*
* Setup multiboot information structure
*/
- LoaderBlock.Flags = MB_FLAGS_BOOT_DEVICE | MB_FLAGS_COMMAND_LINE | MB_FLAGS_MODULE_INFO;
+ LoaderBlock.CommandLine = reactos_kernel_cmdline;
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
- LoaderBlock.BootDevice = 0xffffffff;
- LoaderBlock.CommandLine = (unsigned long)reactos_kernel_cmdline;
LoaderBlock.ModsCount = 0;
- LoaderBlock.ModsAddr = (unsigned long)reactos_modules;
- LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&reactos_memory_map, 32) * sizeof(memory_map_t);
- if (LoaderBlock.MmapLength)
- {
- LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
- LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
- reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
- DbgPrint((DPRINT_REACTOS, "memory map length: %d\n", LoaderBlock.MmapLength));
- DbgPrint((DPRINT_REACTOS, "dumping memory map:\n"));
- for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
- {
- if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
- 0 == reactos_memory_map[i].base_addr_low)
- {
- LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
- if (640 < LoaderBlock.MemLower)
- {
- LoaderBlock.MemLower = 640;
- }
- }
- if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
- reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
- 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;
- }
- DbgPrint((DPRINT_REACTOS, "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));
- }
- }
- DbgPrint((DPRINT_REACTOS, "low_mem = %d\n", LoaderBlock.MemLower));
- DbgPrint((DPRINT_REACTOS, "high_mem = %d\n", LoaderBlock.MemHigher));
+ LoaderBlock.ModsAddr = reactos_modules;
+ LoaderBlock.DrivesAddr = reactos_arc_disk_info;
+ LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t);
+ if (LoaderBlock.MmapLength)
+ {
+ ULONG i;
+ LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
+ LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
+ reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
+ for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
+ {
+#ifdef _M_PPC
+ ULONG tmp;
+ /* Also swap from long long to high/low
+ * We also have unusable memory that will be available to kernel
+ * land. Mark it here.
+ */
+ if (BiosMemoryAcpiReclaim == reactos_memory_map[i].type)
+ {
+ reactos_memory_map[i].type = BiosMemoryUsable;
+ }
+
+ tmp = reactos_memory_map[i].base_addr_low;
+ reactos_memory_map[i].base_addr_low = reactos_memory_map[i].base_addr_high;
+ reactos_memory_map[i].base_addr_high = tmp;
+ tmp = reactos_memory_map[i].length_low;
+ reactos_memory_map[i].length_low = reactos_memory_map[i].length_high;
+ reactos_memory_map[i].length_high = tmp;
+#endif
+
+ if (BiosMemoryUsable == reactos_memory_map[i].type &&
+ 0 == reactos_memory_map[i].base_addr_low)
+ {
+ LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
+ if (640 < LoaderBlock.MemLower)
+ {
+ LoaderBlock.MemLower = 640;
+ }
+ }
+ if (BiosMemoryUsable == reactos_memory_map[i].type &&
+ reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
+ 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;
+ }
+ }
+ }
/*
* Initialize the registry
/*
* Read the optional kernel parameters (if any)
*/
- if (IniReadSettingByName(SectionId, "Options", value, 1024))
+ if (IniReadSettingByName(SectionId, "Options", value, sizeof(value)))
{
strcat(reactos_kernel_cmdline, " ");
strcat(reactos_kernel_cmdline, value);
/*
* Detect hardware
*/
- MachHwDetect();
+ LoaderBlock.ArchExtra = (ULONG)MachHwDetect();
UiDrawProgressBarCenter(5, 100, szLoadingMsg);
- if (AcpiPresent) LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE;
+ LoaderBlock.DrivesCount = reactos_disk_count;
UiDrawStatusText("Loading...");
+ //
+ // If we have a ramdisk, this will switch to the ramdisk disk routines
+ // which read from memory instead of using the firmware. This has to be done
+ // after hardware detection, since hardware detection will require using the
+ // real routines in order to perform disk-detection (just because we're on a
+ // ram-boot doesn't mean the user doesn't have actual disks installed too!)
+ //
+ RamDiskSwitchFromBios();
+
/*
* Try to open system drive
*/
strcat(szBootPath, "\\");
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
+ strcpy(SystemRoot, szBootPath);
/*
* Find the kernel image name
* and try to load the kernel off the disk
*/
- if(IniReadSettingByName(SectionId, "Kernel", value, 1024))
+ if(IniReadSettingByName(SectionId, "Kernel", value, sizeof(value)))
{
/*
* Set the name and
strcat(szKernelName, value);
}
- if (!FrLdrLoadKernel(szKernelName, 5)) return;
-
/*
* Find the HAL image name
* and try to load the kernel off the disk
*/
- if(IniReadSettingByName(SectionId, "Hal", value, 1024))
+ if(IniReadSettingByName(SectionId, "Hal", value, sizeof(value)))
{
/*
* Set the name and
strcat(szHalName, value);
}
- if (!FrLdrLoadDriver(szHalName, 10))
- return;
+ /* Load the kernel */
+ LoadBase = FrLdrLoadImage(szKernelName, 5, 1);
+ if (!LoadBase) return;
-#if 0
- /* Load bootvid */
- strcpy(value, "INBV.DLL");
- strcpy(szHalName, szBootPath);
- strcat(szHalName, "SYSTEM32\\");
- strcat(szHalName, value);
+ /* Get the NT header, kernel base and kernel entry */
+ NtHeader = RtlImageNtHeader(LoadBase);
+ KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase);
+ KernelEntryPoint = (ROS_KERNEL_ENTRY_POINT)(KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint));
+ LoaderBlock.KernelBase = KernelBase;
- if (!FrLdrLoadDriver(szHalName, 10))
- return;
-#endif
/*
* Load the System hive from disk
*/
UiDrawProgressBarCenter(15, 100, szLoadingMsg);
- /*
- * Export the hardware hive
- */
- Base = FrLdrCreateModule ("HARDWARE");
- RegExportBinaryHive (L"\\Registry\\Machine\\HARDWARE", (PCHAR)Base, &Size);
- FrLdrCloseModule (Base, Size);
-
UiDrawProgressBarCenter(20, 100, szLoadingMsg);
/*
*/
if (!FrLdrLoadNlsFiles(szBootPath, MsgBuffer))
{
- UiMessageBox(MsgBuffer);
+ UiMessageBox(MsgBuffer);
return;
}
UiDrawProgressBarCenter(30, 100, szLoadingMsg);
- /*
- * Load kernel symbols
- */
- LoadKernelSymbols(szKernelName, 30);
- UiDrawProgressBarCenter(40, 100, szLoadingMsg);
-
/*
* Load boot drivers
*/
FrLdrLoadBootDrivers(szBootPath, 40);
- UiUnInitialize("Booting ReactOS...");
+ //UiUnInitialize("Booting ReactOS...");
- /*
- * Now boot the kernel
- */
- DiskStopFloppyMotor();
- MachVideoPrepareForReactOS();
- FrLdrStartup(0x2badb002);
+ //
+ // Perform architecture-specific pre-boot configuration
+ //
+ MachPrepareForReactOS(FALSE);
+
+ //
+ // Setup paging and jump to kernel
+ //
+ FrLdrStartup(0x2badb002);
}
#undef DbgPrint
ULONG
-DbgPrint(char *Fmt, ...)
+DbgPrint(const char *Format, ...)
{
- UiMessageBox(Fmt);
- return 0;
+ va_list ap;
+ CHAR Buffer[512];
+ ULONG Length;
+
+ va_start(ap, Format);
+
+ /* Construct a string */
+ Length = _vsnprintf(Buffer, 512, Format, ap);
+
+ /* Check if we went past the buffer */
+ if (Length == -1)
+ {
+ /* Terminate it if we went over-board */
+ Buffer[sizeof(Buffer) - 1] = '\n';
+
+ /* Put maximum */
+ Length = sizeof(Buffer);
+ }
+
+ /* Show it as a message box */
+ UiMessageBox(Buffer);
+
+ /* Cleanup and exit */
+ va_end(ap);
+ return 0;
}
/* EOF */