Folder virtualization

Hello all!
I would like to know what is the best approach to write a minifilter that virtualizes a folder, that is, if I have a folder c:\dir1 and \192.168.1.1\dir2, when I open dir1 I want to see the content of both folders (make the network files in dir2 appear as local files inside dir1, besides dir1 files).

I don?t think reparse would be the right approach due to its limitations, would it?
Would I have to intercept all IRPs and process them? (in that case it would be a very long road)

Thank you very much!!

You may be able to leverage reparse processing on individual files
within C:\Dir1 which actually reside on the network share but the
population of the content for directory enumerations would be handled
within your driver. It would not be a trivial design but possible
through a layered FS approach.

Pete

On 9/4/2012 5:53 AM, xxxxx@gmail.com wrote:

Hello all!
I would like to know what is the best approach to write a minifilter that virtualizes a folder, that is, if I have a folder c:\dir1 and \192.168.1.1\dir2, when I open dir1 I want to see the content of both folders (make the network files in dir2 appear as local files inside dir1, besides dir1 files).

I don´t think reparse would be the right approach due to its limitations, would it?
Would I have to intercept all IRPs and process them? (in that case it would be a very long road)

Thank you very much!!


NTFSD is sponsored by OSR

For our schedule of debugging and file system seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Kernel Drivers
Windows File System and Device Driver Consulting
www.KernelDrivers.com
866.263.9295

Thank you very much Pete!

Actually this is what I had in mind, but what happens if an application opens file c:\Dir1\foo, my MF reparses this to \192.168.1.1\Dir2\foo and finally the application performs a replacefile (renames can?t work on different volumes AFAIK). Can this case be solved??

Thank you!

I’m not sure exactly what solution Pete had in mind when he mentioned reparse and layered FS.

Anyway, to quickly discuss renames and reparse. The whole idea behind reparse is that the IO manager knows the real location of the file. And the check for cross-volume renames happes in the IO manager. So you must either hide the fact that the file location is different from the IO manager (which is generally achieved with the layered FS and not with reparse) or somehow trick the IO manager into thinking that all the files are in the same place (which might be possible with reparse, but I think you’d have to mess with some of the FILE_OBJECT fields directly - i haven’t tried this, i can think of some trouble spots but perhaps they can be worked around).

Thanks,
Alex.

I am still trying to understand and implement it.
Thank you very much for your help!

I recently had to do virtualization in FSD, not in MF.

The trick i used was very simple, keep the file full name and target name both in MCB. When I get the IRP_MJ_QUERY_DIRECTORIES, I find the original directory and virtual directory as well (as per my requirement).
Then in IRP_MJ_CREATE, I use to open the file using the original file full name or target file full name (depends on flags, I set in MCB).

I don’t know if it helps your needs or not, but just an idea to post for you. It may help you.

Thank you Adnan!
I will surely consider your suggestion. I will tell you my results as soon as I have some time to keep on with this project.
Thank you!