Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating virtual files at NTFS-Volumes #69

Closed
Albeoris opened this issue Feb 21, 2016 · 17 comments
Closed

Creating virtual files at NTFS-Volumes #69

Albeoris opened this issue Feb 21, 2016 · 17 comments

Comments

@Albeoris
Copy link

Is it possible to use dokany to create virtual files (or folders) at existing volumes?
In my case it can be read-only. (Redirect calls from an archive to the extracted files.)

@Liryna
Copy link
Member

Liryna commented Feb 21, 2016

Yes, you can do it by using a path folder as mount point.
Like :mirror.exe /r C:\Users /l C:\MyMountPoint

@Liryna Liryna closed this as completed Feb 21, 2016
@Albeoris
Copy link
Author

Thank you very much!

@Albeoris
Copy link
Author

It's working!
One more question: can I use a file as a mout point and describe a virtual file system as one file?

@Liryna
Copy link
Member

Liryna commented Feb 22, 2016

Good news !
😢 No impossible

@Albeoris
Copy link
Author

It is sad. :(
I try to replace the contents of a file on the fly.
If I know, the hard link to the virtual file system instead original file will not work too?

@Albeoris
Copy link
Author

Yeah. :(
"The system cannot move the file to a different disk drive."
If you will have any thoughts around this subject that tell me please!
And thanks again for your help!

@marinkobabic
Copy link
Contributor

Maybe you want to use a folder as mount point?

@Albeoris
Copy link
Author

@marinkobabic
Yes, now I am on this way. But it's crooked workaround because I need to replace content of a single file (a custom reparse point?) instead of the entire folder.
https://i.imgur.com/PpTXdN9.png

@Albeoris
Copy link
Author

Hm. Another thought:
If I understand correctly, dokany uses a filter driver of file system?
Can it work just as filter as alternative of mount? Like that:

IDokanOperations myHandler = new MyHandler();
Dokan.Filter(myHandler, "D:\SomeFolder");

class MyHandler() : IDokanOperations 
{
  ...
  public NtStatus CreateFile(string fileName, FileAccess access, FileShare share, FileMode mode, FileOptions options, FileAttributes attributes, DokanFileInfo info)
        {
            if (fileName != @"SomeFile.bin")
                return DokanResult.NotHandled;

            info.Context = new FileStream(@"C:\OtherFile.bin", mode, access, share, 4096, options);
            return DokanResult.AccessDenied;
        }
  ...
}

Is it possible?
Excuse me if I say stupid things, I have no idea about how work kernel level programs.

@marinkobabic
Copy link
Contributor

Let me try to understand what you are trying to achieve.

If you would like to control access to a specific file which already exists on the NTFS file system or FAT etc. then you should write your own minifilter.

Dokan is a filesystem like NTFS or FAT.

@Liryna
Copy link
Member

Liryna commented Feb 24, 2016

@marinkobabic is right, dokan does not give you the choice. You have to handle everything that is happening in the mounted device or folder.

@Albeoris
Copy link
Author

@marinkobabic, yes you are right. My question how this behavior is different from what Dokany doing?

@Liryna, probably, the answer was meant for me? Is it difficult to implement using Dokany as a basis?
Or is it completely different drivers and what I described above can not be solved by 10-20 lines of code in the driver?

@Liryna
Copy link
Member

Liryna commented Feb 24, 2016

I forgot a word yes 😄 I wanted to say that he is right.

totally different driver unfortunatly 😢

@Albeoris
Copy link
Author

Miserably. :(
Understood, thanks! I will try to write my own driver or focus on virtualization entire folder. :)

@marinkobabic
Copy link
Contributor

Like Liryna said that would be a total different driver you have to write. It's a minifilter driver and there are a lot of people on the web doing this. Also Microsoft provides templates and examples.

As a filter driver you can decide to pass the request down to lower driver or to handle it your self.

There is no way to avoid kernel debugging and start to learn how to manage the os request. www.osronline.com is a good place for your questions when you once start to write the code.

Dokan is a virtual file system. We handle all the request for our mointpoints and pass them to usermode application which returns the response to the dokan driver.

@marinkobabic
Copy link
Contributor

Dropbox and OneDrive are implemented based on shell extensions. This approach is complicate because of missing documentation and examples.

Your options are:

Minifilter driver or virtualize folder using dokany

@Albeoris
Copy link
Author

@marinkobabic, thank you! I found many examples, try to implement now. (=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants