In the previous post we have seen how to completely Dump an URB but as you should remember exists a particular structure _URB_CONTROL_TRANSFER, that USB client drivers sets up to transfer data to or from a control pipe. So we need to implement two external Dump Functions, DumpPipeHandle and DumpTransferBuffer.
in struct Buffer *b,const char *s,
in USBD_PIPE_HANDLE inPipeHandle
unsigned char ep;
KPrintf(b,”%s = %p [endpoint 0x%x]\n”,s,inPipeHandle,ep);
KPrintf(b,”%s = %p\n”,s,inPipeHandle);
As you should remember it’s necessary for any PipeHandle to know the Endpoint. This can be accomplished by tracing the USBD_PIPE_HANDLE for each Endpoint (the number of Endpoints is declared at our choise (use for example MAXEP = 50).
Now is time to rip the TransferBuffer with DumpTransferBuffer:
struct Buffer *b,
in BOOLEAN bPrintHeader,
ULONG uBufferOffset = 0
PUCHAR pMDLBuf = (PUCHAR)MmGetSystemAddressForMdlSafe(pMdl,NormalPagePriority);
Here ends the USB Coding Series (source code I’ve used is taken from SniffUSB 2.0), but surely i’ll come back with other arguments related to USB..
See you to the next post..