Hello,
I’m trying to implement a write-protected virtual mirror disk
for an NTFS volume. My driver is stacked on top of the
block device driver. When a request arrives, I’ll build new
IRPs
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
BlockDeviceObject,
Buffer,
Length,
Offset,
&Event,
pIoStatus
);
// Using IoBuildAsynchronousFsdRequest produce the same error
Then pass it down to the lower device
Status = IoCallDriver(BlockDeviceObject, Irp);
if(Status == STATUS_PENDING)
{
KeWaitForSingleObject(
&Event,
Executive,
KernelMode,
FALSE,
NULL
);
Status = pIoStatus->Status;
}
This approach works fine for small files (< 2 KBytes). But
when reading/copying a large file, the process will fail near the
2 KBytes mark with this error
“MM MODWRITE: failing all io, controlarea 82119B38 status c00000a2”
where c00000a2 is “STATUS_MEDIA_WRITE_PROTECTED”
I dont understand why the file size make a different. The
buffer size of an individual IRP will always be 64 KBytes or
less regardless of the size of the file. Besides, if I use the original IRP
instead of building a new one, there will be no error.
Anyone knows what I am doing wrong here?
TIA,
Chu Bun