WTSVirtualChannelRead sometimes drops packets when using timeouts
I am using WTSVirtualChannelRead and have noticed some incorrect behavior that occurs when using timeouts. I believe that when a packet is sent from the client just as the function is timing out, GetLastError returns ERROR_IO_INCOMPLETE and pBytesRead is 0 as usual during a timeout, however the packet is dropped as calling WTSVirtualChannelRead again will read the next packet instead.
Using WTSVirtualChannelQuery to replace the calls to WTSVirtualChannelRead and WTSVirtualChannelWrite with ReadFile and WriteFile seems to fix the issue, but is a much more complicated process. Is there any way to get WTSVirtualChannelRead to work correctly instead?