Commit ed517f3a authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

InternetSetStatusCallback can be used on any handle and callbacks are

inherited by derived handles.
parent 56b9d3c7
...@@ -670,6 +670,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs, ...@@ -670,6 +670,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
HINTERNET handle = NULL; HINTERNET handle = NULL;
static const WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s',0}; static const WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s',0};
DWORD len; DWORD len;
INTERNET_ASYNC_RESULT iar;
TRACE("--> \n"); TRACE("--> \n");
...@@ -688,6 +689,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs, ...@@ -688,6 +689,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
lpwhr->hdr.dwContext = dwContext; lpwhr->hdr.dwContext = dwContext;
lpwhr->hdr.dwRefCount = 1; lpwhr->hdr.dwRefCount = 1;
lpwhr->hdr.destroy = HTTP_CloseHTTPRequestHandle; lpwhr->hdr.destroy = HTTP_CloseHTTPRequestHandle;
lpwhr->hdr.lpfnStatusCB = lpwhs->hdr.lpfnStatusCB;
handle = WININET_AllocHandle( &lpwhr->hdr ); handle = WININET_AllocHandle( &lpwhr->hdr );
if (NULL == handle) if (NULL == handle)
...@@ -791,18 +793,12 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs, ...@@ -791,18 +793,12 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
HeapFree(GetProcessHeap(), 0, lpszUrl); HeapFree(GetProcessHeap(), 0, lpszUrl);
iar.dwResult = (DWORD_PTR)handle;
iar.dwError = ERROR_SUCCESS;
if (hIC->lpfnStatusCB) SendAsyncCallback(&lpwhs->hdr, dwContext,
{ INTERNET_STATUS_HANDLE_CREATED, &iar,
INTERNET_ASYNC_RESULT iar; sizeof(INTERNET_ASYNC_RESULT));
iar.dwResult = (DWORD)handle;
iar.dwError = ERROR_SUCCESS;
SendAsyncCallback(hIC, &lpwhs->hdr, dwContext,
INTERNET_STATUS_HANDLE_CREATED, &iar,
sizeof(INTERNET_ASYNC_RESULT));
}
/* /*
* A STATUS_REQUEST_COMPLETE is NOT sent here as per my tests on windows * A STATUS_REQUEST_COMPLETE is NOT sent here as per my tests on windows
...@@ -811,7 +807,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs, ...@@ -811,7 +807,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
/* /*
* According to my tests. The name is not resolved until a request is Opened * According to my tests. The name is not resolved until a request is Opened
*/ */
SendAsyncCallback(hIC, &lpwhs->hdr, dwContext, SendAsyncCallback(&lpwhr->hdr, dwContext,
INTERNET_STATUS_RESOLVING_NAME, INTERNET_STATUS_RESOLVING_NAME,
lpwhs->lpszServerName, lpwhs->lpszServerName,
strlenW(lpwhs->lpszServerName)+1); strlenW(lpwhs->lpszServerName)+1);
...@@ -824,7 +820,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs, ...@@ -824,7 +820,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
goto lend; goto lend;
} }
SendAsyncCallback(hIC, &lpwhs->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_NAME_RESOLVED, INTERNET_STATUS_NAME_RESOLVED,
&(lpwhs->socketAddress), &(lpwhs->socketAddress),
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
...@@ -1381,7 +1377,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST ...@@ -1381,7 +1377,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
HTTP_ProcessHeader(lpwhr, g_szHost, hostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); HTTP_ProcessHeader(lpwhr, g_szHost, hostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ);
SendAsyncCallback(hIC, &lpwhs->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_RESOLVING_NAME, INTERNET_STATUS_RESOLVING_NAME,
lpwhs->lpszServerName, lpwhs->lpszServerName,
strlenW(lpwhs->lpszServerName)+1); strlenW(lpwhs->lpszServerName)+1);
...@@ -1393,7 +1389,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST ...@@ -1393,7 +1389,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
return FALSE; return FALSE;
} }
SendAsyncCallback(hIC, &lpwhs->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_NAME_RESOLVED, INTERNET_STATUS_NAME_RESOLVED,
&(lpwhs->socketAddress), &(lpwhs->socketAddress),
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
...@@ -1469,6 +1465,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, ...@@ -1469,6 +1465,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
LPWININETAPPINFOW hIC = NULL; LPWININETAPPINFOW hIC = NULL;
BOOL loop_next = FALSE; BOOL loop_next = FALSE;
int CustHeaderIndex; int CustHeaderIndex;
INTERNET_ASYNC_RESULT iar;
TRACE("--> %p\n", lpwhr); TRACE("--> %p\n", lpwhr);
...@@ -1636,17 +1633,17 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, ...@@ -1636,17 +1633,17 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
ascii_req[len] = 0; ascii_req[len] = 0;
TRACE("full request -> %s\n", ascii_req ); TRACE("full request -> %s\n", ascii_req );
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_SENDING_REQUEST, NULL, 0); INTERNET_STATUS_SENDING_REQUEST, NULL, 0);
NETCON_send(&lpwhr->netConnection, ascii_req, len, 0, &cnt); NETCON_send(&lpwhr->netConnection, ascii_req, len, 0, &cnt);
HeapFree( GetProcessHeap(), 0, ascii_req ); HeapFree( GetProcessHeap(), 0, ascii_req );
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_REQUEST_SENT, INTERNET_STATUS_REQUEST_SENT,
&len,sizeof(DWORD)); &len,sizeof(DWORD));
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0); INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
if (cnt < 0) if (cnt < 0)
...@@ -1656,7 +1653,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, ...@@ -1656,7 +1653,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
if (responseLen) if (responseLen)
bSuccess = TRUE; bSuccess = TRUE;
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_RESPONSE_RECEIVED, &responseLen, INTERNET_STATUS_RESPONSE_RECEIVED, &responseLen,
sizeof(DWORD)); sizeof(DWORD));
...@@ -1757,7 +1754,7 @@ lend: ...@@ -1757,7 +1754,7 @@ lend:
dwIndex=0; dwIndex=0;
if(HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,&dwIndex)) if(HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,&dwIndex))
{ {
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_REDIRECT, szNewLocation, INTERNET_STATUS_REDIRECT, szNewLocation,
dwBufferSize); dwBufferSize);
return HTTP_HandleRedirect(lpwhr, szNewLocation, lpszHeaders, return HTTP_HandleRedirect(lpwhr, szNewLocation, lpszHeaders,
...@@ -1766,17 +1763,13 @@ lend: ...@@ -1766,17 +1763,13 @@ lend:
} }
} }
if (hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess; iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError(); iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_REQUEST_COMPLETE, &iar, INTERNET_STATUS_REQUEST_COMPLETE, &iar,
sizeof(INTERNET_ASYNC_RESULT)); sizeof(INTERNET_ASYNC_RESULT));
}
TRACE("<--\n"); TRACE("<--\n");
return bSuccess; return bSuccess;
...@@ -1829,6 +1822,7 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName, ...@@ -1829,6 +1822,7 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
lpwhs->hdr.dwInternalFlags = dwInternalFlags; lpwhs->hdr.dwInternalFlags = dwInternalFlags;
lpwhs->hdr.dwRefCount = 1; lpwhs->hdr.dwRefCount = 1;
lpwhs->hdr.destroy = HTTP_CloseHTTPSessionHandle; lpwhs->hdr.destroy = HTTP_CloseHTTPSessionHandle;
lpwhs->hdr.lpfnStatusCB = hIC->hdr.lpfnStatusCB;
handle = WININET_AllocHandle( &lpwhs->hdr ); handle = WININET_AllocHandle( &lpwhs->hdr );
if (NULL == handle) if (NULL == handle)
...@@ -1851,14 +1845,14 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName, ...@@ -1851,14 +1845,14 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
lpwhs->nServerPort = nServerPort; lpwhs->nServerPort = nServerPort;
/* Don't send a handle created callback if this handle was created with InternetOpenUrl */ /* Don't send a handle created callback if this handle was created with InternetOpenUrl */
if (hIC->lpfnStatusCB && !(lpwhs->hdr.dwInternalFlags & INET_OPENURL)) if (!(lpwhs->hdr.dwInternalFlags & INET_OPENURL))
{ {
INTERNET_ASYNC_RESULT iar; INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)handle; iar.dwResult = (DWORD_PTR)handle;
iar.dwError = ERROR_SUCCESS; iar.dwError = ERROR_SUCCESS;
SendAsyncCallback(hIC, &hIC->hdr, dwContext, SendAsyncCallback(&lpwhs->hdr, dwContext,
INTERNET_STATUS_HANDLE_CREATED, &iar, INTERNET_STATUS_HANDLE_CREATED, &iar,
sizeof(INTERNET_ASYNC_RESULT)); sizeof(INTERNET_ASYNC_RESULT));
} }
...@@ -1907,7 +1901,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr) ...@@ -1907,7 +1901,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
lpwhs = (LPWININETHTTPSESSIONW)lpwhr->hdr.lpwhparent; lpwhs = (LPWININETHTTPSESSIONW)lpwhr->hdr.lpwhparent;
hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent; hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CONNECTING_TO_SERVER, INTERNET_STATUS_CONNECTING_TO_SERVER,
&(lpwhs->socketAddress), &(lpwhs->socketAddress),
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
...@@ -1926,7 +1920,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr) ...@@ -1926,7 +1920,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
goto lend; goto lend;
} }
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CONNECTED_TO_SERVER, INTERNET_STATUS_CONNECTED_TO_SERVER,
&(lpwhs->socketAddress), &(lpwhs->socketAddress),
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
...@@ -2437,7 +2431,7 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQW lpwhr) ...@@ -2437,7 +2431,7 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQW lpwhr)
lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent; lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent; hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CLOSING_CONNECTION, 0, 0); INTERNET_STATUS_CLOSING_CONNECTION, 0, 0);
if (NETCON_connected(&lpwhr->netConnection)) if (NETCON_connected(&lpwhr->netConnection))
...@@ -2445,7 +2439,7 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQW lpwhr) ...@@ -2445,7 +2439,7 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQW lpwhr)
NETCON_close(&lpwhr->netConnection); NETCON_close(&lpwhr->netConnection);
} }
SendAsyncCallback(hIC, &lpwhr->hdr, lpwhr->hdr.dwContext, SendAsyncCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); INTERNET_STATUS_CONNECTION_CLOSED, 0, 0);
} }
......
...@@ -856,7 +856,6 @@ lend: ...@@ -856,7 +856,6 @@ lend:
BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData) BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData)
{ {
BOOL bSuccess = TRUE; BOOL bSuccess = TRUE;
LPWININETAPPINFOW hIC = NULL;
LPWIN32_FIND_DATAW lpFindFileData; LPWIN32_FIND_DATAW lpFindFileData;
TRACE("\n"); TRACE("\n");
...@@ -892,8 +891,7 @@ BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData) ...@@ -892,8 +891,7 @@ BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData)
lend: lend:
hIC = GET_HWININET_FROM_LPWININETFINDNEXT(lpwh); if (lpwh->hdr.dwFlags & INTERNET_FLAG_ASYNC && lpwh->hdr.lpfnStatusCB)
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{ {
INTERNET_ASYNC_RESULT iar; INTERNET_ASYNC_RESULT iar;
...@@ -901,7 +899,7 @@ lend: ...@@ -901,7 +899,7 @@ lend:
iar.dwError = iar.dwError = bSuccess ? ERROR_SUCCESS : iar.dwError = iar.dwError = bSuccess ? ERROR_SUCCESS :
INTERNET_GetLastError(); INTERNET_GetLastError();
SendAsyncCallback(hIC, &lpwh->hdr, lpwh->hdr.dwContext, SendAsyncCallback(&lpwh->hdr, lpwh->hdr.dwContext,
INTERNET_STATUS_REQUEST_COMPLETE, &iar, INTERNET_STATUS_REQUEST_COMPLETE, &iar,
sizeof(INTERNET_ASYNC_RESULT)); sizeof(INTERNET_ASYNC_RESULT));
} }
...@@ -956,8 +954,7 @@ static VOID INTERNET_CloseHandle(LPWININETHANDLEHEADER hdr) ...@@ -956,8 +954,7 @@ static VOID INTERNET_CloseHandle(LPWININETHANDLEHEADER hdr)
*/ */
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet) BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
{ {
LPWININETHANDLEHEADER lpwh, parent; LPWININETHANDLEHEADER lpwh;
LPWININETAPPINFOW hIC;
TRACE("%p\n",hInternet); TRACE("%p\n",hInternet);
...@@ -968,12 +965,7 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet) ...@@ -968,12 +965,7 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
return FALSE; return FALSE;
} }
parent = lpwh; SendAsyncCallback(lpwh, lpwh->dwContext,
while( parent && (parent->htype != WH_HINIT ) )
parent = parent->lpwhparent;
hIC = (LPWININETAPPINFOW) parent;
SendAsyncCallback(hIC, lpwh, lpwh->dwContext,
INTERNET_STATUS_HANDLE_CLOSING, hInternet, INTERNET_STATUS_HANDLE_CLOSING, hInternet,
sizeof(HINTERNET)); sizeof(HINTERNET));
...@@ -1489,22 +1481,20 @@ BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, ...@@ -1489,22 +1481,20 @@ BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer,
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA( INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB) HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
{ {
INTERNET_STATUS_CALLBACK retVal = INTERNET_INVALID_STATUS_CALLBACK; INTERNET_STATUS_CALLBACK retVal;
LPWININETAPPINFOW lpwai; LPWININETHANDLEHEADER lpwh;
TRACE("(%p, %p)\n", hInternet, lpfnIntCB); TRACE("0x%08lx\n", (ULONG)hInternet);
lpwai = (LPWININETAPPINFOW)WININET_GetObject(hInternet); lpwh = WININET_GetObject(hInternet);
if (!lpwai) if (!lpwh)
return retVal; return INTERNET_INVALID_STATUS_CALLBACK;
if (lpwai->hdr.htype == WH_HINIT) lpwh->dwInternalFlags &= ~INET_CALLBACKW;
{ retVal = lpwh->lpfnStatusCB;
lpwai->hdr.dwInternalFlags &= ~INET_CALLBACKW; lpwh->lpfnStatusCB = lpfnIntCB;
retVal = lpwai->lpfnStatusCB;
lpwai->lpfnStatusCB = lpfnIntCB; WININET_Release( lpwh );
}
WININET_Release( &lpwai->hdr );
return retVal; return retVal;
} }
...@@ -1523,23 +1513,20 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA( ...@@ -1523,23 +1513,20 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW( INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(
HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB) HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
{ {
INTERNET_STATUS_CALLBACK retVal = INTERNET_INVALID_STATUS_CALLBACK; INTERNET_STATUS_CALLBACK retVal;
LPWININETAPPINFOW lpwai; LPWININETHANDLEHEADER lpwh;
TRACE("(%p, %p)\n", hInternet, lpfnIntCB); TRACE("0x%08lx\n", (ULONG)hInternet);
lpwai = (LPWININETAPPINFOW)WININET_GetObject(hInternet); lpwh = WININET_GetObject(hInternet);
if (!lpwai) if (!lpwh)
return retVal; return INTERNET_INVALID_STATUS_CALLBACK;
if (lpwai->hdr.htype == WH_HINIT) lpwh->dwInternalFlags |= INET_CALLBACKW;
{ retVal = lpwh->lpfnStatusCB;
lpwai->hdr.dwInternalFlags |= INET_CALLBACKW; lpwh->lpfnStatusCB = lpfnIntCB;
retVal = lpwai->lpfnStatusCB;
lpwai->lpfnStatusCB = lpfnIntCB;
}
WININET_Release( &lpwai->hdr ); WININET_Release( lpwh );
return retVal; return retVal;
} }
...@@ -2714,11 +2701,10 @@ static VOID INTERNET_ExecuteWork() ...@@ -2714,11 +2701,10 @@ static VOID INTERNET_ExecuteWork()
case SENDCALLBACK: case SENDCALLBACK:
{ {
struct WORKREQ_SENDCALLBACK *req = &workRequest.u.SendCallback; struct WORKREQ_SENDCALLBACK *req = &workRequest.u.SendCallback;
LPWININETAPPINFOW hIC = (LPWININETAPPINFOW) workRequest.hdr;
TRACE("SENDCALLBACK %p\n", hIC); TRACE("SENDCALLBACK %p\n", workRequest.hdr);
SendAsyncCallbackInt(hIC, req->hdr, SendSyncCallback(workRequest.hdr,
req->dwContext, req->dwInternetStatus, req->lpvStatusInfo, req->dwContext, req->dwInternetStatus, req->lpvStatusInfo,
req->dwStatusInfoLength); req->dwStatusInfoLength);
} }
......
...@@ -140,6 +140,7 @@ struct _WININETHANDLEHEADER ...@@ -140,6 +140,7 @@ struct _WININETHANDLEHEADER
DWORD dwInternalFlags; DWORD dwInternalFlags;
DWORD dwRefCount; DWORD dwRefCount;
WININET_object_destructor destroy; WININET_object_destructor destroy;
INTERNET_STATUS_CALLBACK lpfnStatusCB;
struct _WININETHANDLEHEADER *lpwhparent; struct _WININETHANDLEHEADER *lpwhparent;
}; };
...@@ -153,7 +154,6 @@ typedef struct ...@@ -153,7 +154,6 @@ typedef struct
LPWSTR lpszProxyUsername; LPWSTR lpszProxyUsername;
LPWSTR lpszProxyPassword; LPWSTR lpszProxyPassword;
DWORD dwAccessType; DWORD dwAccessType;
INTERNET_STATUS_CALLBACK lpfnStatusCB;
} WININETAPPINFOW, *LPWININETAPPINFOW; } WININETAPPINFOW, *LPWININETAPPINFOW;
...@@ -345,7 +345,6 @@ struct WORKREQ_HTTPSENDREQUESTW ...@@ -345,7 +345,6 @@ struct WORKREQ_HTTPSENDREQUESTW
struct WORKREQ_SENDCALLBACK struct WORKREQ_SENDCALLBACK
{ {
WININETHANDLEHEADER *hdr;
DWORD dwContext; DWORD dwContext;
DWORD dwInternetStatus; DWORD dwInternetStatus;
LPVOID lpvStatusInfo; LPVOID lpvStatusInfo;
...@@ -443,13 +442,13 @@ INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs, ...@@ -443,13 +442,13 @@ INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes,
DWORD dwFlags, DWORD dwContext); DWORD dwFlags, DWORD dwContext);
VOID SendAsyncCallback(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
DWORD dwContext, DWORD dwInternetStatus, LPVOID DWORD dwInternetStatus, LPVOID lpvStatusInfo,
lpvStatusInfo , DWORD dwStatusInfoLength); DWORD dwStatusInfoLength);
VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, VOID SendSyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
DWORD dwContext, DWORD dwInternetStatus, LPVOID DWORD dwInternetStatus, LPVOID lpvStatusInfo,
lpvStatusInfo , DWORD dwStatusInfoLength); DWORD dwStatusInfoLength);
BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr, BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr,
LPCWSTR username, LPCWSTR password ); LPCWSTR username, LPCWSTR password );
......
...@@ -216,14 +216,14 @@ static const char *get_callback_name(DWORD dwInternetStatus) { ...@@ -216,14 +216,14 @@ static const char *get_callback_name(DWORD dwInternetStatus) {
return "Unknown"; return "Unknown";
} }
VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, VOID SendSyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
DWORD dwContext, DWORD dwInternetStatus, LPVOID DWORD dwInternetStatus, LPVOID lpvStatusInfo,
lpvStatusInfo, DWORD dwStatusInfoLength) DWORD dwStatusInfoLength)
{ {
HINTERNET hHttpSession; HINTERNET hHttpSession;
LPVOID lpvNewInfo = NULL; LPVOID lpvNewInfo = NULL;
if( !hIC->lpfnStatusCB ) if( !hdr->lpfnStatusCB )
return; return;
/* the IE5 version of wininet does not /* the IE5 version of wininet does not
...@@ -238,7 +238,7 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, ...@@ -238,7 +238,7 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr,
return; return;
lpvNewInfo = lpvStatusInfo; lpvNewInfo = lpvStatusInfo;
if(!(hIC->hdr.dwInternalFlags & INET_CALLBACKW)) { if(!(hdr->dwInternalFlags & INET_CALLBACKW)) {
switch(dwInternetStatus) switch(dwInternetStatus)
{ {
case INTERNET_STATUS_RESOLVING_NAME: case INTERNET_STATUS_RESOLVING_NAME:
...@@ -246,7 +246,7 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, ...@@ -246,7 +246,7 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr,
lpvNewInfo = WININET_strdup_WtoA(lpvStatusInfo); lpvNewInfo = WININET_strdup_WtoA(lpvStatusInfo);
} }
} }
hIC->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus, hdr->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus,
lpvNewInfo, dwStatusInfoLength); lpvNewInfo, dwStatusInfoLength);
if(lpvNewInfo != lpvStatusInfo) if(lpvNewInfo != lpvStatusInfo)
HeapFree(GetProcessHeap(), 0, lpvNewInfo); HeapFree(GetProcessHeap(), 0, lpvNewInfo);
...@@ -258,23 +258,22 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, ...@@ -258,23 +258,22 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr,
VOID SendAsyncCallback(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
DWORD dwContext, DWORD dwInternetStatus, LPVOID DWORD dwInternetStatus, LPVOID lpvStatusInfo,
lpvStatusInfo, DWORD dwStatusInfoLength) DWORD dwStatusInfoLength)
{ {
TRACE("Send Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus)); TRACE("Send Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
if (! (hIC->lpfnStatusCB)) if (!(hdr->lpfnStatusCB))
return; return;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hdr->dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_SENDCALLBACK *req; struct WORKREQ_SENDCALLBACK *req;
workRequest.asyncall = SENDCALLBACK; workRequest.asyncall = SENDCALLBACK;
workRequest.hdr = WININET_AddRef( &hIC->hdr ); workRequest.hdr = WININET_AddRef( hdr );
req = &workRequest.u.SendCallback; req = &workRequest.u.SendCallback;
req->hdr = hdr;
req->dwContext = dwContext; req->dwContext = dwContext;
req->dwInternetStatus = dwInternetStatus; req->dwInternetStatus = dwInternetStatus;
req->lpvStatusInfo = lpvStatusInfo; req->lpvStatusInfo = lpvStatusInfo;
...@@ -283,6 +282,6 @@ VOID SendAsyncCallback(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr, ...@@ -283,6 +282,6 @@ VOID SendAsyncCallback(LPWININETAPPINFOW hIC, LPWININETHANDLEHEADER hdr,
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
} }
else else
SendAsyncCallbackInt(hIC, hdr, dwContext, dwInternetStatus, SendSyncCallback(hdr, dwContext, dwInternetStatus,
lpvStatusInfo, dwStatusInfoLength); lpvStatusInfo, dwStatusInfoLength);
} }
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