wininet: Store WININETFTPSESSIONW pointer in WININETFTPFILEW.

This commit is contained in:
Jacek Caban 2006-10-29 18:55:15 +01:00 committed by Alexandre Julliard
parent 51ba292716
commit 550ffef212
3 changed files with 17 additions and 9 deletions

View File

@ -1008,7 +1008,7 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
{
INT nDataSocket;
BOOL bSuccess = FALSE;
LPWININETFILE lpwh = NULL;
LPWININETFTPFILE lpwh = NULL;
LPWININETAPPINFOW hIC = NULL;
HINTERNET handle = NULL;
@ -1033,7 +1033,7 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
/* Get data socket to server */
if (bSuccess && FTP_GetDataSocket(lpwfs, &nDataSocket))
{
lpwh = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETFILE));
lpwh = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETFTPFILE));
lpwh->hdr.htype = WH_HFILE;
lpwh->hdr.dwFlags = dwFlags;
lpwh->hdr.dwContext = dwContext;
@ -1044,6 +1044,9 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
lpwh->nDataSocket = nDataSocket;
lpwh->session_deleted = FALSE;
WININET_AddRef( &lpwfs->hdr );
lpwh->lpFtpSession = lpwfs;
handle = WININET_AllocHandle( &lpwh->hdr );
if( !handle )
goto lend;
@ -2800,12 +2803,14 @@ static void FTP_CloseFindNextHandle(LPWININETHANDLEHEADER hdr)
*/
static void FTP_CloseFileTransferHandle(LPWININETHANDLEHEADER hdr)
{
LPWININETFILE lpwh = (LPWININETFILE) hdr;
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) lpwh->hdr.lpwhparent;
LPWININETFTPFILE lpwh = (LPWININETFTPFILE) hdr;
LPWININETFTPSESSIONW lpwfs = lpwh->lpFtpSession;
INT nResCode;
TRACE("\n");
WININET_Release(&lpwh->lpFtpSession->hdr);
if (!lpwh->session_deleted)
lpwfs->download_in_progress = NULL;

View File

@ -1703,7 +1703,7 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
break;
case WH_HFILE:
nSocket = ((LPWININETFILE)lpwh)->nDataSocket;
nSocket = ((LPWININETFTPFILE)lpwh)->nDataSocket;
break;
default:
@ -1745,7 +1745,7 @@ static BOOL INTERNET_ReadFile(LPWININETHANDLEHEADER lpwh, LPVOID lpBuffer,
case WH_HFILE:
/* FIXME: FTP should use NETCON_ stuff */
nSocket = ((LPWININETFILE)lpwh)->nDataSocket;
nSocket = ((LPWININETFTPFILE)lpwh)->nDataSocket;
if (nSocket != -1)
{
int res = recv(nSocket, lpBuffer, dwNumOfBytesToRead, bWait ? MSG_WAITALL : 0);

View File

@ -202,22 +202,25 @@ typedef struct
} WININETHTTPREQW, *LPWININETHTTPREQW;
struct _WININETFTPSESSIONW;
typedef struct
{
WININETHANDLEHEADER hdr;
struct _WININETFTPSESSIONW *lpFtpSession;
BOOL session_deleted;
int nDataSocket;
} WININETFILE, *LPWININETFILE;
} WININETFTPFILE, *LPWININETFTPFILE;
typedef struct
typedef struct _WININETFTPSESSIONW
{
WININETHANDLEHEADER hdr;
WININETAPPINFOW *lpAppInfo;
int sndSocket;
int lstnSocket;
int pasvSocket; /* data socket connected by us in case of passive FTP */
LPWININETFILE download_in_progress;
LPWININETFTPFILE download_in_progress;
struct sockaddr_in socketAddress;
struct sockaddr_in lstnSocketAddress;
LPWSTR lpszPassword;