diff --git a/reactos/drivers/filesystems/cdfs/common.c b/reactos/drivers/filesystems/cdfs/common.c index dd47a78a964..4dd9888492e 100644 --- a/reactos/drivers/filesystems/cdfs/common.c +++ b/reactos/drivers/filesystems/cdfs/common.c @@ -50,6 +50,7 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject, PIRP Irp; NTSTATUS Status; +again: KeInitializeEvent(&Event, NotificationEvent, FALSE); @@ -102,14 +103,19 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject, if (Status == STATUS_VERIFY_REQUIRED) { PDEVICE_OBJECT DeviceToVerify; - NTSTATUS NewStatus; DPRINT1("STATUS_VERIFY_REQUIRED\n"); DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); IoSetDeviceToVerify(PsGetCurrentThread(), NULL); - NewStatus = IoVerifyVolume(DeviceToVerify, FALSE); - DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus); + Status = IoVerifyVolume(DeviceToVerify, FALSE); + DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status); + + if (NT_SUCCESS(Status)) + { + DPRINT1("Volume verify succeeded; trying request again\n"); + goto again; + } } DPRINT("CdfsReadSectors() failed (Status %x)\n", Status); @@ -146,6 +152,7 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize, OutputBufferSize ? *OutputBufferSize : 0); +again: KeInitializeEvent (&Event, NotificationEvent, FALSE); DPRINT("Building device I/O control request ...\n"); @@ -191,7 +198,6 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, if (Status == STATUS_VERIFY_REQUIRED) { PDEVICE_OBJECT DeviceToVerify; - NTSTATUS NewStatus; DPRINT1("STATUS_VERIFY_REQUIRED\n"); DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); @@ -199,8 +205,14 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, if (DeviceToVerify) { - NewStatus = IoVerifyVolume(DeviceToVerify, FALSE); - DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus); + Status = IoVerifyVolume(DeviceToVerify, FALSE); + DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status); + } + + if (NT_SUCCESS(Status)) + { + DPRINT1("Volume verify succeeded; trying request again\n"); + goto again; } } diff --git a/reactos/drivers/filesystems/fastfat/rw.c b/reactos/drivers/filesystems/fastfat/rw.c index bbcae945c83..3d395a193b6 100644 --- a/reactos/drivers/filesystems/fastfat/rw.c +++ b/reactos/drivers/filesystems/fastfat/rw.c @@ -697,12 +697,11 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) } Status = VfatReadFileData(IrpContext, Length, ByteOffset, &ReturnedLength); -/**/ if (Status == STATUS_VERIFY_REQUIRED) { - DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n"); + DPRINT("VfatReadFileData returned STATUS_VERIFY_REQUIRED\n"); DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); - IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify); + IoSetDeviceToVerify(PsGetCurrentThread(), NULL); Status = IoVerifyVolume (DeviceToVerify, FALSE); if (NT_SUCCESS(Status)) @@ -710,9 +709,8 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) Status = VfatReadFileData(IrpContext, Length, ByteOffset, &ReturnedLength); } - } -/**/ + if (NT_SUCCESS(Status)) { IrpContext->Irp->IoStatus.Information = ReturnedLength; @@ -769,6 +767,7 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext) ULONG OldAllocationSize; PVOID Buffer; ULONG BytesPerSector; + PDEVICE_OBJECT DeviceToVerify; ASSERT(IrpContext); @@ -990,6 +989,19 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext) } Status = VfatWriteFileData(IrpContext, Length, ByteOffset); + if (Status == STATUS_VERIFY_REQUIRED) + { + DPRINT("VfatWriteFileData returned STATUS_VERIFY_REQUIRED\n"); + DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); + IoSetDeviceToVerify(PsGetCurrentThread(), NULL); + Status = IoVerifyVolume (DeviceToVerify, FALSE); + + if (NT_SUCCESS(Status)) + { + Status = VfatWriteFileData(IrpContext, Length, ByteOffset); + } + } + if (NT_SUCCESS(Status)) { IrpContext->Irp->IoStatus.Information = Length;