wininet: Track child handles, free all child handles on WININET_FreeHandle as native.
This commit is contained in:
parent
eecc57f104
commit
728e5fa559
@ -39,8 +39,6 @@
|
|||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "internet.h"
|
#include "internet.h"
|
||||||
|
|
||||||
#include "wine/list.h"
|
|
||||||
|
|
||||||
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
|
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1128,6 +1128,7 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
|
|||||||
|
|
||||||
WININET_AddRef( &lpwfs->hdr );
|
WININET_AddRef( &lpwfs->hdr );
|
||||||
lpwh->lpFtpSession = lpwfs;
|
lpwh->lpFtpSession = lpwfs;
|
||||||
|
list_add_head( &lpwfs->hdr.children, &lpwh->hdr.entry );
|
||||||
|
|
||||||
handle = WININET_AllocHandle( &lpwh->hdr );
|
handle = WININET_AllocHandle( &lpwh->hdr );
|
||||||
if( !handle )
|
if( !handle )
|
||||||
@ -1904,6 +1905,7 @@ HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
|
|||||||
|
|
||||||
WININET_AddRef( &hIC->hdr );
|
WININET_AddRef( &hIC->hdr );
|
||||||
lpwfs->lpAppInfo = hIC;
|
lpwfs->lpAppInfo = hIC;
|
||||||
|
list_add_head( &hIC->hdr.children, &lpwfs->hdr.entry );
|
||||||
|
|
||||||
handle = WININET_AllocHandle( &lpwfs->hdr );
|
handle = WININET_AllocHandle( &lpwfs->hdr );
|
||||||
if( !handle )
|
if( !handle )
|
||||||
@ -3012,6 +3014,7 @@ static HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONW lpwfs, INT nSocket, LP
|
|||||||
|
|
||||||
WININET_AddRef( &lpwfs->hdr );
|
WININET_AddRef( &lpwfs->hdr );
|
||||||
lpwfn->lpFtpSession = lpwfs;
|
lpwfn->lpFtpSession = lpwfs;
|
||||||
|
list_add_head( &lpwfs->hdr.children, &lpwfn->hdr.entry );
|
||||||
|
|
||||||
handle = WININET_AllocHandle( &lpwfn->hdr );
|
handle = WININET_AllocHandle( &lpwfn->hdr );
|
||||||
}
|
}
|
||||||
|
@ -1371,6 +1371,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
|
|||||||
|
|
||||||
WININET_AddRef( &lpwhs->hdr );
|
WININET_AddRef( &lpwhs->hdr );
|
||||||
lpwhr->lpHttpSession = lpwhs;
|
lpwhr->lpHttpSession = lpwhs;
|
||||||
|
list_add_head( &lpwhs->hdr.children, &lpwhr->hdr.entry );
|
||||||
|
|
||||||
handle = WININET_AllocHandle( &lpwhr->hdr );
|
handle = WININET_AllocHandle( &lpwhr->hdr );
|
||||||
if (NULL == handle)
|
if (NULL == handle)
|
||||||
@ -2824,6 +2825,7 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
|
|||||||
|
|
||||||
WININET_AddRef( &hIC->hdr );
|
WININET_AddRef( &hIC->hdr );
|
||||||
lpwhs->lpAppInfo = hIC;
|
lpwhs->lpAppInfo = hIC;
|
||||||
|
list_add_head( &hIC->hdr.children, &lpwhs->hdr.entry );
|
||||||
|
|
||||||
handle = WININET_AllocHandle( &lpwhs->hdr );
|
handle = WININET_AllocHandle( &lpwhs->hdr );
|
||||||
if (NULL == handle)
|
if (NULL == handle)
|
||||||
|
@ -105,6 +105,8 @@ HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info )
|
|||||||
LPWININETHANDLEHEADER *p;
|
LPWININETHANDLEHEADER *p;
|
||||||
UINT handle = 0, num;
|
UINT handle = 0, num;
|
||||||
|
|
||||||
|
list_init( &info->children );
|
||||||
|
|
||||||
EnterCriticalSection( &WININET_cs );
|
EnterCriticalSection( &WININET_cs );
|
||||||
if( !WININET_dwMaxHandles )
|
if( !WININET_dwMaxHandles )
|
||||||
{
|
{
|
||||||
@ -182,6 +184,8 @@ BOOL WININET_Release( LPWININETHANDLEHEADER info )
|
|||||||
INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
|
INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
|
||||||
sizeof(HINTERNET));
|
sizeof(HINTERNET));
|
||||||
TRACE( "destroying object %p\n", info);
|
TRACE( "destroying object %p\n", info);
|
||||||
|
if ( info->htype != WH_HINIT )
|
||||||
|
list_remove( &info->entry );
|
||||||
info->destroy( info );
|
info->destroy( info );
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -191,7 +195,7 @@ BOOL WININET_FreeHandle( HINTERNET hinternet )
|
|||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
UINT handle = (UINT) hinternet;
|
UINT handle = (UINT) hinternet;
|
||||||
LPWININETHANDLEHEADER info = NULL;
|
LPWININETHANDLEHEADER info = NULL, child, next;
|
||||||
|
|
||||||
EnterCriticalSection( &WININET_cs );
|
EnterCriticalSection( &WININET_cs );
|
||||||
|
|
||||||
@ -212,7 +216,16 @@ BOOL WININET_FreeHandle( HINTERNET hinternet )
|
|||||||
LeaveCriticalSection( &WININET_cs );
|
LeaveCriticalSection( &WININET_cs );
|
||||||
|
|
||||||
if( info )
|
if( info )
|
||||||
|
{
|
||||||
|
/* Free all children as native does */
|
||||||
|
LIST_FOR_EACH_ENTRY_SAFE( child, next, &info->children, WININETHANDLEHEADER, entry )
|
||||||
|
{
|
||||||
|
TRACE( "freeing child handle %d for parent handle %d\n",
|
||||||
|
(UINT)child->hInternet, handle+1);
|
||||||
|
WININET_FreeHandle( child->hInternet );
|
||||||
|
}
|
||||||
WININET_Release( info );
|
WININET_Release( info );
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
|
#include "wine/list.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef HAVE_NETDB_H
|
#ifdef HAVE_NETDB_H
|
||||||
@ -149,6 +150,8 @@ struct _WININETHANDLEHEADER
|
|||||||
WININET_object_function close_connection;
|
WININET_object_function close_connection;
|
||||||
WININET_object_function destroy;
|
WININET_object_function destroy;
|
||||||
INTERNET_STATUS_CALLBACK lpfnStatusCB;
|
INTERNET_STATUS_CALLBACK lpfnStatusCB;
|
||||||
|
struct list entry;
|
||||||
|
struct list children;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
#include "shlobj.h"
|
#include "shlobj.h"
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "wine/list.h"
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user