Author: hpoussin Date: Thu Sep 24 10:15:13 2009 New Revision: 43126
URL: http://svn.reactos.org/svn/reactos?rev=43126&view=rev Log: WINLDR: Don't hardcode filesystem driver name Instead, use the one of the system partition
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c trunk/reactos/boot/freeldr/freeldr/fs/fat.c trunk/reactos/boot/freeldr/freeldr/fs/fs.c trunk/reactos/boot/freeldr/freeldr/fs/iso.c trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c trunk/reactos/boot/freeldr/freeldr/include/fs.h trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ext... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -1257,6 +1257,7 @@ Ext2Open, Ext2Read, Ext2Seek, + L"ext2", };
const DEVVTBL* Ext2Mount(ULONG DeviceId)
Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fat... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -1463,6 +1463,7 @@ FatOpen, FatRead, FatSeek, + L"fastfat", };
const DEVVTBL* FatMount(ULONG DeviceId)
Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs.... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -411,6 +411,13 @@ 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)
Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/iso... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/iso.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/iso.c [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -479,6 +479,7 @@ IsoOpen, IsoRead, IsoSeek, + L"cdfs", };
const DEVVTBL* IsoMount(ULONG DeviceId)
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ntf... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -836,6 +836,7 @@ NtfsOpen, NtfsRead, NtfsSeek, + L"ntfs", };
const DEVVTBL* NtfsMount(ULONG DeviceId)
Modified: trunk/reactos/boot/freeldr/freeldr/include/fs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -27,6 +27,7 @@ ARC_OPEN Open; ARC_READ Read; ARC_SEEK Seek; + LPCWSTR ServiceName; } DEVVTBL;
#define FS_FAT 1 @@ -37,6 +38,7 @@ #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);
Modified: trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/window... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c [iso-8859-1] Thu Sep 24 10:15:13 2009 @@ -50,6 +50,7 @@ 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 @@
/* Finally read from file to the memory */ Status = ArcRead(FileId, (PVOID)HiveDataPhysical, HiveFileSize, &BytesRead); + 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); - if (Status != ESUCCESS) - { - UiMessageBox("Unable to read from hive file!"); - return FALSE; - } - return TRUE; }
@@ -144,14 +163,6 @@
// 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);