Revert r65097 and r65090.
Thanks to r65104, now the FSCTLs go to the right place: the FSDs!

Thanks to Thomas for pointing out that NTFSinfo was really talking with the FSD on Windows and not to disk.sys

CORE-8725

svn path=/trunk/; revision=65105
This commit is contained in:
Pierre Schweitzer 2014-10-29 18:25:30 +00:00
parent 48cddc2fcc
commit c009666393

View file

@ -385,11 +385,6 @@ 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
//
@ -5214,116 +5209,3 @@ 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)
{
#define FSCTL_GET_VOLUME_INFORMATION 0x90064
typedef struct {
LARGE_INTEGER SerialNumber;
LARGE_INTEGER NumberOfSectors;
LARGE_INTEGER TotalClusters;
LARGE_INTEGER FreeClusters;
LARGE_INTEGER Reserved;
ULONG BytesPerSector;
ULONG BytesPerCluster;
ULONG BytesPerMFTRecord;
ULONG ClustersPerMFTRecord;
LARGE_INTEGER MFTLength;
LARGE_INTEGER MFTStart;
LARGE_INTEGER MFTMirrorStart;
LARGE_INTEGER MFTZoneStart;
LARGE_INTEGER MFTZoneEnd;
} NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER;
PIO_STACK_LOCATION Stack;
NTSTATUS Status;
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
PDISK_DATA diskData;
DPRINT1("NtfsRussinovichism(%p, %p)\n", DeviceObject, Irp);
Stack = IoGetCurrentIrpStackLocation(Irp);
switch (Stack->Parameters.FileSystemControl.FsControlCode)
{
case FSCTL_GET_VOLUME_INFORMATION:
//
// Check we received something we understand
//
if (Stack->Parameters.FileSystemControl.OutputBufferLength < sizeof(NTFS_VOLUME_DATA_BUFFER) ||
Irp->UserBuffer == NULL)
{
DPRINT1("Invalid output! %d %p\n", Stack->Parameters.FileSystemControl.OutputBufferLength, Irp->UserBuffer);
Status = STATUS_INVALID_PARAMETER;
break;
}
//
// Now, quickly check we are supposed to have a NTFS volume
//
diskData = (PDISK_DATA)(deviceExtension + 1);
if (diskData->PartitionType != PARTITION_IFS)
{
DPRINT1("Invalid partition type! %x\n", diskData->PartitionType);
Status = STATUS_INVALID_PARAMETER;
break;
}
UNIMPLEMENTED;
Status = STATUS_NOT_IMPLEMENTED;
break;
default:
Status = STATUS_INVALID_DEVICE_REQUEST;
break;
}
return Status;
#undef FSCTL_GET_VOLUME_INFORMATION
}
//
// 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;
}