Reputation: 95
I need to call DbgPrint or KdPrint function from WDK sample src\print\monitors\localmon
Please help with instructions
I've just added
#include <ntddk.h>
in localmon.c file
and
DbgPrint("Some message");
in same file
and at compiling I've get next errors:
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
What i'm doing wrong?
Thanks
Upvotes: 1
Views: 3170
Reputation: 21279
This is user-mode code. Use OutputDebugString
instead and don't include ntddk.h
at all. If you need to, write a little function as adapter to OutputDebugString
as it does not take a formatting string etc. like its counterpart DbgPrint
.
If you absolutely must use DbgPrint
, it is also available from ntdll.dll
, of course. So you could reach into that and import it from there (prototype can be found in wdm.h
in the WDK). But I would prefer OutputDebugString
in user-mode code.
Upvotes: 3