Not getting data (which I have written to the 1st volume) on another volume!

Hello NTDEV,

I have written a simple VolumeFilter driver. Beyond this I just modified the dispatch WRITE routine to create another WRITE request rather a IRP for passing down to the another Volume’s lower device object. Now, while running the driver is showing successful completion of both of the IRPs (one I received in WRITE request & other that I have created), but the problem is that I’m not getting the data (which I have written to the 1st volume) on another volume. For checking this I am creating a .txt file with some data on 1st volume and trying to see that the file created on the other volume with same name & contents.
Did I missed something in logic OR while sending the new WRITE request? Thanks!!
-Jhon-

Hi Everybody,

Please suggest some hints to proceed further. I’m really stuck!
Thanks in advance.

jhon wrote:

Hi Everybody,

I have written a VolumeFilter driver. Then, I modified the dispatch WRITE routine to create another WRITE request (new IRP) for passing down to the another Volume’s lower device object. Now, while running the driver is showing successful completion of both of the IRPs (one I received in WRITE request & other that I have created), but the problem is that I’m not getting the data (which I have written to the 1st volume) on another volume. For checking this I am creating a .txt file with some data on 1st volume and trying to see that the file created on the other volume with same name & contents…

Here is the WRITE dispatch code…

// Initialization…
KeInitializeEvent (&Event, NotificationEvent, FALSE);

// Get Target Device’s Object
pTargetDeviceObject = ((PDRIVER_OBJECT)pDeviceObject->DriverObject)->DeviceObject;

/* Trying to allocate the new IRP…But just trying :slight_smile: */
pBuffer = MmGetSystemAddressForMdlSafe (pIrp->MdlAddress, NormalPagePriority);
pNewIrp = IoBuildAsynchronousFsdRequest (IRP_MJ_WRITE,
((PDEVICE_EXTENSION)pTargetDeviceObject->DeviceExtension)->pLowerDeviceObject,
pBuffer,
pIoStackLocation->Parameters.Write.Length,
&pIoStackLocation->Parameters.Write.ByteOffset,
&IoStatusBlock);
if (!pNewIrp)
DbgPrint (“VolumeMirror: Failed - IoBuildAsynchronousFsdRequest!!”);

IoSetCompletionRoutine (pNewIrp,
VolumeFilterWriteIoCompletion,
&Event,
TRUE,
TRUE,
TRUE);

// Get NextStackLocation - for debugging perpose…
pTopIrpStack = IoGetNextIrpStackLocation (pNewIrp);

status = IoCallDriver (((PDEVICE_EXTENSION)pTargetDeviceObject->DeviceExtension)->pLowerDeviceObject, pNewIrp);
if (STATUS_PENDING == status) {

status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
if (STATUS_TIMEOUT == status)
DbgPrint (“\n NewIrp: Wait time out!”);
}

IoSkipCurrentIrpStackLocation (pIrp);
return IoCallDriver (((PDEVICE_EXTENSION)pDeviceObject->DeviceExtension)->pLowerDeviceObject, pIrp);

/* return STATUS_SUCCESS; Do you need this? */
}

NTSTATUS
VolumeFilterWriteIoCompletion (
IN PDEVICE_OBJECT pDeviceObject,
IN PIRP pIrp,
IN PRKEVENT Event) {

if (pIrp->PendingReturned) {
KeSetEvent(Event, EVENT_INCREMENT, FALSE);
}

IoFreeIrp (pIrp);
return STATUS_MORE_PROCESSING_REQUIRED ;
}

Thanks in advance!!