- Implement boot drivers loading.

svn path=/trunk/; revision=40066
This commit is contained in:
Aleksey Bragin 2009-03-16 20:56:07 +00:00
parent 08c383c3de
commit 455369fa90

View file

@ -42,7 +42,11 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
IN LPCSTR AnsiFileName,
IN LPCSTR OemFileName,
IN LPCSTR LanguageFileName);
BOOLEAN
WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
LPWSTR RegistryPath,
LPWSTR ImagePath,
LPWSTR ServiceName);
//FIXME: Do a better way to retrieve Arc disk information
@ -100,6 +104,52 @@ SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR
DPRINTM(DPRINT_WINDOWS, "NLS data loaded with status %d\n", Status);
}
VOID
SetupLdrScanBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR SearchPath)
{
INFCONTEXT InfContext;
BOOLEAN Status;
LPCSTR Media, DriverName;
WCHAR ServiceName[256];
WCHAR ImagePath[256];
/* Open inf section */
if (!InfFindFirstLine(InfHandle, "SourceDisksFiles", NULL, &InfContext))
return;
/* Load all listed boot drivers */
do
{
if (InfGetDataField(&InfContext, 7, &Media) &&
InfGetDataField(&InfContext, 0, &DriverName))
{
if (strcmp(Media, "x") == 0)
{
/* Convert name to widechar */
swprintf(ServiceName, L"%S", DriverName);
/* Remove .sys extension */
ServiceName[wcslen(ServiceName) - 4] = 0;
/* Prepare image path */
swprintf(ImagePath, L"%S", DriverName);
/* Add it to the list */
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
ImagePath,
ServiceName);
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "could not add boot driver %s, %s\n", SearchPath, DriverName);
return;
}
}
}
} while (InfFindNextLine(&InfContext, &InfContext));
}
VOID LoadReactOSSetup2(VOID)
{
CHAR SystemPath[512], SearchPath[512];
@ -239,8 +289,11 @@ VOID LoadReactOSSetup2(VOID)
/* Load NLS data */
SetupLdrLoadNlsData(LoaderBlock, InfHandle, BootPath);
/* Get a list of boot drivers */
SetupLdrScanBootDrivers(LoaderBlock, InfHandle, BootPath);
/* Load boot drivers */
//Status = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
Status = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
DPRINTM(DPRINT_WINDOWS, "Boot drivers loaded with status %d\n", Status);
/* Alloc PCR, TSS, do magic things with the GDT/IDT */