DebugView doesn't capture KdPrint output

给你一囗甜甜゛ 提交于 2021-01-29 08:59:17

问题


I cannot make DbgView.exe work properly on my Windows 10 64-bit v2004 Virtual Machine. The program doesn't capture any kernel message from the driver if using KdPrint, but works fine with DbgPrint. I've already tried "bcdedit /debug on", adding "Debug Print Filter" on the registry editor and rebooting, enabling verbose kernel output. I've also tried on my host machine, same outcome. It is a very simple driver, only to be loaded and unloaded, copied from the book Windows Kernel Programming.

This works

DbgPrint("Driver initialized.\n");

This doesn't

KdPrint(("Driver initialized.\n"));

Any help would be greatly appreciated!


回答1:


Jump to KdPrint and you will see a preprocessing magic:

#if DBG 

#define KdPrint(_x_) DbgPrint _x_
#define KdPrintEx(_x_) DbgPrintEx _x_ 
#define vKdPrintEx(_x_) vDbgPrintEx _x_
#define vKdPrintExWithPrefix(_x_) vDbgPrintExWithPrefix _x_
#define KdBreakPoint() DbgBreakPoint() 

#define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)

#else 

#define KdPrint(_x_)
#define KdPrintEx(_x_) 
#define vKdPrintEx(_x_)
#define vKdPrintExWithPrefix(_x_)
#define KdBreakPoint() 

#define KdBreakPointWithStatus(s)

#endif // DBG wudfwdm

This means that if you are compiling with Release configuration (DBG macro will not be defined), nothing will happen to KdPrint.

So it's not a DbgView problem.



来源:https://stackoverflow.com/questions/63256262/debugview-doesnt-capture-kdprint-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!