Previous Next

ASSERTMSG

ASSERTMSG tests an expression. If the expression is false, it breaks into the kernel debugger and sends it the specified message.

VOID
  ASSERTMSG(
    IN PCHAR  Message,
    Expression
    );

Parameters

Message
Specifies the null-delimited string to be displayed by the debugger.
Expression
Specifies any logical expression.

Headers

This routine is defined in ntddk.h and wdm.h. Include ntddk.h or wdm.h.

Comments

This routine can only be used in Windows 2000 and later.

The ASSERTMSG routine is identical to ASSERT, except that it sends an additional message to the debugger.

This macro will only be included in your binary if your code is compiled in a checked build environment. Once your driver has been built, ASSERTMSG will work properly regardless of whether your driver is run on the checked build or on the free build of Windows.

If Expression evaluates to TRUE, this routine has no effect.

If Expression evaluates to FALSE, a message will be displayed in the Debugger Command window. The message contains the source-code string of Expression, as well as the path of the source-code file and the line number in that file of the instruction that called the macro. In this event, ASSERTMSG can be ignored and the process or thread in which ASSERTMSG occurred can be terminated. Alternatively, the debugger can be used to analyze the situation or to edit memory. If ASSERTMSG is ignored, execution continues as if the g command was entered.

See Also

ASSERT