From: tatsun on 30 Nov 2009 21:40 Hi I am developing the driver based on HidFx2Usb driver source. Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT. So I add the following code in this IOCTL process in order to send data to the USB, but CompleteWriteReport callback routine always called with status = STATUS_INVALID_PARAMETER (0xc000000d). I do not know why error occurs. --- code --- status = WdfRequestRetrieveInputMemory(Request, &memory); if (!NT_SUCCESS(status)) { goto Exit; } status = WdfUsbTargetPipeFormatRequestForWrite( pipe, Request, memory, NULL ); if (!NT_SUCCESS(status)) { goto Exit; } WdfRequestSetCompletionRoutine( Request, CompleteWriteReport, pipe ); if (WdfRequestSend( Request, WdfUsbTargetPipeGetIoTarget(pipe), WDF_NO_SEND_OPTIONS ) == FALSE) { status = WdfRequestGetStatus(Request); goto Exit; }
From: Doron Holan [MSFT] on 2 Dec 2009 20:01 WdfUsbTargetPipeFormatRequestForWrite does not send a IOCTL_HID_WRITE_REPORT. you need to format the pipe for an IOCTL d -- This posting is provided "AS IS" with no warranties, and confers no rights. "tatsun" <tatsun(a)discussions.microsoft.com> wrote in message news:9AC48ED6-AB33-47E4-AF05-EDB489F78722(a)microsoft.com... > Hi > > I am developing the driver based on HidFx2Usb driver source. > Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT. > So I add the following code in this IOCTL process in order to send data to > the USB, but CompleteWriteReport callback routine always called with > status = > STATUS_INVALID_PARAMETER (0xc000000d). > > I do not know why error occurs. > > --- code --- > status = WdfRequestRetrieveInputMemory(Request, &memory); > > if (!NT_SUCCESS(status)) { > goto Exit; > } > > status = WdfUsbTargetPipeFormatRequestForWrite( > pipe, > Request, > memory, > NULL > ); > if (!NT_SUCCESS(status)) { > goto Exit; > } > WdfRequestSetCompletionRoutine( > Request, > CompleteWriteReport, > pipe > ); > > if (WdfRequestSend( > Request, > WdfUsbTargetPipeGetIoTarget(pipe), > WDF_NO_SEND_OPTIONS > ) == FALSE) { > status = WdfRequestGetStatus(Request); > goto Exit; > } >
From: tatsun on 4 Dec 2009 00:12 Thank you Doron I retrieved the WDFMEMORY from WDFREQUEST as follows, status = WdfRequestRetrieveInputMemory(Request, &memory); status is OK, but memory object does not contain buffer information. Because I added below code and check return value, buffer=NULL. buffer = WdfMemoryGetBuffer(memory, NULL); I checked MdlAddress and found the data is stored in MDL. So I retrieved the buffer and its length successfuly as follows, Irp = WdfRequestWdmGetIrp(Request); Buffer = (PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); BuffLen = Irp->MdlAddress->ByteCount; After above I add making the new WDFMEMORY object and called WdfUsbTargetPipeFormatRequestForWrite, then called WdfRequestSend, it success. Is my method OK ? Thanks. "Doron Holan [MSFT]" wrote: > WdfUsbTargetPipeFormatRequestForWrite does not send a > IOCTL_HID_WRITE_REPORT. you need to format the pipe for an IOCTL > > d > > -- > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > "tatsun" <tatsun(a)discussions.microsoft.com> wrote in message > news:9AC48ED6-AB33-47E4-AF05-EDB489F78722(a)microsoft.com... > > Hi > > > > I am developing the driver based on HidFx2Usb driver source. > > Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT. > > So I add the following code in this IOCTL process in order to send data to > > the USB, but CompleteWriteReport callback routine always called with > > status = > > STATUS_INVALID_PARAMETER (0xc000000d). > > > > I do not know why error occurs. > > > > --- code --- > > status = WdfRequestRetrieveInputMemory(Request, &memory); > > > > if (!NT_SUCCESS(status)) { > > goto Exit; > > } > > > > status = WdfUsbTargetPipeFormatRequestForWrite( > > pipe, > > Request, > > memory, > > NULL > > ); > > if (!NT_SUCCESS(status)) { > > goto Exit; > > } > > WdfRequestSetCompletionRoutine( > > Request, > > CompleteWriteReport, > > pipe > > ); > > > > if (WdfRequestSend( > > Request, > > WdfUsbTargetPipeGetIoTarget(pipe), > > WDF_NO_SEND_OPTIONS > > ) == FALSE) { > > status = WdfRequestGetStatus(Request); > > goto Exit; > > } > > > . >
From: Doron Holan [MSFT] on 4 Dec 2009 13:10 for IOCTL_HID_WRITE_REPORT, the KMDF APIs used to extract the buffer do not work b/c hidclass does not follow the standard rules for formatting. you get the buffer from Irp->UserBuffer which is a pointer to a HID_XFER_PACKET. the HID_XFER_PACKET contains pointers for the underlying buffer and its length d -- This posting is provided "AS IS" with no warranties, and confers no rights. "tatsun" <tatsun(a)discussions.microsoft.com> wrote in message news:55918E86-C7FC-4E6A-A548-3640152FD7AB(a)microsoft.com... > Thank you Doron > > I retrieved the WDFMEMORY from WDFREQUEST as follows, > > status = WdfRequestRetrieveInputMemory(Request, &memory); > > status is OK, but memory object does not contain buffer information. > Because > I added below code and check return value, buffer=NULL. > > buffer = WdfMemoryGetBuffer(memory, NULL); > > I checked MdlAddress and found the data is stored in MDL. So I retrieved > the > buffer and its length successfuly as follows, > > Irp = WdfRequestWdmGetIrp(Request); > Buffer = (PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress, > NormalPagePriority); > BuffLen = Irp->MdlAddress->ByteCount; > > After above I add making the new WDFMEMORY object and called > WdfUsbTargetPipeFormatRequestForWrite, then called WdfRequestSend, it > success. > > Is my method OK ? > > Thanks. > > "Doron Holan [MSFT]" wrote: > >> WdfUsbTargetPipeFormatRequestForWrite does not send a >> IOCTL_HID_WRITE_REPORT. you need to format the pipe for an IOCTL >> >> d >> >> -- >> >> This posting is provided "AS IS" with no warranties, and confers no >> rights. >> >> >> "tatsun" <tatsun(a)discussions.microsoft.com> wrote in message >> news:9AC48ED6-AB33-47E4-AF05-EDB489F78722(a)microsoft.com... >> > Hi >> > >> > I am developing the driver based on HidFx2Usb driver source. >> > Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT. >> > So I add the following code in this IOCTL process in order to send data >> > to >> > the USB, but CompleteWriteReport callback routine always called with >> > status = >> > STATUS_INVALID_PARAMETER (0xc000000d). >> > >> > I do not know why error occurs. >> > >> > --- code --- >> > status = WdfRequestRetrieveInputMemory(Request, &memory); >> > >> > if (!NT_SUCCESS(status)) { >> > goto Exit; >> > } >> > >> > status = WdfUsbTargetPipeFormatRequestForWrite( >> > pipe, >> > Request, >> > memory, >> > NULL >> > ); >> > if (!NT_SUCCESS(status)) { >> > goto Exit; >> > } >> > WdfRequestSetCompletionRoutine( >> > Request, >> > CompleteWriteReport, >> > pipe >> > ); >> > >> > if (WdfRequestSend( >> > Request, >> > WdfUsbTargetPipeGetIoTarget(pipe), >> > WDF_NO_SEND_OPTIONS >> > ) == FALSE) { >> > status = WdfRequestGetStatus(Request); >> > goto Exit; >> > } >> > >> . >>
|
Pages: 1 Prev: Compile error after adding #define WPP_GLOBALLOGGER Next: kernel-mode encryption |