For a user application (not a driver) using WinUSB, I use WinUsb_ControlTransfer in combination with overlapped I/O to asynchronously send a control message. Is it possible to cancel the asynchronous operation? WinUsb_AbortPipe works for all other endpoints but gives an 'invalid parameter' error when the control endpoint is passed (0x00 or 0x80 as the pipe address). I also tried CancelIo and CancelIoEx but both give an 'invalid handle' error on the WinUSB handle. The only related information I could find is on http://www.winvistatips.com/winusb-bugchecks-t335323.html, but offers no solution. Is this just impossible?
Asked
Active
Viewed 1,504 times
1 Answers
1
Probably not useful to the original asker any more, but in case anyone else comes across this: you can use CancelIo()
or CancelIoEx()
with the file handle that you originally passed in to WinUsb_Initialize()
.
This is similar to how the documentation of WinUsb_GetOverlappedResult
says:
This function is like the Win32 API routine, GetOverlappedResult, with one difference—instead of passing a file handle that is returned from CreateFile, the caller passes an interface handle that is returned from WinUsb_Initialize. The caller can use either API routine, if the appropriate handle is passed. The WinUsb_GetOverlappedResult function extracts the file handle from the interface handle and then calls GetOverlappedResult.

alexmerry
- 31
- 2
-
phew, i got this in a review queue and its the first answer to a 10 year old question. – Hack5 Jan 10 '20 at 17:31