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