Simple Directmedia Layer

hidapi: update hid_write() for windows from mainstream.

Returns bytes_written if WriteFile returns synchronously
Relevant mainstream discussions:
https://github.com/libusb/hidapi/pull/697
https://github.com/libusb/hidapi/issues/695

authored by

Ozkan Sezer and committed by
Sam Lantinga
13c5d109 3eab5999

+4 -1
+4 -1
src/hidapi/windows/hid.c
··· 1282 1282 length = dev->output_report_length; 1283 1283 } 1284 1284 1285 - res = WriteFile(dev->device_handle, buf, (DWORD) length, NULL, &dev->write_ol); 1285 + res = WriteFile(dev->device_handle, buf, (DWORD) length, &bytes_written, &dev->write_ol); 1286 1286 1287 1287 if (!res) { 1288 1288 if (GetLastError() != ERROR_IO_PENDING) { ··· 1291 1291 goto end_of_function; 1292 1292 } 1293 1293 overlapped = TRUE; 1294 + } else { 1295 + /* WriteFile() succeeded synchronously. */ 1296 + function_result = bytes_written; 1294 1297 } 1295 1298 1296 1299 if (overlapped) {