4 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <multiboot.h>
39 #define IsRecognizedPartition(P) \
40 ((P) == PARTITION_FAT_12 || \
41 (P) == PARTITION_FAT_16 || \
42 (P) == PARTITION_HUGE || \
43 (P) == PARTITION_IFS || \
44 (P) == PARTITION_EXT2 || \
45 (P) == PARTITION_FAT32 || \
46 (P) == PARTITION_FAT32_XINT13 || \
47 (P) == PARTITION_XINT13)
50 LoadKernel(PCHAR szFileName
, int nPos
)
56 szShortName
= strrchr(szFileName
, '\\');
57 if (szShortName
== NULL
)
58 szShortName
= szFileName
;
60 szShortName
= szShortName
+ 1;
62 FilePointer
= FsOpenFile(szFileName
);
63 if (FilePointer
== NULL
)
65 strcpy(szBuffer
, szShortName
);
66 strcat(szBuffer
, " not found.");
67 UiMessageBox(szBuffer
);
72 * Update the status bar with the current file
74 strcpy(szBuffer
, "Reading ");
75 strcat(szBuffer
, szShortName
);
76 UiDrawStatusText(szBuffer
);
81 MultiBootLoadKernel(FilePointer
);
83 UiDrawProgressBarCenter(nPos
, 100, "Loading ReactOS...");
89 LoadSymbolFile(PCHAR szSystemRoot
,
93 CHAR SymbolFileName
[1024];
101 /* Get the path to the symbol store */
102 strcpy(SymbolFileName
, szSystemRoot
);
103 strcat(SymbolFileName
, "symbols\\");
105 /* Get the symbol filename from the module name */
106 Start
= strrchr(ModuleName
, '\\');
112 Ext
= strrchr(ModuleName
, '.');
114 Length
= Ext
- Start
;
116 Length
= strlen(Start
);
118 strncat(SymbolFileName
, Start
, Length
);
119 strcat(SymbolFileName
, ".sym");
121 FilePointer
= FsOpenFile((PCHAR
)&SymbolFileName
[0]);
122 if (FilePointer
== NULL
)
124 DbgPrint((DPRINT_REACTOS
, "Symbol file %s not loaded.\n", SymbolFileName
));
125 /* This is not critical */
129 DbgPrint((DPRINT_REACTOS
, "Symbol file %s is loaded.\n", SymbolFileName
));
132 * Update the status bar with the current file
134 strcpy(value
, "Reading ");
135 p
= strrchr(SymbolFileName
, '\\');
137 strcat(value
, SymbolFileName
);
139 strcat(value
, p
+ 1);
140 UiDrawStatusText(value
);
143 * Load the symbol file
145 MultiBootLoadModule(FilePointer
, SymbolFileName
, NULL
);
147 UiDrawProgressBarCenter(nPos
, 100, "Loading ReactOS...");
154 LoadDriver(PCHAR szFileName
, int nPos
)
160 FilePointer
= FsOpenFile(szFileName
);
161 if (FilePointer
== NULL
)
163 strcpy(value
, szFileName
);
164 strcat(value
, " not found.");
170 * Update the status bar with the current file
172 strcpy(value
, "Reading ");
173 p
= strrchr(szFileName
, '\\');
175 strcat(value
, szFileName
);
177 strcat(value
, p
+ 1);
178 UiDrawStatusText(value
);
183 MultiBootLoadModule(FilePointer
, szFileName
, NULL
);
185 UiDrawProgressBarCenter(nPos
, 100, "Loading ReactOS...");
192 LoadNlsFile(PCHAR szFileName
, PCHAR szModuleName
)
198 FilePointer
= FsOpenFile(szFileName
);
199 if (FilePointer
== NULL
)
201 strcpy(value
, szFileName
);
202 strcat(value
, " not found.");
208 * Update the status bar with the current file
210 strcpy(value
, "Reading ");
211 p
= strrchr(szFileName
, '\\');
213 strcat(value
, szFileName
);
215 strcat(value
, p
+ 1);
216 UiDrawStatusText(value
);
221 MultiBootLoadModule(FilePointer
, szModuleName
, NULL
);
228 LoadBootDrivers(PCHAR szSystemRoot
, int nPos
)
231 HKEY hGroupKey
, hOrderKey
, hServiceKey
, hDriverKey
;
232 char GroupNameBuffer
[512];
233 char ServiceName
[256];
244 UCHAR DriverGroup
[256];
247 UCHAR ImagePath
[256];
248 UCHAR TempImagePath
[256];
250 /* get 'service group order' key */
251 rc
= RegOpenKey(NULL
,
252 "\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\ServiceGroupOrder",
254 if (rc
!= ERROR_SUCCESS
)
256 DbgPrint((DPRINT_REACTOS
, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc
));
260 /* get 'group order list' key */
261 rc
= RegOpenKey(NULL
,
262 "\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\GroupOrderList",
264 if (rc
!= ERROR_SUCCESS
)
266 DbgPrint((DPRINT_REACTOS
, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc
));
270 /* enumerate drivers */
271 rc
= RegOpenKey(NULL
,
272 "\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services",
274 if (rc
!= ERROR_SUCCESS
)
276 DbgPrint((DPRINT_REACTOS
, "Failed to open the 'Services' key (rc %d)\n", (int)rc
));
280 BufferSize
= sizeof(GroupNameBuffer
);
281 rc
= RegQueryValue(hGroupKey
, "List", NULL
, (PUCHAR
)GroupNameBuffer
, &BufferSize
);
282 DbgPrint((DPRINT_REACTOS
, "RegQueryValue(): rc %d\n", (int)rc
));
283 if (rc
!= ERROR_SUCCESS
)
286 DbgPrint((DPRINT_REACTOS
, "BufferSize: %d \n", (int)BufferSize
));
288 DbgPrint((DPRINT_REACTOS
, "GroupNameBuffer: '%s' \n", GroupNameBuffer
));
290 GroupName
= GroupNameBuffer
;
293 DbgPrint((DPRINT_REACTOS
, "Driver group: '%s'\n", GroupName
));
295 BufferSize
= sizeof(OrderList
);
296 rc
= RegQueryValue(hOrderKey
, GroupName
, NULL
, (PUCHAR
)OrderList
, &BufferSize
);
297 if (rc
!= ERROR_SUCCESS
)
302 for (TagIndex
= 1; TagIndex
<= OrderList
[0]; TagIndex
++)
304 /* enumerate all drivers */
308 ValueSize
= sizeof(ServiceName
);
309 rc
= RegEnumKey(hServiceKey
, Index
, ServiceName
, &ValueSize
);
310 DbgPrint((DPRINT_REACTOS
, "RegEnumKey(): rc %d\n", (int)rc
));
311 if (rc
== ERROR_NO_MORE_ITEMS
)
313 if (rc
!= ERROR_SUCCESS
)
315 DbgPrint((DPRINT_REACTOS
, "Service %d: '%s'\n", (int)Index
, ServiceName
));
317 /* open driver Key */
318 rc
= RegOpenKey(hServiceKey
, ServiceName
, &hDriverKey
);
320 ValueSize
= sizeof(U32
);
321 rc
= RegQueryValue(hDriverKey
, "Start", &ValueType
, (PUCHAR
)&StartValue
, &ValueSize
);
322 DbgPrint((DPRINT_REACTOS
, " Start: %x \n", (int)StartValue
));
324 ValueSize
= sizeof(U32
);
325 rc
= RegQueryValue(hDriverKey
, "Tag", &ValueType
, (PUCHAR
)&TagValue
, &ValueSize
);
326 if (rc
!= ERROR_SUCCESS
)
330 DbgPrint((DPRINT_REACTOS
, " Tag: %x \n", (int)TagValue
));
333 DriverGroupSize
= 256;
334 rc
= RegQueryValue(hDriverKey
, "Group", NULL
, (PUCHAR
)DriverGroup
, &DriverGroupSize
);
335 DbgPrint((DPRINT_REACTOS
, " Group: '%s' \n", DriverGroup
));
337 if ((StartValue
== 0) && (TagValue
== OrderList
[TagIndex
]) &&(stricmp(DriverGroup
, GroupName
) == 0))
340 rc
= RegQueryValue(hDriverKey
,
343 (PUCHAR
)TempImagePath
,
345 if (rc
!= ERROR_SUCCESS
)
347 DbgPrint((DPRINT_REACTOS
, " ImagePath: not found\n"));
348 strcpy(ImagePath
, szSystemRoot
);
349 strcat(ImagePath
, "system32\\drivers\\");
350 strcat(ImagePath
, ServiceName
);
351 strcat(ImagePath
, ".sys");
353 else if (TempImagePath
[0] != '\\')
355 strcpy(ImagePath
, szSystemRoot
);
356 strcat(ImagePath
, TempImagePath
);
360 strcpy(ImagePath
, TempImagePath
);
361 DbgPrint((DPRINT_REACTOS
, " ImagePath: '%s'\n", ImagePath
));
363 DbgPrint((DPRINT_REACTOS
, " Loading driver: '%s'\n", ImagePath
));
368 LoadDriver(ImagePath
, nPos
);
369 LoadSymbolFile(szSystemRoot
, ImagePath
, nPos
);
373 DbgPrint((DPRINT_REACTOS
, " Skipping driver '%s' with Start %d, Tag %d and Group '%s' (Current Tag %d, current group '%s')\n",
374 ServiceName
, StartValue
, TagValue
, DriverGroup
, OrderList
[TagIndex
], GroupName
));
383 ValueSize
= sizeof(ServiceName
);
384 rc
= RegEnumKey(hServiceKey
, Index
, ServiceName
, &ValueSize
);
385 DbgPrint((DPRINT_REACTOS
, "RegEnumKey(): rc %d\n", (int)rc
));
386 if (rc
== ERROR_NO_MORE_ITEMS
)
388 if (rc
!= ERROR_SUCCESS
)
390 DbgPrint((DPRINT_REACTOS
, "Service %d: '%s'\n", (int)Index
, ServiceName
));
392 /* open driver Key */
393 rc
= RegOpenKey(hServiceKey
, ServiceName
, &hDriverKey
);
395 ValueSize
= sizeof(U32
);
396 rc
= RegQueryValue(hDriverKey
, "Start", &ValueType
, (PUCHAR
)&StartValue
, &ValueSize
);
397 DbgPrint((DPRINT_REACTOS
, " Start: %x \n", (int)StartValue
));
399 ValueSize
= sizeof(U32
);
400 rc
= RegQueryValue(hDriverKey
, "Tag", &ValueType
, (PUCHAR
)&TagValue
, &ValueSize
);
401 if (rc
!= ERROR_SUCCESS
)
405 DbgPrint((DPRINT_REACTOS
, " Tag: %x \n", (int)TagValue
));
407 DriverGroupSize
= 256;
408 rc
= RegQueryValue(hDriverKey
, "Group", NULL
, (PUCHAR
)DriverGroup
, &DriverGroupSize
);
409 DbgPrint((DPRINT_REACTOS
, " Group: '%s' \n", DriverGroup
));
411 for (TagIndex
= 1; TagIndex
<= OrderList
[0]; TagIndex
++)
413 if (TagValue
== OrderList
[TagIndex
])
417 if ((StartValue
== 0) && (TagIndex
> OrderList
[0]) && (stricmp(DriverGroup
, GroupName
) == 0))
420 rc
= RegQueryValue(hDriverKey
,
423 (PUCHAR
)TempImagePath
,
425 if (rc
!= ERROR_SUCCESS
)
427 DbgPrint((DPRINT_REACTOS
, " ImagePath: not found\n"));
428 strcpy(ImagePath
, szSystemRoot
);
429 strcat(ImagePath
, "system32\\drivers\\");
430 strcat(ImagePath
, ServiceName
);
431 strcat(ImagePath
, ".sys");
433 else if (TempImagePath
[0] != '\\')
435 strcpy(ImagePath
, szSystemRoot
);
436 strcat(ImagePath
, TempImagePath
);
440 strcpy(ImagePath
, TempImagePath
);
441 DbgPrint((DPRINT_REACTOS
, " ImagePath: '%s'\n", ImagePath
));
443 DbgPrint((DPRINT_REACTOS
, " Loading driver: '%s'\n", ImagePath
));
448 LoadDriver(ImagePath
, nPos
);
449 LoadSymbolFile(szSystemRoot
, ImagePath
, nPos
);
453 DbgPrint((DPRINT_REACTOS
, " Skipping driver '%s' with Start %d, Tag %d and Group '%s' (Current group '%s')\n",
454 ServiceName
, StartValue
, TagValue
, DriverGroup
, GroupName
));
459 GroupName
= GroupName
+ strlen(GroupName
) + 1;
465 LoadNlsFiles(PCHAR szSystemRoot
, PCHAR szErrorOut
)
467 S32 rc
= ERROR_SUCCESS
;
470 char szNameBuffer
[80];
471 char szFileName
[256];
474 /* open the codepage key */
475 rc
= RegOpenKey(NULL
,
476 "\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage",
478 if (rc
!= ERROR_SUCCESS
) {
479 strcpy(szErrorOut
, "Couldn't open CodePage registry key");
484 /* get ANSI codepage */
486 rc
= RegQueryValue(hKey
, "ACP", NULL
, (PUCHAR
)szIdBuffer
, &BufferSize
);
487 if (rc
!= ERROR_SUCCESS
) {
488 strcpy(szErrorOut
, "Couldn't get ACP NLS setting");
493 rc
= RegQueryValue(hKey
, szIdBuffer
, NULL
, (PUCHAR
)szNameBuffer
, &BufferSize
);
494 if (rc
!= ERROR_SUCCESS
) {
495 strcpy(szErrorOut
, "ACP NLS Setting exists, but isn't readable");
499 /* load ANSI codepage table */
500 strcpy(szFileName
, szSystemRoot
);
501 strcat(szFileName
, "system32\\");
502 strcat(szFileName
, szNameBuffer
);
503 DbgPrint((DPRINT_REACTOS
, "ANSI file: %s\n", szFileName
));
504 if (!LoadNlsFile(szFileName
, "ansi.nls")) {
505 strcpy(szErrorOut
, "Couldn't load ansi.nls");
509 /* get OEM codepage */
511 rc
= RegQueryValue(hKey
, "OEMCP", NULL
, (PUCHAR
)szIdBuffer
, &BufferSize
);
512 if (rc
!= ERROR_SUCCESS
) {
513 strcpy(szErrorOut
, "Couldn't get OEMCP NLS setting");
518 rc
= RegQueryValue(hKey
, szIdBuffer
, NULL
, (PUCHAR
)szNameBuffer
, &BufferSize
);
519 if (rc
!= ERROR_SUCCESS
) {
520 strcpy(szErrorOut
, "OEMCP NLS setting exists, but isn't readable");
524 /* load OEM codepage table */
525 strcpy(szFileName
, szSystemRoot
);
526 strcat(szFileName
, "system32\\");
527 strcat(szFileName
, szNameBuffer
);
528 DbgPrint((DPRINT_REACTOS
, "Oem file: %s\n", szFileName
));
529 if (!LoadNlsFile(szFileName
, "oem.nls")) {
530 strcpy(szErrorOut
, "Couldn't load oem.nls");
534 /* open the language key */
535 rc
= RegOpenKey(NULL
,
536 "\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language",
538 if (rc
!= ERROR_SUCCESS
) {
539 strcpy(szErrorOut
, "Couldn't open Language registry key");
543 /* get the Unicode case table */
545 rc
= RegQueryValue(hKey
, "Default", NULL
, (PUCHAR
)szIdBuffer
, &BufferSize
);
546 if (rc
!= ERROR_SUCCESS
) {
547 strcpy(szErrorOut
, "Couldn't get Language Default setting");
552 rc
= RegQueryValue(hKey
, szIdBuffer
, NULL
, (PUCHAR
)szNameBuffer
, &BufferSize
);
553 if (rc
!= ERROR_SUCCESS
) {
555 "Language Default setting exists, but isn't readable");
559 /* load Unicode case table */
560 strcpy(szFileName
, szSystemRoot
);
561 strcat(szFileName
, "system32\\");
562 strcat(szFileName
, szNameBuffer
);
563 DbgPrint((DPRINT_REACTOS
, "Casemap file: %s\n", szFileName
));
564 if (!LoadNlsFile(szFileName
, "casemap.nls")) {
565 strcpy(szErrorOut
, "casemap.nls");
574 LoadAndBootReactOS(PUCHAR OperatingSystemName
)
579 char szKernelName
[1024];
580 char szHalName
[1024];
581 char szFileName
[1024];
582 char szBootPath
[256];
590 PARTITION_TABLE_ENTRY PartitionTableEntry
;
594 // Open the operating system section
595 // specified in the .ini file
597 if (!IniOpenSection(OperatingSystemName
, &SectionId
))
599 sprintf(MsgBuffer
,"Operating System section '%s' not found in freeldr.ini", OperatingSystemName
);
600 UiMessageBox(MsgBuffer
);
605 * Setup multiboot information structure
607 mb_info
.flags
= MB_INFO_FLAG_MEM_SIZE
| MB_INFO_FLAG_BOOT_DEVICE
| MB_INFO_FLAG_COMMAND_LINE
| MB_INFO_FLAG_MODULES
;
608 mb_info
.boot_device
= 0xffffffff;
609 mb_info
.cmdline
= (unsigned long)multiboot_kernel_cmdline
;
610 mb_info
.mods_count
= 0;
611 mb_info
.mods_addr
= (unsigned long)multiboot_modules
;
612 mb_info
.mmap_length
= (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP
)(PVOID
)&multiboot_memory_map
, 32) * sizeof(memory_map_t
);
613 if (mb_info
.mmap_length
)
615 mb_info
.mmap_addr
= (unsigned long)&multiboot_memory_map
;
616 mb_info
.flags
|= MB_INFO_FLAG_MEM_SIZE
| MB_INFO_FLAG_MEMORY_MAP
;
617 multiboot_memory_map_descriptor_size
= sizeof(memory_map_t
); // GetBiosMemoryMap uses a fixed value of 24
618 DbgPrint((DPRINT_REACTOS
, "memory map length: %d\n", mb_info
.mmap_length
));
619 DbgPrint((DPRINT_REACTOS
, "dumping memory map:\n"));
620 for (i
=0; i
<(mb_info
.mmap_length
/sizeof(memory_map_t
)); i
++)
622 if (MEMTYPE_USABLE
== multiboot_memory_map
[i
].type
&&
623 0 == multiboot_memory_map
[i
].base_addr_low
)
625 mb_info
.mem_lower
= (multiboot_memory_map
[i
].base_addr_low
+ multiboot_memory_map
[i
].length_low
) / 1024;
626 if (640 < mb_info
.mem_lower
)
628 mb_info
.mem_lower
= 640;
631 if (MEMTYPE_USABLE
== multiboot_memory_map
[i
].type
&&
632 multiboot_memory_map
[i
].base_addr_low
<= 1024 * 1024 &&
633 1024 * 1024 <= multiboot_memory_map
[i
].base_addr_low
+ multiboot_memory_map
[i
].length_low
)
635 mb_info
.mem_upper
= (multiboot_memory_map
[i
].base_addr_low
+ multiboot_memory_map
[i
].length_low
) / 1024 - 1024;
637 DbgPrint((DPRINT_REACTOS
, "start: %x\t size: %x\t type %d\n",
638 multiboot_memory_map
[i
].base_addr_low
,
639 multiboot_memory_map
[i
].length_low
,
640 multiboot_memory_map
[i
].type
));
643 DbgPrint((DPRINT_REACTOS
, "low_mem = %d\n", mb_info
.mem_lower
));
644 DbgPrint((DPRINT_REACTOS
, "high_mem = %d\n", mb_info
.mem_upper
));
647 * Initialize the registry
649 RegInitializeRegistry();
652 * Make sure the system path is set in the .ini file
654 if (!IniReadSettingByName(SectionId
, "SystemPath", value
, 1024))
656 UiMessageBox("System path not specified for selected operating system.");
661 * Special case for Live CD.
663 if (!stricmp(value
, "LiveCD"))
665 strcpy(szBootPath
, "\\reactos");
667 /* Set kernel command line */
668 sprintf(multiboot_kernel_cmdline
,
669 "multi(0)disk(0)cdrom(%u)\\reactos /MININT",
670 (unsigned int)BootDrive
);
677 if (!DissectArcPath(value
, szBootPath
, &BootDrive
, &BootPartition
))
679 sprintf(MsgBuffer
,"Invalid system path: '%s'", value
);
680 UiMessageBox(MsgBuffer
);
684 /* recalculate the boot partition for freeldr */
689 if (!MachDiskGetPartitionEntry(BootDrive
, ++i
, &PartitionTableEntry
))
694 if (IsRecognizedPartition(PartitionTableEntry
.SystemIndicator
))
696 if (++rosPartition
== BootPartition
)
704 if (BootPartition
== 0)
706 sprintf(MsgBuffer
,"Invalid system path: '%s'", value
);
707 UiMessageBox(MsgBuffer
);
711 /* copy ARC path into kernel command line */
712 strcpy(multiboot_kernel_cmdline
, value
);
715 /* Set boot drive and partition */
716 ((char *)(&mb_info
.boot_device
))[0] = (char)BootDrive
;
717 ((char *)(&mb_info
.boot_device
))[1] = (char)BootPartition
;
720 * Read the optional kernel parameters (if any)
722 if (IniReadSettingByName(SectionId
, "Options", value
, 1024))
724 strcat(multiboot_kernel_cmdline
, " ");
725 strcat(multiboot_kernel_cmdline
, value
);
728 /* append a backslash */
729 if ((strlen(szBootPath
)==0) ||
730 szBootPath
[strlen(szBootPath
)] != '\\')
731 strcat(szBootPath
, "\\");
733 DbgPrint((DPRINT_REACTOS
,"SystemRoot: '%s'\n", szBootPath
));
737 UiDrawStatusText("Detecting Hardware...");
745 UiDrawStatusText("Loading...");
746 UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
749 * Try to open boot drive
751 if (!FsOpenVolume(BootDrive
, BootPartition
))
753 UiMessageBox("Failed to open boot drive.");
758 * Find the kernel image name
759 * and try to load the kernel off the disk
761 if(IniReadSettingByName(SectionId
, "Kernel", value
, 1024))
766 if (value
[0] == '\\')
768 strcpy(szKernelName
, value
);
772 strcpy(szKernelName
, szBootPath
);
773 strcat(szKernelName
, "SYSTEM32\\");
774 strcat(szKernelName
, value
);
779 strcpy(value
, "NTOSKRNL.EXE");
780 strcpy(szKernelName
, szBootPath
);
781 strcat(szKernelName
, "SYSTEM32\\");
782 strcat(szKernelName
, value
);
785 if (!LoadKernel(szKernelName
, 5))
789 * Find the HAL image name
790 * and try to load the kernel off the disk
792 if(IniReadSettingByName(SectionId
, "Hal", value
, 1024))
797 if (value
[0] == '\\')
799 strcpy(szHalName
, value
);
803 strcpy(szHalName
, szBootPath
);
804 strcat(szHalName
, "SYSTEM32\\");
805 strcat(szHalName
, value
);
810 strcpy(value
, "HAL.DLL");
811 strcpy(szHalName
, szBootPath
);
812 strcat(szHalName
, "SYSTEM32\\");
813 strcat(szHalName
, value
);
816 if (!LoadDriver(szHalName
, 10))
820 * Load the System hive from disk
822 strcpy(szFileName
, szBootPath
);
823 strcat(szFileName
, "SYSTEM32\\CONFIG\\SYSTEM");
825 DbgPrint((DPRINT_REACTOS
, "SystemHive: '%s'", szFileName
));
827 FilePointer
= FsOpenFile(szFileName
);
828 if (FilePointer
== NULL
)
830 UiMessageBox("Could not find the System hive!");
835 * Update the status bar with the current file
837 strcpy(name
, "Reading ");
839 while (strlen(name
) < 80)
841 UiDrawStatusText(name
);
844 * Load the System hive
846 Base
= MultiBootLoadModule(FilePointer
, szFileName
, &Size
);
847 if (Base
== NULL
|| Size
== 0)
849 UiMessageBox("Could not load the System hive!\n");
852 DbgPrint((DPRINT_REACTOS
, "SystemHive loaded at 0x%x size %u", (unsigned)Base
, (unsigned)Size
));
855 * Import the loaded system hive
857 RegImportBinaryHive(Base
, Size
);
860 * Initialize the 'CurrentControlSet' link
862 RegInitCurrentControlSet(FALSE
);
864 UiDrawProgressBarCenter(15, 100, "Loading ReactOS...");
867 * Export the hardware hive
869 Base
= MultiBootCreateModule ("HARDWARE");
870 RegExportBinaryHive ("\\Registry\\Machine\\HARDWARE", Base
, &Size
);
871 MultiBootCloseModule (Base
, Size
);
873 UiDrawProgressBarCenter(20, 100, "Loading ReactOS...");
878 if (!LoadNlsFiles(szBootPath
, MsgBuffer
))
880 UiMessageBox(MsgBuffer
);
883 UiDrawProgressBarCenter(25, 100, "Loading ReactOS...");
888 LoadSymbolFile(szBootPath
, szKernelName
, 30);
889 LoadSymbolFile(szBootPath
, szHalName
, 30);
891 UiDrawProgressBarCenter(30, 100, "Loading ReactOS...");
896 LoadBootDrivers(szBootPath
, 30);
901 * Clear the screen and redraw the backdrop and status bar
904 UiDrawStatusText("Press any key to boot");
909 strcpy(name
, "Kernel and Drivers loaded.\nPress any key to boot ");
910 strcat(name
, OperatingSystemName
);
915 UiUnInitialize("Booting ReactOS...");
918 * Now boot the kernel
920 DiskStopFloppyMotor();