问题
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