how to print data from mdl?

I am using the usbsamp sample. I want to print the receive data in windbg. Please tell me the wdf method to do so. How can i print the data in an mdl?

xxxxx@gmail.com wrote:

I am using the usbsamp sample. I want to print the receive data in windbg. Please tell me the wdf method to do so. How can i print the data in an mdl?

I don’t understand the question. Are you trying to ask how to implement
a hex dump? Surely you already know how to access the request’s buffers
using KMDF.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

yes…i want to log the output buffer of readfile api in the driver.

xxxxx@gmail.com wrote:

yes…i want to log the output buffer of readfile api in the driver.

The easiest way is to set a breakpoint into the debugger in your
completion routine and dump the buffer there. You probably don’t want
to dump the entire buffer on every call, forever and ever.

You know how to use WdfRequestRetrieveOutputBuffer, right? Once you
have the output buffer, it’s just a straight C programming problem. I
use something like this for debugging:

#pragma warning( disable: 4995 )
void HexDump( unsigned long * Buffer, int Count )
{
static char sz[80] = {0};
for( int i = 0; i < Count; i++ )
{
sprintf( sz + (i&7) * 9, " %08x", Buffer[i] );
if( (i&7) == 7 )
{
KdPrint(( “%s\n”, sz ));
sz[0] = 0;
}
}
if( sz[0] )
KdPrint(( “%s\n”, sz ));
}
#pragma warning( default: 4995 )


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.