Re: BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- From: Linus <Linus@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Oct 2007 19:35:00 -0700
During the PNPd test from DTMtest
in my case the URB request codes are:
URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
URB_FUNCTION_SELECT_CONFIGURATION
URB_FUNCTION_CLASS_INTERFACE
URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE
URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
URB_FUNCTION_ABORT_PIPE
so I took a shut at URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
the codes are changed like this->
NTSTATUS DeviceControlComplete(PDEVICE_OBJECT fido, PIRP Irp, PURB purb){
PDEVICE_EXTENSION pdx=(PDEVICE_EXTENSION) fido->DeviceExtension;
PCHAR DescriptorBuffer;
ULONG currentX = 0, currentY = 0;
UCHAR Button = 0;
KdPrint(("purb->UrbHeader.Function %x",purb->UrbHeader.Function));
if(purb->UrbHeader.Function==URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER)//this
line avoid other UrbHeader.Function to access thes codes{
if(purb){
if(purb->UrbControlDescriptorRequest.TransferBufferLength==5)
{
RtlCopyMemory(pdx->intdata,
purb->UrbControlDescriptorRequest.TransferBuffer,
purb->UrbControlDescriptorRequest.TransferBufferLength);
........
}
and it works, it pass the PNPd test....
basically just modified two place,
1.Pass the URB as the context to the completion routine
2.make sure every time when complete routine had been triggered, only
UrbHeader.Function==URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER can access the
complete routine.
Finally the problem is solved.
thanks everyone for all your tips and helps.
"Kalle Olavi Niemitalo" wrote:
Tim Roberts <timr@xxxxxxxxx> writes:.
Kalle Olavi Niemitalo <kon@xxxxxx> wrote:
purb->UrbControlDescriptorRequest.TransferBuffer is supposed to
point to one of the structures USB_DEVICE_DESCRIPTOR,
USB_CONFIGURATION_DESCRIPTOR, or USB_STRING_DESCRIPTOR.
No, that's not at all true. Control transfers are used for many things
besides descriptors. For vendor commands, one very common use, the
transfer buffer can contain anything at all.
The type of purb->UrbControlDescriptorRequest is
_URB_CONTROL_DESCRIPTOR_REQUEST. According to the documentation
<http://msdn2.microsoft.com/en-us/library/ms793525.aspx>,
Hdr.Function in such a request must be one of:
URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT
URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE
URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE
URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT
URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE
Would one use any of these values for a vendor command?
If Hdr.Function contains some other value, then a different
member of the *purb union should also be used, I think.
- References:
- BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- From: xyz . linus
- Re: BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- From: Kalle Olavi Niemitalo
- Re: BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- From: Tim Roberts
- Re: BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- From: Kalle Olavi Niemitalo
- BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- Prev by Date: Re: Stop Error:0x8E(0xC0000005,........)
- Next by Date: Re: Where is my KSSTATE_STOP notification?
- Previous by thread: Re: BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- Next by thread: Re: BSOD because RtlCopyMemory running at wrong IRQL...HELP....
- Index(es):