# FastSeek WPF A Windows-only WPF port of the FastSeek instant file search tool. ## Requirements - Windows 10/11 - .NET 8 SDK or later - Administrator privileges (required for NTFS MFT and USN journal access) ## Build ```powershell cd FastSeekWpf dotnet publish -c Release -r win-x64 --self-contained false ``` Or just run from source: ```powershell cd FastSeekWpf dotnet run ``` **Must run as Administrator.** Right-click → Run as Administrator, or launch from an elevated PowerShell. ## Usage - **Alt+Space** — toggle the search window - **Esc** — hide - **Up/Down** — navigate results - **Enter** — open selected file/folder - **Ctrl+Enter** — open containing folder - **Type** — search as you type (results update instantly) ## Architecture The app reads the NTFS Master File Table (MFT) directly via `FSCTL_ENUM_USN_DATA` / direct `$MFT` read, builds an in-memory index, and keeps it in sync via the USN Change Journal. Search is name-only with fuzzy matching and type-based ranking. ## Performance Fixes Applied - **Zero-CPU hotkey thread**: Switched from `PeekMessageW` polling (`Thread.Sleep(10)`) to blocking `GetMessageW` with a manual reset event for clean shutdown. Idle CPU is now 0%. - **Allocation-free search**: `SearchEngine` uses cached lowercase string arrays (`IndexStore.NameCache` / `NameLowerCache`) instead of calling `Encoding.UTF8.GetString` in the hot loop. Uses `Span` for matching, stack-allocated candidate arrays, and `[ThreadStatic]` reusable `StringBuilder` for path building. - **Debounced search**: TextChanged no longer blocks the UI thread. Searches run on a background thread with 25ms debounce and a `CancellationTokenSource` to cancel stale queries. - **DWM rounded corners**: Added `DwmSetWindowAttribute` with `DWMWA_WINDOW_CORNER_PREFERENCE=DWMWCP_ROUND` for native Windows 11 rounded window corners, plus `DWMWA_USE_IMMERSIVE_DARK_MODE`. - **Arena-based inserts**: `IndexStore` keeps `List` for arenas (O(1) append instead of `Array.Resize` on every insert). Live updates no longer copy the entire arena array. - **Lock isolation**: Search result building (path resolution, exclusion filtering, ranking) happens outside the `lock(_indexLock)` — only the candidate matching is inside. Deadlocks eliminated. ## Known Issues / TODO - [x] DWM rounded corners — fixed via `DwmSetWindowAttribute` P/Invoke - [x] Zero-CPU hotkey thread — fixed via `GetMessageW` + manual reset event - [x] Arena allocation churn — fixed via `List.AddRange` - [x] Search blocking UI — fixed via debounced background search - [ ] Search results could use a virtualized `ListView` with container recycling for >10k visible items - [ ] No system tray icon — app runs hidden with hotkey toggle only - [ ] No settings UI for exclusions