KdPrint sends a string to the kernel debugger.
ULONG
KdPrint ( (
IN PCHAR Format,
. . . . [arguments]
) ) ;
If successful, KdPrint returns the NTSTATUS code STATUS_SUCCESS; otherwise it returns the appropriate error code.
This routine is defined in ntddk.h, wdm.h, and ndis.h. Include ntddk.h, wdm.h, or ndis.h.
This routine can only be used in Windows 2000 and later.
The KdPrint routine is identical to DbgPrint in code that is compiled in a checked build environment. This routine has no effect if compiled in a free build environment. Only kernel-mode drivers can call the KdPrint routine.
A call to this macro requires double parentheses.
Unless it is absolutely necessary, you should not obtain a string from user input or another process and pass it to KdPrint. If you do use a string that you did not create, you must verify that this is a valid format string, and that the format codes match the argument list in type and quantity. The best coding practice is for all Format strings to be static and defined at compile time.
The formatted string is sent to the DbgPrint Buffer. The contents of this buffer are displayed immediately in the Debugger Command window, unless this display has been disabled by using the Global Flags Editor (gflags.exe).
If this display has been disabled, the contents of the DbgPrint Buffer can only be viewed by using the !dbgprint extension command. For information on debugger extensions, see Debugging Tools for NT-Based Operating Systems.
There is no upper limit to the size of the Format string or the number of arguments. However, the DbgPrint buffer can only hold 512 bytes of information. Any output longer than this will be lost.