wininet: Store handle in WININETHANDLEHEADER and use it in SendCallback.
This commit is contained in:
parent
957516f8e6
commit
ae430f9323
|
@ -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;
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue