RETURN_FAIL("SetCommTimeouts() failed");
}
+ /* Reduce count if it exceeds the WriteFile limit. */
+ if (count > WRITEFILE_MAX_SIZE)
+ count = WRITEFILE_MAX_SIZE;
+
/* Start write. */
if (WriteFile(port->hdl, buf, count, NULL, &port->write_ovl)) {
DEBUG("Write completed immediately");
RETURN_FAIL("SetCommTimeouts() failed");
}
+ /* Reduce count if it exceeds the WriteFile limit. */
+ if (count > WRITEFILE_MAX_SIZE)
+ count = WRITEFILE_MAX_SIZE;
+
/* Copy data to our write buffer. */
buf_bytes = min(port->write_buf_size, count);
memcpy(port->write_buf, buf, buf_bytes);