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_prin开发者_开发技巧tf ...
Is there another way to output traffic information to a log file? Am I not linking some library somewhere properly?
Thank you
Well you are writing KernelMode drivers so you have to call DbgPrint which is equivalent to printf in c.
printf(format, params) -> DbgPrint(format, params)
You will have to use either WinDbg or DbgView tool to view the debug messages.
To dump to a file you should first open the file with CreateFile function. Once the handle is open and valid, you can write to it using WriteFile function.
精彩评论