Use Mirror.exe to "File Redirect"

45 views
Skip to first unread message

wang peikai

unread,
Mar 14, 2025, 4:03:51 AMMar 14
to Dokan
quetion 1:
I just begin learning dokan, and learn that dokan has a sample called mirror.c.
I encounter a problem  from this sample when mirroring the directory D:\\Genshin Impact Game to M: and try to running Yuanshen.exe. But there is no error when I run the game from  D:\\"Genshin Impact Game\\Yuanshen.exe. I want to know the reason

dokey version:2.2.1
mirror.c from the dokey lastest git

quetion 2:
Could I use dokey to make a overlayfs in windows? Need I modify the dokey driver or just modify usermode example(mirroc)?


Liryna

unread,
Mar 14, 2025, 10:17:41 PMMar 14
to Dokan
> I encounter a problem  from this sample when mirroring the directory D:\\Genshin Impact Game to M: and try to running Yuanshen.exe. But there is no error when I run the game from  D:\\"Genshin Impact Game\\Yuanshen.exe. I want to know the reason

I would suggest trying with option /o as such application might be trying to get information about the volume which requires the mount manager to be used. https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c#L1595-L1597
If you want to know what failure the application is having, you can use https://learn.microsoft.com/en-us/sysinternals/downloads/procmon to investigate the filesystem activity of that app.

> Could I use dokey to make a overlayfs in windows?

Yes, you can! You will need to write your own usermode like mirror.c

wang peikai

unread,
Mar 16, 2025, 2:42:31 AMMar 16
to Dokan
Hi Liryna!,Thanks For your answer. Just usermode? Need I change the kernel driver mode (dokan.sys e.g.)?  And I want to know how these function run in mirroc.c when I mount a directory and create/write a file?
if I know the order of these function, I would know how to write 没有 usermode file system based from mirror.c

Liryna

unread,
Mar 16, 2025, 10:26:10 PMMar 16
to Dokan
Yes, only the usermode should be necessary to change. Let me know otherwise the reason.
> I want to know how these function run in mirroc.c when I mount a directory and create/write a file?
The documentation is a good start for that! https://dokan-dev.github.io/dokany-doc/html/
Then reading the sample code and looking at the debug logs + procmon while testing would be the best.

wang peikai

unread,
Mar 25, 2025, 5:29:34 AMMar 25
to Dokan

Hi Liryna! I just use  achieve a overlayfs from dokan_memfs that the file will be read from upper layer(mountpoint E:) firstly , if there is not found and read from lower layer(D:). And file open/write only exists in upper layer(E:),which  of these functions should I modify?

wang peikai

unread,
Mar 25, 2025, 5:47:28 AMMar 25
to Dokan
in memfs_operations.cpp file

Liryna

unread,
Mar 25, 2025, 10:14:24 PMMar 25
to Dokan
Hi, you will have to modify most of the functions since memfs is a in memory filesystem and isn't reading content on disk. I would suggest starting with the mirror sample instead (since it is reading a disk content) and adapt those functions so that they behave as you described.

wang peikai

unread,
Mar 25, 2025, 10:45:20 PMMar 25
to Dokan
Hi! But I use the fs to run a game, so it need more read/write bandwith and iops. it's the reason that I choose memefs.Is there some test result?
I just check a lot these samples, If I build a overlayfs that read from local mount point firstly only it's not found that read from lower layer, I need modify almost of these functions(read write create delete findfiles...)

Reply all
Reply to author
Forward
0 new messages