I can't figure out what the Address parameter is for the ah series of commands.
This is the msdn for the ah series of commands.
https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/ah--assertion-handling-
ahb [Address]
ahi [Address]
ahd [Address]
Address
Specifies the address of the instruction whose assertion-handling status is being set. If you omit this parameter, the debugger uses the current program counter.
It says instruction whose assertion-handling status is being set.
Does this mean there is an assembly instruction that sets assertion-handling status?
In fact, the program executes the comparison instruction and decides whether to execute the asserted function based on the comparison result.
So I can't find an assembly instruction that sets assertion-handling statusd.
I wrote a test program.
The program triggers assertions in the main function.
I set every assembly instruction of the main function using the ahb or ahi instruction.
But these instructions did not change the way assertions are handled, the program always pops up the window.
From what I can gather the
ahcommand works only on assertions that generate anint 0x2c.Here's a very simple example:
Here's the main function, in debug mode (note the interruption at
00007ff6debe2b1c):If I run the program normally, the debugger breaks here:
If I enter (before running the program):
Then the assertion is completely ignored and the program runs normally, without breaking into the debugger.
Note that
DbgRaiseAssertionFailureis documented here and its only job is to emit an int 0x2c:The vector for this interruption is as follows:
What I really don't know is if there are other macros that are as helpful as the "standard" asserts (which either print or generate a message box with file, line number, and a message), for user mode, but with int 0x2C.
In kernel mode the standard way is to use the
NT_ASSERTmacro which also generates an int 0x2c. Note that the documentation for this macro also references theahcommand, which tends to corroborate the fact thatahworks only for int 0x2c.