简体   繁体   English

在Windows内核设备驱动程序中使用fprintf

[英]using fprintf in windows kernel device driver

I need to make a dump of certain structure in a file in Windows driver. 我需要在Windows驱动程序的文件中进行某些结构的转储。 So for the file pointer, I used void pointer and use it in the place of file pointer in fprintf. 因此,对于文件指针,我使用了void指针,并在fprintf中代替了文件指针。

The source also build successfully without any compilation error. 源代码也成功构建,没有任何编译错误。 But when I load the driver, the value stored on that pointer is not printing. 但是,当我加载驱动程序时,该指针上存储的值无法打印。

How I should make use of fprintf in Windows driver. 我应该如何在Windows驱动程序中使用fprintf。

You should be using DbgPrintEx inside your device driver. 您应该在设备驱动程序中使用DbgPrintEx

printf won't be working for you in kernel mode. 在内核模式下,printf不适用于您。

DbgPrintEx prints to the kernel's DbgPrint buffer, which can be watched with a kernel debugger like WinDbg or Kd, or, if you want to watch it on the local system, DebugView . DbgPrintEx打印到内核的DbgPrint缓冲区,可以使用WinDbg或Kd之类的内核调试器进行监视,或者,如果要在本地系统上观看,则可以使用DebugView监视。

Most of the messages you print to this buffer are filtered out by default, so you want to adjust the filtering, as described in MSDN 默认情况下,您打印到此缓冲区的大多数消息都是被过滤掉的,因此,如MSDN中所述,您要调整过滤

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM