Hi Sebastian,
On 04/25/16 21:41, Sebastian Lackner wrote:
- memset( &ib, 0, sizeof(ib) );
- memset( buffer, 0, sizeof(buffer) );
- ib.dwStructSize = sizeof(ib);
- for (count = 0; count < sizeof(buffer); count += ib.dwBufferLength)
- {
ib.lpvBuffer = buffer + count;
ib.dwBufferLength = sizeof(buffer) - count;
SET_OPTIONAL( INTERNET_STATUS_RECEIVING_RESPONSE );
SET_OPTIONAL( INTERNET_STATUS_RESPONSE_RECEIVED );
ret = InternetReadFileExA( req, &ib, 0, 0xdeadbeef );
if (!ret)
{
ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
SetEvent( conn_wait_event );
WaitForSingleObject( hCompleteEvent, INFINITE );
ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE );
}
It's a nice way to force async read, but when you add tests with predictable reads it would be nice to take more advantage of that. What do you think about:
- call InternetReadFileEx and check that it's done sync - call InternetReadFileEx and check that it's done async - set conn_wait_event, wait completion and make sure we read all remaining data - call InternetReadFileEx and make sure it synchronously hits the end of data
Thanks, Jacek