Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7cc70c0a
Commit
7cc70c0a
authored
Feb 07, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Feb 07, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement proper HINTERNET handles.
parent
39081ddc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
321 additions
and
105 deletions
+321
-105
ftp.c
dlls/wininet/ftp.c
+90
-46
http.c
dlls/wininet/http.c
+63
-29
internet.c
dlls/wininet/internet.c
+164
-30
internet.h
dlls/wininet/internet.h
+4
-0
No files found.
dlls/wininet/ftp.c
View file @
7cc70c0a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* WININET - Ftp implementation
* WININET - Ftp implementation
*
*
* Copyright 1999 Corel Corporation
* Copyright 1999 Corel Corporation
* Copyright 2004 Mike McCormack for Codeweavers
*
*
* Ulrich Czekalla
* Ulrich Czekalla
* Noureddine Jemmali
* Noureddine Jemmali
...
@@ -156,9 +157,10 @@ inline static LPSTR FTP_strdup( LPCSTR str )
...
@@ -156,9 +157,10 @@ inline static LPSTR FTP_strdup( LPCSTR str )
BOOL
WINAPI
FtpPutFileA
(
HINTERNET
hConnect
,
LPCSTR
lpszLocalFile
,
BOOL
WINAPI
FtpPutFileA
(
HINTERNET
hConnect
,
LPCSTR
lpszLocalFile
,
LPCSTR
lpszNewRemoteFile
,
DWORD
dwFlags
,
DWORD
dwContext
)
LPCSTR
lpszNewRemoteFile
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -203,10 +205,12 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
...
@@ -203,10 +205,12 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
HANDLE
hFile
=
NULL
;
HANDLE
hFile
=
NULL
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
INT
nResCode
;
INT
nResCode
;
TRACE
(
" lpszLocalFile(%s) lpszNewRemoteFile(%s)
\n
"
,
lpszLocalFile
,
lpszNewRemoteFile
);
TRACE
(
" lpszLocalFile(%s) lpszNewRemoteFile(%s)
\n
"
,
lpszLocalFile
,
lpszNewRemoteFile
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -282,9 +286,10 @@ lend:
...
@@ -282,9 +286,10 @@ lend:
*/
*/
BOOL
WINAPI
FtpSetCurrentDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
BOOL
WINAPI
FtpSetCurrentDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -354,12 +359,13 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
...
@@ -354,12 +359,13 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
BOOL
WINAPI
FTP_FtpSetCurrentDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
BOOL
WINAPI
FTP_FtpSetCurrentDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
{
{
INT
nResCode
;
INT
nResCode
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
DWORD
bSuccess
=
FALSE
;
DWORD
bSuccess
=
FALSE
;
TRACE
(
"lpszDirectory(%s)
\n
"
,
lpszDirectory
);
TRACE
(
"lpszDirectory(%s)
\n
"
,
lpszDirectory
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -411,9 +417,10 @@ lend:
...
@@ -411,9 +417,10 @@ lend:
*/
*/
BOOL
WINAPI
FtpCreateDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
BOOL
WINAPI
FtpCreateDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -483,9 +490,11 @@ BOOL WINAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
...
@@ -483,9 +490,11 @@ BOOL WINAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
INT
nResCode
;
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -537,9 +546,10 @@ lend:
...
@@ -537,9 +546,10 @@ lend:
HINTERNET
WINAPI
FtpFindFirstFileA
(
HINTERNET
hConnect
,
HINTERNET
WINAPI
FtpFindFirstFileA
(
HINTERNET
hConnect
,
LPCSTR
lpszSearchFile
,
LPWIN32_FIND_DATAA
lpFindFileData
,
DWORD
dwFlags
,
DWORD
dwContext
)
LPCSTR
lpszSearchFile
,
LPWIN32_FIND_DATAA
lpFindFileData
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -604,11 +614,12 @@ HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
...
@@ -604,11 +614,12 @@ HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
{
{
INT
nResCode
;
INT
nResCode
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETFINDNEXTA
hFindNext
=
NULL
;
HINTERNET
hFindNext
=
NULL
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -679,7 +690,7 @@ lend:
...
@@ -679,7 +690,7 @@ lend:
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
}
}
return
(
HINTERNET
)
hFindNext
;
return
hFindNext
;
}
}
...
@@ -696,11 +707,12 @@ lend:
...
@@ -696,11 +707,12 @@ lend:
BOOL
WINAPI
FtpGetCurrentDirectoryA
(
HINTERNET
hFtpSession
,
LPSTR
lpszCurrentDirectory
,
BOOL
WINAPI
FtpGetCurrentDirectoryA
(
HINTERNET
hFtpSession
,
LPSTR
lpszCurrentDirectory
,
LPDWORD
lpdwCurrentDirectory
)
LPDWORD
lpdwCurrentDirectory
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
TRACE
(
"len(%ld)
\n
"
,
*
lpdwCurrentDirectory
);
TRACE
(
"len(%ld)
\n
"
,
*
lpdwCurrentDirectory
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -761,12 +773,13 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrent
...
@@ -761,12 +773,13 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrent
LPDWORD
lpdwCurrentDirectory
)
LPDWORD
lpdwCurrentDirectory
)
{
{
INT
nResCode
;
INT
nResCode
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
DWORD
bSuccess
=
FALSE
;
DWORD
bSuccess
=
FALSE
;
TRACE
(
"len(%ld)
\n
"
,
*
lpdwCurrentDirectory
);
TRACE
(
"len(%ld)
\n
"
,
*
lpdwCurrentDirectory
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -841,9 +854,10 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
...
@@ -841,9 +854,10 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
LPCSTR
lpszFileName
,
DWORD
fdwAccess
,
DWORD
dwFlags
,
LPCSTR
lpszFileName
,
DWORD
fdwAccess
,
DWORD
dwFlags
,
DWORD
dwContext
)
DWORD
dwContext
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -914,12 +928,14 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
...
@@ -914,12 +928,14 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
{
{
INT
nDataSocket
;
INT
nDataSocket
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETFILE
hFile
=
NULL
;
LPWININETFILE
lpwh
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
HINTERNET
handle
=
NULL
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -943,16 +959,17 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
...
@@ -943,16 +959,17 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
/* Get data socket to server */
/* Get data socket to server */
if
(
bSuccess
&&
FTP_GetDataSocket
(
lpwfs
,
&
nDataSocket
))
if
(
bSuccess
&&
FTP_GetDataSocket
(
lpwfs
,
&
nDataSocket
))
{
{
hFile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WININETFILE
));
lpwh
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WININETFILE
));
hFile
->
hdr
.
htype
=
WH_HFILE
;
handle
=
WININET_AllocHandle
(
&
lpwh
->
hdr
);
hFile
->
hdr
.
dwFlags
=
dwFlags
;
lpwh
->
hdr
.
htype
=
WH_HFILE
;
hFile
->
hdr
.
dwContext
=
dwContext
;
lpwh
->
hdr
.
dwFlags
=
dwFlags
;
hFile
->
hdr
.
lpwhparent
=
hFtpSession
;
lpwh
->
hdr
.
dwContext
=
dwContext
;
hFile
->
nDataSocket
=
nDataSocket
;
lpwh
->
hdr
.
lpwhparent
=
&
lpwfs
->
hdr
;
hFile
->
session_deleted
=
FALSE
;
lpwh
->
nDataSocket
=
nDataSocket
;
lpwh
->
session_deleted
=
FALSE
;
/* Indicate that a download is currently in progress */
/* Indicate that a download is currently in progress */
lpwfs
->
download_in_progress
=
hFile
;
lpwfs
->
download_in_progress
=
lpwh
;
}
}
if
(
lpwfs
->
lstnSocket
!=
-
1
)
if
(
lpwfs
->
lstnSocket
!=
-
1
)
...
@@ -963,9 +980,9 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
...
@@ -963,9 +980,9 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
{
{
INTERNET_ASYNC_RESULT
iar
;
INTERNET_ASYNC_RESULT
iar
;
if
(
hFile
)
if
(
lpwh
)
{
{
iar
.
dwResult
=
(
DWORD
)
hFile
;
iar
.
dwResult
=
(
DWORD
)
lpwh
;
iar
.
dwError
=
ERROR_SUCCESS
;
iar
.
dwError
=
ERROR_SUCCESS
;
hIC
->
lpfnStatusCB
(
hFtpSession
,
lpwfs
->
hdr
.
dwContext
,
INTERNET_STATUS_HANDLE_CREATED
,
hIC
->
lpfnStatusCB
(
hFtpSession
,
lpwfs
->
hdr
.
dwContext
,
INTERNET_STATUS_HANDLE_CREATED
,
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
...
@@ -977,7 +994,7 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
...
@@ -977,7 +994,7 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
}
}
return
(
HINTERNET
)
hFi
le
;
return
hand
le
;
}
}
...
@@ -995,9 +1012,10 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
...
@@ -995,9 +1012,10 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
BOOL
fFailIfExists
,
DWORD
dwLocalFlagsAttribute
,
DWORD
dwInternetFlags
,
BOOL
fFailIfExists
,
DWORD
dwLocalFlagsAttribute
,
DWORD
dwInternetFlags
,
DWORD
dwContext
)
DWORD
dwContext
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hInternet
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hInternet
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1072,9 +1090,11 @@ BOOL WINAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR l
...
@@ -1072,9 +1090,11 @@ BOOL WINAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR l
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
HANDLE
hFile
;
HANDLE
hFile
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hInternet
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"lpszRemoteFile(%s) lpszNewFile(%s)
\n
"
,
lpszRemoteFile
,
lpszNewFile
);
TRACE
(
"lpszRemoteFile(%s) lpszNewFile(%s)
\n
"
,
lpszRemoteFile
,
lpszNewFile
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hInternet
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1151,9 +1171,10 @@ lend:
...
@@ -1151,9 +1171,10 @@ lend:
*/
*/
BOOL
WINAPI
FtpDeleteFileA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszFileName
)
BOOL
WINAPI
FtpDeleteFileA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszFileName
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1195,9 +1216,11 @@ BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
...
@@ -1195,9 +1216,11 @@ BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
INT
nResCode
;
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"0x%08lx
\n
"
,
(
ULONG
)
hFtpSession
);
TRACE
(
"0x%08lx
\n
"
,
(
ULONG
)
hFtpSession
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1247,9 +1270,10 @@ lend:
...
@@ -1247,9 +1270,10 @@ lend:
*/
*/
BOOL
WINAPI
FtpRemoveDirectoryA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszDirectory
)
BOOL
WINAPI
FtpRemoveDirectoryA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszDirectory
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1291,9 +1315,11 @@ BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
...
@@ -1291,9 +1315,11 @@ BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
INT
nResCode
;
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1344,9 +1370,10 @@ lend:
...
@@ -1344,9 +1370,10 @@ lend:
*/
*/
BOOL
WINAPI
FtpRenameFileA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszSrc
,
LPCSTR
lpszDest
)
BOOL
WINAPI
FtpRenameFileA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszSrc
,
LPCSTR
lpszDest
)
{
{
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1388,9 +1415,11 @@ BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest)
...
@@ -1388,9 +1415,11 @@ BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest)
INT
nResCode
;
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hFtpSession
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1456,16 +1485,16 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
...
@@ -1456,16 +1485,16 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETFTPSESSIONA
lpwfs
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
NULL
;
HINTERNET
handle
=
NULL
;
TRACE
(
"0x%08lx Server(%s) Port(%d) User(%s) Paswd(%s)
\n
"
,
TRACE
(
"0x%08lx Server(%s) Port(%d) User(%s) Paswd(%s)
\n
"
,
(
ULONG
)
hInternet
,
lpszServerName
,
(
ULONG
)
hInternet
,
lpszServerName
,
nServerPort
,
lpszUserName
,
lpszPassword
);
nServerPort
,
lpszUserName
,
lpszPassword
);
if
(((
LPWININETHANDLEHEADER
)
hInternet
)
->
htype
!=
WH_HINIT
)
hIC
=
(
LPWININETAPPINFOA
)
WININET_GetObject
(
hInternet
);
if
(
(
hIC
==
NULL
)
||
(
hIC
->
hdr
.
htype
!=
WH_HINIT
)
)
goto
lerror
;
goto
lerror
;
hIC
=
(
LPWININETAPPINFOA
)
hInternet
;
if
(
NULL
==
lpszUserName
&&
NULL
!=
lpszPassword
)
if
(
NULL
==
lpszUserName
&&
NULL
!=
lpszPassword
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_USER_NAME
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_USER_NAME
);
...
@@ -1519,6 +1548,13 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
...
@@ -1519,6 +1548,13 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
goto
lerror
;
goto
lerror
;
}
}
handle
=
WININET_AllocHandle
(
&
lpwfs
->
hdr
);
if
(
!
handle
)
{
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
goto
lerror
;
}
lpwfs
->
hdr
.
htype
=
WH_HFTPSESSION
;
lpwfs
->
hdr
.
htype
=
WH_HFTPSESSION
;
lpwfs
->
hdr
.
dwFlags
=
dwFlags
;
lpwfs
->
hdr
.
dwFlags
=
dwFlags
;
lpwfs
->
hdr
.
dwContext
=
dwContext
;
lpwfs
->
hdr
.
dwContext
=
dwContext
;
...
@@ -1564,6 +1600,7 @@ lerror:
...
@@ -1564,6 +1600,7 @@ lerror:
if
(
!
bSuccess
&&
lpwfs
)
if
(
!
bSuccess
&&
lpwfs
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
lpwfs
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwfs
);
WININET_FreeHandle
(
handle
);
lpwfs
=
NULL
;
lpwfs
=
NULL
;
}
}
...
@@ -1577,7 +1614,7 @@ lerror:
...
@@ -1577,7 +1614,7 @@ lerror:
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
}
}
return
(
HINTERNET
)
lpwfs
;
return
handle
;
}
}
...
@@ -2491,6 +2528,7 @@ HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
...
@@ -2491,6 +2528,7 @@ HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
DWORD
dwSize
=
0
;
DWORD
dwSize
=
0
;
LPFILEPROPERTIESA
lpafp
=
NULL
;
LPFILEPROPERTIESA
lpafp
=
NULL
;
LPWININETFINDNEXTA
lpwfn
=
NULL
;
LPWININETFINDNEXTA
lpwfn
=
NULL
;
HINTERNET
handle
=
0
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -2499,19 +2537,25 @@ HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
...
@@ -2499,19 +2537,25 @@ HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
FTP_ConvertFileProp
(
lpafp
,
lpFindFileData
);
FTP_ConvertFileProp
(
lpafp
,
lpFindFileData
);
lpwfn
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WININETFINDNEXTA
));
lpwfn
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WININETFINDNEXTA
));
if
(
NULL
!=
lpwfn
)
if
(
lpwfn
)
{
{
lpwfn
->
hdr
.
htype
=
WH_HFINDNEXT
;
handle
=
WININET_AllocHandle
(
&
lpwfn
->
hdr
);
lpwfn
->
hdr
.
lpwhparent
=
(
LPWININETHANDLEHEADER
)
lpwfs
;
if
(
handle
)
lpwfn
->
hdr
.
dwContext
=
dwContext
;
{
lpwfn
->
index
=
1
;
/* Next index is 1 since we return index 0 */
lpwfn
->
hdr
.
htype
=
WH_HFINDNEXT
;
lpwfn
->
size
=
dwSize
;
lpwfn
->
hdr
.
lpwhparent
=
(
LPWININETHANDLEHEADER
)
lpwfs
;
lpwfn
->
lpafp
=
lpafp
;
lpwfn
->
hdr
.
dwContext
=
dwContext
;
lpwfn
->
index
=
1
;
/* Next index is 1 since we return index 0 */
lpwfn
->
size
=
dwSize
;
lpwfn
->
lpafp
=
lpafp
;
}
else
HeapFree
(
GetProcessHeap
(),
0
,
lpwfn
);
}
}
}
}
TRACE
(
"Matched %ld files
\n
"
,
dwSize
);
TRACE
(
"Matched %ld files
\n
"
,
dwSize
);
return
(
HINTERNET
)
lpwfn
;
return
handle
;
}
}
...
...
dlls/wininet/http.c
View file @
7cc70c0a
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
* Copyright 1999 Corel Corporation
* Copyright 1999 Corel Corporation
* Copyright 2002 CodeWeavers Inc.
* Copyright 2002 CodeWeavers Inc.
* Copyright 2002 TransGaming Technologies Inc.
* Copyright 2002 TransGaming Technologies Inc.
* Copyright 2004 Mike McCormack for Codeweavers
*
*
* Ulrich Czekalla
* Ulrich Czekalla
* Aric Stewart
* Aric Stewart
...
@@ -113,11 +114,12 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest,
...
@@ -113,11 +114,12 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest,
LPSTR
buffer
;
LPSTR
buffer
;
CHAR
value
[
MAX_FIELD_VALUE_LEN
],
field
[
MAX_FIELD_LEN
];
CHAR
value
[
MAX_FIELD_VALUE_LEN
],
field
[
MAX_FIELD_LEN
];
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hHttpRequest
;
LPWININETHTTPREQA
lpwhr
;
TRACE
(
"%p, %s, %li, %li
\n
"
,
hHttpRequest
,
lpszHeader
,
dwHeaderLength
,
TRACE
(
"%p, %s, %li, %li
\n
"
,
hHttpRequest
,
lpszHeader
,
dwHeaderLength
,
dwModifier
);
dwModifier
);
lpwhr
=
(
LPWININETHTTPREQA
)
WININET_GetObject
(
hHttpRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
{
...
@@ -209,8 +211,9 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -209,8 +211,9 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
LPCSTR
lpszReferrer
,
LPCSTR
*
lpszAcceptTypes
,
LPCSTR
lpszReferrer
,
LPCSTR
*
lpszAcceptTypes
,
DWORD
dwFlags
,
DWORD
dwContext
)
DWORD
dwFlags
,
DWORD
dwContext
)
{
{
LPWININETHTTPSESSIONA
lpwhs
=
(
LPWININETHTTPSESSIONA
)
hHttpSession
;
LPWININETHTTPSESSIONA
lpwhs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
HINTERNET
handle
=
NULL
;
TRACE
(
"(%p, %s, %s, %s, %s, %p, %08lx, %08lx)
\n
"
,
hHttpSession
,
TRACE
(
"(%p, %s, %s, %s, %s, %p, %08lx, %08lx)
\n
"
,
hHttpSession
,
debugstr_a
(
lpszVerb
),
lpszObjectName
,
debugstr_a
(
lpszVerb
),
lpszObjectName
,
...
@@ -223,10 +226,11 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -223,10 +226,11 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
TRACE
(
"
\t
accept type: %s
\n
"
,
lpszAcceptTypes
[
i
]);
TRACE
(
"
\t
accept type: %s
\n
"
,
lpszAcceptTypes
[
i
]);
}
}
lpwhs
=
(
LPWININETHTTPSESSIONA
)
WININET_GetObject
(
hHttpSession
);
if
(
NULL
==
lpwhs
||
lpwhs
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
if
(
NULL
==
lpwhs
||
lpwhs
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
return
FALSE
;
return
NULL
;
}
}
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
...
@@ -263,17 +267,15 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -263,17 +267,15 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
req
->
dwContext
=
dwContext
;
req
->
dwContext
=
dwContext
;
INTERNET_AsyncCall
(
&
workRequest
);
INTERNET_AsyncCall
(
&
workRequest
);
TRACE
(
"returning NULL
\n
"
);
return
NULL
;
}
}
else
else
{
{
HINTERNET
rec
=
HTTP_HttpOpenRequestA
(
hHttpSession
,
lpszVerb
,
lpszObjectName
,
handle
=
HTTP_HttpOpenRequestA
(
hHttpSession
,
lpszVerb
,
lpszObjectName
,
lpszVersion
,
lpszReferrer
,
lpszAcceptTypes
,
lpszVersion
,
lpszReferrer
,
lpszAcceptTypes
,
dwFlags
,
dwContext
);
dwFlags
,
dwContext
);
TRACE
(
"returning %p
\n
"
,
rec
);
return
rec
;
}
}
TRACE
(
"returning %p
\n
"
,
handle
);
return
handle
;
}
}
...
@@ -554,19 +556,21 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -554,19 +556,21 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
LPCSTR
lpszReferrer
,
LPCSTR
*
lpszAcceptTypes
,
LPCSTR
lpszReferrer
,
LPCSTR
*
lpszAcceptTypes
,
DWORD
dwFlags
,
DWORD
dwContext
)
DWORD
dwFlags
,
DWORD
dwContext
)
{
{
LPWININETHTTPSESSIONA
lpwhs
=
(
LPWININETHTTPSESSIONA
)
hHttpSession
;
LPWININETHTTPSESSIONA
lpwhs
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETHTTPREQA
lpwhr
;
LPWININETHTTPREQA
lpwhr
;
LPSTR
lpszCookies
;
LPSTR
lpszCookies
;
LPSTR
lpszUrl
=
NULL
;
LPSTR
lpszUrl
=
NULL
;
DWORD
nCookieSize
;
DWORD
nCookieSize
;
HINTERNET
handle
;
TRACE
(
"-->
\n
"
);
TRACE
(
"-->
\n
"
);
lpwhs
=
(
LPWININETHTTPSESSIONA
)
WININET_GetObject
(
hHttpSession
);
if
(
NULL
==
lpwhs
||
lpwhs
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
if
(
NULL
==
lpwhs
||
lpwhs
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
return
FALSE
;
return
NULL
;
}
}
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
...
@@ -575,11 +579,18 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -575,11 +579,18 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
if
(
NULL
==
lpwhr
)
if
(
NULL
==
lpwhr
)
{
{
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
return
(
HINTERNET
)
NULL
;
return
NULL
;
}
handle
=
WININET_AllocHandle
(
&
lpwhr
->
hdr
);
if
(
NULL
==
handle
)
{
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwhr
);
return
NULL
;
}
}
lpwhr
->
hdr
.
htype
=
WH_HHTTPREQ
;
lpwhr
->
hdr
.
htype
=
WH_HHTTPREQ
;
lpwhr
->
hdr
.
lpwhparent
=
hHttpSession
;
lpwhr
->
hdr
.
lpwhparent
=
&
lpwhs
->
hdr
;
lpwhr
->
hdr
.
dwFlags
=
dwFlags
;
lpwhr
->
hdr
.
dwFlags
=
dwFlags
;
lpwhr
->
hdr
.
dwContext
=
dwContext
;
lpwhr
->
hdr
.
dwContext
=
dwContext
;
NETCON_init
(
&
lpwhr
->
netConnection
,
dwFlags
&
INTERNET_FLAG_SECURE
);
NETCON_init
(
&
lpwhr
->
netConnection
,
dwFlags
&
INTERNET_FLAG_SECURE
);
...
@@ -638,7 +649,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -638,7 +649,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
{
{
char
*
agent_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
hIC
->
lpszAgent
)
+
1
+
14
);
char
*
agent_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
hIC
->
lpszAgent
)
+
1
+
14
);
sprintf
(
agent_header
,
"User-Agent: %s
\r\n
"
,
hIC
->
lpszAgent
);
sprintf
(
agent_header
,
"User-Agent: %s
\r\n
"
,
hIC
->
lpszAgent
);
HttpAddRequestHeadersA
(
(
HINTERNET
)
lpwhr
,
agent_header
,
strlen
(
agent_header
),
HttpAddRequestHeadersA
(
handle
,
agent_header
,
strlen
(
agent_header
),
HTTP_ADDREQ_FLAG_ADD
);
HTTP_ADDREQ_FLAG_ADD
);
HeapFree
(
GetProcessHeap
(),
0
,
agent_header
);
HeapFree
(
GetProcessHeap
(),
0
,
agent_header
);
}
}
...
@@ -656,7 +667,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -656,7 +667,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
cnt
+=
nCookieSize
-
1
;
cnt
+=
nCookieSize
-
1
;
sprintf
(
lpszCookies
+
cnt
,
"
\r\n
"
);
sprintf
(
lpszCookies
+
cnt
,
"
\r\n
"
);
HttpAddRequestHeadersA
(
(
HINTERNET
)
lpwhr
,
lpszCookies
,
strlen
(
lpszCookies
),
HttpAddRequestHeadersA
(
handle
,
lpszCookies
,
strlen
(
lpszCookies
),
HTTP_ADDREQ_FLAG_ADD
);
HTTP_ADDREQ_FLAG_ADD
);
HeapFree
(
GetProcessHeap
(),
0
,
lpszCookies
);
HeapFree
(
GetProcessHeap
(),
0
,
lpszCookies
);
}
}
...
@@ -691,7 +702,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -691,7 +702,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
&
lpwhs
->
phostent
,
&
lpwhs
->
socketAddress
))
&
lpwhs
->
phostent
,
&
lpwhs
->
socketAddress
))
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_NAME_NOT_RESOLVED
);
INTERNET_SetLastError
(
ERROR_INTERNET_NAME_NOT_RESOLVED
);
return
FALSE
;
return
NULL
;
}
}
SendAsyncCallback
(
hIC
,
hHttpSession
,
lpwhr
->
hdr
.
dwContext
,
SendAsyncCallback
(
hIC
,
hHttpSession
,
lpwhr
->
hdr
.
dwContext
,
...
@@ -699,8 +710,8 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
...
@@ -699,8 +710,8 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
&
(
lpwhs
->
socketAddress
),
&
(
lpwhs
->
socketAddress
),
sizeof
(
struct
sockaddr_in
));
sizeof
(
struct
sockaddr_in
));
TRACE
(
"<--
\n
"
);
TRACE
(
"<--
%p
\n
"
,
handle
);
return
(
HINTERNET
)
lpwhr
;
return
handle
;
}
}
...
@@ -719,10 +730,11 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
...
@@ -719,10 +730,11 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
{
{
LPHTTPHEADERA
lphttpHdr
=
NULL
;
LPHTTPHEADERA
lphttpHdr
=
NULL
;
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hHttpRequest
;
LPWININETHTTPREQA
lpwhr
;
TRACE
(
"(0x%08lx)--> %ld
\n
"
,
dwInfoLevel
,
dwInfoLevel
);
TRACE
(
"(0x%08lx)--> %ld
\n
"
,
dwInfoLevel
,
dwInfoLevel
);
lpwhr
=
(
LPWININETHTTPREQA
)
WININET_GetObject
(
hHttpRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -947,13 +959,14 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
...
@@ -947,13 +959,14 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
BOOL
WINAPI
HttpSendRequestA
(
HINTERNET
hHttpRequest
,
LPCSTR
lpszHeaders
,
BOOL
WINAPI
HttpSendRequestA
(
HINTERNET
hHttpRequest
,
LPCSTR
lpszHeaders
,
DWORD
dwHeaderLength
,
LPVOID
lpOptional
,
DWORD
dwOptionalLength
)
DWORD
dwHeaderLength
,
LPVOID
lpOptional
,
DWORD
dwOptionalLength
)
{
{
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hHttpRequest
;
LPWININETHTTPREQA
lpwhr
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
TRACE
(
"
(0x%08lx, %p (%s), %li, %p, %li)
\n
"
,
(
unsigned
long
)
hHttpRequest
,
TRACE
(
"
%p, %p (%s), %li, %p, %li)
\n
"
,
hHttpRequest
,
lpszHeaders
,
debugstr_a
(
lpszHeaders
),
dwHeaderLength
,
lpOptional
,
dwOptionalLength
);
lpszHeaders
,
debugstr_a
(
lpszHeaders
),
dwHeaderLength
,
lpOptional
,
dwOptionalLength
);
lpwhr
=
(
LPWININETHTTPREQA
)
WININET_GetObject
(
hHttpRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1041,6 +1054,8 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQA lpwhr, LPCSTR lpszUrl, LPCSTR
...
@@ -1041,6 +1054,8 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQA lpwhr, LPCSTR lpszUrl, LPCSTR
LPWININETHTTPSESSIONA
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
LPWININETHTTPSESSIONA
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
LPWININETAPPINFOA
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
LPWININETAPPINFOA
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
char
path
[
2048
];
char
path
[
2048
];
HINTERNET
handle
;
if
(
lpszUrl
[
0
]
==
'/'
)
if
(
lpszUrl
[
0
]
==
'/'
)
{
{
/* if it's an absolute path, keep the same session info */
/* if it's an absolute path, keep the same session info */
...
@@ -1143,7 +1158,8 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQA lpwhr, LPCSTR lpszUrl, LPCSTR
...
@@ -1143,7 +1158,8 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQA lpwhr, LPCSTR lpszUrl, LPCSTR
}
}
}
}
return
HttpSendRequestA
((
HINTERNET
)
lpwhr
,
lpszHeaders
,
dwHeaderLength
,
lpOptional
,
dwOptionalLength
);
handle
=
WININET_FindHandle
(
&
lpwhr
->
hdr
);
return
HttpSendRequestA
(
handle
,
lpszHeaders
,
dwHeaderLength
,
lpOptional
,
dwOptionalLength
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -1167,7 +1183,7 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
...
@@ -1167,7 +1183,7 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
INT
requestStringLen
;
INT
requestStringLen
;
INT
responseLen
;
INT
responseLen
;
INT
headerLength
=
0
;
INT
headerLength
=
0
;
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hHttpRequest
;
LPWININETHTTPREQA
lpwhr
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
BOOL
loop_next
=
FALSE
;
BOOL
loop_next
=
FALSE
;
...
@@ -1176,6 +1192,7 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
...
@@ -1176,6 +1192,7 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
TRACE
(
"--> 0x%08lx
\n
"
,
(
ULONG
)
hHttpRequest
);
TRACE
(
"--> 0x%08lx
\n
"
,
(
ULONG
)
hHttpRequest
);
/* Verify our tree of internet handles */
/* Verify our tree of internet handles */
lpwhr
=
(
LPWININETHTTPREQA
)
WININET_GetObject
(
hHttpRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -1557,13 +1574,14 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
...
@@ -1557,13 +1574,14 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
BOOL
bSuccess
=
FALSE
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
HINTERNET
handle
=
NULL
;
TRACE
(
"-->
\n
"
);
TRACE
(
"-->
\n
"
);
if
(((
LPWININETHANDLEHEADER
)
hInternet
)
->
htype
!=
WH_HINIT
)
hIC
=
(
LPWININETAPPINFOA
)
WININET_GetObject
(
hInternet
);
if
(
(
hIC
==
NULL
)
||
(
hIC
->
hdr
.
htype
!=
WH_HINIT
)
)
goto
lerror
;
goto
lerror
;
hIC
=
(
LPWININETAPPINFOA
)
hInternet
;
hIC
->
hdr
.
dwContext
=
dwContext
;
hIC
->
hdr
.
dwContext
=
dwContext
;
lpwhs
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WININETHTTPSESSIONA
));
lpwhs
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WININETHTTPSESSIONA
));
...
@@ -1573,6 +1591,14 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
...
@@ -1573,6 +1591,14 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
goto
lerror
;
goto
lerror
;
}
}
handle
=
WININET_AllocHandle
(
&
lpwhs
->
hdr
);
if
(
NULL
==
handle
)
{
ERR
(
"Failed to alloc handle
\n
"
);
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
goto
lerror
;
}
/*
/*
* According to my tests. The name is not resolved until a request is sent
* According to my tests. The name is not resolved until a request is sent
*/
*/
...
@@ -1581,7 +1607,7 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
...
@@ -1581,7 +1607,7 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
nServerPort
=
INTERNET_DEFAULT_HTTP_PORT
;
nServerPort
=
INTERNET_DEFAULT_HTTP_PORT
;
lpwhs
->
hdr
.
htype
=
WH_HHTTPSESSION
;
lpwhs
->
hdr
.
htype
=
WH_HHTTPSESSION
;
lpwhs
->
hdr
.
lpwhparent
=
(
LPWININETHANDLEHEADER
)
hInternet
;
lpwhs
->
hdr
.
lpwhparent
=
&
hIC
->
hdr
;
lpwhs
->
hdr
.
dwFlags
=
dwFlags
;
lpwhs
->
hdr
.
dwFlags
=
dwFlags
;
lpwhs
->
hdr
.
dwContext
=
dwContext
;
lpwhs
->
hdr
.
dwContext
=
dwContext
;
if
(
hIC
->
lpszProxy
&&
hIC
->
dwAccessType
==
INTERNET_OPEN_TYPE_PROXY
)
{
if
(
hIC
->
lpszProxy
&&
hIC
->
dwAccessType
==
INTERNET_OPEN_TYPE_PROXY
)
{
...
@@ -1614,6 +1640,7 @@ lerror:
...
@@ -1614,6 +1640,7 @@ lerror:
if
(
!
bSuccess
&&
lpwhs
)
if
(
!
bSuccess
&&
lpwhs
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
lpwhs
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwhs
);
WININET_FreeHandle
(
handle
);
lpwhs
=
NULL
;
lpwhs
=
NULL
;
}
}
...
@@ -1622,8 +1649,8 @@ lerror:
...
@@ -1622,8 +1649,8 @@ lerror:
* windows
* windows
*/
*/
TRACE
(
"%p -->
\n
"
,
hInternet
);
TRACE
(
"%p -->
%p
\n
"
,
hInternet
,
handle
);
return
(
HINTERNET
)
lpwhs
;
return
handle
;
}
}
...
@@ -2058,9 +2085,11 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQA lpwhr)
...
@@ -2058,9 +2085,11 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQA lpwhr)
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
HINTERNET
handle
;
TRACE
(
"%p
\n
"
,
lpwhr
);
TRACE
(
"%p
\n
"
,
lpwhr
);
handle
=
WININET_FindHandle
(
&
lpwhr
->
hdr
);
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
...
@@ -2088,16 +2117,18 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
...
@@ -2088,16 +2117,18 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
int
i
;
int
i
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
HINTERNET
handle
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
NETCON_connected
(
&
lpwhr
->
netConnection
))
if
(
NETCON_connected
(
&
lpwhr
->
netConnection
))
HTTP_CloseConnection
(
lpwhr
);
HTTP_CloseConnection
(
lpwhr
);
handle
=
WININET_FindHandle
(
&
lpwhr
->
hdr
);
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
SendAsyncCallback
(
hIC
,
lpwhr
,
lpwhr
->
hdr
.
dwContext
,
SendAsyncCallback
(
hIC
,
handle
,
lpwhr
->
hdr
.
dwContext
,
INTERNET_STATUS_HANDLE_CLOSING
,
lpwhr
,
INTERNET_STATUS_HANDLE_CLOSING
,
lpwhr
,
sizeof
(
HINTERNET
));
sizeof
(
HINTERNET
));
...
@@ -2138,11 +2169,14 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
...
@@ -2138,11 +2169,14 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
void
HTTP_CloseHTTPSessionHandle
(
LPWININETHTTPSESSIONA
lpwhs
)
void
HTTP_CloseHTTPSessionHandle
(
LPWININETHTTPSESSIONA
lpwhs
)
{
{
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
HINTERNET
handle
;
TRACE
(
"%p
\n
"
,
lpwhs
);
TRACE
(
"%p
\n
"
,
lpwhs
);
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
SendAsyncCallback
(
hIC
,
lpwhs
,
lpwhs
->
hdr
.
dwContext
,
handle
=
WININET_FindHandle
(
&
lpwhs
->
hdr
);
SendAsyncCallback
(
hIC
,
handle
,
lpwhs
->
hdr
.
dwContext
,
INTERNET_STATUS_HANDLE_CLOSING
,
lpwhs
,
INTERNET_STATUS_HANDLE_CLOSING
,
lpwhs
,
sizeof
(
HINTERNET
));
sizeof
(
HINTERNET
));
...
...
dlls/wininet/internet.c
View file @
7cc70c0a
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* Copyright 2002 CodeWeavers Inc.
* Copyright 2002 CodeWeavers Inc.
* Copyright 2002 Jaco Greeff
* Copyright 2002 Jaco Greeff
* Copyright 2002 TransGaming Technologies Inc.
* Copyright 2002 TransGaming Technologies Inc.
* Copyright 2004 Mike McCormack for Codeweavers
*
*
* Ulrich Czekalla
* Ulrich Czekalla
* Aric Stewart
* Aric Stewart
...
@@ -73,14 +74,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
...
@@ -73,14 +74,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
#define GET_HWININET_FROM_LPWININETFINDNEXT(lpwh) \
#define GET_HWININET_FROM_LPWININETFINDNEXT(lpwh) \
(LPWININETAPPINFOA)(((LPWININETFTPSESSIONA)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
(LPWININETAPPINFOA)(((LPWININETFTPSESSIONA)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
/* filter for page-fault exceptions */
static
WINE_EXCEPTION_FILTER
(
page_fault
)
{
if
(
GetExceptionCode
()
==
EXCEPTION_ACCESS_VIOLATION
||
GetExceptionCode
()
==
EXCEPTION_PRIV_INSTRUCTION
)
return
EXCEPTION_EXECUTE_HANDLER
;
return
EXCEPTION_CONTINUE_SEARCH
;
}
typedef
struct
typedef
struct
{
{
...
@@ -105,6 +98,122 @@ LPWORKREQUEST lpWorkQueueTail;
...
@@ -105,6 +98,122 @@ LPWORKREQUEST lpWorkQueueTail;
extern
void
URLCacheContainers_CreateDefaults
();
extern
void
URLCacheContainers_CreateDefaults
();
extern
void
URLCacheContainers_DeleteAll
();
extern
void
URLCacheContainers_DeleteAll
();
#define HANDLE_CHUNK_SIZE 0x10
static
CRITICAL_SECTION
WININET_cs
;
static
CRITICAL_SECTION_DEBUG
WININET_cs_debug
=
{
0
,
0
,
&
WININET_cs
,
{
&
WININET_cs_debug
.
ProcessLocksList
,
&
WININET_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
0
,
(
DWORD
)(
__FILE__
": WININET_cs"
)
}
};
static
CRITICAL_SECTION
WININET_cs
=
{
&
WININET_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
LPWININETHANDLEHEADER
*
WININET_Handles
;
static
UINT
WININET_dwNextHandle
;
static
UINT
WININET_dwMaxHandles
;
HINTERNET
WININET_AllocHandle
(
LPWININETHANDLEHEADER
info
)
{
LPWININETHANDLEHEADER
*
p
;
UINT
handle
=
0
,
num
;
EnterCriticalSection
(
&
WININET_cs
);
if
(
!
WININET_dwMaxHandles
)
{
num
=
HANDLE_CHUNK_SIZE
;
p
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
UINT
)
*
num
);
if
(
!
p
)
goto
end
;
WININET_Handles
=
p
;
WININET_dwMaxHandles
=
num
;
}
if
(
WININET_dwMaxHandles
==
WININET_dwNextHandle
)
{
num
=
WININET_dwMaxHandles
+
HANDLE_CHUNK_SIZE
;
p
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
WININET_Handles
,
sizeof
(
UINT
)
*
num
);
if
(
!
p
)
goto
end
;
WININET_Handles
=
p
;
WININET_dwMaxHandles
=
num
;
}
handle
=
WININET_dwNextHandle
;
if
(
WININET_Handles
[
handle
]
)
ERR
(
"handle isn't free but should be
\n
"
);
WININET_Handles
[
handle
]
=
info
;
while
(
WININET_Handles
[
WININET_dwNextHandle
]
&&
(
WININET_dwNextHandle
<
WININET_dwMaxHandles
)
)
WININET_dwNextHandle
++
;
end:
LeaveCriticalSection
(
&
WININET_cs
);
return
(
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
]
)
{
handle
=
i
+
1
;
break
;
}
}
LeaveCriticalSection
(
&
WININET_cs
);
return
(
HINTERNET
)
handle
;
}
LPWININETHANDLEHEADER
WININET_GetObject
(
HINTERNET
hinternet
)
{
LPWININETHANDLEHEADER
info
=
NULL
;
UINT
handle
=
(
UINT
)
hinternet
;
EnterCriticalSection
(
&
WININET_cs
);
if
(
(
handle
>
0
)
&&
(
handle
<=
WININET_dwNextHandle
)
)
info
=
WININET_Handles
[
handle
-
1
];
LeaveCriticalSection
(
&
WININET_cs
);
TRACE
(
"handle %d -> %p
\n
"
,
handle
,
info
);
return
info
;
}
BOOL
WININET_FreeHandle
(
HINTERNET
hinternet
)
{
BOOL
ret
=
FALSE
;
UINT
handle
=
(
UINT
)
hinternet
;
EnterCriticalSection
(
&
WININET_cs
);
if
(
(
handle
>
1
)
&&
(
handle
<
WININET_dwNextHandle
)
)
{
handle
--
;
if
(
WININET_Handles
[
handle
]
)
{
WININET_Handles
[
handle
]
=
NULL
;
ret
=
TRUE
;
if
(
WININET_dwNextHandle
>
handle
)
WININET_dwNextHandle
=
handle
;
}
}
LeaveCriticalSection
(
&
WININET_cs
);
return
ret
;
}
/***********************************************************************
/***********************************************************************
* DllMain [Internal] Initializes the internal 'WININET.DLL'.
* DllMain [Internal] Initializes the internal 'WININET.DLL'.
*
*
...
@@ -294,6 +403,7 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
...
@@ -294,6 +403,7 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
LPCSTR
lpszProxy
,
LPCSTR
lpszProxyBypass
,
DWORD
dwFlags
)
LPCSTR
lpszProxy
,
LPCSTR
lpszProxyBypass
,
DWORD
dwFlags
)
{
{
LPWININETAPPINFOA
lpwai
=
NULL
;
LPWININETAPPINFOA
lpwai
=
NULL
;
HINTERNET
handle
;
TRACE
(
"(%s, %li, %s, %s, %li)
\n
"
,
debugstr_a
(
lpszAgent
),
dwAccessType
,
TRACE
(
"(%s, %li, %s, %s, %li)
\n
"
,
debugstr_a
(
lpszAgent
),
dwAccessType
,
debugstr_a
(
lpszProxy
),
debugstr_a
(
lpszProxyBypass
),
dwFlags
);
debugstr_a
(
lpszProxy
),
debugstr_a
(
lpszProxyBypass
),
dwFlags
);
...
@@ -316,6 +426,14 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
...
@@ -316,6 +426,14 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
lpwai
->
lpszProxyUsername
=
NULL
;
lpwai
->
lpszProxyUsername
=
NULL
;
lpwai
->
lpszProxyPassword
=
NULL
;
lpwai
->
lpszProxyPassword
=
NULL
;
handle
=
WININET_AllocHandle
(
&
lpwai
->
hdr
);
if
(
!
handle
)
{
HeapFree
(
GetProcessHeap
(),
0
,
lpwai
);
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
return
NULL
;
}
if
(
NULL
!=
lpszAgent
)
if
(
NULL
!=
lpszAgent
)
{
{
lpwai
->
lpszAgent
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lpwai
->
lpszAgent
=
HeapAlloc
(
GetProcessHeap
(),
0
,
...
@@ -342,7 +460,8 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
...
@@ -342,7 +460,8 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
}
}
TRACE
(
"returning %p
\n
"
,
(
HINTERNET
)
lpwai
);
TRACE
(
"returning %p
\n
"
,
(
HINTERNET
)
lpwai
);
return
(
HINTERNET
)
lpwai
;
return
handle
;
}
}
...
@@ -593,10 +712,12 @@ HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
...
@@ -593,10 +712,12 @@ HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
BOOL
WINAPI
InternetFindNextFileA
(
HINTERNET
hFind
,
LPVOID
lpvFindData
)
BOOL
WINAPI
InternetFindNextFileA
(
HINTERNET
hFind
,
LPVOID
lpvFindData
)
{
{
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFINDNEXTA
lpwh
=
(
LPWININETFINDNEXTA
)
hFind
;
LPWININETFINDNEXTA
lpwh
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwh
=
(
LPWININETFINDNEXTA
)
WININET_GetObject
(
hFind
);
if
(
NULL
==
lpwh
||
lpwh
->
hdr
.
htype
!=
WH_HFINDNEXT
)
if
(
NULL
==
lpwh
||
lpwh
->
hdr
.
htype
!=
WH_HFINDNEXT
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -637,10 +758,11 @@ BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
...
@@ -637,10 +758,11 @@ BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
BOOL
bSuccess
=
TRUE
;
BOOL
bSuccess
=
TRUE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWIN32_FIND_DATAA
lpFindFileData
;
LPWIN32_FIND_DATAA
lpFindFileData
;
LPWININETFINDNEXTA
lpwh
=
(
LPWININETFINDNEXTA
)
hFind
;
LPWININETFINDNEXTA
lpwh
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwh
=
(
LPWININETFINDNEXTA
)
WININET_GetObject
(
hFind
);
if
(
NULL
==
lpwh
||
lpwh
->
hdr
.
htype
!=
WH_HFINDNEXT
)
if
(
NULL
==
lpwh
||
lpwh
->
hdr
.
htype
!=
WH_HFINDNEXT
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
@@ -743,13 +865,17 @@ VOID INTERNET_CloseHandle(LPWININETAPPINFOA lpwai)
...
@@ -743,13 +865,17 @@ VOID INTERNET_CloseHandle(LPWININETAPPINFOA lpwai)
BOOL
WINAPI
InternetCloseHandle
(
HINTERNET
hInternet
)
BOOL
WINAPI
InternetCloseHandle
(
HINTERNET
hInternet
)
{
{
BOOL
retval
;
BOOL
retval
;
LPWININETHANDLEHEADER
lpwh
=
(
LPWININETHANDLEHEADER
)
hInternet
;
LPWININETHANDLEHEADER
lpwh
;
TRACE
(
"%p
\n
"
,
hInternet
);
TRACE
(
"%p
\n
"
,
hInternet
);
lpwh
=
WININET_GetObject
(
hInternet
);
if
(
NULL
==
lpwh
)
if
(
NULL
==
lpwh
)
{
INTERNET_SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
return
FALSE
;
}
__TRY
{
/* Clear any error information */
/* Clear any error information */
INTERNET_SetLastError
(
0
);
INTERNET_SetLastError
(
0
);
retval
=
FALSE
;
retval
=
FALSE
;
...
@@ -786,11 +912,8 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
...
@@ -786,11 +912,8 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
default:
default:
break
;
break
;
}
}
}
__EXCEPT
(
page_fault
)
{
if
(
retval
)
INTERNET_SetLastError
(
ERROR_INVALID_PARAMETER
);
WININET_FreeHandle
(
hInternet
);
return
FALSE
;
}
__ENDTRY
return
retval
;
return
retval
;
}
}
...
@@ -1300,7 +1423,11 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
...
@@ -1300,7 +1423,11 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
HINTERNET
hInternet
,
INTERNET_STATUS_CALLBACK
lpfnIntCB
)
HINTERNET
hInternet
,
INTERNET_STATUS_CALLBACK
lpfnIntCB
)
{
{
INTERNET_STATUS_CALLBACK
retVal
;
INTERNET_STATUS_CALLBACK
retVal
;
LPWININETAPPINFOA
lpwai
=
(
LPWININETAPPINFOA
)
hInternet
;
LPWININETAPPINFOA
lpwai
;
lpwai
=
(
LPWININETAPPINFOA
)
WININET_GetObject
(
hInternet
);
if
(
!
lpwai
)
return
NULL
;
TRACE
(
"0x%08lx
\n
"
,
(
ULONG
)
hInternet
);
TRACE
(
"0x%08lx
\n
"
,
(
ULONG
)
hInternet
);
if
(
lpwai
->
hdr
.
htype
!=
WH_HINIT
)
if
(
lpwai
->
hdr
.
htype
!=
WH_HINIT
)
...
@@ -1336,9 +1463,10 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
...
@@ -1336,9 +1463,10 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
{
{
BOOL
retval
=
FALSE
;
BOOL
retval
=
FALSE
;
int
nSocket
=
-
1
;
int
nSocket
=
-
1
;
LPWININETHANDLEHEADER
lpwh
=
(
LPWININETHANDLEHEADER
)
hFile
;
LPWININETHANDLEHEADER
lpwh
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwh
=
(
LPWININETHANDLEHEADER
)
WININET_GetObject
(
hFile
);
if
(
NULL
==
lpwh
)
if
(
NULL
==
lpwh
)
return
FALSE
;
return
FALSE
;
...
@@ -1348,11 +1476,11 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
...
@@ -1348,11 +1476,11 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
FIXME
(
"This shouldn't be here! We don't support this kind"
FIXME
(
"This shouldn't be here! We don't support this kind"
" of connection anymore. Must use NETCON functions,"
" of connection anymore. Must use NETCON functions,"
" especially if using SSL
\n
"
);
" especially if using SSL
\n
"
);
nSocket
=
((
LPWININETHTTPREQA
)
hFile
)
->
netConnection
.
socketFD
;
nSocket
=
((
LPWININETHTTPREQA
)
lpwh
)
->
netConnection
.
socketFD
;
break
;
break
;
case
WH_HFILE
:
case
WH_HFILE
:
nSocket
=
((
LPWININETFILE
)
hFile
)
->
nDataSocket
;
nSocket
=
((
LPWININETFILE
)
lpwh
)
->
nDataSocket
;
break
;
break
;
default:
default:
...
@@ -1385,10 +1513,11 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
...
@@ -1385,10 +1513,11 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
{
{
BOOL
retval
=
FALSE
;
BOOL
retval
=
FALSE
;
int
nSocket
=
-
1
;
int
nSocket
=
-
1
;
LPWININETHANDLEHEADER
lpwh
=
(
LPWININETHANDLEHEADER
)
hFile
;
LPWININETHANDLEHEADER
lpwh
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
lpwh
=
(
LPWININETHANDLEHEADER
)
WININET_GetObject
(
hFile
);
if
(
NULL
==
lpwh
)
if
(
NULL
==
lpwh
)
return
FALSE
;
return
FALSE
;
...
@@ -1396,7 +1525,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
...
@@ -1396,7 +1525,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
switch
(
lpwh
->
htype
)
switch
(
lpwh
->
htype
)
{
{
case
WH_HHTTPREQ
:
case
WH_HHTTPREQ
:
if
(
!
NETCON_recv
(
&
((
LPWININETHTTPREQA
)
hFile
)
->
netConnection
,
lpBuffer
,
if
(
!
NETCON_recv
(
&
((
LPWININETHTTPREQA
)
lpwh
)
->
netConnection
,
lpBuffer
,
dwNumOfBytesToRead
,
0
,
(
int
*
)
dwNumOfBytesRead
))
dwNumOfBytesToRead
,
0
,
(
int
*
)
dwNumOfBytesRead
))
{
{
*
dwNumOfBytesRead
=
0
;
*
dwNumOfBytesRead
=
0
;
...
@@ -1408,7 +1537,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
...
@@ -1408,7 +1537,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
case
WH_HFILE
:
case
WH_HFILE
:
/* FIXME: FTP should use NETCON_ stuff */
/* FIXME: FTP should use NETCON_ stuff */
nSocket
=
((
LPWININETFILE
)
hFile
)
->
nDataSocket
;
nSocket
=
((
LPWININETFILE
)
lpwh
)
->
nDataSocket
;
if
(
nSocket
!=
-
1
)
if
(
nSocket
!=
-
1
)
{
{
int
res
=
recv
(
nSocket
,
lpBuffer
,
dwNumOfBytesToRead
,
0
);
int
res
=
recv
(
nSocket
,
lpBuffer
,
dwNumOfBytesToRead
,
0
);
...
@@ -1471,7 +1600,9 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
...
@@ -1471,7 +1600,9 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
TRACE
(
"(%p, 0x%08lx, %p, %p)
\n
"
,
hInternet
,
dwOption
,
lpBuffer
,
lpdwBufferLength
);
TRACE
(
"(%p, 0x%08lx, %p, %p)
\n
"
,
hInternet
,
dwOption
,
lpBuffer
,
lpdwBufferLength
);
lpwhh
=
(
LPWININETHANDLEHEADER
)
hInternet
;
lpwhh
=
(
LPWININETHANDLEHEADER
)
WININET_GetObject
(
hInternet
);
if
(
!
lpwhh
)
return
FALSE
;
switch
(
dwOption
)
switch
(
dwOption
)
{
{
...
@@ -1512,7 +1643,7 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
...
@@ -1512,7 +1643,7 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
ULONG
type
=
lpwhh
->
htype
;
ULONG
type
=
lpwhh
->
htype
;
if
(
type
==
WH_HHTTPREQ
)
if
(
type
==
WH_HHTTPREQ
)
{
{
LPWININETHTTPREQA
lpreq
=
hInternet
;
LPWININETHTTPREQA
lpreq
=
(
LPWININETHTTPREQA
)
lpwhh
;
char
url
[
1023
];
char
url
[
1023
];
sprintf
(
url
,
"http://%s%s"
,
lpreq
->
lpszHostName
,
lpreq
->
lpszPath
);
sprintf
(
url
,
"http://%s%s"
,
lpreq
->
lpszHostName
,
lpreq
->
lpszPath
);
...
@@ -1607,7 +1738,9 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
...
@@ -1607,7 +1738,9 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
TRACE
(
"0x%08lx
\n
"
,
dwOption
);
TRACE
(
"0x%08lx
\n
"
,
dwOption
);
lpwhh
=
(
LPWININETHANDLEHEADER
)
hInternet
;
lpwhh
=
(
LPWININETHANDLEHEADER
)
WININET_GetObject
(
hInternet
);
if
(
!
lpwhh
)
return
FALSE
;
switch
(
dwOption
)
switch
(
dwOption
)
{
{
...
@@ -2425,11 +2558,12 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
...
@@ -2425,11 +2558,12 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
LPDWORD
lpdwNumberOfBytesAvailble
,
LPDWORD
lpdwNumberOfBytesAvailble
,
DWORD
dwFlags
,
DWORD
dwConext
)
DWORD
dwFlags
,
DWORD
dwConext
)
{
{
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hFile
;
LPWININETHTTPREQA
lpwhr
;
INT
retval
=
-
1
;
INT
retval
=
-
1
;
char
buffer
[
4048
];
char
buffer
[
4048
];
lpwhr
=
(
LPWININETHTTPREQA
)
WININET_GetObject
(
hFile
);
if
(
NULL
==
lpwhr
)
if
(
NULL
==
lpwhr
)
{
{
SetLastError
(
ERROR_NO_MORE_FILES
);
SetLastError
(
ERROR_NO_MORE_FILES
);
...
@@ -2441,7 +2575,7 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
...
@@ -2441,7 +2575,7 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
switch
(
lpwhr
->
hdr
.
htype
)
switch
(
lpwhr
->
hdr
.
htype
)
{
{
case
WH_HHTTPREQ
:
case
WH_HHTTPREQ
:
if
(
!
NETCON_recv
(
&
((
LPWININETHTTPREQA
)
hFile
)
->
netConnection
,
buffer
,
if
(
!
NETCON_recv
(
&
lpwhr
->
netConnection
,
buffer
,
4048
,
MSG_PEEK
,
(
int
*
)
lpdwNumberOfBytesAvailble
))
4048
,
MSG_PEEK
,
(
int
*
)
lpdwNumberOfBytesAvailble
))
{
{
SetLastError
(
ERROR_NO_MORE_FILES
);
SetLastError
(
ERROR_NO_MORE_FILES
);
...
...
dlls/wininet/internet.h
View file @
7cc70c0a
...
@@ -309,6 +309,10 @@ typedef struct WORKREQ
...
@@ -309,6 +309,10 @@ typedef struct WORKREQ
}
WORKREQUEST
,
*
LPWORKREQUEST
;
}
WORKREQUEST
,
*
LPWORKREQUEST
;
HINTERNET
WININET_AllocHandle
(
LPWININETHANDLEHEADER
info
);
LPWININETHANDLEHEADER
WININET_GetObject
(
HINTERNET
hinternet
);
BOOL
WININET_FreeHandle
(
HINTERNET
hinternet
);
HINTERNET
WININET_FindHandle
(
LPWININETHANDLEHEADER
info
);
time_t
ConvertTimeString
(
LPCSTR
asctime
);
time_t
ConvertTimeString
(
LPCSTR
asctime
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment