I’m running into an Access Violation problem using WDF with Isochronous.
I’ve had no problems performing Bulk, Interrupt and Control transfers, but
Isochronous transfers are causing me a headache.
I’ve been through the DDK documentation and I’m confident I’m following the
instructions correctly.
I’m trying to read 160 bytes, broken down into 10, 16 byte packets. I build
the URB and when I try to send synchronously I get an access violation.
In this example I create a URB in a new buffer, and create a new buffer to
hold the 160bytes, and simply try to read data into the new buffer.
I’ve posted the code segment + the output from windbg.
I’d appreciate any help, even just a pointer in the right direction for some
good documentation on chasing down this problem.
Chris.
CODE SEGMENT
//create new URB in buffer
ULONG ulURB, i;
PURB purbURB; //pointer to new URB in new Buffer
PVOID pvTemp; //pointer to new buffer used to recieve data from read
request
ulURB = GET_ISO_URB_SIZE(10);
purbURB = (PURB)ExAllocatePoolWithTag(PagedPool, ulURB, ‘meme’);
pvTemp = ExAllocatePoolWithTag(PagedPool, 160, ‘mema’);
purbURB->UrbIsochronousTransfer.Hdr.Function =
URB_FUNCTION_ISOCH_TRANSFER ;
purbURB->UrbIsochronousTransfer.Hdr.Length = (short)ulURB;
purbURB->UrbIsochronousTransfer.PipeHandle = hUSBPipe;
purbURB->UrbIsochronousTransfer.TransferFlags =
USBD_TRANSFER_DIRECTION_IN;
purbURB->UrbIsochronousTransfer.NumberOfPackets = 10;
purbURB->UrbIsochronousTransfer.TransferBufferLength = 160;
purbURB->UrbIsochronousTransfer.TransferBuffer = pvTemp;
purbURB->UrbIsochronousTransfer.TransferBufferMDL = NULL;
purbURB->UrbIsochronousTransfer.StartFrame =
URB_FUNCTION_GET_CURRENT_FRAME_NUMBER;
purbURB->UrbIsochronousTransfer.UrbLink = NULL;
for(i = 0; i <10; i++){
KdPrint((“Setting Iso Desc %d\n”, i));
purbURB->UrbIsochronousTransfer.IsoPacket[i].Offset = i*16;
purbURB->UrbIsochronousTransfer.IsoPacket[i].Length = 16;
}
KdPrint((“Sending Packet\n”));
status =
WdfUsbTargetPipeSendUrbSynchronously(upPipe,NULL,&(pDevContext->wrsoReadWriteOptions),purbURB);
ExFreePool((PVOID)purbURB);
ExFreePool(pvTemp);
if (NT_SUCCESS(status)) {
KdPrint((“Send success\n”));
}else{
KdPrint((“Send Failed\n”));
}
WINDBG OUTPUT
Setting Iso Desc 0
Setting Iso Desc 1
Setting Iso Desc 2
Setting Iso Desc 3
Setting Iso Desc 4
Setting Iso Desc 5
Setting Iso Desc 6
Setting Iso Desc 7
Setting Iso Desc 8
Setting Iso Desc 9
Sending Packet
Access violation - code c0000005 (!!! second chance !!!)
USBPORT!USBPORT_AllocTransfer+0x1d5:
f97f8c4b 0fb6800a010000 movzx eax,byte ptr [eax+0x10a]