Sending Output to the Debugger
User-mode and kernel-mode code use different routines to send output to the debugger.
OutputDebugString sends a null-terminated string to the debugger of the calling process. In a user-mode driver, OutputDebugString displays the string in the Debugger Command window. If a debugger is not running, this routine has no effect. OutputDebugString does not support the variable arguments of a printf formatted string.
For complete documentation of this routine, see the Microsoft Windows SDK.
DbgPrint displays output in the debugger window. This routine supports the basic printf format parameters. Only kernel-mode code can call DbgPrint.
DbgPrintEx is similar to DbgPrint, but it allows you to "tag" your messages. When running the debugger, you can permit only those messages with certain tags to be sent. This allows you to view only those messages that you are interested in. For details, see Reading and Filtering Debugging Messages.
KdPrint and KdPrintEx are identical to DbgPrint and DbgPrintEx, respectively, when compiled in the checked build environment. When compiled in the free build environment, they have no effect.
For complete documentation of these routines, as well as the build environment, see the Windows Driver Kit.