mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 00:50:23 +00:00
- Implemented FatPerformDevIoCtrl
- Use it while mounting new volume to get the right sector size. This fixes a TODO (that was looking as a hack :p) svn path=/trunk/; revision=39025
This commit is contained in:
parent
63677b493d
commit
68ca50178c
3 changed files with 69 additions and 2 deletions
|
@ -21,4 +21,51 @@ FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
|
||||||
|
ULONG ControlCode,
|
||||||
|
PVOID InputBuffer,
|
||||||
|
ULONG InputBufferSize,
|
||||||
|
PVOID OutputBuffer,
|
||||||
|
ULONG OutputBufferSize,
|
||||||
|
BOOLEAN Override)
|
||||||
|
{
|
||||||
|
PIRP Irp;
|
||||||
|
KEVENT Event;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PIO_STACK_LOCATION Stack;
|
||||||
|
IO_STATUS_BLOCK IoStatus;
|
||||||
|
|
||||||
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
Irp = IoBuildDeviceIoControlRequest(ControlCode,
|
||||||
|
DeviceObject,
|
||||||
|
InputBuffer,
|
||||||
|
InputBufferSize,
|
||||||
|
OutputBuffer,
|
||||||
|
OutputBufferSize,
|
||||||
|
FALSE,
|
||||||
|
&Event,
|
||||||
|
&IoStatus);
|
||||||
|
if (Irp == NULL)
|
||||||
|
{
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Override)
|
||||||
|
{
|
||||||
|
Stack = IoGetNextIrpStackLocation(Irp);
|
||||||
|
Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = IoCallDriver(DeviceObject, Irp);
|
||||||
|
if (Status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||||
|
Status = IoStatus.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -342,6 +342,15 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
|
||||||
|
ULONG ControlCode,
|
||||||
|
PVOID InputBuffer,
|
||||||
|
ULONG InputBufferSize,
|
||||||
|
PVOID OutputBuffer,
|
||||||
|
ULONG OutputBufferSize,
|
||||||
|
BOOLEAN Override);
|
||||||
|
|
||||||
/* ------------------------------------------------------ direntry.c */
|
/* ------------------------------------------------------ direntry.c */
|
||||||
|
|
||||||
/* ----------------------------------------------------------- fcb.c */
|
/* ----------------------------------------------------------- fcb.c */
|
||||||
|
|
|
@ -55,6 +55,7 @@ FatMountVolume(PFAT_IRP_CONTEXT IrpContext,
|
||||||
PDEVICE_OBJECT FsDeviceObject)
|
PDEVICE_OBJECT FsDeviceObject)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
DISK_GEOMETRY DiskGeometry;
|
||||||
PVOLUME_DEVICE_OBJECT VolumeDevice;
|
PVOLUME_DEVICE_OBJECT VolumeDevice;
|
||||||
|
|
||||||
DPRINT1("FatMountVolume()\n");
|
DPRINT1("FatMountVolume()\n");
|
||||||
|
@ -89,8 +90,18 @@ FatMountVolume(PFAT_IRP_CONTEXT IrpContext,
|
||||||
/* Init stack size */
|
/* Init stack size */
|
||||||
VolumeDevice->DeviceObject.StackSize = TargetDeviceObject->StackSize + 1;
|
VolumeDevice->DeviceObject.StackSize = TargetDeviceObject->StackSize + 1;
|
||||||
|
|
||||||
/* TODO: IOCTL_DISK_GET_DRIVE_GEOMETRY to obtain BytesPerSector */
|
/* Get sector size */
|
||||||
VolumeDevice->DeviceObject.SectorSize = 512;
|
Status = FatPerformDevIoCtrl(TargetDeviceObject,
|
||||||
|
IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&DiskGeometry,
|
||||||
|
sizeof(DISK_GEOMETRY),
|
||||||
|
TRUE);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
VolumeDevice->DeviceObject.SectorSize = DiskGeometry.BytesPerSector;
|
||||||
|
|
||||||
/* Signal we're done with initializing */
|
/* Signal we're done with initializing */
|
||||||
VolumeDevice->DeviceObject.Flags &= ~DO_DEVICE_INITIALIZING;
|
VolumeDevice->DeviceObject.Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
Loading…
Reference in a new issue