CHAR SystemPath[512], SearchPath[512];
CHAR FileName[512];
CHAR BootPath[512];
- CHAR LoadOptions[512];
- LPCSTR BootOptions;
+ LPCSTR LoadOptions, DbgOptions, BootOptions;
PVOID NtosBase = NULL, HalBase = NULL, KdComBase = NULL;
BOOLEAN Status;
- ULONG BootDevice;
ULONG i, ErrorLine;
HINF InfHandle;
INFCONTEXT InfContext;
NULL
};
- /* Get boot device number */
- MachDiskGetBootDevice(&BootDevice);
-
/* Open 'txtsetup.sif' from any of source paths */
+ MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
for (i = MachDiskBootingFromFloppy() ? 0 : 1; ; i++)
{
SourcePath = SourcePaths[i];
printf("Failed to open 'txtsetup.sif'\n");
return;
}
- sprintf(FileName,"%s\\txtsetup.sif", SourcePath);
+ sprintf(FileName, "%s\\txtsetup.sif", SourcePath);
if (InfOpenFile (&InfHandle, FileName, &ErrorLine))
+ {
+ sprintf(BootPath, "%s%s\\", SystemPath, SourcePath);
break;
+ }
}
- /* If we didn't find it anywhere, then just use root */
- if (!*SourcePath)
- SourcePath = "\\";
-
- /* Load options */
+ /* Get Load options - debug and non-debug */
if (!InfFindFirstLine(InfHandle,
"SetupData",
"OsLoadOptions",
return;
}
- if (!InfGetDataField (&InfContext, 1, &BootOptions))
+ if (!InfGetDataField (&InfContext, 1, &LoadOptions))
{
printf("Failed to get load options\n");
return;
}
- /* Save source path */
- strcpy(BootPath, SourcePath);
+ BootOptions = LoadOptions;
+
+#if DBG
+ /* Get debug load options and use them */
+ if (InfFindFirstLine(InfHandle,
+ "SetupData",
+ "DbgOsLoadOptions",
+ &InfContext))
+ {
+ if (!InfGetDataField(&InfContext, 1, &DbgOptions))
+ DbgOptions = "";
+ else
+ BootOptions = DbgOptions;
+ }
+#endif
+
+ DPRINTM(DPRINT_WINDOWS,"BootOptions: '%s'\n", BootOptions);
SetupUiInitialize();
UiDrawStatusText("");
/* Let user know we started loading */
UiDrawStatusText("Loading...");
- /* Try to open system drive */
- FsOpenBootVolume();
-
- /* Append a backslash to the bootpath if needed */
- if ((strlen(BootPath)==0) || BootPath[strlen(BootPath)] != '\\')
- {
- strcat(BootPath, "\\");
- }
-
/* Construct the system path */
- MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
- strcat(SystemPath, SourcePath);
+ sprintf(SystemPath, "%s\\", SourcePath);
- DPRINTM(DPRINT_WINDOWS,"SystemRoot: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
+ DPRINTM(DPRINT_WINDOWS,"BootPath: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
/* Allocate and minimalistic-initialize LPB */
AllocateAndInitLPB(&LoaderBlock);
WinLdrSetupForNt(LoaderBlock, &GdtIdt, &PcrBasePage, &TssBasePage);
/* Initialize Phase 1 - no drivers loading anymore */
- LoadOptions[0] = 0;
- WinLdrInitializePhase1(LoaderBlock, LoadOptions, SystemPath, BootPath, _WIN32_WINNT_WS03);
+ WinLdrInitializePhase1(LoaderBlock, (PCHAR)BootOptions, SystemPath, BootPath, _WIN32_WINNT_WS03);
/* Save entry-point pointer and Loader block VAs */
KiSystemStartup = (KERNEL_ENTRY_POINT)KernelDTE->EntryPoint;