Author: hpoussin
Date: Sat Aug 8 22:53:10 2009
New Revision: 42537
URL:
http://svn.reactos.org/svn/reactos?rev=42537&view=rev
Log:
- Half-convert FAT, Ext2 and NTFS filesytems to provide new ARC file infrastructure. This
allows removing some compatibility code in fs.c
- Remove use of FsOpenBootVolume() and FsOpenSystemVolume(). If callers don't want a
file on boot volume, they need to use the new ArcOpen/ArcSeek/ArcRead/ArcClose functions
instead of the old FsOpenFile/FsSetFilePointer/FsReadFile/FsCloseFile
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
trunk/reactos/boot/freeldr/freeldr/bootmgr.c
trunk/reactos/boot/freeldr/freeldr/disk/disk.c
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/arch.h
trunk/reactos/boot/freeldr/freeldr/include/disk.h
trunk/reactos/boot/freeldr/freeldr/include/fs.h
trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h
trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h
trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h
trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h
trunk/reactos/boot/freeldr/freeldr/include/machine.h
trunk/reactos/boot/freeldr/freeldr/linuxboot.c
trunk/reactos/boot/freeldr/freeldr/machine.c
trunk/reactos/boot/freeldr/freeldr/miscboot.c
trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] Sat Aug 8
22:53:10 2009
@@ -264,11 +264,7 @@
BOOLEAN PpcDiskGetSystemVolume( char *SystemPath,
char *RemainingPath,
- PULONG Device,
- PULONG DriveNumber,
- PULONGLONG StartSector,
- PULONGLONG SectorCount,
- int *FsType ) {
+ PULONG Device ) {
char *remain = strchr(SystemPath, '\\');
if( remain ) {
strcpy( RemainingPath, remain+1 );
@@ -278,7 +274,7 @@
*Device = 0;
// Hack to be a bit easier on ram
CacheSizeLimit = 64 * 1024;
- return MachDiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType);
+ return TRUE;
}
BOOLEAN PpcDiskGetBootPath( char *OutBootPath, unsigned Size ) {
Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/bootm…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -31,12 +31,6 @@
LONG TimeOut;
ULONG SelectedOperatingSystem;
- if (!FsOpenBootVolume())
- {
- UiMessageBoxCritical("Error opening boot partition for file access.");
- return;
- }
-
// FIXME: if possible, only detect and register ARC devices...
if (!MachHwDetect())
{
Modified: trunk/reactos/boot/freeldr/freeldr/disk/disk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -241,22 +241,19 @@
BOOLEAN DiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
- PULONG Device,
- PULONG DriveNumber,
- PULONGLONG StartSector,
- PULONGLONG SectorCount,
- int *FsType)
+ PULONG Device)
{
ULONG PartitionNumber;
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR VolumeType;
CHAR BootPath[256];
unsigned i, RosPartition;
+ ULONG DriveNumber;
/*
* Verify system path
*/
- if (!DissectArcPath(SystemPath, BootPath, DriveNumber, &PartitionNumber))
+ if (!DissectArcPath(SystemPath, BootPath, &DriveNumber, &PartitionNumber))
{
return FALSE;
}
@@ -278,7 +275,7 @@
RosPartition = 0;
while (1)
{
- if (!MachDiskGetPartitionEntry(*DriveNumber, ++i, &PartitionTableEntry))
+ if (!MachDiskGetPartitionEntry(DriveNumber, ++i, &PartitionTableEntry))
{
return FALSE;
}
@@ -294,33 +291,28 @@
}
/* Check for ISO9660 file system type */
- if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber))
+ if (DriveNumber >= 0x80 && FsRecIsIso9660(DriveNumber))
{
DPRINTM(DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file
system.\n");
if (NULL != Device)
{
- ((char *)Device)[0] = (char)(*DriveNumber);
+ ((char *)Device)[0] = (char)DriveNumber;
((char *)Device)[1] = (char)i;
}
- *StartSector = 0;
- *SectorCount = 0;
- *FsType = FS_ISO9660;
return TRUE;
}
- if (!FsRecognizeVolume(*DriveNumber, PartitionTableEntry.SectorCountBeforePartition,
&VolumeType))
+ if (!FsRecognizeVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition,
&VolumeType))
{
return FALSE;
}
if (NULL != Device)
{
- ((char *)Device)[0] = (char)(*DriveNumber);
+ ((char *)Device)[0] = (char)DriveNumber;
((char *)Device)[1] = (char)i;
}
- *StartSector = PartitionTableEntry.SectorCountBeforePartition;
- *SectorCount = PartitionTableEntry.PartitionSectorCount;
switch (VolumeType)
{
@@ -330,16 +322,10 @@
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
- *FsType = FS_FAT;
- return TRUE;
case PARTITION_EXT2:
- *FsType = FS_EXT2;
- return TRUE;
case PARTITION_NTFS:
- *FsType = FS_NTFS;
return TRUE;
default:
- *FsType = 0;
return FALSE;
}
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ex…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -20,6 +20,31 @@
#include <freeldr.h>
#include <debug.h>
+BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
PartitionSectorCount);
+FILE* Ext2OpenFile(PCSTR FileName);
+BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
+BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize,
PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
+BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG
SectorCount, PVOID Buffer);
+
+BOOLEAN Ext2ReadFileBig(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead,
PVOID Buffer);
+BOOLEAN Ext2ReadSuperBlock(VOID);
+BOOLEAN Ext2ReadGroupDescriptors(VOID);
+BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE
InodePointer);
+BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer);
+BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID
Buffer);
+ULONG Ext2GetGroupDescBlockNumber(ULONG Group);
+ULONG Ext2GetGroupDescOffsetInBlock(ULONG Group);
+ULONG Ext2GetInodeGroupNumber(ULONG Inode);
+ULONG Ext2GetInodeBlockNumber(ULONG Inode);
+ULONG Ext2GetInodeOffsetInBlock(ULONG Inode);
+BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer);
+BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer);
+ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode);
+ULONGLONG Ext2GetInodeFileSize(PEXT2_INODE Inode);
+BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG
BlockCount, ULONG IndirectBlock);
+BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList,
ULONG BlockCount, ULONG DoubleIndirectBlock);
+BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList,
ULONG BlockCount, ULONG TripleIndirectBlock);
+
GEOMETRY Ext2DiskGeometry; // Ext2 file system disk geometry
PEXT2_SUPER_BLOCK Ext2SuperBlock = NULL; // Ext2 file system super block
@@ -517,43 +542,6 @@
}
return TRUE;
-}
-
-BOOLEAN Ext2ReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID
Buffer)
-{
- BOOLEAN Success;
- ULONGLONG BytesReadBig;
-
- Success = Ext2ReadFileBig(FileHandle, BytesToRead, &BytesReadBig, Buffer);
- *BytesRead = (ULONG)BytesReadBig;
- return Success;
-}
-
-ULONG Ext2GetFileSize(FILE *FileHandle)
-{
- PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileSize() FileSize = %d\n",
Ext2FileHandle->FileSize);
-
- return Ext2FileHandle->FileSize;
-}
-
-VOID Ext2SetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
-{
- PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "Ext2SetFilePointer() NewFilePointer = %d\n",
NewFilePointer);
-
- Ext2FileHandle->FilePointer = NewFilePointer;
-}
-
-ULONG Ext2GetFilePointer(FILE *FileHandle)
-{
- PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFilePointer() FilePointer = %d\n",
Ext2FileHandle->FilePointer);
-
- return Ext2FileHandle->FilePointer;
}
BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG
SectorCount, PVOID Buffer)
@@ -1178,12 +1166,144 @@
return TRUE;
}
-const FS_VTBL Ext2Vtbl = {
- Ext2OpenVolume,
- Ext2OpenFile,
- NULL,
- Ext2ReadFile,
- Ext2GetFileSize,
- Ext2SetFilePointer,
- Ext2GetFilePointer,
+LONG Ext2Close(ULONG FileId)
+{
+ PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+
+ MmHeapFree(FileHandle);
+
+ return ESUCCESS;
+}
+
+LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information)
+{
+ PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+
+ RtlZeroMemory(Information, sizeof(FILEINFORMATION));
+ Information->EndingAddress.LowPart = FileHandle->FileSize;
+ Information->CurrentAddress.LowPart = FileHandle->FilePointer;
+
+ DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n",
+ Information->EndingAddress.LowPart);
+ DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FilePointer = %d\n",
+ Information->CurrentAddress.LowPart);
+
+ return ESUCCESS;
+}
+
+LONG Ext2Open(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
+{
+ PEXT2_FILE_INFO FileHandle;
+ ULONG DeviceId;
+
+ if (OpenMode != OpenReadOnly)
+ return EACCES;
+
+ DeviceId = FsGetDeviceId(*FileId);
+
+ DPRINTM(DPRINT_FILESYSTEM, "Ext2Open() FileName = %s\n", Path);
+
+ //
+ // Call old open method
+ //
+ FileHandle = Ext2OpenFile(Path);
+
+ //
+ // Check for error
+ //
+ if (!FileHandle)
+ return ENOENT;
+
+ //
+ // Success. Remember the handle
+ //
+ FsSetDeviceSpecific(*FileId, FileHandle);
+ return ESUCCESS;
+}
+
+LONG Ext2Read(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
+{
+ PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+ ULONGLONG BytesReadBig;
+ BOOLEAN ret;
+
+ //
+ // Read data
+ //
+ ret = Ext2ReadFileBig(FileHandle, N, &BytesReadBig, Buffer);
+ *Count = (ULONG)BytesReadBig;
+
+ //
+ // Check for success
+ //
+ if (ret)
+ return ESUCCESS;
+ else
+ return EIO;
+}
+
+LONG Ext2Seek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
+{
+ PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+
+ DPRINTM(DPRINT_FILESYSTEM, "Ext2Seek() NewFilePointer = %lu\n",
Position->LowPart);
+
+ if (SeekMode != SeekAbsolute)
+ return EINVAL;
+ if (Position->HighPart != 0)
+ return EINVAL;
+ if (Position->LowPart >= FileHandle->FileSize)
+ return EINVAL;
+
+ FileHandle->FilePointer = Position->LowPart;
+ return ESUCCESS;
+}
+
+const DEVVTBL Ext2FuncTable =
+{
+ Ext2Close,
+ Ext2GetFileInformation,
+ Ext2Open,
+ Ext2Read,
+ Ext2Seek,
};
+
+const DEVVTBL* Ext2Mount(ULONG DeviceId)
+{
+ EXT2_SUPER_BLOCK SuperBlock;
+ LARGE_INTEGER Position;
+ ULONG Count;
+ LONG ret;
+
+ //
+ // Read the SuperBlock
+ //
+ Position.HighPart = 0;
+ Position.LowPart = 2 * 512;
+ ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
+ if (ret != ESUCCESS)
+ return NULL;
+ ret = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count);
+ if (ret != ESUCCESS || Count != sizeof(SuperBlock))
+ return NULL;
+
+ //
+ // Check if SuperBlock is valid. If yes, return Ext2 function table
+ //
+ if (SuperBlock.s_magic == EXT3_SUPER_MAGIC)
+ {
+ //
+ // Compatibility hack as long as FS is not using underlying device DeviceId
+ //
+ ULONG DriveNumber;
+ ULONGLONG StartSector;
+ ULONGLONG SectorCount;
+ int Type;
+ if (!MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount,
&Type))
+ return NULL;
+ Ext2OpenVolume(DriveNumber, StartSector, SectorCount);
+ return &Ext2FuncTable;
+ }
+ else
+ return NULL;
+}
Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fa…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -21,6 +21,20 @@
#define NDEBUG
#include <debug.h>
+
+ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount);
+PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN
RootDirectory);
+BOOLEAN FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PCHAR
FileName, PFAT_FILE_INFO FatFileInfoPointer);
+LONG FatLookupFile(PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer);
+void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry);
+BOOLEAN FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer);
+ULONG FatCountClustersInChain(ULONG StartCluster);
+ULONG* FatGetClusterChainArray(ULONG StartCluster);
+BOOLEAN FatReadCluster(ULONG ClusterNumber, PVOID Buffer);
+BOOLEAN FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID
Buffer);
+BOOLEAN FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length,
PVOID Buffer);
+BOOLEAN FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID
Buffer);
+BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount,
PVOID Buffer);
BOOLEAN gCacheEnabled = FALSE;
@@ -778,11 +792,10 @@
/*
* FatLookupFile()
* This function searches the file system for the
- * specified filename and fills in a FAT_FILE_INFO structure
- * with info describing the file, etc. returns true
- * if the file exists or false otherwise
+ * specified filename and fills in an FAT_FILE_INFO structure
+ * with info describing the file, etc. returns ARC error code
*/
-BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer)
+LONG FatLookupFile(PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer)
{
UINT32 i;
ULONG NumberOfPathParts;
@@ -825,7 +838,7 @@
DirectoryBuffer = FatBufferDirectory(DirectoryStartCluster, &DirectorySize, (i ==
0) );
if (DirectoryBuffer == NULL)
{
- return FALSE;
+ return ENOMEM;
}
//
@@ -836,7 +849,7 @@
if (!FatXSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart,
&FatFileInfo))
{
MmHeapFree(DirectoryBuffer);
- return FALSE;
+ return ENOENT;
}
}
else
@@ -844,7 +857,7 @@
if (!FatSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart,
&FatFileInfo))
{
MmHeapFree(DirectoryBuffer);
- return FALSE;
+ return ENOENT;
}
}
@@ -863,7 +876,7 @@
memcpy(FatFileInfoPointer, &FatFileInfo, sizeof(FAT_FILE_INFO));
- return TRUE;
+ return ESUCCESS;
}
/*
@@ -1006,35 +1019,6 @@
*ClusterPointer = fat;
return TRUE;
-}
-
-/*
- * FatOpenFile()
- * Tries to open the file 'name' and returns true or false
- * for success and failure respectively
- */
-FILE* FatOpenFile(PCSTR FileName)
-{
- FAT_FILE_INFO TempFatFileInfo;
- PFAT_FILE_INFO FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "FatOpenFile() FileName = %s\n", FileName);
-
- if (!FatLookupFile(FileName, &TempFatFileInfo))
- {
- return NULL;
- }
-
- FileHandle = MmHeapAlloc(sizeof(FAT_FILE_INFO));
-
- if (FileHandle == NULL)
- {
- return NULL;
- }
-
- memcpy(FileHandle, &TempFatFileInfo, sizeof(FAT_FILE_INFO));
-
- return (FILE*)FileHandle;
}
ULONG FatCountClustersInChain(ULONG StartCluster)
@@ -1394,33 +1378,6 @@
return TRUE;
}
-ULONG FatGetFileSize(FILE *FileHandle)
-{
- PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "FatGetFileSize() FileSize = %d\n",
FatFileHandle->FileSize);
-
- return FatFileHandle->FileSize;
-}
-
-VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
-{
- PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "FatSetFilePointer() NewFilePointer = %d\n",
NewFilePointer);
-
- FatFileHandle->FilePointer = NewFilePointer;
-}
-
-ULONG FatGetFilePointer(FILE *FileHandle)
-{
- PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle;
-
- DPRINTM(DPRINT_FILESYSTEM, "FatGetFilePointer() FilePointer = %d\n",
FatFileHandle->FilePointer);
-
- return FatFileHandle->FilePointer;
-}
-
BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount,
PVOID Buffer)
{
if (gCacheEnabled)
@@ -1443,12 +1400,147 @@
}
}
-const FS_VTBL FatVtbl = {
- FatOpenVolume,
- FatOpenFile,
- NULL,
- FatReadFile,
- FatGetFileSize,
- FatSetFilePointer,
- FatGetFilePointer,
+LONG FatClose(ULONG FileId)
+{
+ PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+
+ MmHeapFree(FileHandle);
+
+ return ESUCCESS;
+}
+
+LONG FatGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
+{
+ PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+
+ RtlZeroMemory(Information, sizeof(FILEINFORMATION));
+ Information->EndingAddress.LowPart = FileHandle->FileSize;
+ Information->CurrentAddress.LowPart = FileHandle->FilePointer;
+
+ DPRINTM(DPRINT_FILESYSTEM, "FatGetFileInformation() FileSize = %d\n",
+ Information->EndingAddress.LowPart);
+ DPRINTM(DPRINT_FILESYSTEM, "FatGetFileInformation() FilePointer = %d\n",
+ Information->CurrentAddress.LowPart);
+
+ return ESUCCESS;
+}
+
+LONG FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
+{
+ FAT_FILE_INFO TempFileInfo;
+ PFAT_FILE_INFO FileHandle;
+ ULONG DeviceId;
+ LONG ret;
+
+ if (OpenMode != OpenReadOnly)
+ return EACCES;
+
+ DeviceId = FsGetDeviceId(*FileId);
+
+ DPRINTM(DPRINT_FILESYSTEM, "FatOpen() FileName = %s\n", Path);
+
+ RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
+ ret = FatLookupFile(Path, DeviceId, &TempFileInfo);
+ if (ret != ESUCCESS)
+ return ENOENT;
+
+ FileHandle = MmHeapAlloc(sizeof(FAT_FILE_INFO));
+ if (!FileHandle)
+ return ENOMEM;
+
+ RtlCopyMemory(FileHandle, &TempFileInfo, sizeof(FAT_FILE_INFO));
+
+ FsSetDeviceSpecific(*FileId, FileHandle);
+ return ESUCCESS;
+}
+
+LONG FatRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
+{
+ PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+ BOOLEAN ret;
+
+ //
+ // Call old read method
+ //
+ ret = FatReadFile(FileHandle, N, Count, Buffer);
+
+ //
+ // Check for success
+ //
+ if (ret)
+ return ESUCCESS;
+ else
+ return EIO;
+}
+
+LONG FatSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
+{
+ PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
+
+ DPRINTM(DPRINT_FILESYSTEM, "FatSeek() NewFilePointer = %lu\n",
Position->LowPart);
+
+ if (SeekMode != SeekAbsolute)
+ return EINVAL;
+ if (Position->HighPart != 0)
+ return EINVAL;
+ if (Position->LowPart >= FileHandle->FileSize)
+ return EINVAL;
+
+ FileHandle->FilePointer = Position->LowPart;
+ return ESUCCESS;
+}
+
+const DEVVTBL FatFuncTable =
+{
+ FatClose,
+ FatGetFileInformation,
+ FatOpen,
+ FatRead,
+ FatSeek,
};
+
+const DEVVTBL* FatMount(ULONG DeviceId)
+{
+ UCHAR Buffer[512];
+ PFAT_BOOTSECTOR BootSector = (PFAT_BOOTSECTOR)Buffer;
+ PFAT32_BOOTSECTOR BootSector32 = (PFAT32_BOOTSECTOR)Buffer;
+ PFATX_BOOTSECTOR BootSectorX = (PFATX_BOOTSECTOR)Buffer;
+ LARGE_INTEGER Position;
+ ULONG Count;
+ LONG ret;
+
+ //
+ // Read the BootSector
+ //
+ Position.HighPart = 0;
+ Position.LowPart = 0;
+ ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
+ if (ret != ESUCCESS)
+ return NULL;
+ ret = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count);
+ if (ret != ESUCCESS || Count != sizeof(Buffer))
+ return NULL;
+
+ //
+ // Check if BootSector is valid. If yes, return FAT function table
+ //
+ if (RtlEqualMemory(BootSector->FileSystemType, "FAT12 ", 8) ||
+ RtlEqualMemory(BootSector->FileSystemType, "FAT16 ", 8) ||
+ RtlEqualMemory(BootSector32->FileSystemType, "FAT32 ", 8) ||
+ RtlEqualMemory(BootSectorX->FileSystemType, "FATX", 4))
+ {
+ //
+ // Compatibility hack as long as FS is not using underlying device DeviceId
+ //
+ ULONG DriveNumber;
+ ULONGLONG StartSector;
+ ULONGLONG SectorCount;
+ int Type;
+ if (!MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount,
&Type))
+ return NULL;
+ FatOpenVolume(DriveNumber, StartSector, SectorCount);
+ return &FatFuncTable;
+ }
+ else
+ return NULL;
+}
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] Sat Aug 8 22:53:10 2009
@@ -24,31 +24,28 @@
#include <debug.h>
/////////////////////////////////////////////////////////////////////////////////////////////
-// DATA
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-const FS_VTBL* pFSVtbl = NULL; // Type of filesystem on boot device, set by
FsOpenVolume()
-PVOID FsStaticBufferDisk = 0, FsStaticBufferData = 0;
-
-/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////
-static BOOLEAN CompatArcOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector,
ULONGLONG PartitionSectorCount)
-{
- //
- // Always return success
- //
- return TRUE;
-}
-
-static FILE* CompatArcOpenFile(PCSTR FileName)
+VOID FileSystemError(PCSTR ErrorString)
+{
+ DPRINTM(DPRINT_FILESYSTEM, "%s\n", ErrorString);
+
+ UiMessageBox(ErrorString);
+}
+
+PFILE FsOpenFile(PCSTR FileName)
{
CHAR FullPath[MAX_PATH];
ULONG FileId;
LONG ret;
//
+ // Print status message
+ //
+ DPRINTM(DPRINT_FILESYSTEM, "Opening file '%s'...\n", FileName);
+
+ //
// Create full file name
//
MachDiskGetBootPath(FullPath, sizeof(FullPath));
@@ -63,261 +60,24 @@
// Check for success
//
if (ret == ESUCCESS)
- return (FILE*)FileId;
+ return (PFILE)FileId;
else
return NULL;
}
-static BOOLEAN CompatArcReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead,
PVOID Buffer)
+VOID FsCloseFile(PFILE FileHandle)
{
ULONG FileId = (ULONG)FileHandle;
- LONG ret;
-
- //
- // Read the file
- //
- ret = ArcRead(FileId, Buffer, BytesToRead, BytesRead);
-
- //
- // Check for success
- //
- if (ret == ESUCCESS)
- return TRUE;
- else
- return FALSE;
-}
-
-ULONG CompatArcGetFileSize(FILE *FileHandle)
-{
- ULONG FileId = (ULONG)FileHandle;
- FILEINFORMATION Information;
- LONG ret;
-
- //
- // Query file informations
- //
- ret = ArcGetFileInformation(FileId, &Information);
-
- //
- // Check for error
- //
- if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0)
- return 0;
-
- //
- // Return file size
- //
- return Information.EndingAddress.LowPart;
-}
-
-VOID CompatArcSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
-{
- ULONG FileId = (ULONG)FileHandle;
- LARGE_INTEGER Position;
-
- //
- // Set file position
- //
- Position.HighPart = 0;
- Position.LowPart = NewFilePointer;
- ArcSeek(FileId, &Position, SeekAbsolute);
+
+ //
+ // Close the handle
+ //
+ ArcClose(FileId);
//
// Do not check for error; this function is
// supposed to always succeed
//
-}
-
-ULONG CompatArcGetFilePointer(FILE *FileHandle)
-{
- ULONG FileId = (ULONG)FileHandle;
- FILEINFORMATION Information;
- LONG ret;
-
- //
- // Query file informations
- //
- ret = ArcGetFileInformation(FileId, &Information);
-
- //
- // Check for error
- //
- if (ret != ESUCCESS || Information.CurrentAddress.HighPart != 0)
- return 0;
-
- //
- // Return file pointer position
- //
- return Information.CurrentAddress.LowPart;
-}
-
-static const FS_VTBL CompatArcVtbl =
-{
- CompatArcOpenVolume,
- CompatArcOpenFile,
- NULL,
- CompatArcReadFile,
- CompatArcGetFileSize,
- CompatArcSetFilePointer,
- CompatArcGetFilePointer,
-};
-
-VOID FileSystemError(PCSTR ErrorString)
-{
- DPRINTM(DPRINT_FILESYSTEM, "%s\n", ErrorString);
-
- UiMessageBox(ErrorString);
-}
-
-/*
- *
- * BOOLEAN FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount,
int Type);
- *
- * This function is called to open a disk volume for file access.
- * It must be called before any of the file functions will work.
- *
- */
-static BOOLEAN FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG
SectorCount, int Type)
-{
- CHAR ErrorText[80];
-
- if( !FsStaticBufferDisk )
- FsStaticBufferDisk = MmAllocateMemory( 0x20000 );
- if( !FsStaticBufferDisk )
- {
- FileSystemError("could not allocate filesystem static buffer");
- return FALSE;
- }
- FsStaticBufferData = ((PCHAR)FsStaticBufferDisk) + 0x10000;
-
- switch (Type)
- {
- case FS_FAT:
- pFSVtbl = &FatVtbl;
- break;
- case FS_NTFS:
- pFSVtbl = &NtfsVtbl;
- break;
- case FS_EXT2:
- pFSVtbl = &Ext2Vtbl;
- break;
- case FS_ISO9660:
- pFSVtbl = &CompatArcVtbl;
- break;
- default:
- pFSVtbl = NULL;
- break;
- }
-
- if (pFSVtbl && pFSVtbl->OpenVolume)
- {
- return (*pFSVtbl->OpenVolume)(DriveNumber, StartSector, SectorCount);
- }
- else
- {
- sprintf(ErrorText, "Unsupported file system. Type: 0x%x", Type);
- FileSystemError(ErrorText);
- }
-
- return FALSE;
-}
-/*
- *
- * BOOLEAN FsOpenBootVolume()
- *
- * This function is called to open the boot disk volume for file access.
- * It must be called before any of the file functions will work.
- */
-BOOLEAN FsOpenBootVolume()
-{
- ULONG DriveNumber;
- ULONGLONG StartSector;
- ULONGLONG SectorCount;
- int Type;
-
- if (! MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount,
&Type))
- {
- FileSystemError("Unable to locate boot partition\n");
- return FALSE;
- }
-
- return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
-}
-
-BOOLEAN FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device)
-{
- ULONG DriveNumber;
- ULONGLONG StartSector;
- ULONGLONG SectorCount;
- int Type;
-
- if (! MachDiskGetSystemVolume(SystemPath, RemainingPath, Device,
- &DriveNumber, &StartSector, &SectorCount,
- &Type))
- {
- FileSystemError("Unable to locate system partition\n");
- return FALSE;
- }
-
- return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
-}
-
-
-PFILE FsOpenFile(PCSTR FileName)
-{
- PFILE FileHandle = NULL;
-
- //
- // Print status message
- //
- DPRINTM(DPRINT_FILESYSTEM, "Opening file '%s'...\n", FileName);
-
- //
- // Check and see if the first character is '\' or '/' and remove it if
so
- //
- while ((*FileName == '\\') || (*FileName == '/'))
- {
- FileName++;
- }
-
- //
- // Check file system type and pass off to appropriate handler
- //
- if (pFSVtbl && pFSVtbl->OpenFile)
- {
- FileHandle = pFSVtbl->OpenFile(FileName);
- }
- else
- {
- FileSystemError("Error: Unknown filesystem.");
- }
-
- //
- // Check return value
- //
- if (FileHandle != NULL)
- {
- DPRINTM(DPRINT_FILESYSTEM, "FsOpenFile() succeeded. FileHandle: 0x%x\n",
FileHandle);
- }
- else
- {
- DPRINTM(DPRINT_FILESYSTEM, "FsOpenFile() failed.\n");
- }
-
- return FileHandle;
-}
-
-VOID FsCloseFile(PFILE FileHandle)
-{
- if (pFSVtbl)
- {
- if (pFSVtbl->CloseFile)
- (*pFSVtbl->CloseFile)(FileHandle);
- }
- else
- {
- FileSystemError("Error: Unknown filesystem.");
- }
}
/*
@@ -326,61 +86,85 @@
*/
BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)
{
- //
- // Set the number of bytes read equal to zero
- //
- if (BytesRead != NULL)
- {
- *BytesRead = 0;
- }
-
- if (pFSVtbl && pFSVtbl->ReadFile)
- {
- return (*pFSVtbl->ReadFile)(FileHandle, BytesToRead, BytesRead, Buffer);
- }
+ ULONG FileId = (ULONG)FileHandle;
+ LONG ret;
+
+ //
+ // Read the file
+ //
+ ret = ArcRead(FileId, Buffer, BytesToRead, BytesRead);
+
+ //
+ // Check for success
+ //
+ if (ret == ESUCCESS)
+ return TRUE;
else
- {
- FileSystemError("Unknown file system.");
return FALSE;
- }
}
ULONG FsGetFileSize(PFILE FileHandle)
{
- if (pFSVtbl && pFSVtbl->GetFileSize)
- {
- return (*pFSVtbl->GetFileSize)(FileHandle);
- }
- else
- {
- FileSystemError("Unknown file system.");
+ ULONG FileId = (ULONG)FileHandle;
+ FILEINFORMATION Information;
+ LONG ret;
+
+ //
+ // Query file informations
+ //
+ ret = ArcGetFileInformation(FileId, &Information);
+
+ //
+ // Check for error
+ //
+ if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0)
return 0;
- }
+
+ //
+ // Return file size
+ //
+ return Information.EndingAddress.LowPart;
}
VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer)
{
- if (pFSVtbl && pFSVtbl->SetFilePointer)
- {
- (*pFSVtbl->SetFilePointer)(FileHandle, NewFilePointer);
- }
- else
- {
- FileSystemError("Unknown file system.");
- }
+ ULONG FileId = (ULONG)FileHandle;
+ LARGE_INTEGER Position;
+
+ //
+ // Set file position
+ //
+ Position.HighPart = 0;
+ Position.LowPart = NewFilePointer;
+ ArcSeek(FileId, &Position, SeekAbsolute);
+
+ //
+ // Do not check for error; this function is
+ // supposed to always succeed
+ //
}
ULONG FsGetFilePointer(PFILE FileHandle)
{
- if (pFSVtbl && pFSVtbl->SetFilePointer)
- {
- return (*pFSVtbl->GetFilePointer)(FileHandle);
- }
- else
- {
- FileSystemError("Unknown file system.");
+ ULONG FileId = (ULONG)FileHandle;
+ FILEINFORMATION Information;
+ LONG ret;
+
+ //
+ // Query file informations
+ //
+ ret = ArcGetFileInformation(FileId, &Information);
+
+ //
+ // Check for error
+ //
+ if (ret != ESUCCESS || Information.CurrentAddress.HighPart != 0)
return 0;
- }
+
+ //
+ // Return file pointer position
+ //
+ return Information.CurrentAddress.LowPart;
}
BOOLEAN FsIsEndOfFile(PFILE FileHandle)
@@ -448,71 +232,6 @@
DPRINTM(DPRINT_FILESYSTEM, "FatGetFirstNameFromPath() Path = %s FirstName =
%s\n", Path, Buffer);
}
-
-LONG CompatFsClose(ULONG FileId)
-{
- PFILE FileHandle = FsGetDeviceSpecific(FileId);
-
- FsCloseFile(FileHandle);
- return ESUCCESS;
-}
-
-LONG CompatFsGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
-{
- PFILE FileHandle = FsGetDeviceSpecific(FileId);
-
- memset(Information, 0, sizeof(FILEINFORMATION));
- Information->EndingAddress.LowPart = FsGetFileSize(FileHandle);
- Information->CurrentAddress.LowPart = FsGetFilePointer(FileHandle);
- return ESUCCESS;
-}
-
-LONG CompatFsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
-{
- PFILE FileHandle;
- static BOOLEAN bVolumeOpened = FALSE;
-
- if (!bVolumeOpened)
- {
- bVolumeOpened = FsOpenBootVolume();
- if (!bVolumeOpened)
- return EIO;
- }
-
- FileHandle = FsOpenFile(Path);
- if (!FileHandle)
- return EIO;
- FsSetDeviceSpecific(*FileId, FileHandle);
- return ESUCCESS;
-}
-
-LONG CompatFsRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
-{
- PFILE FileHandle = FsGetDeviceSpecific(FileId);
- BOOLEAN ret;
-
- ret = FsReadFile(FileHandle, N, Count, Buffer);
- return (ret ? ESUCCESS : EFAULT);
-}
-
-LONG CompatFsSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
-{
- PFILE FileHandle = FsGetDeviceSpecific(FileId);
-
- if (SeekMode != SeekAbsolute)
- return EINVAL;
-
- FsSetFilePointer(FileHandle, Position->LowPart);
- return ESUCCESS;
-}
-
-const DEVVTBL CompatFsFuncTable = {
- CompatFsClose,
- CompatFsGetFileInformation,
- CompatFsOpen,
- CompatFsRead,
- CompatFsSeek,
-};
#define MAX_FDS 60
typedef struct tagFILEDATA
@@ -640,9 +359,16 @@
/* Try to detect the file system */
FileData[DeviceId].FileFuncTable = IsoMount(DeviceId);
if (!FileData[DeviceId].FileFuncTable)
+ FileData[DeviceId].FileFuncTable = FatMount(DeviceId);
+ if (!FileData[DeviceId].FileFuncTable)
+ FileData[DeviceId].FileFuncTable = NtfsMount(DeviceId);
+ if (!FileData[DeviceId].FileFuncTable)
+ FileData[DeviceId].FileFuncTable = Ext2Mount(DeviceId);
+ if (!FileData[DeviceId].FileFuncTable)
{
- /* FIXME: we link there to old infrastructure... */
- FileData[DeviceId].FileFuncTable = &CompatFsFuncTable;
+ /* Error, unable to detect file system */
+ FileData[DeviceId].FuncTable = NULL;
+ return ENODEV;
}
pDevice->DeviceId = DeviceId;
@@ -670,6 +396,10 @@
if (i == MAX_FDS)
return EMFILE;
+ /* Skip leading backslash, if any */
+ if (*FileName == '\\')
+ FileName++;
+
/* Open the file */
FileData[i].FuncTable = FileData[DeviceId].FileFuncTable;
FileData[i].DeviceId = DeviceId;
Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/is…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/iso.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/iso.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -271,9 +271,6 @@
DPRINTM(DPRINT_FILESYSTEM, "IsoOpen() FileName = %s\n", Path);
- if (*Path == '\\')
- Path++;
-
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
ret = IsoLookupFile(Path, DeviceId, &TempFileInfo);
if (ret != ESUCCESS)
@@ -507,7 +504,7 @@
//
// Check if PVD is valid. If yes, return ISO9660 function table
//
- if (Pvd->VdType == 1 && RtlCompareMemory(Pvd->StandardId,
"CD001", 5) == 5)
+ if (Pvd->VdType == 1 && RtlEqualMemory(Pvd->StandardId, "CD001",
5))
return &Iso9660FuncTable;
else
return NULL;
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/nt…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -760,74 +760,156 @@
return TRUE;
}
-FILE* NtfsOpenFile(PCSTR FileName)
+LONG NtfsClose(ULONG FileId)
+{
+ PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
+
+ NtfsReleaseAttributeContext(FileHandle->DataContext);
+ MmHeapFree(FileHandle);
+
+ return ESUCCESS;
+}
+
+LONG NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
+{
+ PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
+
+ RtlZeroMemory(Information, sizeof(FILEINFORMATION));
+ Information->EndingAddress.LowPart =
(ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record);
+ Information->CurrentAddress.LowPart = FileHandle->Offset;
+
+ DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n",
+ Information->EndingAddress.LowPart);
+ DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FilePointer = %d\n",
+ Information->CurrentAddress.LowPart);
+
+ return ESUCCESS;
+}
+
+LONG NtfsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
{
PNTFS_FILE_HANDLE FileHandle;
PNTFS_MFT_RECORD MftRecord;
-
+ ULONG DeviceId;
+
+ //
+ // Check parameters
+ //
+ if (OpenMode != OpenReadOnly)
+ return EACCES;
+
+ //
+ // Get underlying device
+ //
+ DeviceId = FsGetDeviceId(*FileId);
+
+ DPRINTM(DPRINT_FILESYSTEM, "NtfsOpen() FileName = %s\n", Path);
+
+ //
+ // Allocate file structure
+ //
FileHandle = MmHeapAlloc(sizeof(NTFS_FILE_HANDLE) + NtfsMftRecordSize);
- if (FileHandle == NULL)
- {
+ if (!FileHandle)
+ {
+ return ENOMEM;
+ }
+ RtlZeroMemory(FileHandle, sizeof(NTFS_FILE_HANDLE) + NtfsMftRecordSize);
+
+ //
+ // Search file entry
+ //
+ MftRecord = (PNTFS_MFT_RECORD)(FileHandle + 1);
+ if (!NtfsLookupFile(Path, MftRecord, &FileHandle->DataContext))
+ {
+ MmHeapFree(FileHandle);
+ return ENOENT;
+ }
+
+ return ESUCCESS;
+}
+
+LONG NtfsRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
+{
+ PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
+ ULONGLONG BytesRead64;
+
+ //
+ // Read file
+ //
+ BytesRead64 = NtfsReadAttribute(FileHandle->DataContext, FileHandle->Offset,
Buffer, N);
+ *Count = (ULONG)BytesRead64;
+
+ //
+ // Check for success
+ //
+ if (BytesRead64 > 0)
+ return ESUCCESS;
+ else
+ return EIO;
+}
+
+LONG NtfsSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
+{
+ PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
+
+ DPRINTM(DPRINT_FILESYSTEM, "NtfsSeek() NewFilePointer = %lu\n",
Position->LowPart);
+
+ if (SeekMode != SeekAbsolute)
+ return EINVAL;
+ if (Position->HighPart != 0)
+ return EINVAL;
+ if (Position->LowPart >=
(ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record))
+ return EINVAL;
+
+ FileHandle->Offset = Position->LowPart;
+ return ESUCCESS;
+}
+
+const DEVVTBL NtfsFuncTable =
+{
+ NtfsClose,
+ NtfsGetFileInformation,
+ NtfsOpen,
+ NtfsRead,
+ NtfsSeek,
+};
+
+const DEVVTBL* NtfsMount(ULONG DeviceId)
+{
+ NTFS_BOOTSECTOR BootSector;
+ LARGE_INTEGER Position;
+ ULONG Count;
+ LONG ret;
+
+ //
+ // Read the BootSector
+ //
+ Position.HighPart = 0;
+ Position.LowPart = 0;
+ ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
+ if (ret != ESUCCESS)
return NULL;
- }
-
- MftRecord = (PNTFS_MFT_RECORD)(FileHandle + 1);
- if (!NtfsLookupFile(FileName, MftRecord, &FileHandle->DataContext))
- {
- MmHeapFree(FileHandle);
+ ret = ArcRead(DeviceId, &BootSector, sizeof(BootSector), &Count);
+ if (ret != ESUCCESS || Count != sizeof(BootSector))
return NULL;
- }
-
- FileHandle->Offset = 0;
-
- return (FILE*)FileHandle;
-}
-
-VOID NtfsCloseFile(FILE *File)
-{
- PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File;
- NtfsReleaseAttributeContext(FileHandle->DataContext);
- MmHeapFree(FileHandle);
-}
-
-BOOLEAN NtfsReadFile(FILE *File, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)
-{
- PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File;
- ULONGLONG BytesRead64;
- BytesRead64 = NtfsReadAttribute(FileHandle->DataContext, FileHandle->Offset,
Buffer, BytesToRead);
- if (BytesRead64)
- {
- *BytesRead = (ULONG)BytesRead64;
- FileHandle->Offset += BytesRead64;
- return TRUE;
- }
- return FALSE;
-}
-
-ULONG NtfsGetFileSize(FILE *File)
-{
- PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File;
- return (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record);
-}
-
-VOID NtfsSetFilePointer(FILE *File, ULONG NewFilePointer)
-{
- PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File;
- FileHandle->Offset = NewFilePointer;
-}
-
-ULONG NtfsGetFilePointer(FILE *File)
-{
- PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File;
- return FileHandle->Offset;
-}
-
-const FS_VTBL NtfsVtbl = {
- NtfsOpenVolume,
- NtfsOpenFile,
- NtfsCloseFile,
- NtfsReadFile,
- NtfsGetFileSize,
- NtfsSetFilePointer,
- NtfsGetFilePointer,
-};
+
+ //
+ // Check if BootSector is valid. If yes, return NTFS function table
+ //
+ if (RtlEqualMemory(BootSector.SystemId, "NTFS", 4))
+ {
+ //
+ // Compatibility hack as long as FS is not using underlying device DeviceId
+ //
+ ULONG DriveNumber;
+ ULONGLONG StartSector;
+ ULONGLONG SectorCount;
+ int Type;
+ if (!MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount,
&Type))
+ return NULL;
+ NtfsOpenVolume(DriveNumber, StartSector, SectorCount);
+ return &NtfsFuncTable;
+ }
+ else
+ return NULL;
+}
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -47,7 +47,6 @@
#define FILESYSBUFFER 0x80000 /* Buffer to store file system data (e.g. cluster buffer
for FAT) */
#define DISKREADBUFFER 0x90000 /* Buffer to store data read in from the disk via the
BIOS */
#elif defined(_M_PPC) || defined(_M_MIPS) || defined(_M_ARM)
-extern PVOID FsStaticBufferDisk, FsStaticBufferData;
#define DISKREADBUFFER 0x80000000
#define FILESYSBUFFER 0x80000000
#endif
Modified: trunk/reactos/boot/freeldr/freeldr/include/disk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -130,9 +130,7 @@
BOOLEAN DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector,
PULONGLONG SectorCount, int *FsType);
BOOLEAN DiskGetSystemVolume(char *SystemPath, char *RemainingPath,
- PULONG Device, PULONG DriveNumber,
- PULONGLONG StartSector,
- PULONGLONG SectorCount, int *FsType);
+ PULONG Device);
BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size);
VOID DiskGetBootDevice(PULONG BootDevice);
BOOLEAN DiskBootingFromFloppy(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/fs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -50,8 +50,6 @@
LONG ArcSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode);
VOID FileSystemError(PCSTR ErrorString);
-BOOLEAN FsOpenBootVolume();
-BOOLEAN FsOpenSystemVolume(PCHAR SystemPath, PCHAR RemainingPath, PULONG BootDevice);
PFILE FsOpenFile(PCSTR FileName);
VOID FsCloseFile(PFILE FileHandle);
BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);
@@ -62,15 +60,4 @@
ULONG FsGetNumPathParts(PCSTR Path);
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path);
-typedef struct
-{
- BOOLEAN (*OpenVolume)(UCHAR DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount);
- PFILE (*OpenFile)(PCSTR FileName);
- VOID (*CloseFile)(PFILE FileHandle);
- BOOLEAN (*ReadFile)(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID
Buffer);
- ULONG (*GetFileSize)(PFILE FileHandle);
- VOID (*SetFilePointer)(PFILE FileHandle, ULONG NewFilePointer);
- ULONG (*GetFilePointer)(PFILE FileHandle);
-} FS_VTBL;
-
#endif // #defined __FS_H
Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -668,37 +668,6 @@
EXT2_INODE Inode; // File's inode
} EXT2_FILE_INFO, * PEXT2_FILE_INFO;
-
-
-BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
PartitionSectorCount);
-FILE* Ext2OpenFile(PCSTR FileName);
-BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
-BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize,
PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
-BOOLEAN Ext2ReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID
Buffer);
-ULONG Ext2GetFileSize(FILE *FileHandle);
-VOID Ext2SetFilePointer(FILE *FileHandle, ULONG NewFilePointer);
-ULONG Ext2GetFilePointer(FILE *FileHandle);
-BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG
SectorCount, PVOID Buffer);
-
-BOOLEAN Ext2ReadFileBig(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead,
PVOID Buffer);
-BOOLEAN Ext2ReadSuperBlock(VOID);
-BOOLEAN Ext2ReadGroupDescriptors(VOID);
-BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE
InodePointer);
-BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer);
-BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID
Buffer);
-ULONG Ext2GetGroupDescBlockNumber(ULONG Group);
-ULONG Ext2GetGroupDescOffsetInBlock(ULONG Group);
-ULONG Ext2GetInodeGroupNumber(ULONG Inode);
-ULONG Ext2GetInodeBlockNumber(ULONG Inode);
-ULONG Ext2GetInodeOffsetInBlock(ULONG Inode);
-BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer);
-BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer);
-ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode);
-ULONGLONG Ext2GetInodeFileSize(PEXT2_INODE Inode);
-BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG
BlockCount, ULONG IndirectBlock);
-BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList,
ULONG BlockCount, ULONG DoubleIndirectBlock);
-BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList,
ULONG BlockCount, ULONG TripleIndirectBlock);
-
-extern const FS_VTBL Ext2Vtbl;
+const DEVVTBL* Ext2Mount(ULONG DeviceId);
#endif // #defined __EXT2_H
Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -152,28 +152,6 @@
ULONG DriveNumber;
} FAT_FILE_INFO, * PFAT_FILE_INFO;
-
-
-BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
PartitionSectorCount);
-ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount);
-PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN
RootDirectory);
-BOOLEAN FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PCHAR
FileName, PFAT_FILE_INFO FatFileInfoPointer);
-BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer);
-void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry);
-BOOLEAN FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer);
-FILE* FatOpenFile(PCSTR FileName);
-ULONG FatCountClustersInChain(ULONG StartCluster);
-ULONG* FatGetClusterChainArray(ULONG StartCluster);
-BOOLEAN FatReadCluster(ULONG ClusterNumber, PVOID Buffer);
-BOOLEAN FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID
Buffer);
-BOOLEAN FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length,
PVOID Buffer);
-BOOLEAN FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID
Buffer);
-ULONG FatGetFileSize(FILE *FileHandle);
-VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer);
-ULONG FatGetFilePointer(FILE *FileHandle);
-BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount,
PVOID Buffer);
-
-
#define ATTR_NORMAL 0x00
#define ATTR_READONLY 0x01
#define ATTR_HIDDEN 0x02
@@ -191,6 +169,6 @@
#define ISFATX(FT) ((FT) == FATX16 || (FT) == FATX32)
-extern const FS_VTBL FatVtbl;
+const DEVVTBL* FatMount(ULONG DeviceId);
#endif // #defined __FAT_H
Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -99,8 +99,6 @@
ULONG DriveNumber;
} ISO_FILE_INFO, * PISO_FILE_INFO;
-extern const FS_VTBL Iso9660Vtbl;
-
const DEVVTBL* IsoMount(ULONG DeviceId);
#endif // #defined __FAT_H
Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -222,14 +222,6 @@
} NTFS_FILE_HANDLE, *PNTFS_FILE_HANDLE;
#include <poppack.h>
-BOOLEAN NtfsOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
PartitionSectorCount);
-FILE* NtfsOpenFile(PCSTR FileName);
-VOID NtfsCloseFile(FILE *FileHandle);
-BOOLEAN NtfsReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID
Buffer);
-ULONG NtfsGetFileSize(FILE *FileHandle);
-VOID NtfsSetFilePointer(FILE *FileHandle, ULONG NewFilePointer);
-ULONG NtfsGetFilePointer(FILE *FileHandle);
-
-extern const FS_VTBL NtfsVtbl;
+const DEVVTBL* NtfsMount(ULONG DeviceId);
#endif // #defined __NTFS_H
Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -63,7 +63,7 @@
ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
BOOLEAN (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG
SectorCount, int *FsType);
- BOOLEAN (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device,
PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
+ BOOLEAN (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device);
BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
VOID (*DiskGetBootDevice)(PULONG BootDevice);
BOOLEAN (*DiskBootingFromFloppy)(VOID);
@@ -104,11 +104,7 @@
BOOLEAN
MachDiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
- PULONG Device,
- PULONG DriveNumber,
- PULONGLONG StartSector,
- PULONGLONG SectorCount,
- int *FsType);
+ PULONG Device);
BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size);
VOID MachDiskGetBootDevice(PULONG BootDevice);
BOOLEAN MachDiskBootingFromFloppy();
@@ -140,7 +136,7 @@
#define MachBeep() MachVtbl.Beep()
#define MachPrepareForReactOS(a) MachVtbl.PrepareForReactOS(a)
#define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv),
(Start), (Cnt), (FsType))
-#define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt,
FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt),
(FsType))
+#define MachDiskGetSystemVolume(SysPath, RemPath,
Dev) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev))
#define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
#define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice)
#define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy()
Modified: trunk/reactos/boot/freeldr/freeldr/linuxboot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/linux…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/linuxboot.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/linuxboot.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -73,9 +73,9 @@
UiMessageBox("Invalid boot path");
goto LinuxBootFailed;
}
- if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL))
- {
- UiMessageBox("Failed to open boot drive.");
+ if (!MachDiskGetSystemVolume(LinuxBootPath, NULL, NULL))
+ {
+ UiMessageBox("Failed to get system volume.");
goto LinuxBootFailed;
}
Modified: trunk/reactos/boot/freeldr/freeldr/machine.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/machi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -333,15 +333,9 @@
BOOLEAN
MachDiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
- PULONG Device,
- PULONG DriveNumber,
- PULONGLONG StartSector,
- PULONGLONG SectorCount,
- int *FsType)
-{
- return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device,
- DriveNumber, StartSector, SectorCount,
- FsType);
+ PULONG Device)
+{
+ return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device);
}
BOOLEAN
Modified: trunk/reactos/boot/freeldr/freeldr/miscboot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/miscb…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/miscboot.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/miscboot.c [iso-8859-1] Sat Aug 8 22:53:10 2009
@@ -51,9 +51,9 @@
return;
}
- if (!FsOpenSystemVolume(FileName, FileName, NULL))
- {
- UiMessageBox("Failed to open boot drive.");
+ if (!MachDiskGetSystemVolume(FileName, FileName, NULL))
+ {
+ UiMessageBox("Failed to get system volume.");
return;
}
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -756,11 +756,11 @@
RamDiskSwitchFromBios();
/*
- * Try to open system drive
- */
- if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
- {
- UiMessageBox("Failed to open system drive.");
+ * Try to get system volume
+ */
+ if (!MachDiskGetSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
+ {
+ UiMessageBox("Failed to get system volume.");
return;
}
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c [iso-8859-1] Sat Aug 8 22:53:10
2009
@@ -119,13 +119,6 @@
/* set boot device */
MachDiskGetBootDevice(&LoaderBlock.BootDevice);
- /* Open boot drive */
- if (!FsOpenBootVolume())
- {
- UiMessageBox("Failed to open boot drive.");
- return;
- }
-
UiDrawStatusText("Loading txtsetup.sif...");
/* Open 'txtsetup.sif' */
for (i = MachDiskBootingFromFloppy() ? 0 : 1; ; i++)
@@ -201,13 +194,6 @@
if (MachDiskBootingFromFloppy())
{
UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press
ENTER");
-
- /* Open boot drive */
- if (!FsOpenBootVolume())
- {
- UiMessageBox("Failed to open boot drive.");
- return;
- }
/* FIXME: check volume label or disk marker file */
}
Modified: trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c [iso-8859-1] Sat Aug 8
22:53:10 2009
@@ -186,9 +186,6 @@
NULL
};
- /* Try to open system drive */
- FsOpenBootVolume();
-
/* Open 'txtsetup.sif' from any of source paths */
MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
for (i = MachDiskBootingFromFloppy() ? 0 : 1; ; i++)