Redirecting across volumes troubles.

Hello everyone,

Sorry to post for something that is probably something simple, but for the life of me, i can’t get seem to redirect a a file open to a different volume.

My reparse code is working fine on the same volume and I’m guessing that I’m not formatting that fully qualitified volume incorrectly.

Can someone please point me to which format string SHOULD be the right one?

Below are the strings I’ve tried replaceing Data->Iopb->TargetFileObject->FileName with:

// this one worked since it was on the same volume (C:) as the redirected file.
L"\temp\dirty.txt"

BTW. There is both a “c:\temp\dirty.txt” and a “d:\temp\dirty.txt”. Neither one was found with the following strings.

L"\Device\HarddiskVolume1\temp\dirty.txt"
L"\Device\HarddiskDmVolumes\PhysicalDmVolumes\BlockVolume1\temp\dirty.txt"
L"\??\Volume{f6cb0bb9-72a5-4884-be29-10b06eef0ec2}\temp\dirty.txt");
L"\Device\Harddisk1\Partition0\temp\dirty.txt"
L"\Device\Harddisk1\Partition1\temp\dirty.txt"
L"\Device\Harddisk1\Partition2\temp\dirty.txt"
L"\??\d:\temp\dirty.txt"
L"\Device\Harddisk0\Partition0\temp\dirty.txt"
L"\Device\Harddisk0\Partition1\temp\dirty.txt"
L"\Device\Harddisk0\Partition2\temp\dirty.txt"

Thank you for advice you have,

Gene

Hi Gene,

I hope you are also changing the Target Instance and setting FLTFL_CALLBACK_DATA_DIRTY by calling FltSetCallbackDataDirty.
Since you told that it is working fine when you redirect on the same volume, but not working when you try to redirect across volume, try doing the above stuff.

Regards,
Ayush Gupta

Thanks Ayush for the reply.

Target Instance? I’m setting the TargetFileObject and calling FltSetCallbackDataDirty, but I’ve never heard of doing anything with Target Instance. it was my understanding that putting a fully qualified path in the FileName and returning STATUS_REPARSE would do this trick.

Here is my Code. (targetFile is my test string from above.)

len = targetFile.Length;
maxlen = targetFile.MaximumLength;

pBuffer = (PWCHAR) ExAllocatePool(NonPagedPool, maxlen);
if(!pBuffer)
return FLT_PREOP_SUCCESS_WITH_CALLBACK;

RtlZeroMemory(pBuffer, maxlen);
RtlCopyMemory(pBuffer, targetFile.Buffer, len);

if( Data->Iopb->TargetFileObject->FileName.Buffer)
ExFreePool(Data->Iopb->TargetFileObject->FileName.Buffer);

Data->Iopb->TargetFileObject->FileName.Buffer = pBuffer;
Data->Iopb->TargetFileObject->FileName.Length = len;
Data->Iopb->TargetFileObject->FileName.MaximumLength = maxlen;
Data->Iopb->TargetFileObject->RelatedFileObject = NULL;

Data->IoStatus.Status = STATUS_REPARSE;
Data->IoStatus.Information = IO_REPARSE;

FltSetCallbackDataDirty(Data);

thanks again,

Gene

> it was my understanding that putting a fully qualified path in the FileName and returning STATUS_REPARSE would do this trick.

Correct. This is one of the ways and should work properly.
What is the status that you are returning?
And I hope that the new path that you are returning is of the form “\Device\HarddiskVolumeX.…”

Target Instance? I’m setting the TargetFileObject and calling FltSetCallbackDataDirty, but I’ve never heard of doing anything with Target Instance.

If I remember correctly, this was mentioned under the topic “Modifying the parameters for an I/O operation” in the documentation for Minifilters in WDK.
I think in this case since you will be modifying the target instance ( and the target instance is an instance of YOUR minifilter on the target volume at same altitude ), filter manager will take care of necessary things. And I suppose you don’t have to return a FULLY qualified name in this case ( i.e., you don’t need “\Device\HarddiskVolumeX” component.)

Regards,
Ayush Gupta.

I’m returning FLT_PREOP_SUCCESS_WITH_CALLBACK.
I’ll study the docs more and maybe I’ll figure out why I can’t switch volumes.

thanks again,

I think that if you are setting STATUS_REPARSE then you are completing the
IRP and need to return FLT_PREOP_COMPLETE. The IO Manager will then start
all over with the new file name/path.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@bystormsoftware.com
Sent: Monday, January 07, 2008 12:39 PM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Redirecting across volumes troubles.

I’m returning FLT_PREOP_SUCCESS_WITH_CALLBACK.
I’ll study the docs more and maybe I’ll figure out why I can’t switch
volumes.

thanks again,


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars (including our new fs
mini-filter seminar) visit:
http://www.osr.com/seminars

You are currently subscribed to ntfsd as: xxxxx@bwandel.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Gene,

I’m returning FLT_PREOP_SUCCESS_WITH_CALLBACK.

You have to return FLT_PREOP_COMPLETE. If you return FLT_PREOP_SUCCESS_WITH_CALLBACK, the I/O operation won’t be restarted.

Regards,
Ayush Gupta.

Thank you so much. That did the trick!

BTW. My volume string turned out to be
L"\Device\HarddiskDmVolumes\PhysicalDmVolumes\BlockVolume1\temp\dirty.txt"

Thank you again,

Gene