In Microsoft Windows Server 2003 and earlier versions of Windows, the KdPrint macro sends a message to the kernel debugger. In Windows Vista and later versions of Windows, KdPrint sends a message only if certain conditions apply.
A call to KdPrint requires double parentheses.
- Format [in]
Specifies a pointer to the format string to print. The Format string supports all the printf-style format specification fields. However, the Unicode format codes (%C, %S, %lc, %ls, %wc, %ws, and %wZ) can only be used with IRQL = PASSIVE_LEVEL.
Specifies arguments for the format string, as in printf.
If successful, KdPrint returns the NTSTATUS code STATUS_SUCCESS; otherwise it returns the appropriate error code.
KdPrint is identical to the DbgPrint routine in code that is compiled for a debug configuration. This routine has no effect if compiled for a release configuration. Only kernel-mode drivers can call the KdPrint routine.
In Windows Vista and later versions of Windows, KdPrint sends a message only if certain conditions apply. Specifically, it behaves like KdPrintEx with the DEFAULT component and a message importance level of DPFLTR_INFO_LEVEL. In other words, the following two function calls are identical:
KdPrint (( Format, arguments )) KdPrintEx (( DPFLTR_DEFAULT_ID, DPFLTR_INFO_LEVEL, Format, arguments ))
For more information about message filtering, components, and message importance level, see Reading and Filtering Debugging Messages.
Note Regardless of which version of Windows you are using, it is recommended that you use KdPrintEx instead of KdPrint, since KdPrintEx allows you to control the conditions under which the message is sent.
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.
There is no upper limit to the size of the Format string or the number of arguments. However, any single call to KdPrint will only transmit 512 bytes of information. There is also a limit to the size of the DbgPrint buffer.
|Available in Microsoft Windows 2000 and later.|
Build date: 5/7/2013