mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[KSECDD]
Implement IRP_MJ_QUERY_INFORMATION and IRP_MJ_QUERY_VOLUME_INFORMATION svn path=/trunk/; revision=61755
This commit is contained in:
parent
fcc7d66c11
commit
793f6fe43d
2 changed files with 99 additions and 0 deletions
|
@ -16,6 +16,71 @@
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
KsecQueryFileInformation(
|
||||
PVOID InfoBuffer,
|
||||
FILE_INFORMATION_CLASS FileInformationClass,
|
||||
PSIZE_T BufferLength)
|
||||
{
|
||||
PFILE_STANDARD_INFORMATION StandardInformation;
|
||||
|
||||
/* Only FileStandardInformation is supported */
|
||||
if (FileInformationClass != FileStandardInformation)
|
||||
{
|
||||
return STATUS_INVALID_INFO_CLASS;
|
||||
}
|
||||
|
||||
/* Validate buffer size */
|
||||
if (*BufferLength >= sizeof(FILE_STANDARD_INFORMATION))
|
||||
{
|
||||
*BufferLength = sizeof(FILE_STANDARD_INFORMATION);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
|
||||
/* Fill the structure */
|
||||
StandardInformation = (PFILE_STANDARD_INFORMATION)InfoBuffer;
|
||||
StandardInformation->AllocationSize.QuadPart = 0;
|
||||
StandardInformation->EndOfFile.QuadPart = 0;
|
||||
StandardInformation->NumberOfLinks = 1;
|
||||
StandardInformation->DeletePending = FALSE;
|
||||
StandardInformation->Directory = FALSE;
|
||||
*BufferLength = sizeof(FILE_STANDARD_INFORMATION);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
KsecQueryVolumeInformation(
|
||||
PVOID InfoBuffer,
|
||||
FS_INFORMATION_CLASS FsInformationClass,
|
||||
PSIZE_T BufferLength)
|
||||
{
|
||||
PFILE_FS_DEVICE_INFORMATION DeviceInformation;
|
||||
|
||||
/* Only FileFsDeviceInformation is supported */
|
||||
if (FsInformationClass == FileFsDeviceInformation)
|
||||
{
|
||||
return STATUS_INVALID_INFO_CLASS;
|
||||
}
|
||||
|
||||
/* Validate buffer size */
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
{
|
||||
*BufferLength = sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
|
||||
/* Fill the structure */
|
||||
DeviceInformation = (PFILE_FS_DEVICE_INFORMATION)InfoBuffer;
|
||||
DeviceInformation->DeviceType = FILE_DEVICE_NULL;
|
||||
DeviceInformation->Characteristics = 0;
|
||||
*BufferLength = sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
KsecDdDispatch(
|
||||
|
@ -25,6 +90,10 @@ KsecDdDispatch(
|
|||
PIO_STACK_LOCATION IoStackLocation;
|
||||
ULONG_PTR Information;
|
||||
NTSTATUS Status;
|
||||
PVOID Buffer;
|
||||
SIZE_T OutputLength;
|
||||
FILE_INFORMATION_CLASS FileInfoClass;
|
||||
FS_INFORMATION_CLASS FsInfoClass;
|
||||
|
||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
|
@ -52,6 +121,34 @@ KsecDdDispatch(
|
|||
Information = IoStackLocation->Parameters.Write.Length;
|
||||
break;
|
||||
|
||||
case IRP_MJ_QUERY_INFORMATION:
|
||||
|
||||
/* Extract the parameters */
|
||||
Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
OutputLength = IoStackLocation->Parameters.QueryFile.Length;
|
||||
FileInfoClass = IoStackLocation->Parameters.QueryFile.FileInformationClass;
|
||||
|
||||
/* Call the internal function */
|
||||
Status = KsecQueryFileInformation(Buffer,
|
||||
FileInfoClass,
|
||||
&OutputLength);
|
||||
Information = OutputLength;
|
||||
break;
|
||||
|
||||
case IRP_MJ_QUERY_VOLUME_INFORMATION:
|
||||
|
||||
/* Extract the parameters */
|
||||
Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
OutputLength = IoStackLocation->Parameters.QueryVolume.Length;
|
||||
FsInfoClass = IoStackLocation->Parameters.QueryVolume.FsInformationClass;
|
||||
|
||||
/* Call the internal function */
|
||||
Status = KsecQueryVolumeInformation(Buffer,
|
||||
FsInfoClass,
|
||||
&OutputLength);
|
||||
Information = OutputLength;
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("Unhandled major function %lu!\n",
|
||||
IoStackLocation->MajorFunction);
|
||||
|
|
|
@ -48,6 +48,8 @@ DriverEntry(
|
|||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = KsecDdDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = KsecDdDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = KsecDdDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = KsecDdDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = KsecDdDispatch;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue