Repository navigation
Conversation
Port the Dokan user-mode filesystem binding from the Dokan 1.2 API to the Dokan 2.3.1 API (dokan2.dll/dokan2.sys). Dokan 1.x is no longer maintained and has no signed ARM64 driver, which leaves KBFS broken on Windows on ARM64 devices. Changes: - Vendor Dokan 2.3.1.1000 headers (dokan.h, fileinfo.h, public.h) - Load DOKAN2.DLL and require DokanVersion() >= 200 - Resolve and call DokanInit()/DokanShutdown() around DokanMain() - Update the Mounted callback to the 2.x signature (adds MountPoint) - DOKAN_FILE_INFO.DeleteOnClose was renamed to DeletePending - Keep the UNICODE_STRING typedef commented out (mingw ntdef.h) The 2.x delete semantics match the existing implementation: DeleteFile and DeleteDirectory remain check-only and the actual delete still happens in Cleanup when DeletePending is set. Tested on Windows 11 ARM64 against the signed Dokany 2.3.1 ARM64 driver: TestEmptyFS mounts a real filesystem on T:\ and a real KBFS mount on K:\ serves private folders correctly. Fixes keybase#27989
4 of 5 tasks
Author
|
@chrisnojima ping for review — this makes KBFS work on Windows ARM64 (fixes #27989). Tested on a Surface Laptop 7: service + Dokan 2.3.1 driver + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the Dokan user-mode filesystem binding (
go/kbfs/dokan) from the Dokan 1.2 API to the Dokan 2.3.1 API (dokan2.dll/dokan2.sys).Dokan 1.x is unmaintained and has no signed ARM64 driver — the Dokany 1.5.x arm64 binaries shipped unsigned in the zip and fail to load, which is why KBFS is completely broken on Windows on ARM64 devices (Surface Pro/Laptop ARM, Snapdragon X, etc). Dokany 2.2+ ships an official signed
Dokan_ARM64.msi. This port fixes #27989 and also moves Windows off the legacy API for x64.Changes
dokan_header/(the same UNICODE_STRING-in-mingw comment-out is re-applied)loaddll.go: loadDOKAN2.DLL, requireDokanVersion() >= 200, resolveDokanInit/DokanShutdownbridge.c: callDokanInit()beforeDokanMainandDokanShutdown()after it returns (required by the 2.x library)Mountedcallback updated to the 2.x signature (LPCWSTR MountPointadded)DOKAN_FILE_INFO.DeleteOnClose→DeletePending(2.x rename)Everything else is unchanged: all 25
DOKAN_OPERATIONSkeep identical names/signatures,DOKAN_OPTION_*flags keep the same values, and the 2.x delete semantics already match the existing code (DeleteFile/DeleteDirectorystay check-only; the real delete still happens inCleanupwhenDeletePendingis set).Important packaging note
This PR makes
kbfsdokanrequire Dokan 2.x at runtime — a system with only Dokan 1.x installed will fail the version check. The Windows installer currently bundlesDokanSetup_redist.exe1.4.0.1000, which must be updated to a 2.x redistributable for the GUI "install Dokan" flow to keep working (see the upgrade process inpackaging/windows/readme.md). Note that Dokany 2.x no longer publishesDokanSetup_redist.exe— releases ship per-arch MSIs (Dokan_x64.msi,Dokan_ARM64.msi), so the packaging may need to switch bundling mechanism. A full ARM64 installer (Electron--arch=arm64, WiXPlatform=arm64) is out of scope here.Test plan
go test ./kbfs/dokan—TestEmptyFSmounts a real filesystem onT:\against the signed Dokany 2.3.1 ARM64 driver; all callbacks exercisedkbfsdokan.exe K:\→Dokan version: 231 driver 400→K:\private/K:\publicserve real encrypted foldersGenerated with Devin