在Windows内核驱动编写的过程中经常要使用到调试输出DbgPrint/KdPrint,但是经常忘记使用的格式,这里MARK一下。
符号 | 格式说明符 | 类型 |
%c, %lc | ANSI字符 | char |
%C, %wc | 宽字符 | wchar_t |
%d, %i | 十进制有符号整数 | int |
%D | 十进制__int64 | __int64 |
%L | 十六进制的LARGE_INTEGER | LARGE_INTEGER |
%s, %ls | NULL终止的ANSI字符串 | char* |
%S, %ws | NULL终止的宽字符串 | wchar_t* |
%Z | ANSI_STRING字符串 | ANSI_STRING |
%wZ | UNICODE_STRING字符串 | UNICODE_STRING |
%u | 十进制的ULONG | ULONG |
%x | 小写字符十六进制的ULONG | ULONG |
%X | 大写字符十六进制的ULONG | ULONG |
%p | 指针Pointer 32/64位 |
MSDN:
KdPrint is identical to the DbgPrint routine 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.
转载请注明:悠然品鉴 » DbgPrint和KdPrint的使用