WINLDR: Don't hardcode filesystem driver name

Instead, use the one of the system partition

svn path=/trunk/; revision=43126
This commit is contained in:
Hervé Poussineau 2009-09-24 08:15:13 +00:00
parent d338a87238
commit 2432b60a2e
7 changed files with 33 additions and 9 deletions

View file

@ -1257,6 +1257,7 @@ const DEVVTBL Ext2FuncTable =
Ext2Open,
Ext2Read,
Ext2Seek,
L"ext2",
};
const DEVVTBL* Ext2Mount(ULONG DeviceId)

View file

@ -1463,6 +1463,7 @@ const DEVVTBL FatFuncTable =
FatOpen,
FatRead,
FatSeek,
L"fastfat",
};
const DEVVTBL* FatMount(ULONG DeviceId)

View file

@ -411,6 +411,13 @@ VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable)
InsertHeadList(&DeviceListHead, &pNewEntry->ListEntry);
}
LPCWSTR FsGetServiceName(ULONG FileId)
{
if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
return NULL;
return FileData[FileId].FuncTable->ServiceName;
}
VOID FsSetDeviceSpecific(ULONG FileId, VOID* Specific)
{
if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)

View file

@ -479,6 +479,7 @@ const DEVVTBL Iso9660FuncTable =
IsoOpen,
IsoRead,
IsoSeek,
L"cdfs",
};
const DEVVTBL* IsoMount(ULONG DeviceId)

View file

@ -836,6 +836,7 @@ const DEVVTBL NtfsFuncTable =
NtfsOpen,
NtfsRead,
NtfsSeek,
L"ntfs",
};
const DEVVTBL* NtfsMount(ULONG DeviceId)

View file

@ -27,6 +27,7 @@ typedef struct tagDEVVTBL
ARC_OPEN Open;
ARC_READ Read;
ARC_SEEK Seek;
LPCWSTR ServiceName;
} DEVVTBL;
#define FS_FAT 1
@ -37,6 +38,7 @@ typedef struct tagDEVVTBL
#define PFILE ULONG
VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable);
LPCWSTR FsGetServiceName(ULONG FileId);
VOID FsSetDeviceSpecific(ULONG FileId, VOID* Specific);
VOID* FsGetDeviceSpecific(ULONG FileId);
ULONG FsGetDeviceId(ULONG FileId);

View file

@ -50,6 +50,7 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG_PTR HiveDataPhysical;
PVOID HiveDataVirtual;
ULONG BytesRead;
LPCWSTR FsService;
/* Concatenate path and filename to get the full name */
strcpy(FullHiveName, DirectoryPath);
@ -95,13 +96,31 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Finally read from file to the memory */
Status = ArcRead(FileId, (PVOID)HiveDataPhysical, HiveFileSize, &BytesRead);
ArcClose(FileId);
if (Status != ESUCCESS)
{
ArcClose(FileId);
UiMessageBox("Unable to read from hive file!");
return FALSE;
}
// Add boot filesystem driver to the list
FsService = FsGetServiceName(FileId);
if (FsService)
{
DPRINTM(DPRINT_WINDOWS, " Adding filesystem service %S\n", FsService);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
NULL,
(LPWSTR)FsService);
if (!Status)
DPRINTM(DPRINT_WINDOWS, " Failed to add filesystem service\n");
}
else
{
DPRINTM(DPRINT_WINDOWS, " No required filesystem service\n");
}
ArcClose(FileId);
return TRUE;
}
@ -145,14 +164,6 @@ BOOLEAN WinLdrLoadAndScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
// Scan registry and prepare boot drivers list
WinLdrScanRegistry(LoaderBlock, DirectoryPath);
// Add boot filesystem driver to the list
//FIXME: Use corresponding driver instead of hardcoding
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
NULL,
L"fastfat");
// Get names of NLS files
Status = WinLdrGetNLSNames(AnsiName, OemName, LangName);
if (!Status)