Aldaviva / AuthenticatorChooser

🗝️ Background program that skips the phone option and chooses the USB security key in Windows credential prompts.
Apache License 2.0
46 stars 0 forks source link

Native crash when fingerprint prompt appears #1

Closed Aldaviva closed 5 months ago

Aldaviva commented 6 months ago

On a 0.1.0 developer build from 4/8, AuthenticatorChooser.exe crashed when the Windows Security dialog box appeared to prompt me for my fingerprint to unlock KeePass with KeePassWinHelloPlugin installed. AuthenticatorChooser was not running elevated. Win11 23H2 x64.

Faulting application name: AuthenticatorChooser.exe, version: 0.1.0.0, time stamp: 0x65cd0000
Faulting module name: KERNELBASE.dll, version: 10.0.22621.3374, time stamp: 0x3069ce37
Exception code: 0xe0434352
Fault offset: 0x00000000000653ac
Faulting process id: 0x0x352C
Faulting application start time: 0x0x1DA8984095F8D17
Faulting application path: C:\Programs\Accessories\AuthenticatorChooser.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: e75fc682-5122-4d39-9fc6-155bb2eb3281
Faulting package full name: 
Faulting package-relative application ID: 

There is no corresponding .NET runtime stacktrace event in the Application log, so the crash must have been in unmanaged code in kernelbase.dll. The new code in this developer build tries to bring these windows to the foreground and activate them, so they are visible to the user and not stuck hidden behind all other windows. Restarting AuthenticatorChooser while the same credential prompt is still visible does not reproduce the crash. Similarly, opening new credential prompt windows also does not reproduce the crash.

This might be just a race with any of the Win32 API calls AuthenticatorChooser makes as part of bringing the window to the foreground. I guess those should all be in a try block, and just proceed if any of them fail.

Aldaviva commented 5 months ago

Maybe I should remove this entire feature because it was only really there to improve sirAndros/KeePassWinHello, which was improved in 3.3.1. It still doesn't get focus, but at least it's on top, and making another program's window get focus is nearly impossible in Windows.

Aldaviva commented 5 months ago

Moved this code to the foreground-prompt branch.