gpt4 book ai didi

c++ - 来自 WDK 示例的 DbgPrint

转载 作者:太空宇宙 更新时间:2023-11-04 02:13:20 25 4
gpt4 key购买 nike

我需要从 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

我做错了什么?

谢谢

最佳答案

这是用户模式代码。请改用 OutputDebugString 并且根本不包含 ntddk.h。如果需要,请编写一个小函数作为 OutputDebugString 的适配器,因为它不像其对应的 DbgPrint 那样采用格式化字符串等。


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

关于c++ - 来自 WDK 示例的 DbgPrint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10798923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com