Printing wchar string form a driver

Normally wchar_t strings can be printed by using wprintf()/wout in c/c++.But how to do that in driver either there is KdPrint(()) or DbgPrint.What access qualifier we have to set for this purpose or is there any other Print function?
wcstombs() function works here after including stdio.h but while printing char string converted from wchar_t string gives only ‘?’ marks.Why is that so?

  1. Don’t include stdio in a driver.

  2. Read the documentation for DbgPrint/KdPrint. Depending on what you want to print exactly, you can use one of %C, %S, %lc, %ls, %wc, %ws, or %wZ, but you can only do so at IRQL=PASSIVE_LEVEL.

mm

wrote in message news:xxxxx@windbg…

> wcstombs() function works here after including stdio.h but while printing
> char string converted from wchar_t string gives only ‘?’ marks.Why is that
> so?

This is probably because DbgPrint internally uses single character encoding
(at least on NT5.x).
So even if you use UTF-16 formats like %ws or %wZ, it eventually is
converted to the system
default charset, similar to how unicode is displayed in console windows.

When the debugger interface has been designed, developers used mainly plain
ASCII.
There were the times.
– pa