The KdPrintEx macro sends a string to the kernel debugger if the conditions you specify are met.
A call to KdPrintEx requires double parentheses.
ULONG KdPrintEx( _In_ ULONG ComponentId, _In_ ULONG Level, _In_ PCSTR Format, ... arguments );
KdPrintEx is identical to the DbgPrintEx routine in code that is compiled for a debug configuration. This routine has no effect in code that is compiled for a release build. Only kernel-mode drivers can call the KdPrintEx routine.
KdPrintEx either passes the specified string to the kernel debugger or does nothing at all, depending on the values of ComponentId, Level, and the corresponding component filter masks. For details, see Reading and Filtering Debugging Messages.
Unless it is absolutely necessary, you should not obtain a string from user input or another process and pass it to KdPrintEx. 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 KdPrintEx will only transmit 512 bytes of information. There is also a limit to the size of the DbgPrint buffer. See The DbgPrint Buffer and the Debugger for details.
This routine is defined in ntddk.h and ndis.h; component filter IDs are defined in dpfilter.h, ndis.h, and wdm.h. Include ntddk.h or ndis.h.
|Windows version||Available in Microsoft Windows XP and later. Available in Microsoft Windows XP and later.|
|Header||wdm.h (include Wdm.h)|
|Library||NtosKrnl.lib (See DbgPrintEx.)|