dokan-dev / dokany

User mode file system library for windows with FUSE Wrapper
http://dokan-dev.github.io
5.2k stars 661 forks source link

dokanfuse1.dll doesn't work for fuse file system program #1144

Closed Lucasq11 closed 1 year ago

Lucasq11 commented 1 year ago

Environment

Check List

Description

I have built the repo /dokan_fuse /dokan using VS2022 and get dokanfuse1.dll dokan1.dll

My program implimented the struct fuse_operations and tries to use those 2 dll above in order to create a file system on windows. When the program runs, windows tells me 4 dll are missing:

Msvcp140D.dll VCRUNTIME140D.dll VCRUNTIME140_1D.dll ucrtbased.dll

and can't continue to run code.

Did I missied something when build dokanfuse and dokan? Or I should include somthing when building dokanfuse?

Liryna commented 1 year ago

Hi @Lucasq11

Those dlls are debug visual studio runtime libraries. See https://stackoverflow.com/questions/25383833/install-vc-debug-runtime-distributable

Lucasq11 commented 1 year ago

@Liryna Thanks, It didn't came up with dll missing warning again. But it seems my release version dokanfuse is not working at all, the directory I created in my file system is treated as a file and files can not be writen. When I removed the dokanfuse1.dll and run the generator again, the file system can still create directoried and files, and they are all treated as files and not writable.

Let me discribe the background in detail: My file system generator is using the dokanfuse1.dll built by a former colleague, however I don't know how he compiled it. I'm tring to modify some code of dokanfuse and make a new version of dokanfuse1.dll. The default version created by the former colleague is 551 kb, mybe is release version. But my dokanfuse.dll is only 80 kb in release version The following is my processes step by step building dokanfuse:

  1. Double click /dokan.sln and enter vs2022
  2. Set /dokan_fuse as startup project
  3. Enter dokan_fuse Propertey Pages, set Configuration to Release, Platform to Active(x64)
  4. Click Build dokan_fuse
  5. Vs output like: Build started... 1>------ Build started: Project: dokan_fuse, Configuration: Release x64 ------ 1>fuse_helpers.c 1>fuse_opt.c 1>dokanfuse.cpp 1>fusemain.cpp 1>utils.cpp 1> Creating library D:\VsProject\dokany-1.4.0.1000_20ms\x64\Release\dokanfuse1.lib and object D:\VsProject\dokany-1.4.0.1000_20ms\x64\Release\dokanfuse1.exp 1>dokan_fuse.vcxproj -> D:\VsProject\dokany-1.4.0.1000_20ms\x64\Release\dokanfuse1.dll ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Elapsed 00:01.745 ========== And I got a tiny release version dokanfuse1.dll (80kb) that doesn't work, what's the problem?
Liryna commented 1 year ago

My guess would be they statically linked the Visual Studio runtime in the library. If it is not that, they must have made other changes which it will be complicated for me to know. https://stackoverflow.com/questions/37398/how-do-i-make-a-fully-statically-linked-exe-with-visual-studio-express-2005

Lucasq11 commented 1 year ago

I've tried the method in that post and get a dokanfuse1.dll of 554 kb. I thnink its very closer but still doesn't work.

Liryna commented 1 year ago

the directory I created in my file system is treated as a file and files can not be writen. When I removed the dokanfuse1.dll and run the generator again, the file system can still create directoried and files, and they are all treated as files and not writable.

If it works without the dokanfuse1.dll, it means you are not using a FUSE filesystem but the standard dokan API like https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c

The problem of whether it is a directory or a file comes for your filesystem implementation not setting the right values I would say. Or maybe the version of Dokany you are using was changed and in this case I cannot help.