wininet: Fix reference count on internet handle for asynchronous InternetReadFileEx call.

This commit is contained in:
Misha Koshelev 2007-08-22 00:12:52 -05:00 committed by Alexandre Julliard
parent 5320d3e3ea
commit 1ee9ea91a5
2 changed files with 18 additions and 5 deletions

View File

@ -1883,11 +1883,11 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
req = &workRequest.u.InternetReadFileExA; req = &workRequest.u.InternetReadFileExA;
req->lpBuffersOut = lpBuffersOut; req->lpBuffersOut = lpBuffersOut;
retval = INTERNET_AsyncCall(&workRequest); if (!INTERNET_AsyncCall(&workRequest))
if (!retval) return FALSE; WININET_Release( lpwh );
else
INTERNET_SetLastError(ERROR_IO_PENDING); INTERNET_SetLastError(ERROR_IO_PENDING);
return FALSE; goto end;
} }
} }
@ -1903,6 +1903,7 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
sizeof(dwBytesReceived)); sizeof(dwBytesReceived));
} }
end:
WININET_Release( lpwh ); WININET_Release( lpwh );
TRACE("-- %s (bytes read: %d)\n", retval ? "TRUE": "FALSE", lpBuffersOut->dwBufferLength); TRACE("-- %s (bytes read: %d)\n", retval ? "TRUE": "FALSE", lpBuffersOut->dwBufferLength);

View File

@ -704,6 +704,8 @@ static void InternetReadFileExA_test(int flags)
abort: abort:
SET_EXPECT2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0)); SET_EXPECT2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0));
if (hor) { if (hor) {
SET_WINE_ALLOW(INTERNET_STATUS_CLOSING_CONNECTION);
SET_WINE_ALLOW(INTERNET_STATUS_CONNECTION_CLOSED);
rc = InternetCloseHandle(hor); rc = InternetCloseHandle(hor);
ok ((rc != 0), "InternetCloseHandle of handle opened by HttpOpenRequestA failed\n"); ok ((rc != 0), "InternetCloseHandle of handle opened by HttpOpenRequestA failed\n");
rc = InternetCloseHandle(hor); rc = InternetCloseHandle(hor);
@ -721,6 +723,16 @@ abort:
Sleep(100); Sleep(100);
CHECK_NOTIFIED2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0)); CHECK_NOTIFIED2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0));
} }
if (hor != 0x0) todo_wine
{
CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
}
else
{
CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
}
CloseHandle(hCompleteEvent); CloseHandle(hCompleteEvent);
first_connection_to_test_url = FALSE; first_connection_to_test_url = FALSE;
} }