This project allows you to easily use Dokan in Rust. It consists of two crates:
-
dokan-sys
provides raw bindings to the functions and structures provided by Dokan. -
dokan
is built on top ofdokan-sys
and provides high-level, Rust-friendly wrappers for Dokan.
Generally, it is recommended to use the dokan
crate, which has the unsafe raw bindings wrapped and is easier to use. However, if you want to access the low-level interface provided by Dokan, dokan-sys
can save you from writing the function and structure definitions yourself.
dokan-sys
, which is also a dependency of dokan
, requires the import library of the native Dokan library in order to link against it.
If the DokanLibrary2_LibraryPath_{ARCH}
environment variable exists ({ARCH}
can be x86
or x64
depending on the architecture of your target platform), dokan-sys
will look for the import library in the directory specified by the aforementioned environment variable. These environment variables are automatically set by Dokan's installer since v1.0.0.
Otherwise, dokan-sys
will build the import library from bundled Dokan source code. The DLL file will be built as well and you can use the DOKAN_DLL_OUTPUT_PATH
environment variable to have the build script copy it to the specified directory.
Note that the versions of the dokan-sys
crate, the linked import library and the Dokan library loaded at runtime should be identical, or you may run into troubles. So please take care when using the DokanLibrary2_LibraryPath_*
environment variables and deploying your application.
dokan-sys
can be used in exactly the same way as the native Dokan library. Read Dokan's documentation for more information.dokan
has detailed documentation and a memfs example available. You can also find some examples in the unit tests and existing projects like yasfw.