Skip to content
Adrien J edited this page Nov 23, 2026 · 29 revisions

Dokan FUSE

Dokan Fuse is a wrapper library that makes Dokan compatible with FUSE API. Now available by default in main source repository and installers, Dokan Fuse comes from an original work of Alex Besogonov, fuse4win project.

To use it, you only have to link with the dynamic library dokanfuse3.dll (or cygdokanfuse3.dll / libdokanfuse3.dll for Cygwin / MSYS2; replace 3 with 2 in Dokany 2.x releases).

TODO

  • Currently special entries '.' and '..' in walk_directory/walk_directory_getdir are not processed correctly. Particularly, they have incorrect timestamps. Fix this.
  • Try to emulate Unix permissions using Windows ACLs.
  • Fix symlink handling.

FUSE / Dokan map

The table bellow describes the approximate mapping required if you attempt to port your FUSE application manually without Dokan Fuse.

FUSE Dokan
fuse_operations::mknod
fuse_operations::create
fuse_operations::open
fuse_operations::mkdir
fuse_operations::opendir
DOKAN_OPERATIONS::ZwCreateFile
fuse_operations::release
fuse_operations::releasedir
DOKAN_OPERATIONS::Cleanup
fuse_operations::read DOKAN_OPERATIONS::ReadFile
fuse_operations::write DOKAN_OPERATIONS::WriteFile
fuse_operations::flush DOKAN_OPERATIONS::FlushFileBuffers
fuse_operations::readdir DOKAN_OPERATIONS::FindFiles
fuse_operations::utimens DOKAN_OPERATIONS::SetFileAttributes
fuse_operations::getattr DOKAN_OPERATIONS::GetFileInformation
fuse_operations::access DOKAN_OPERATIONS::GetFileSecurity
fuse_operations::unlink DOKAN_OPERATIONS::DeleteFile
fuse_operations::rmdir DOKAN_OPERATIONS::DeleteDirectory
fuse_operations::rename DOKAN_OPERATIONS::MoveFile
fuse_operations::truncate
fuse_operations::ftruncate
DOKAN_OPERATIONS::SetEndOfFile
fuse_operations::lock DOKAN_OPERATIONS::LockFile
DOKAN_OPERATIONS::UnlockFile
fuse_operations::chmod
fuse_operations::chown
DOKAN_OPERATIONS::SetFileSecurity
fuse_operations::statfs DOKAN_OPERATIONS::GetDiskFreeSpace
DOKAN_OPERATIONS::GetVolumeInformation

Rename & Remove issue

Depending of your FUSE implementation, it is possible that you have an error when you try to rename or remove a file. This is happening because Linux & Windows handle differently how a file is rename & removed. See https://github.com/dokan-dev/dokany/issues/178#issuecomment-187881947 for more informations.

Compiler

You need to use the same toolchain to compile your own dokanfuse and your FUSE program to make it compatible. Neglect of doing so will result in mysterious problems like stack overflows and BSOD.

MSVC

If you use MSVC to compile your FUSE program you have to use struct FUSE_STAT instead of struct stat in the source code. The dokanfuse3.dll distributed is compiled by MSVC (with static CRT /MT, for x64, ARM64, and Win32), which means it's not compatible with other compilers because the types used in other compilers are not all the same.

Cygwin

The cygdokanfuse3.dll distributed is compiled by 64-bit Cygwin GCC (32-bit Cygwin was discontinued upstream and is not provided in Dokany 3.0.0). You can also build it yourself with .\dokan_fuse\build.ps1 -Targets cygwin, or manually inside Cygwin:

cd dokan_fuse/
cmake .
make

Be aware that cygdokanfuse3.dll has dependencies on cygwin1.dll, cyggcc_s-seh-1.dll, and cygstdc++-6.dll.

As a sample, to build fusexmp (mirror sample on libfuse project or samples/fuse_mirror/) use the following command line:

gcc samples/fuse_mirror/fusexmp.c $(PKG_CONFIG_PATH=x64/Cygwin/lib/pkgconfig pkg-config fuse --cflags --libs) -o fusexmp.exe

Run:

./fusexmp.exe m       # Mount a clone of Cygwin / as drive M:\

MSYS2 / mingw-w64

Starting with Dokany 3.0.0 (upcoming), the prebuilt MSYS2 libraries target:

  • 64-bit (x64\Msys2\libdokanfuse3.dll, installed to %DokanLibrary3%\libdokanfuse3.dll): MSYS2 UCRT64 (Universal CRT / ucrtbase.dll, matching MSYS2's default 64-bit environment).
  • 32-bit (Win32\Msys2\libdokanfuse3.dll, installed to %DokanLibrary3%\x86\libdokanfuse3.dll): MSYS2 MINGW32 (msvcrt.dll).

Because libdokanfuse3.dll links dynamically against the matching MSYS2 GCC/C++ runtime (libgcc_s_*.dll, libstdc++-6.dll) and CRT, do not mix the UCRT64 binary with a legacy MINGW64 (msvcrt.dll) application. To build locally for a specific MSYS2 environment (including legacy MINGW64), run:

.\dokan_fuse\build.ps1 -Targets msys2 -Msys2Envs UCRT64   # or MINGW64, MINGW32

mingw-w64 compilers are also available on many Linux distributions and can be used to cross-compile Dokan FUSE. If you compile your FUSE program with mingw-w64, you have to use struct FUSE_STAT instead of struct stat in your FUSE program.

You may need a cmake Toolchain file for cross-compilation, here is an example for x86_64-w64-mingw32:

set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)

# The following line links the shared library libdokanfuse3.dll statically, so it won't depend on any additional dlls.
set(CMAKE_SHARED_LINKER_FLAGS "-static -static-libgcc -static-libstdc++" CACHE STRING "" FORCE)

set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)

For other mingw32-w64 compilers, just adjust TOOLCHAIN_PREFIX.

Then, you can build it as follows:

cd dokan_fuse/
cmake -DCMAKE_TOOLCHAIN_FILE="your_toolchain_file.cmake"
make

Using FUSE in other languages

Language Project
Python fusepy
Javascript fuse-bindings, fuse4js
Java fuse-jna, jnr-fuse
Ruby rfusefs
.NET (C#, VB.NET ...) mono-fuse

Clone this wiki locally