Repository: PowerToys
Issue: FAST_FAIL_FATAL_APP_EXIT during startup -- PowerToys_PowerAccentKeyboardService!abort+0x35
Labels: Issue-Bug,Needs-Triage

### Microsoft PowerToys version

0.77.0

### Installation method

WinGet

### Running as admin

None

### Area(s) with issue?

Quick Accent

### Steps to reproduce

ProcDump is enabled (-ma) as AeDebug handler. During startup of PowerToys, the a crash dump was created. Below is a dump of exception details (with symbols loaded).

```
.symfix+ "C:\dumps\Symbols-0.77.0-x64"
.reload /f

```

```
0:000> .lastevent
Last event: 1d10.1708: Security check failure or stack buffer overrun - code c0000409 (first/second chance not available)
  debugger time: Mon Feb  5 13:21:19.435 2024 (UTC + 9:00)

```

```
0:000> .exr -1
ExceptionAddress: 00007ffa6b5516a5 (PowerToys_PowerAccentKeyboardService!abort+0x0000000000000035)
   ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
  ExceptionFlags: 00000001
NumberParameters: 1
   Parameter[0]: 0000000000000007
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 

```

```
0:000> .ecxr
rax=0000000000000001 rbx=000000c60e77dee0 rcx=0000000000000007
rdx=000000c60e77cb60 rsi=000000c60e77d4d0 rdi=00000000ffffffff
rip=00007ffa6b5516a5 rsp=000000c60e77cb50 rbp=000000c60e77ccb0
 r8=000000c60e77cb50  r9=000000c60e77cb58 r10=0000000000000024
r11=000000c60e77cb48 r12=0000000000000000 r13=000000c60e77d690
r14=000000c60e77ceb0 r15=000000c60e77cee0
iopl=0         nv up ei pl nz na pe nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202
PowerToys_PowerAccentKeyboardService!abort+0x35:
00007ffa`6b5516a5 cd29            int     29h

```

```
0:000> k
  *** Stack trace for last set context - .thread/.cxr resets it
 # Child-SP          RetAddr               Call Site
00 000000c6`0e77cb50 00007ffa`6b557705     PowerToys_PowerAccentKeyboardService!abort+0x35 [minkernel\crts\ucrt\src\appcrt\startup\abort.cpp @ 77] 
01 000000c6`0e77cb80 00007ffa`6b54e296     PowerToys_PowerAccentKeyboardService!terminate+0x29 [minkernel\crts\ucrt\src\appcrt\misc\terminate.cpp @ 58] 
02 000000c6`0e77cbb0 00007ffa`6b54ef45     PowerToys_PowerAccentKeyboardService!FindHandler<__FrameHandler4>+0x512 [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp @ 739] 
03 000000c6`0e77cd80 00007ffa`6b54efad     PowerToys_PowerAccentKeyboardService!__InternalCxxFrameHandler<__FrameHandler4>+0x275 [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp @ 403] 
04 000000c6`0e77ce20 00007ffa`6b54c619     PowerToys_PowerAccentKeyboardService!__InternalCxxFrameHandlerWrapper<__FrameHandler4>+0x35 [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp @ 236] 
05 000000c6`0e77ce70 00007ffa`6b54b1e0     PowerToys_PowerAccentKeyboardService!__CxxFrameHandler4+0xa9 [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\risctrnsctrl.cpp @ 306] 
06 000000c6`0e77cee0 00007ffa`e98723af     PowerToys_PowerAccentKeyboardService!__GSHandlerCheck_EH4+0x64 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\gs\amd64\gshandlereh4.cpp @ 86] 
07 000000c6`0e77cf10 00007ffa`e98214b4     ntdll!RtlpExecuteHandlerForException+0xf
08 000000c6`0e77cf40 00007ffa`e9821207     ntdll!RtlDispatchException+0x244
09 000000c6`0e77d650 00007ffa`e72dcf19     ntdll!RtlRaiseException+0x1d7
0a 000000c6`0e77dec0 00007ffa`6b54ca4f     KERNELBASE!RaiseException+0x69
0b 000000c6`0e77dfa0 00007ffa`6b51b1cd     PowerToys_PowerAccentKeyboardService!_CxxThrowException+0x97 [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\throw.cpp @ 82] 
0c 000000c6`0e77e000 00007ffa`6b509820     PowerToys_PowerAccentKeyboardService!winrt::throw_hresult+0xfd [C:\a\_work\1\s\src\modules\poweraccent\PowerAccentKeyboardService\Generated Files\winrt\base.h @ 5013] 
0d (Inline Function) --------`--------     PowerToys_PowerAccentKeyboardService!winrt::check_hresult+0x18 [C:\a\_work\1\s\src\modules\poweraccent\PowerAccentKeyboardService\Generated Files\winrt\base.h @ 5126] 
0e (Inline Function) --------`--------     PowerToys_PowerAccentKeyboardService!winrt::PowerToys::PowerAccentKeyboardService::HideToolbar::operator()+0x4c [C:\a\_work\1\s\src\modules\poweraccent\PowerAccentKeyboardService\Generated Files\winrt\PowerToys.PowerAccentKeyboardService.h @ 184] 
0f (Inline Function) --------`--------     PowerToys_PowerAccentKeyboardService!winrt::PowerToys::PowerAccentKeyboardService::implementation::KeyboardListener::SetHideToolbarEvent::__l2::<lambda_1>::operator()+0x4c [C:\a\_work\1\s\src\modules\poweraccent\PowerAccentKeyboardService\KeyboardListener.cpp @ 63] 
10 (Inline Function) --------`--------     PowerToys_PowerAccentKeyboardService!std::invoke+0x4c [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\type_traits @ 1741] 
11 000000c6`0e77e060 00007ffa`6b506fcb     PowerToys_PowerAccentKeyboardService!std::_Func_impl_no_alloc<`winrt::PowerToys::PowerAccentKeyboardService::implementation::KeyboardListener::SetHideToolbarEvent'::`2'::<lambda_1>,void,enum winrt::PowerToys::PowerAccentKeyboardService::InputType>::_Do_call+0x50 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\functional @ 808] 
12 000000c6`0e77e0b0 00007ffa`6b506bac     PowerToys_PowerAccentKeyboardService!std::_Func_class<void,enum winrt::PowerToys::PowerAccentKeyboardService::InputType>::operator()+0x2b [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\functional @ 855] 
13 000000c6`0e77e0f0 00007ffa`6b506c35     PowerToys_PowerAccentKeyboardService!winrt::PowerToys::PowerAccentKeyboardService::implementation::KeyboardListener::OnKeyUp+0x19c [C:\a\_work\1\s\src\modules\poweraccent\PowerAccentKeyboardService\KeyboardListener.cpp @ 265] 
14 000000c6`0e77e170 00007ffa`e8730ef2     PowerToys_PowerAccentKeyboardService!winrt::PowerToys::PowerAccentKeyboardService::implementation::KeyboardListener::LowLevelKeyboardProc+0x55 [C:\a\_work\1\s\src\modules\poweraccent\PowerAccentKeyboardService\KeyboardListener.cpp @ 290] 
15 000000c6`0e77e1c0 00007ffa`e8798fe9     user32!DispatchHookW+0xb2
16 000000c6`0e77e250 00007ffa`e9870e64     user32!_fnHkINLPKBDLLHOOKSTRUCT+0x29
17 000000c6`0e77e2b0 00007ffa`e75b1104     ntdll!KiUserCallbackDispatcherContinue
18 000000c6`0e77e348 00007ffa`e8731c0e     win32u!NtUserGetMessage+0x14
19 000000c6`0e77e350 00007ff9`f3a69efe     user32!GetMessageW+0x2e
1a 000000c6`0e77e3b0 00000000`00000000     0x00007ff9`f3a69efe

```

```
0:000> lm v m PowerToys_PowerAccentKeyboardService
Browse full module list
start             end                 module name
00007ffa`6b500000 00007ffa`6b5ad000   PowerToys_PowerAccentKeyboardService   (private pdb symbols)  c:\dumps\symbols-0.77.0-x64\PowerToys.PowerAccentKeyboardService.pdb
    Loaded symbol image file: PowerToys.PowerAccentKeyboardService.dll
    Image path: C:\Program Files\PowerToys\PowerToys.PowerAccentKeyboardService.dll
    Image name: PowerToys.PowerAccentKeyboardService.dll
    Browse all global symbols  functions  data
    Timestamp:        Sat Jan  6 05:09:26 2024 (659861F6)
    CheckSum:         000AF8ED
    ImageSize:        000AD000
    File version:     0.77.0.0
    Product version:  0.77.0.0
    File flags:       0 (Mask 3F)
    File OS:          40004 NT Win32
    File type:        2.0 Dll
    File date:        00000000.00000000
    Translations:     0409.04b0
    Information from resource tables:
        CompanyName:      Microsoft Corporation
        ProductName:      PowerToys
        InternalName:     PowerToys.PowerAccentKeyboardService
        OriginalFilename: PowerToys.PowerAccentKeyboardService.dll
        ProductVersion:   0.77.0.0
        FileVersion:      0.77.0.0
        FileDescription:  PowerToys PowerAccentKeyboardService
        LegalCopyright:   Copyright (C) 2024 Microsoft Corporation

```

Best regards -- Ben

### ✔️ Expected Behavior

Should not crash.

### ❌ Actual Behavior

Crashed.

### Other Software

_No response_