mirror of
https://github.com/reactos/reactos.git
synced 2024-12-13 14:13:36 +08:00
[FREELDR] Fix remaining hwdisk and FATX bugs (#1766)
- DiskGetFileInformation() should return relative addresses -- relative to the beginning of the "device" (partition, or disk) in question. - FatXSearchDirectoryBufferForFile() should assign file attributes. - Minor code style improvements in FatOpenVolume(). CORE-16216 CORE-16248 Co-authored-by: Victor Perevertkin <victor@perevertkin.ru>
This commit is contained in:
parent
48200015f7
commit
ef76709b3d
@ -65,8 +65,8 @@ DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
|
||||
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
|
||||
|
||||
RtlZeroMemory(Information, sizeof(FILEINFORMATION));
|
||||
Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize;
|
||||
Information->CurrentAddress.QuadPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize;
|
||||
Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize;
|
||||
Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize;
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
@ -266,12 +266,12 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG
|
||||
{
|
||||
Volume->BytesPerSector = 512;
|
||||
Volume->SectorsPerCluster = SWAPD(FatXVolumeBootSector->SectorsPerCluster);
|
||||
Volume->FatSectorStart = (4096 / Volume->BytesPerSector);
|
||||
Volume->FatSectorStart = (0x1000 / Volume->BytesPerSector);
|
||||
Volume->ActiveFatSectorStart = Volume->FatSectorStart;
|
||||
Volume->NumberOfFats = 1;
|
||||
FatSize = (ULONG)(PartitionSectorCount / Volume->SectorsPerCluster *
|
||||
(Volume->FatType == FATX16 ? 2 : 4));
|
||||
Volume->SectorsPerFat = (((FatSize + 4095) / 4096) * 4096) / Volume->BytesPerSector;
|
||||
Volume->SectorsPerFat = ROUND_UP(FatSize, 0x1000) / Volume->BytesPerSector;
|
||||
|
||||
Volume->RootDirSectorStart = Volume->FatSectorStart + Volume->NumberOfFats * Volume->SectorsPerFat;
|
||||
Volume->RootDirSectors = FatXVolumeBootSector->SectorsPerCluster;
|
||||
@ -720,6 +720,7 @@ static BOOLEAN FatXSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID D
|
||||
/*
|
||||
* We found the entry, now fill in the FAT_FILE_INFO struct
|
||||
*/
|
||||
FatFileInfoPointer->Attributes = DirEntry->Attr;
|
||||
FatFileInfoPointer->FileSize = DirEntry->Size;
|
||||
FatFileInfoPointer->FilePointer = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user