首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WDK样品中的DbgPrint

WDK样品中的DbgPrint
EN

Stack Overflow用户
提问于 2012-05-29 12:13:09
回答 1查看 3K关注 0票数 1

我需要从WDK示例DbgPrint调用KdPrint或src\print\monitors\localmon函数。

请帮助阅读说明。

我刚加了

#include <ntddk.h>在localmon.c文件中

同一文件中的DbgPrint("Some message");

在编译过程中,我得到了下一个错误:

代码语言:javascript
复制
1>errors in directory c:\winddk\7600.16385.1\src\print\new2\monitors\localmon
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(149) : error C2220: warning treated as
error - no 'object' file generated
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(614) : error C2011: '_PROCESSOR_NUMBER'
 : 'struct' type redefinition
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(625) : error C2011: '_GROUP_AFFINITY' :
 'struct' type redefinition
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(882) : error C2011: '_FLOAT128' : 'stru
ct' type redefinition
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(933) : error C2011: '_LARGE_INTEGER' :
'union' type redefinition
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(951) : error C2011: '_ULARGE_INTEGER' :
 'union' type redefinition
1>c:\winddk\7600.16385.1\inc\api\ntdef.h(973) : error C2011: '_LUID' : 'struct'
type redefinition

我做错什么了?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2012-05-29 12:43:52

这是用户模式代码。而是使用OutputDebugString,根本不包括ntddk.h。如果需要,可以编写一个小函数作为OutputDebugString的适配器,因为它不像对应的DbgPrint那样接受格式化字符串等。

当然,如果您绝对必须使用DbgPrint,它也可以从ntdll.dll获得。因此您可以从那里导入它(在WDK中的wdm.h中可以找到原型)。但是我更喜欢用户模式代码中的OutputDebugString

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10798923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档