RtlpCheckFileNameExtension(PCHAR FileName,
PCHAR Extension)
{
- PCHAR Ext;
-
- Ext = strrchr(FileName, '.');
- if ((Extension == NULL) || (*Extension == 0))
- {
- if (Ext == NULL)
- return TRUE;
- else
- return FALSE;
- }
- if (*Extension != '.')
- Ext++;
-
- if (_stricmp(Ext, Extension) == 0)
- return TRUE;
- else
- return FALSE;
-}
+ PCHAR Ext;
+ Ext = strrchr(FileName, '.');
+ if (Ext == NULL)
+ {
+ if ((Extension == NULL) || (*Extension == 0))
+ return TRUE;
+ else
+ return FALSE;
+ }
-static BOOLEAN
-RtlpIsSystemHive(PCHAR FileName)
-{
- PCHAR Name;
+ if (*Extension != '.')
+ Ext++;
- Name = strrchr(FileName, '\\');
- if (Name == NULL)
- {
- Name = FileName;
- }
+ if (_stricmp(Ext, Extension) == 0)
+ return TRUE;
else
- {
- Name = Name + 1;
- }
-
- return((_stricmp(Name, "system.hiv") == 0) ||
- (_stricmp(Name, "system") == 0));
+ return FALSE;
}
if (KeNumberProcessors > 1)
{
sprintf(str,
- "Found %d system processors. [%u MB Memory]\n",
+ "Found %d system processors. [%lu MB Memory]\n",
KeNumberProcessors,
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
else
{
sprintf(str,
- "Found 1 system processor. [%u MB Memory]\n",
+ "Found 1 system processor. [%lu MB Memory]\n",
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
HalDisplayString(str);
}
}
- /* Pass 2: load registry chunks passed in */
+ /* Pass 2: import system hive registry chunk */
SetupBoot = TRUE;
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
start = KeLoaderModules[i].ModStart;
length = KeLoaderModules[i].ModEnd - start;
- name = (PCHAR)KeLoaderModules[i].String;
- if (RtlpCheckFileNameExtension(name, "") ||
- RtlpCheckFileNameExtension(name, ".hiv"))
+
+ DPRINT("Module: '%s'\n", (PCHAR)KeLoaderModules[i].String);
+ name = strrchr((PCHAR)KeLoaderModules[i].String, '\\');
+ if (name == NULL)
+ {
+ name = (PCHAR)KeLoaderModules[i].String;
+ }
+ else
{
- CPRINT("Process registry chunk at %08lx\n", start);
- CmImportHive((PCHAR)start, length);
+ name++;
}
- if (RtlpIsSystemHive(name))
+
+ if (!_stricmp (name, "system") ||
+ !_stricmp (name, "system.hiv"))
{
+ CPRINT("Process system hive registry chunk at %08lx\n", start);
SetupBoot = FALSE;
+ CmImportSystemHive((PCHAR)start, length);
}
}
+ /* Pass 3: import hardware hive registry chunk */
+ for (i = 1; i < KeLoaderBlock.ModsCount; i++)
+ {
+ start = KeLoaderModules[i].ModStart;
+ length = KeLoaderModules[i].ModEnd - start;
+ name = (PCHAR)KeLoaderModules[i].String;
+ if (!_stricmp (name, "hardware") ||
+ !_stricmp (name, "hardware.hiv"))
+ {
+ CPRINT("Process hardware hive registry chunk at %08lx\n", start);
+ CmImportHardwareHive((PCHAR)start, length);
+ }
+ }
+
+ /* Create dummy keys if no hardware hive was found */
+ CmImportHardwareHive (NULL, 0);
+
+
/* Initialize volatile registry settings */
if (SetupBoot == FALSE)
{
IoCreateDriverList();
- /* Pass 3: process boot loaded drivers */
+ /* Pass 4: process boot loaded drivers */
BootDriverCount = 0;
for (i=1; i < KeLoaderBlock.ModsCount; i++)
{
{
KeBugCheckEx(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
-
/*
* Crash the system if the initial process terminates within 5 seconds.
*/
}
}
sprintf(KeLoaderCommandLine,
- "multi(0)disk(0)rdisk(%d)partition(%d)%s %s",
+ "multi(0)disk(0)rdisk(%lu)partition(%lu)%s %s",
DiskNumber, PartNumber + 1, Temp, options);
p = KeLoaderCommandLine;