question on rename of directories in cross-volume redirection minifilter

Hello Folks,

Just wanted to pick your brains on this design question I have.

I’m currently implementing a classic cross-volume redirection minifilter driver.
While my minifilter handles move/rename operation itself successfully, currently it fails to deal with
the fact that a directory can contain multiple sub-directories/files.

Let me explain the issue in more detail with below example:

  • rename c:\tmp1\dirA c:\tmp1\dirB
    All the requests are rediected to a hidden volume in reality, so it really looks like
    “rename t:\tmp1\dirA t:\tmp1\dirB”. Internally, all my minifilter does is redirects initial create on
    c:\tmp1\dirA to t:\tmp1\dirA and then IRP_MJ_SET_INFORMATION on this redirected location takes care of
    the actual rename business. But during all of this processing, only directory was created in the
    alternate location. So when the user goes “notepad c:\tmp1\dirB\t1.txt” - he is greeted with file not found error.

It looks like I need to maintain this mapping in the minifilter. I plan to maintain this in the file context of
the new name, so e.g. file context of t:\tmp1\dirB would contain c:\tmp1\dirA when “rename c:\tmp1\dirA c:\tmp1\dirB”
is issued. So when a command like “notepad c:\tmp1\dirB\t1.txt” is issued, I can look in the file context and
figure out its really trying to access c:\tmp1\dirA\t1.txt and then trigger COW and soforth.
Obviusly, there are more complicated test-cases (e.g. when you rename directories multiple times or
only certain elements in the paths have been renamed etc.) but I’m looking at this design as the basis for
handling all of those.

Let me know if there are any obvious(or not) pitfalls in this approach or if there is better of going about it.

Thanks,
Nik

Hello folks,

Any thoughts on above approach?

Thanks

Hi,

You cannot rename across volumes. MoveFile api emulates it by copying and deleting the original file in user mode.

You must implement a similar behavior in kernel.