Correct way to shutdown dokan 2 driver #1102
Replies: 3 comments 2 replies
-
Hi @dswiss-desktop-app , Have you called |
Beta Was this translation helpful? Give feedback.
-
Hi @Liryna, Yes, it does not matter if I call DokanShutdown or not, the folder remains (not accessible but you can actually delete it manually from Explorer - this is a correction to what I wrote earlier). Also it does not matter if I use single thread or multi. In a matter of fact I copied most of the mirror.c example into my app (options, operations, callbacks) with no change - mirror reacts to Ctrl+C with DokanRemoveMountPoint() followed by a clean shutdown, in my app DokanRemoveMountPoint() is called (from receiving an "exit" message via TCP - app specific) and does not shut down cleanly. I have a feeling it is either a thread synchronisation problem or access rights. Currently my workaround is to wait for the Dokan process to finish (or kill it if it is hanging on DokanMain()) and force delete the mount folder from the parent process - that always works. |
Beta Was this translation helpful? Give feedback.
-
Well, it works fine in mirror so I guess the bug is on our side. I just wanted to find out if there is other way to shut down the driver from external source other than Ctrl+C or dokanctl.exe. Currently I can't reproduce the hanging thread but it was the thread that called DokanInit() and DokanMain() and never returned, even though another thread successfully called DokanRemoveMountPoint(). In the async API scenario, the main thread always returned after waiting on DokanWaitForFileSystemClosed() but in both cases the mount folder remained undeleted. In all cases Dokan debug log showed a successful: |
Beta Was this translation helpful? Give feedback.
-
Hi,
We are in the process of upgrading from Dokan 1.5.0 to 2.0.5 and we discovered a problem with shutting down the Dokan driver cleanly. Using Dokan 1.5.0 we called DokanRemoveMountPoint() which in turn caused DokanMain() to finish - job done. In 2.0.4 and 2.0.5 we encountered a problem - DokanRemoveMountPoint() completed successfully but the mount point was not removed and DokanMain() does not return. Trying to access it or remove it while the process is still running gives ACCESS_DENIED from the OS. Only after the process is stopped, the mount folder can be removed programatically (but not manually from Windows Explorer!).
I tried the async API and got into the same problem - here DokanRemoveMountPoint() also returned success and actually released the main Dokan thread waiting on DokanWaitForFileSystemClosed() but the mount point folder did not get removed and was in non-accessible state as before.
I tried to unmount the "hanging" folders with dokanctl.exe and it worked fine but unfortunately it is not a solution as it requires admin rights. Also sending Ctrl+C to the console, like in mirror, is not good for us as the driver runs as a non-console app.
Any ideas how to do the shutdown cleanly or why does not DokanRemoveMountPoint() do its job ?
Best regards,
Maciej Kwiatkowski
Beta Was this translation helpful? Give feedback.
All reactions