Get ready to enter into the 10th dimension... So:
- Implement support for IRP_MJ_FILE_SYSTEM_CONTROL. Yes... You read well! So, implemented a ScsiDiskFileSystemControl() function. The way it is added to the DriverObject is a big hack, class2 is not supposed to have such requests, so, we do it in its back. Fear!
- Stubplement the NtfsRussinovichism() function. This is the only function we're supposed to call with IRP MJ FSCTRL and with IRP MN USRFSRQST. Its purpose (when its implemented) is to reply back to the M. Russinovich tools (NFI & NTFSInfo) so that they can directly dump NTFS information without going into NTFS driver. They kind of bypass it.
We do all agree this is a ugly hack. But it exists in Windows, as these tools work in Windows. And it would be useful they actually work in ReactOS.
Soon, we'll be able to publish a book "ReactOS Internals" where we speak about undocumented FS controls to dump NTFS information to show how well our NTFS works ;-).

svn path=/trunk/; revision=65090
This commit is contained in:
Pierre Schweitzer 2014-10-28 21:59:57 +00:00
parent 70cb67436c
commit 7a204076f6

View file

@ -310,6 +310,11 @@ ResetScsiBus(
IN PDEVICE_OBJECT DeviceObject
);
NTSTATUS
NTAPI
ScsiDiskFileSystemControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp);
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, DriverEntry)
#pragma alloc_text(PAGE, FindScsiDisks)
@ -380,6 +385,11 @@ Return Value:
InitializationData.ClassShutdownFlush = ScsiDiskShutdownFlush;
InitializationData.ClassCreateClose = NULL;
//
// HACK! Please check below to the implementation of the function
//
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = ScsiDiskFileSystemControl;
//
// Call the class init routine
//
@ -5202,3 +5212,56 @@ Return Value:
}
} // end UpdateDeviceObjects()
//
// This function is supposed only to support NTFS tools
// from M. Russinovich. This is kind of huge hack and is
// totally undocumented :-).
//
NTSTATUS
NtfsRussinovichism(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
//
// Hack: this function is not supposed to be implemented
// Even though it's required to enable some M. Russinovich
// to directly request disks so that they can dump NTFS data
// without going through the driver.
// We don't expect doing more from here, hence the limited
// implementation and support.
//
NTSTATUS
NTAPI
ScsiDiskFileSystemControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION Stack;
NTSTATUS Status;
DPRINT1("ScsiDiskFileSystemControl(%p, %p)\n", DeviceObject, Irp);
Stack = IoGetCurrentIrpStackLocation(Irp);
switch (Stack->MinorFunction)
{
case IRP_MN_USER_FS_REQUEST:
Status = NtfsRussinovichism(DeviceObject, Irp);
break;
default:
DPRINT("MinorFunction %d\n", Stack->MinorFunction);
Status = STATUS_INVALID_DEVICE_REQUEST;
break;
}
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}