How to i print PVOID buffer using DbgPrint ? RRS feed


  • Like you would in user space, cast the PVOID to a pointer of the size of the item you wish to dump (for example PUCHAR is you want to print things as bytes, and PULONG if you want 32-bit values).  Then print the block using DbgPrint for example:

          ULONG    p;

          p = bufPtr;

          DbgPrint( "%p %x %x %x %x\n", p, p[0], p[1], p[2], p[3] );

    The above will print pointer and the first four 32-bit values buffer.  You could extend this in multiple ways with a loop to print more.

    Don Burn Windows Driver Consulting Website:

    Wednesday, December 9, 2015 1:15 PM