Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special-case sync return from async call and preserve last error #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Oct 7, 2023

  1. libusb0 backend: Use macro instead of magic value

    Signed-off-by: Tormod Volden <[email protected]>
    tormodvolden committed Oct 7, 2023
    Configuration menu
    Copy the full SHA
    1f1e7ad View commit details
    Browse the repository at this point in the history
  2. libusb0 backend: Set Win32 last error if usb_control_msg() fails

    usb_control_msg() returns various error codes, so map these to
    Win32 errors that can be read out by calling functions.
    
    Signed-off-by: Tormod Volden <[email protected]>
    tormodvolden committed Oct 7, 2023
    Configuration menu
    Copy the full SHA
    4f3c3a6 View commit details
    Browse the repository at this point in the history
  3. libusb0 backend: Skip GetOverlappedResult() on synchronous completion

    If DeviceIoControl() succeeds synchronously it isn't advised to call
    GetOverlappedResult() [1].
    
    In practive it seems like GetOverlappedResult() works in any case, but
    all Microsoft examples treat the synchronous completion case separately.
    
    Also preserve the Win32 last error from the failing call since a failing
    CloseHandle() might clobber it.
    
    [1] https://learn.microsoft.com/en-GB/troubleshoot/windows/win32/asynchronous-disk-io-synchronous
    
    Signed-off-by: Tormod Volden <[email protected]>
    tormodvolden committed Oct 7, 2023
    Configuration menu
    Copy the full SHA
    ae65204 View commit details
    Browse the repository at this point in the history