Closed phobeus closed 4 years ago
Hi @phobeus ,
Yes, that's a feature missing. For now, it hasn't been implemented because we need to make it optional in a way that some FS might not want this to happen ever or in some cases. @phobeus would you always that the user can unmount your FS ? (same question to anyone here)
Hey @Liryna, thanks for your reply. Thanks for clarifying. Yeah, I would make it optional, maybe allow unmount by default and allow to forbid it? We have the current use case where we don't want the user to unmount while copy operations are still going on, so a new function that gets triggered on unmount would be nice, where we can decide whether we allow the unmount request or not.
Hi @Liryna: I'm working with @phobeus and and would like to take a crack at implementing this feature myself. I've cloned and built dokany as well as dokan-dotnet with VS, but am having trouble figuring out where the driver connects its functionality to the commands triggered in the Windows Explorer. Can you sketch out where you'd begin to add this functionality? Thanks in advance.
Hi @mvonballmo , Contributions are always welcomed :muscle: ! At first you do not need to look into dokan-dotnet, all changes (at first) happen in dokan repo. I haven't look further but disconnect event should trigger a call in dokannp Using dbgview, you will see the function called during this event. If this is confirmed you can DokanRemoveMountPoint to make the disconnect really happen. dokannp is easy to debug/build, you can attach the debugger to explorer and kill explorer / build / run explorer to use the new version.
Then (if I guided you correctly) will have to think how to implement (or not) this option to disallow this feature.
@Liryna: Thanks very much for the pointers. Just briefly looking at the code in dokannp, I see NPCancelConnection
which does nothing but DbgPrintW
. That seems like a decent place to start.
@Liryna: The NPCancelConnection
is definitely the message I want. I can see it in dbgview. However, I'm not clear on how to make explorer use my version of dokan_np. If it's not too much trouble, can you be a bit more specific about how to make it run my code?
Right now, I'm doing the following:
NPCancelConnection
in dokan_npNPCancelConnection
message appears in dbgviewHowever, I can't set breakpoints and I don't see any of my messages in dbgview. It feels like, although I've launched dokan_mirror from VS, Explorer isn't using my local version of dokan_np. That is, the "kill explorer / build / run explorer" magic isn't very clear to me yet. Any tips would be greatly appreciated.
Please let me know if I missed something in the developer docs. I couldn't find much on debugging/running.
@mvonballmo Oh yeah I forgot to point the dokannp is installed in C:\Windows\System32 You need to replaced it by your own 64bits debu/release build WHEN explorer is killed otherwise it will say the dll is already used. When explorer restart it will use your new version.
You can after attached VS debugger on explorer and breakpoint dokannp. If you wanna also enter in dokan dll code, do the same step to replaced the one C:\Windows\System32 by a debug version. (dokannp use dokan library for listing mount point and also umount with your code)
Cool, thanks for the incredibly quick reply! I'll try that, then and let you know how it goes.
Thanks for all the clarifications @Liryna. I picked up this issue and got debugging running. The disconnect works now, but when I tried to put up a parameter to control whether the unmount should be allowed or not, I failed because I don't know where I could persist that flag. I passed the flag from mirror.exe down to the EVENT_START struct and DOKAN_CONTROL but I cannot see where I can access any of that within the dokannp.c -> NPCancelConnection. I can fetch a new DOKAN_CONTROL object, but the value is obviously not persisted. If you have any hints on where I could pass this Boolean through, any help is greatly appreciated.
Another question: When I'm trying to create an installer with or without my patched version, I'm greeted with the error "1>C:\Program Files (x86)\WiX Toolset v4.0\bin\difxapp_x64.wixlib(0,0): error LGHT0104: Not a valid object file; detail: Data at the root level is invalid. Line 1, position 1." from light.exe. Any idea as to what the issue could be? I've tried the latest WiX 4.0 and 3.11 builds.
Hi @phobeus , Am sorry I haven't ever faced this error message. Searching the error seems to be a xml issue, have you changed it ?
I have not changed it. That was my thought too, but the only xml is the .wxs file which I have not changed. I'll disect the light command and see if there's something useful there. We tried to build the wix project on several machines, independent from one another, but they all get the same error. Maybe it's something with the latest wix toolset after all. Thank you for your assistance!
I'm trying to get an event when a dokan connected drive gets disconnected through Windows Explorer directly (right click -> disconnect). I've tried setting several flags, but wasn't able to get anywhere, even with the mirror.exe from dokany v1.1.0 and v1.3.1.1. I'm not seeing any events via WndProc, at least not for dokan mounted drives. Is this something that's not passed through on purpose, or am I doing something wrong?
Here's a simple drive that I mounted and tried to disconnect:
mirror.exe /r C: /l x /n /u \x\u