From 6a71e2613567c90e2113bcfab94099493b044159 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 15 Feb 2015 23:06:30 +0000 Subject: [PATCH] [NTOSKRNL] NtQueryInformationFile: Implement FileAccessInformation and FileAlignmentInformation cases according to 'File System Internals' page 485. svn path=/trunk/; revision=66307 --- reactos/ntoskrnl/io/iomgr/iofunc.c | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/io/iomgr/iofunc.c b/reactos/ntoskrnl/io/iomgr/iofunc.c index c7c62abb196..c04b4e65777 100644 --- a/reactos/ntoskrnl/io/iomgr/iofunc.c +++ b/reactos/ntoskrnl/io/iomgr/iofunc.c @@ -1863,6 +1863,9 @@ NtQueryInformationFile(IN HANDLE FileHandle, PVOID NormalContext; KIRQL OldIrql; IO_STATUS_BLOCK KernelIosb; + BOOLEAN CallDriver = TRUE; + PFILE_ACCESS_INFORMATION AccessBuffer; + PFILE_ALIGNMENT_INFORMATION AlignmentBuffer; PAGED_CODE(); IOTRACE(IO_API_DEBUG, "FileHandle: %p\n", FileHandle); @@ -2043,8 +2046,34 @@ NtQueryInformationFile(IN HANDLE FileHandle, /* Update operation counts */ IopUpdateOperationCount(IopOtherTransfer); + /* Fill in file information before calling the driver. + See 'File System Internals' page 485.*/ + if (FileInformationClass == FileAccessInformation) + { + AccessBuffer = Irp->AssociatedIrp.SystemBuffer; + AccessBuffer->AccessFlags = HandleInformation.GrantedAccess; + Irp->IoStatus.Information = sizeof(FILE_ACCESS_INFORMATION); + CallDriver = FALSE; + } + else if (FileInformationClass == FileAlignmentInformation) + { + AlignmentBuffer = Irp->AssociatedIrp.SystemBuffer; + AlignmentBuffer->AlignmentRequirement = DeviceObject->AlignmentRequirement; + Irp->IoStatus.Information = sizeof(FILE_ALIGNMENT_INFORMATION); + CallDriver = FALSE; + } + /* Call the Driver */ - Status = IoCallDriver(DeviceObject, Irp); + if (CallDriver) + { + Status = IoCallDriver(DeviceObject, Irp); + } + else + { + Status = STATUS_SUCCESS; + Irp->IoStatus.Status = STATUS_SUCCESS; + } + if (Status == STATUS_PENDING) { /* Check if this was async I/O */