How do we print debugging message in the DDK pjlmon dll? RRS feed

  • Question

  • Dear Microsoft experts:

    I am trying to debug the DDK pjlmon dll. 

    In the dll's sample code, it provides me with the DBG_MSG macro to print some debugging messages.

    // Needed by DDK
    #define DBG_TRACE   0x0001
    #define DBG_WARN    0x0002
    #define DBG_ERROR   0x0004
    #define DBG_MSG(level,message)

    But i have no idea about how to see the message because no debugging message shows up in the WinDbg tool.

    Or is there an alternate method to print the debugging message in the pjlmon dll?

    I am grateful for every suggestion. 

    Thanks a lot.


    Zale Yu

    Friday, March 4, 2016 8:46 AM


  • Do you actually think that DBG_MSG macro prints debugging messages?  Look at the definition.  All of those DBG_MSG macros compile to absolutely nothing.  If you want to see debugging messages, then you will need to provide your own definition of DBG_MSG that prints them.  Something like:

    static void DebugPrint( LPCSTR fmt, ... )
        va_list args;
        va_start( args, fmt );
        char sz[128];
        vsprintf_s( sz, 128, fmt, args );
        OutputDebugString( sz );
        va_end( args );
    #define DBG_MSG(level, msg)    DebugPrint msg
    This code doesn't check the debug level.  You can add that if you want.

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    • Marked as answer by Zale Yu Thursday, March 24, 2016 7:27 AM
    Tuesday, March 8, 2016 12:22 AM