From: Hervé Poussineau Date: Sun, 6 Sep 2009 20:00:23 +0000 (+0000) Subject: Implement GetFileInformation() on disks for i386 architecture X-Git-Tag: ReactOS-0.3.11~901 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=0472f141b8de858d02cae0795e6ffa675822119a Implement GetFileInformation() on disks for i386 architecture svn path=/trunk/; revision=43006 --- diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c index 2f800beb1d9..ec55e094ae3 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c @@ -402,6 +402,7 @@ typedef struct tagDISKCONTEXT ULONG DriveNumber; ULONG SectorSize; ULONGLONG SectorOffset; + ULONGLONG SectorCount; ULONGLONG SectorNumber; } DISKCONTEXT; @@ -415,7 +416,13 @@ static LONG DiskClose(ULONG FileId) static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) { - return EINVAL; + DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); + + RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize; + Information->CurrentAddress.LowPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; + + return ESUCCESS; } static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) @@ -423,6 +430,7 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) DISKCONTEXT* Context; ULONG DriveNumber, DrivePartition, SectorSize; ULONGLONG SectorOffset = 0; + ULONGLONG SectorCount = 0; PARTITION_TABLE_ENTRY PartitionTableEntry; CHAR FileName[1]; @@ -434,6 +442,11 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) if (!MachDiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry)) return EINVAL; SectorOffset = PartitionTableEntry.SectorCountBeforePartition; + SectorCount = PartitionTableEntry.PartitionSectorCount; + } + else + { + SectorCount = 0; /* FIXME */ } Context = MmHeapAlloc(sizeof(DISKCONTEXT)); @@ -442,6 +455,7 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) Context->DriveNumber = DriveNumber; Context->SectorSize = SectorSize; Context->SectorOffset = SectorOffset; + Context->SectorCount = SectorCount; Context->SectorNumber = 0; FsSetDeviceSpecific(*FileId, Context);