Skip to content

Modernize to Rust 2024 edition and migrate from winapi to windows-sys#22

Open
coconutbird wants to merge 8 commits intodokan-dev:masterfrom
coconutbird:master
Open

Modernize to Rust 2024 edition and migrate from winapi to windows-sys#22
coconutbird wants to merge 8 commits intodokan-dev:masterfrom
coconutbird:master

Conversation

@coconutbird
Copy link
Copy Markdown

Summary

Modernizes the entire workspace to Rust 2024 edition and migrates from the legacy winapi crate to windows-sys v0.61.2.

Changes

Dependency migration

  • winapiwindows-sys 0.61.2 across dokan-sys, dokan, and the memfs example.
  • Replaced all LPCWSTR/LPWSTR type aliases with PCWSTR/PWSTR from windows_sys::core.
  • Replaced all locally defined Windows constants (e.g. SECURITY_DESCRIPTOR_REVISION, SEF_AVOID_PRIVILEGE_CHECK, FILE_CASE_PRESERVED_NAMES, etc.) with proper imports from windows-sys.
  • Dropped parking_lot dev-dependency — std::sync::Mutex is now competitive on modern Rust (futex-based on Windows since 1.62).
  • Replaced lazy_static usage with std::sync::LazyLock (stable since Rust 1.80).

Rust 2024 edition

  • Updated all Cargo.toml files to edition = "2024".
  • Added unsafe qualifier to extern blocks as required by the new edition.
  • Fixed a null pointer dereference in OperationInfo::context() that was always UB but now triggers a non-unwinding panic (abort) in Rust 2024. Added try_context() method with a null check, and updated cleanup/close_file callbacks to handle null context gracefully.

CI

  • Added GitHub Actions workflow (.github/workflows/build.yml) that builds and tests on windows-latest.
  • Installs the Dokan driver via winget so all tests (including driver-dependent ones) can run.
  • Handled std::sync::Mutex poisoning in test harness to prevent cascading failures.
  • Fixed test fragility on Windows Server 2025 where the OS issues additional GetFileSecurity queries with unexpected security_information values.

Housekeeping

  • Added Cargo.lock to .gitignore.

Testing

All 32 tests pass locally and in CI (Windows). 1 test ignored (can_reset_timeout). Doctests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant