Commit c16bb071 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

wininet: Send the correct callbacks during InternetReadFileExA calls.

parent 78577127
...@@ -1855,6 +1855,9 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu ...@@ -1855,6 +1855,9 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
return FALSE; return FALSE;
} }
INTERNET_SendCallback(lpwh, lpwh->dwContext,
INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
/* FIXME: IRF_ASYNC may not be the right thing to test here; /* FIXME: IRF_ASYNC may not be the right thing to test here;
* hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC is probably better */ * hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC is probably better */
if (dwFlags & IRF_ASYNC) if (dwFlags & IRF_ASYNC)
...@@ -1887,6 +1890,14 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu ...@@ -1887,6 +1890,14 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
lpBuffersOut->dwBufferLength, &lpBuffersOut->dwBufferLength, lpBuffersOut->dwBufferLength, &lpBuffersOut->dwBufferLength,
!(dwFlags & IRF_NO_WAIT), FALSE); !(dwFlags & IRF_NO_WAIT), FALSE);
if (retval)
{
DWORD dwBytesReceived = lpBuffersOut->dwBufferLength;
INTERNET_SendCallback(lpwh, lpwh->dwContext,
INTERNET_STATUS_RESPONSE_RECEIVED, &dwBytesReceived,
sizeof(dwBytesReceived));
}
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);
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#define TEST_URL "http://www.winehq.org/site/about" #define TEST_URL "http://www.winehq.org/site/about"
static HANDLE hCompleteEvent; static HANDLE hCompleteEvent;
static BOOL bResponseReceived;
static BOOL bReceivingResponse;
static INTERNET_STATUS_CALLBACK (WINAPI *pInternetSetStatusCallbackA)(HINTERNET ,INTERNET_STATUS_CALLBACK); static INTERNET_STATUS_CALLBACK (WINAPI *pInternetSetStatusCallbackA)(HINTERNET ,INTERNET_STATUS_CALLBACK);
static BOOL (WINAPI *pInternetTimeFromSystemTimeA)(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD); static BOOL (WINAPI *pInternetTimeFromSystemTimeA)(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD);
...@@ -93,6 +95,7 @@ static VOID WINAPI callback( ...@@ -93,6 +95,7 @@ static VOID WINAPI callback(
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RECEIVING_RESPONSE %p %d\n", trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RECEIVING_RESPONSE %p %d\n",
GetCurrentThreadId(), hInternet, dwContext, GetCurrentThreadId(), hInternet, dwContext,
lpvStatusInformation,dwStatusInformationLength); lpvStatusInformation,dwStatusInformationLength);
bReceivingResponse = TRUE;
break; break;
case INTERNET_STATUS_RESPONSE_RECEIVED: case INTERNET_STATUS_RESPONSE_RECEIVED:
ok(dwStatusInformationLength == sizeof(DWORD), ok(dwStatusInformationLength == sizeof(DWORD),
...@@ -101,6 +104,7 @@ static VOID WINAPI callback( ...@@ -101,6 +104,7 @@ static VOID WINAPI callback(
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESPONSE_RECEIVED 0x%x %d\n", trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESPONSE_RECEIVED 0x%x %d\n",
GetCurrentThreadId(), hInternet, dwContext, GetCurrentThreadId(), hInternet, dwContext,
*(DWORD *)lpvStatusInformation,dwStatusInformationLength); *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
bResponseReceived = TRUE;
break; break;
case INTERNET_STATUS_CTL_RESPONSE_RECEIVED: case INTERNET_STATUS_CTL_RESPONSE_RECEIVED:
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %d\n", trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %d\n",
...@@ -413,13 +417,17 @@ static void InternetReadFileExA_test(int flags) ...@@ -413,13 +417,17 @@ static void InternetReadFileExA_test(int flags)
inetbuffers.dwOffsetHigh = 1234; inetbuffers.dwOffsetHigh = 1234;
inetbuffers.dwOffsetLow = 5678; inetbuffers.dwOffsetLow = 5678;
bReceivingResponse = FALSE;
bResponseReceived = FALSE;
rc = InternetReadFileExA(hor, &inetbuffers, IRF_ASYNC | IRF_USE_CONTEXT, 0xcafebabe); rc = InternetReadFileExA(hor, &inetbuffers, IRF_ASYNC | IRF_USE_CONTEXT, 0xcafebabe);
if (!rc) if (!rc)
{ {
if (GetLastError() == ERROR_IO_PENDING) if (GetLastError() == ERROR_IO_PENDING)
{ {
trace("InternetReadFileEx -> PENDING\n"); trace("InternetReadFileEx -> PENDING\n");
ok(bReceivingResponse, "INTERNET_STATUS_RECEIVING_RESPONSE should have been sent to callback function\n");
WaitForSingleObject(hCompleteEvent, INFINITE); WaitForSingleObject(hCompleteEvent, INFINITE);
ok(!bResponseReceived, "INTERNET_STATUS_RESPONSE_RECEIVED should not have been sent to callback function\n");
} }
else else
{ {
...@@ -428,7 +436,11 @@ static void InternetReadFileExA_test(int flags) ...@@ -428,7 +436,11 @@ static void InternetReadFileExA_test(int flags)
} }
} }
else else
{
trace("InternetReadFileEx -> SUCCEEDED\n"); trace("InternetReadFileEx -> SUCCEEDED\n");
ok(bReceivingResponse, "INTERNET_STATUS_RECEIVING_RESPONSE should have been sent to callback function\n");
ok(bResponseReceived, "INTERNET_STATUS_RESPONSE_RECEIVED should have been sent to callback function\n");
}
trace("read %i bytes\n", inetbuffers.dwBufferLength); trace("read %i bytes\n", inetbuffers.dwBufferLength);
((char *)inetbuffers.lpvBuffer)[inetbuffers.dwBufferLength] = '\0'; ((char *)inetbuffers.lpvBuffer)[inetbuffers.dwBufferLength] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment