DebugPrint 格式说明符

    技术2022-05-20  46

    1) 直接打印字符串。   DbgPrint(“Hello World!”); 2) 空结尾的字符串,你可以用普通得C 语法表示字符串常量     char variable_string[] = “Hello World”;    DbgPrint(“%s”,variable_string); 3) 空结尾的宽字符串(WCHAR 类型 ) WCHAR    string_w[] = L“Hello World!”; DbgPrint(“%ws”,string_w); 或者 DbgPrint(“%S”,string_w);  4)Unicode 串,由UNICODE_STRING 结构描述, 包含16 位字符。 typedef   struct _UNICODE_STRING{        USHORT Length;        USHORT MaximumLength;       PWSTR   Buffer; }UNICODE_STRING , *PUNICODE_STRING;  UNICODE_STRING    string_unicode; RtlInitUnicodeString(&string_unicode, L”Hello World!”); DbgPrint(“%wZ/n”,&string_unicode);       5) ANSI 串,由ANSI_STRING 结构描述,包含8 位字符。 typedef struct _STRING{      USHORT Length;      USHORT MaximumLength;      PCHAR   Buffer; }STRING, *PANSI_STRING; STRING bar; 或者: ANSI_STRING bar; RtlInitAnsiString(&bar,”Hello World!”); DbgPrint(“%Z/n”,&bar); DebugPrint 格式说明符 

    根据DDK 上说明,Unicode 格式(%C, %S, %lc, %ls, %wc, %ws, and %wZ) 只能在 IRQL = PASSIVE_LEVEL 时才能使用.

     

    参考文献:

    1.      内核打印字符串

    2.      DDK

    本文来自博客,转载请标明出处:http://blog.csdn.net/misterliwei/archive/2008/12/19/3559793.aspx


    最新回复(0)