我需要从WDK示例DbgPrint调用KdPrint或src\print\monitors\localmon函数。
请帮助阅读说明。
我刚加了
#include <ntddk.h>在localmon.c文件中
和
同一文件中的DbgPrint("Some message");
在编译过程中,我得到了下一个错误:
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我做错什么了?
谢谢
发布于 2012-05-29 12:43:52
这是用户模式代码。而是使用OutputDebugString,根本不包括ntddk.h。如果需要,可以编写一个小函数作为OutputDebugString的适配器,因为它不像对应的DbgPrint那样接受格式化字符串等。
当然,如果您绝对必须使用DbgPrint,它也可以从ntdll.dll获得。因此您可以从那里导入它(在WDK中的wdm.h中可以找到原型)。但是我更喜欢用户模式代码中的OutputDebugString。
https://stackoverflow.com/questions/10798923
复制相似问题