From: nicolasr on
Hi,
can anyone give me a hint on how to make _DbgPrintF
in ksdebug.h print out messages on Vista?

I'm using DebugView to capture kernel messages.
With my own macro

#define DebugPrint(_x_) \
DbgPrint("MYDRIVER.SYS: ");\
DbgPrint _x_;

I get debug messages. But not from code that uses
_DbgPrintF, which is defined in ksdebug.h as:

#define DEBUGLVL_BLAB 3
#define DEBUGLVL_VERBOSE 2
#define DEBUGLVL_TERSE 1
#define DEBUGLVL_ERROR 0

#if (DBG)
#if !defined( DEBUG_LEVEL )
#if defined( DEBUG_VARIABLE )
#if defined( KSDEBUG_INIT )
ULONG DEBUG_VARIABLE = DEBUGLVL_TERSE;
#else
extern ULONG DEBUG_VARIABLE;
#endif
#else
#define DEBUG_VARIABLE DEBUGLVL_TERSE
#endif
#else
#if defined( DEBUG_VARIABLE )
#if defined( KSDEBUG_INIT )
ULONG DEBUG_VARIABLE = DEBUG_LEVEL;
#else
extern ULONG DEBUG_VARIABLE;
#endif
#else
#define DEBUG_VARIABLE DEBUG_LEVEL
#endif
#endif

#define _DbgPrintF(lvl, strings) \
{ \
if (((lvl)==DEBUG_VARIABLE) || (lvl < DEBUG_VARIABLE)) {\
DbgPrint(STR_MODULENAME);\
DbgPrint##strings;\
DbgPrint("\n");\
if ((lvl) == DEBUGLVL_ERROR) {\
DbgBreakPoint();\
} \
} \
}


What is the correct way to make _DbgPrintF
print all messages?

thanks for any help,
Nicolas Reinschmidt

From: Maxim S. Shatskih on
Google for "debug print filter" and enable the registry settings you will find.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

"nicolasr" <nicolasrREMOVETHISSPAMBLOCKER(a)gmx.net> wrote in message news:OA$npsOgJHA.4728(a)TK2MSFTNGP05.phx.gbl...
> Hi,
> can anyone give me a hint on how to make _DbgPrintF
> in ksdebug.h print out messages on Vista?
>
> I'm using DebugView to capture kernel messages.
> With my own macro
>
> #define DebugPrint(_x_) \
> DbgPrint("MYDRIVER.SYS: ");\
> DbgPrint _x_;
>
> I get debug messages. But not from code that uses
> _DbgPrintF, which is defined in ksdebug.h as:
>
> #define DEBUGLVL_BLAB 3
> #define DEBUGLVL_VERBOSE 2
> #define DEBUGLVL_TERSE 1
> #define DEBUGLVL_ERROR 0
>
> #if (DBG)
> #if !defined( DEBUG_LEVEL )
> #if defined( DEBUG_VARIABLE )
> #if defined( KSDEBUG_INIT )
> ULONG DEBUG_VARIABLE = DEBUGLVL_TERSE;
> #else
> extern ULONG DEBUG_VARIABLE;
> #endif
> #else
> #define DEBUG_VARIABLE DEBUGLVL_TERSE
> #endif
> #else
> #if defined( DEBUG_VARIABLE )
> #if defined( KSDEBUG_INIT )
> ULONG DEBUG_VARIABLE = DEBUG_LEVEL;
> #else
> extern ULONG DEBUG_VARIABLE;
> #endif
> #else
> #define DEBUG_VARIABLE DEBUG_LEVEL
> #endif
> #endif
>
> #define _DbgPrintF(lvl, strings) \
> { \
> if (((lvl)==DEBUG_VARIABLE) || (lvl < DEBUG_VARIABLE)) {\
> DbgPrint(STR_MODULENAME);\
> DbgPrint##strings;\
> DbgPrint("\n");\
> if ((lvl) == DEBUGLVL_ERROR) {\
> DbgBreakPoint();\
> } \
> } \
> }
>
>
> What is the correct way to make _DbgPrintF
> print all messages?
>
> thanks for any help,
> Nicolas Reinschmidt
>
From: nicolasr on
thanks for the hint.
I read several of the articles and already tried setting
DEFAULT to 0xFFFFFFFF in the registry key
'Debug Print Filter' but it doesn't help.

From the ksdebug.h code I posted it looks like there
should be a #define DEBUG_LEVEL VERBOSE (or similar)
somewhere but I'm not able to find it.
So I thought I'm supposed to define it myself. Doing
so results in a warning:

warning C4005: 'DEBUG_LEVEL' : macro redefinition

and finally in

error C2220: warning treated as error - no 'object' file generated

Maybe I should switch off C2220, if possible, and just ignore
the warning?

Any further idea?
thanks,
Nicolas
From: Maxim S. Shatskih on
Try KdPrint, will it work?

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

"nicolasr" <nicolasrREMOVETHISSPAMBLOCKER(a)gmx.net> wrote in message news:eyk7Q9WgJHA.4220(a)TK2MSFTNGP06.phx.gbl...
> thanks for the hint.
> I read several of the articles and already tried setting
> DEFAULT to 0xFFFFFFFF in the registry key
> 'Debug Print Filter' but it doesn't help.
>
> From the ksdebug.h code I posted it looks like there
> should be a #define DEBUG_LEVEL VERBOSE (or similar)
> somewhere but I'm not able to find it.
> So I thought I'm supposed to define it myself. Doing
> so results in a warning:
>
> warning C4005: 'DEBUG_LEVEL' : macro redefinition
>
> and finally in
>
> error C2220: warning treated as error - no 'object' file generated
>
> Maybe I should switch off C2220, if possible, and just ignore
> the warning?
>
> Any further idea?
> thanks,
> Nicolas
From: nicolasr on
> Try KdPrint, will it work?

Yes, KdPrint works.
As an intermediate solution I have removed
the WX compiler switch from my 'sources'
file. Then I get a warning about redefinition
of DEBUG_LEVEL but the driver is linked and
at runtime I get all the messages printed out.
So the question remains how to correctly use
ksdebug.h?
But for now it works.

thanks again,
Nicolas