2

I am working on a driver using WDK that will monitor network traffic and output it to a log file.

I am currently trying to modify the inspect example given in the WinDDK directory.

It seems that I can't call printf, fprintf, etc. because of a linker error:

unresolved external symbol __imp_printf ...

Is there another way to output traffic information to a log file? Am I not linking some library somewhere properly?

Thank you

4

1 回答 1

1

好吧,您正在编写 KernelMode 驱动程序,因此您必须调用 DbgPrint,它相当于 c 中的 printf。

printf(format, params) -> DbgPrint(format, params)

您必须使用 WinDbg 或 DbgView 工具来查看调试消息。

要转储到文件,您应该首先使用 CreateFile 函数打开文件。一旦句柄打开且有效,您就可以使用 WriteFile 函数对其进行写入。

于 2012-03-31T22:02:44.010 回答