Fix Windows flash access denied and UI freeze issues

- Replace PowerShell-based partition discovery with Windows API
  (FindFirstVolumeW/FindNextVolumeW, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS)
- Lock and dismount volumes before raw disk access using
  FSCTL_LOCK_VOLUME and FSCTL_DISMOUNT_VOLUME
- Keep volume handles open during operation to prevent Windows remount
- Use FILE_FLAG_WRITE_THROUGH for writes, FILE_FLAG_NO_BUFFERING for
  verification to bypass OS cache
- Fix intermittent UI freeze by releasing volume locks in background
  threads with FSCTL_UNLOCK_VOLUME before CloseHandle
- Add sector-aligned reads for verification when using NO_BUFFERING
This commit is contained in:
SuperKali
2025-12-21 18:24:31 +01:00
parent 40b97bafab
commit c9fc93135e
2 changed files with 523 additions and 60 deletions

View File

@@ -45,6 +45,12 @@ security-framework-sys = "2.11"
[target.'cfg(target_os = "windows")'.dependencies]
# Windows-specific dependencies
windows-sys = { version = "0.61.2", features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_System_Ioctl",
"Win32_System_IO"
] }
[features]
default = ["custom-protocol"]

File diff suppressed because it is too large Load Diff