Commit ae430f93 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Store handle in WININETHANDLEHEADER and use it in SendCallback.

parent 957516f8
......@@ -151,26 +151,13 @@ HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info )
end:
LeaveCriticalSection( &WININET_cs );
return (HINTERNET) (handle+1);
return info->hInternet = (HINTERNET) (handle+1);
}
HINTERNET WININET_FindHandle( LPWININETHANDLEHEADER info )
{
UINT i, handle = 0;
EnterCriticalSection( &WININET_cs );
for( i=0; i<WININET_dwMaxHandles; i++ )
{
if( info == WININET_Handles[i] )
{
WININET_AddRef( info );
handle = i+1;
break;
}
}
LeaveCriticalSection( &WININET_cs );
return (HINTERNET) handle;
WININET_AddRef(info);
return info->hInternet;
}
LPWININETHANDLEHEADER WININET_AddRef( LPWININETHANDLEHEADER info )
......
......@@ -139,6 +139,7 @@ typedef void (*WININET_object_destructor)( LPWININETHANDLEHEADER );
struct _WININETHANDLEHEADER
{
WH_TYPE htype;
HINTERNET hInternet;
DWORD dwFlags;
DWORD dwContext;
DWORD dwError;
......
......@@ -214,7 +214,6 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
DWORD dwInternetStatus, LPVOID lpvStatusInfo,
DWORD dwStatusInfoLength)
{
HINTERNET hHttpSession;
LPVOID lpvNewInfo = NULL;
if( !hdr->lpfnStatusCB )
......@@ -225,12 +224,6 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
if( !dwContext )
return;
hHttpSession = WININET_FindHandle( hdr );
if( !hHttpSession ) {
TRACE(" Could not convert header '%p' into a handle !\n", hdr);
return;
}
lpvNewInfo = lpvStatusInfo;
if(hdr->dwInternalFlags & INET_CALLBACKW) {
switch(dwInternetStatus) {
......@@ -249,18 +242,16 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
}
TRACE(" callback(%p) (%p (%p), %08x, %d (%s), %p, %d)\n",
hdr->lpfnStatusCB, hHttpSession, hdr, dwContext, dwInternetStatus, get_callback_name(dwInternetStatus),
hdr->lpfnStatusCB, hdr->hInternet, hdr, dwContext, dwInternetStatus, get_callback_name(dwInternetStatus),
lpvNewInfo, dwStatusInfoLength);
hdr->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus,
hdr->lpfnStatusCB(hdr->hInternet, dwContext, dwInternetStatus,
lpvNewInfo, dwStatusInfoLength);
TRACE(" end callback().\n");
if(lpvNewInfo != lpvStatusInfo)
HeapFree(GetProcessHeap(), 0, lpvNewInfo);
WININET_Release( hdr );
}
......
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