News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

CreateAcceleratorTable and VK_F12: a Windows bug

Started by jj2007, March 17, 2024, 11:03:16 AM

Previous topic - Next topic

jj2007

This has driven me crazy for two days now:
- CreateAcceleratorTable with a bunch of ACCELs, VK_F1...VK_F13
- works fine :thumbsup:
- except that when I run the proggie through DebugHeap.exe, something weird happens: ## exception code 80000003 at eip=A3210B10: eip breakpoint

Running the exe normally is no problem, the F12 key behaves as it should. But both DebugHeap and OllyDbg demonstrate that evil things happen when you press that key, and only that key. You need to press 2 or 3 times to see the crash. Drag the exe over HeapDebug.exe, or run it through Olly.

Now this is a fairly big and complex source, with lots of cute macros; so I was convinced that there was a hidden bug somewhere in the guts of MasmBasic. I tried all kinds of debugging devices, including deb and Olly, no luck. In a moment of desperation, I decided to invest some time in a bare metal Masm32 SDK version, and guess what? Same problem. It's a Windows bug, confirmed for Windows 7 and Windows 10.

Full Masm32 SDK source attached.

sinsi

QuoteWhen the F12 key is pressed and the application in focus is being debugged, Windows NT calls a function similar to DebugBreak(), which executes a hard coded breakpoint instruction. The integrated debugger then traps the exception generated by this instruction.

This behavior is intentional and occurs with other debuggers such as WinDbg from the Windows 32-bit SDK.
You receive an error message when you press the F12 key and debug an application in Windows NT (130667)

Last Reviewed:   2/22/2006  :biggrin:

sinsi

I just tried it with my window skeleton in WinDbg, F5 to start, F12 to break  :badgrin:
Sorry jj, not a bug but by design :rofl:

jj2007

Wow :biggrin:

Thanks a lot, Sinsi. Where do you dig out such jewels?

sinsi

I remembered something about F12 and debug from the old nt4 days, so I had a rough idea of what to search for.
I am the all-seeing, all-knowing one.

Choose one  :biggrin:

jj2007

See SetAccels: a simple and flexible use of the CreateAcceleratorTable API.

I had contemplated blocking F12 from this macro, but in the end it does work if you are not debugging, so what?

C3

Hi,

JJ, when I press the F12 key while Visual Studio is running the program it gets back to debugger view.
NTDLL.DLL contains DbgUiRemoteBreakin() with StackFrame DbgBreakPoint.

So your not alone, I had some wondering when tried use F12 as an Accelerator and it gets back to Visual Studio.

I have also slipped to the Dark Side of Visual Studio, and I like it :)

Cheers, Petter