If the port can't be open (probably opened by vdservice), go to
the next one.
Add ability to increase write buffer size and send
entire buffer filled by characters without getting data from the
console.
This helps testing corner cases of vioser.sys, for example:
configure additional test port port with tcp socket backend,
connect to it with 'nc', press ^Z to suspend the 'nc' and send
several large (512K) buffers.
At some point the write does not return immediately and closing
test application causes cancellation flow.
Another scenarion: if 1M buffer sent, the driver fails the operation
due to too large SG table.
Signed-off-by: Yuri Benditovich <[email protected]>
Static analysis was failing with:
app\device.cpp(114): warning C6387: 'ol.hEvent' could be '0': this does not adhere to the specification for the function 'CloseHandle'.
app\device.cpp(196): warning C6387: 'ol.hEvent' could be '0': this does not adhere to the specification for the function 'CloseHandle'.
app\main.cpp(183): warning C28285: For function 'wmain' '_Param_(2)' syntax error in 'SAL_readableTo(elementCount(Argc))' near 'Argc))'.
Signed-off-by: Ladi Prosek <[email protected]>
The driver now returns STATUS_BUFFER_OVERFLOW if the output buffer is big
enough for the VIRTIO_PORT_INFO structure but not big enough for the port
name. The IOCTL method is now METHOD_OUT_DIRECT to enable passing the
required length back to the caller.
This reverts the user space part of commit a7e92d7e8c.
The current code doesn't work. If the supplied output buffer is too small,
the caller does not receive the required size in lpBytesReturned as
intended.
Relevant blog post: http://bit.ly/1NxJik3
I am simply switching to a reasonably sized fixed buffer on the calling
side, exactly what SerialPort::SerialPort() does. The IOCTL implementation
is tweaked to make it clear that the buffer size is not communicated back
on failure.