diff options
author | Pete Batard <pbatard@gmail.com> | 2010-03-12 12:59:04 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-03-12 12:59:04 +0000 |
commit | 8c1de7a64d44cf8176836a514ba332cde10484a4 (patch) | |
tree | 79522ed99363044baefecff72de2c503c39c3eb1 /libusb/os/windows_usb.c | |
parent | 2b47cdb7c8b20fbab0abbaa9ef66d7725af2b94d (diff) | |
download | libusb-8c1de7a64d44cf8176836a514ba332cde10484a4.tar.gz |
remove buggy "completed_synchronously" flag (Graeme Gill)r205
setting this flag in windows_usb.c could be missed by poll
use the overlapped.Internal status instead
Diffstat (limited to 'libusb/os/windows_usb.c')
-rw-r--r-- | libusb/os/windows_usb.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index dd4dac0..53a6a96 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -1933,10 +1933,10 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds, if (found) { // Handle async requests that completed synchronously first - if (transfer_priv->pollable_fd.completed_synchronously) { + if (HasOverlappedIoCompletedSync(transfer_priv->pollable_fd.overlapped)) { io_result = NO_ERROR; io_size = (DWORD)transfer_priv->pollable_fd.overlapped->InternalHigh; - // Regular saync overlapped + // Regular async overlapped } else if (GetOverlappedResult(transfer_priv->pollable_fd.handle, transfer_priv->pollable_fd.overlapped, &io_size, false)) { io_result = NO_ERROR; @@ -2566,7 +2566,7 @@ static int winusb_submit_control_transfer(struct usbi_transfer *itransfer) return LIBUSB_ERROR_IO; } } else { - wfd.completed_synchronously = true; + wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY; wfd.overlapped->InternalHigh = (DWORD)size; } @@ -2649,7 +2649,7 @@ static int winusb_submit_bulk_transfer(struct usbi_transfer *itransfer) return LIBUSB_ERROR_IO; } } else { - wfd.completed_synchronously = true; + wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY; wfd.overlapped->InternalHigh = (DWORD)transfer->length; } @@ -3649,7 +3649,7 @@ static int hid_submit_control_transfer(struct usbi_transfer *itransfer) if (r == LIBUSB_COMPLETED) { // Force request to be completed synchronously. Transferred size has been set by previous call - wfd.completed_synchronously = true; + wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY; // http://msdn.microsoft.com/en-us/library/ms684342%28VS.85%29.aspx // set InternalHigh to the number of bytes transferred wfd.overlapped->InternalHigh = (DWORD)size; @@ -3738,7 +3738,7 @@ static int hid_submit_bulk_transfer(struct usbi_transfer *itransfer) { usbi_err(ctx, "OVERFLOW!"); r = LIBUSB_ERROR_OVERFLOW; } - wfd.completed_synchronously = true; + wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY; wfd.overlapped->InternalHigh = size; } |