Windows Driver Kit: Driver Development Tools
ASSERT

The ASSERT macro tests an expression. If the expression is false, it breaks into the kernel debugger.

VOID
  ASSERT(
    Expression
    );

Parameters

Expression
Specifies any logical expression.

Return Value

None

Comments

ASSERT will only be included in your binary if your code is compiled in a checked build environment. Once your driver is built, ASSERT 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 is 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 of the instruction that called the macro. In this event, ASSERT can be ignored and the process or thread in which ASSERT occurred can be terminated. Alternatively, the debugger can be used to analyze the situation or to edit memory. If ASSERT is ignored, execution continues as if the g (Go) command was entered.

Requirements

Versions: Available in Microsoft Windows 2000 and later.

Headers: The ASSERT routine is defined in ntddk.h and wdm.h. Include ntddk.h or wdm.h.

See Also

ASSERTMSG


Send feedback on this topic
Built on November 19, 2009
Page view tracker