Where can I find the definitive specification of DbgPrint()?

Discussion in 'Windows Vista Drivers' started by xmllmx, Aug 22, 2007.

  1. xmllmx

    xmllmx Guest

    The DDK documentation states DbgPrint() is much like printf which is a
    standard C library function. However, printf doesn't define such
    format specifiers as %ws and %wZ. I know how to use these format
    specifiers, but I can't find any definitive specification for them.

    Where to find them? Thanks for any comments.
     
    xmllmx, Aug 22, 2007
    #1
    1. Advertisements

  2. xmllmx

    Don Burn Guest

    I do not believe there is such a specification Z is the only format type
    that is not defined for printf, and it indicates counted strings (ANSI or
    UNICODE). The other one most people encounter is the size specifiers: I,
    I32, I64 where I is pointer size ints, I32 is 32 bit, and I64 is 64 bit.


    --
    Don Burn (MVP, Windows DDK)
    Windows 2k/XP/2k3 Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply
     
    Don Burn, Aug 22, 2007
    #2
    1. Advertisements

  3. xmllmx

    xmllmx Guest

    Besides %Z, I also can't find the format type %ws in the printf
    definition.
    (Though %s is defined)

    For example, does %ws differ from %wS?
     
    xmllmx, Aug 22, 2007
    #3
  4. xmllmx

    Don Burn Guest

    %wS is redundant since %S is for Unicode null terminated strings, %ws is
    equivalant to %S.


    --
    Don Burn (MVP, Windows DDK)
    Windows 2k/XP/2k3 Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply
     
    Don Burn, Aug 22, 2007
    #4
  5. xmllmx

    xmllmx Guest

    However, the definition of printf doesn't say %ws is equivalent to %S.
    Where can I find such a statement?
     
    xmllmx, Aug 22, 2007
    #5
  6. As an aside, the Microsoft printf implementation (much like DbgPrint) allows
    you to use %Z / %wZ, though these are nonstandard. You can see how this
    works by examining the printf source code included with Visual C++.
     
    Skywing [MVP], Aug 22, 2007
    #6
  7. Actually, that's incorrect. %S inverts the "wide-ness" of a string in
    format strings. When used with "printf", "%S" means "unicode string" (e.g.
    wchar_t*). When used with "wprintf", "%S" means "8-bit character string"
    (e.g. char*).
     
    Skywing [MVP], Aug 22, 2007
    #7
  8. xmllmx

    Don Burn Guest

    And since DbgPrint uses sprintf underneath, my statement about redundancy
    still stands.


    --
    Don Burn (MVP, Windows DDK)
    Windows 2k/XP/2k3 Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply
     
    Don Burn, Aug 22, 2007
    #8
  9. xmllmx

    xmllmx Guest

    Dear all,

    Could you tell me whether the following equations are tenable or not?

    %C = %wc

    %S = %ws

    %c = %lc

    %s = %ls

    I think the 'w' is not a standard format type, am I right?
     
    xmllmx, Aug 22, 2007
    #9
  10. I only use KdPrint

    %p is pointer, 32/64bit portable, a very good format spec
    %ws and %wZ are PANSI_STRING and PUNICODE_STRING
     
    Maxim S. Shatskih, Aug 23, 2007
    #10
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.