mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:25:39 +00:00
Implement GetFileInformation() on disks for i386 architecture
svn path=/trunk/; revision=43006
This commit is contained in:
parent
e6aa81a105
commit
0472f141b8
1 changed files with 15 additions and 1 deletions
|
@ -402,6 +402,7 @@ typedef struct tagDISKCONTEXT
|
||||||
ULONG DriveNumber;
|
ULONG DriveNumber;
|
||||||
ULONG SectorSize;
|
ULONG SectorSize;
|
||||||
ULONGLONG SectorOffset;
|
ULONGLONG SectorOffset;
|
||||||
|
ULONGLONG SectorCount;
|
||||||
ULONGLONG SectorNumber;
|
ULONGLONG SectorNumber;
|
||||||
} DISKCONTEXT;
|
} DISKCONTEXT;
|
||||||
|
|
||||||
|
@ -415,7 +416,13 @@ static LONG DiskClose(ULONG FileId)
|
||||||
|
|
||||||
static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
|
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)
|
static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
|
@ -423,6 +430,7 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
DISKCONTEXT* Context;
|
DISKCONTEXT* Context;
|
||||||
ULONG DriveNumber, DrivePartition, SectorSize;
|
ULONG DriveNumber, DrivePartition, SectorSize;
|
||||||
ULONGLONG SectorOffset = 0;
|
ULONGLONG SectorOffset = 0;
|
||||||
|
ULONGLONG SectorCount = 0;
|
||||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||||
CHAR FileName[1];
|
CHAR FileName[1];
|
||||||
|
|
||||||
|
@ -434,6 +442,11 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
if (!MachDiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry))
|
if (!MachDiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
SectorOffset = PartitionTableEntry.SectorCountBeforePartition;
|
SectorOffset = PartitionTableEntry.SectorCountBeforePartition;
|
||||||
|
SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SectorCount = 0; /* FIXME */
|
||||||
}
|
}
|
||||||
|
|
||||||
Context = MmHeapAlloc(sizeof(DISKCONTEXT));
|
Context = MmHeapAlloc(sizeof(DISKCONTEXT));
|
||||||
|
@ -442,6 +455,7 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
Context->DriveNumber = DriveNumber;
|
Context->DriveNumber = DriveNumber;
|
||||||
Context->SectorSize = SectorSize;
|
Context->SectorSize = SectorSize;
|
||||||
Context->SectorOffset = SectorOffset;
|
Context->SectorOffset = SectorOffset;
|
||||||
|
Context->SectorCount = SectorCount;
|
||||||
Context->SectorNumber = 0;
|
Context->SectorNumber = 0;
|
||||||
FsSetDeviceSpecific(*FileId, Context);
|
FsSetDeviceSpecific(*FileId, Context);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue