Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
09d2d477
Commit
09d2d477
authored
Mar 25, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Mar 25, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert WININETAPPINFOA structure to unicode.
parent
cb308327
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
242 additions
and
206 deletions
+242
-206
dialogs.c
dlls/wininet/dialogs.c
+69
-56
ftp.c
dlls/wininet/ftp.c
+42
-42
http.c
dlls/wininet/http.c
+59
-41
internet.c
dlls/wininet/internet.c
+61
-56
internet.h
dlls/wininet/internet.h
+9
-9
utility.c
dlls/wininet/utility.c
+2
-2
No files found.
dlls/wininet/dialogs.c
View file @
09d2d477
...
...
@@ -56,12 +56,12 @@ struct WININET_ErrorDlgParams
*
* Determine the name of the proxy server the request is using
*/
static
BOOL
WININET_GetProxyServer
(
HINTERNET
hRequest
,
LPSTR
szBuf
,
DWORD
sz
)
static
BOOL
WININET_GetProxyServer
(
HINTERNET
hRequest
,
LP
W
STR
szBuf
,
DWORD
sz
)
{
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hRequest
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPSTR
p
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LP
W
STR
p
;
if
(
NULL
==
lpwhr
)
return
FALSE
;
...
...
@@ -70,14 +70,14 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPSTR szBuf, DWORD sz )
if
(
NULL
==
lpwhs
)
return
FALSE
;
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
if
(
NULL
==
hIC
)
return
FALSE
;
strncpy
(
szBuf
,
hIC
->
lpszProxy
,
sz
);
strncpy
W
(
szBuf
,
hIC
->
lpszProxy
,
sz
);
/* FIXME: perhaps it would be better to use InternetCrackUrl here */
p
=
strchr
(
szBuf
,
':'
);
p
=
strchr
W
(
szBuf
,
':'
);
if
(
*
p
)
*
p
=
0
;
...
...
@@ -89,14 +89,15 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPSTR szBuf, DWORD sz )
*
* Determine the name of the (basic) Authentication realm
*/
static
BOOL
WININET_GetAuthRealm
(
HINTERNET
hRequest
,
LPSTR
szBuf
,
DWORD
sz
)
static
BOOL
WININET_GetAuthRealm
(
HINTERNET
hRequest
,
LP
W
STR
szBuf
,
DWORD
sz
)
{
LPSTR
p
,
q
;
LP
W
STR
p
,
q
;
DWORD
index
;
WCHAR
szRealm
[]
=
{
'r'
,
'e'
,
'a'
,
'l'
,
'm'
,
'='
,
0
};
/* extract the Realm from the proxy response and show it */
index
=
0
;
if
(
!
HttpQueryInfo
A
(
hRequest
,
HTTP_QUERY_PROXY_AUTHENTICATE
,
if
(
!
HttpQueryInfo
W
(
hRequest
,
HTTP_QUERY_PROXY_AUTHENTICATE
,
szBuf
,
&
sz
,
&
index
)
)
return
FALSE
;
...
...
@@ -104,21 +105,21 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPSTR szBuf, DWORD sz )
* FIXME: maybe we should check that we're
* dealing with 'Basic' Authentication
*/
p
=
strchr
(
szBuf
,
' '
);
if
(
p
&&
!
strncmp
(
p
+
1
,
"realm="
,
6
)
)
p
=
strchr
W
(
szBuf
,
' '
);
if
(
p
&&
!
strncmp
W
(
p
+
1
,
szRealm
,
strlenW
(
szRealm
)
)
)
{
/* remove quotes */
p
+=
7
;
if
(
*
p
==
'"'
)
{
p
++
;
q
=
strrchr
(
p
,
'"'
);
q
=
strrchr
W
(
p
,
'"'
);
if
(
q
)
*
q
=
0
;
}
}
strcpy
(
szBuf
,
p
);
strcpy
W
(
szBuf
,
p
);
return
TRUE
;
}
...
...
@@ -126,50 +127,62 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPSTR szBuf, DWORD sz )
/***********************************************************************
* WININET_GetSetPassword
*/
static
BOOL
WININET_GetSetPassword
(
HWND
hdlg
,
LPCSTR
szServer
,
LPCSTR
szRealm
,
BOOL
bSet
)
static
BOOL
WININET_GetSetPassword
(
HWND
hdlg
,
LPC
W
STR
szServer
,
LPC
W
STR
szRealm
,
BOOL
bSet
)
{
CHAR
szResource
[
0x80
],
szUserPass
[
0x40
];
LPSTR
p
;
W
CHAR
szResource
[
0x80
],
szUserPass
[
0x40
];
LP
W
STR
p
;
HWND
hUserItem
,
hPassItem
;
DWORD
r
,
dwMagic
=
19
;
UINT
len
;
UINT
r_len
,
u_
len
;
WORD
sz
;
WCHAR
szColon
[]
=
{
':'
,
0
},
szbs
[]
=
{
'/'
,
0
};
hUserItem
=
GetDlgItem
(
hdlg
,
IDC_USERNAME
);
hPassItem
=
GetDlgItem
(
hdlg
,
IDC_PASSWORD
);
/* now try fetch the username and password */
strcpy
(
szResource
,
szServer
);
strcat
(
szResource
,
"/"
);
strcat
(
szResource
,
szRealm
);
lstrcpyW
(
szResource
,
szServer
);
lstrcatW
(
szResource
,
szbs
);
lstrcatW
(
szResource
,
szRealm
);
/*
* WNetCachePassword is only concerned with the length
* of the data stored (which we tell it) and it does
* not use strlen() internally so we can add WCHAR data
* instead of ASCII data and get it back the same way.
*/
if
(
bSet
)
{
szUserPass
[
0
]
=
0
;
GetWindowTextA
(
hUserItem
,
szUserPass
,
sizeof
szUserPass
-
1
);
strcat
(
szUserPass
,
":"
);
len
=
strlen
(
szUserPass
);
GetWindowTextA
(
hPassItem
,
szUserPass
+
len
,
sizeof
szUserPass
-
len
);
r
=
WNetCachePassword
(
szResource
,
strlen
(
szResource
)
+
1
,
szUserPass
,
strlen
(
szUserPass
)
+
1
,
dwMagic
,
0
);
GetWindowTextW
(
hUserItem
,
szUserPass
,
(
sizeof
szUserPass
-
1
)
/
sizeof
(
WCHAR
)
);
lstrcatW
(
szUserPass
,
szColon
);
u_len
=
strlenW
(
szUserPass
);
GetWindowTextW
(
hPassItem
,
szUserPass
+
u_len
,
(
sizeof
szUserPass
)
/
sizeof
(
WCHAR
)
-
u_len
);
r_len
=
(
strlenW
(
szResource
)
+
1
)
*
sizeof
(
WCHAR
);
u_len
=
(
strlenW
(
szUserPass
)
+
1
)
*
sizeof
(
WCHAR
);
r
=
WNetCachePassword
(
(
CHAR
*
)
szResource
,
r_len
,
(
CHAR
*
)
szUserPass
,
u_len
,
dwMagic
,
0
);
return
(
r
==
WN_SUCCESS
);
}
sz
=
sizeof
szUserPass
;
r
=
WNetGetCachedPassword
(
szResource
,
strlen
(
szResource
)
+
1
,
szUserPass
,
&
sz
,
dwMagic
);
r_len
=
(
strlenW
(
szResource
)
+
1
)
*
sizeof
(
WCHAR
);
r
=
WNetGetCachedPassword
(
(
CHAR
*
)
szResource
,
r_len
,
(
CHAR
*
)
szUserPass
,
&
sz
,
dwMagic
);
if
(
r
!=
WN_SUCCESS
)
return
FALSE
;
p
=
strchr
(
szUserPass
,
':'
);
p
=
strchr
W
(
szUserPass
,
':'
);
if
(
p
)
{
*
p
=
0
;
SetWindowText
A
(
hUserItem
,
szUserPass
);
SetWindowText
A
(
hPassItem
,
p
+
1
);
SetWindowText
W
(
hUserItem
,
szUserPass
);
SetWindowText
W
(
hPassItem
,
p
+
1
);
}
return
TRUE
;
...
...
@@ -179,12 +192,12 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCSTR szServer,
* WININET_SetProxyAuthorization
*/
static
BOOL
WININET_SetProxyAuthorization
(
HINTERNET
hRequest
,
LP
STR
username
,
LP
STR
password
)
LP
WSTR
username
,
LPW
STR
password
)
{
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
hRequest
;
LPWININETHTTPSESSIONA
lpwhs
;
LPWININETAPPINFO
A
hIC
;
LPSTR
p
;
LPWININETAPPINFO
W
hIC
;
LP
W
STR
p
;
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
if
(
NULL
==
lpwhs
||
lpwhs
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
...
...
@@ -193,20 +206,20 @@ static BOOL WININET_SetProxyAuthorization( HINTERNET hRequest,
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
username
)
+
1
);
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
username
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
p
)
return
FALSE
;
strcpy
(
p
,
username
);
lstrcpyW
(
p
,
username
);
hIC
->
lpszProxyUsername
=
p
;
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
password
)
+
1
);
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
password
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
p
)
return
FALSE
;
strcpy
(
p
,
password
);
lstrcpyW
(
p
,
password
);
hIC
->
lpszProxyPassword
=
p
;
return
TRUE
;
...
...
@@ -220,7 +233,7 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
{
HWND
hitem
;
struct
WININET_ErrorDlgParams
*
params
;
CHAR
szRealm
[
0x80
],
szServer
[
0x80
];
W
CHAR
szRealm
[
0x80
],
szServer
[
0x80
];
if
(
uMsg
==
WM_INITDIALOG
)
{
...
...
@@ -232,18 +245,18 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
/* extract the Realm from the proxy response and show it */
if
(
WININET_GetAuthRealm
(
params
->
hRequest
,
szRealm
,
sizeof
szRealm
)
)
szRealm
,
sizeof
szRealm
/
sizeof
(
WCHAR
)
)
)
{
hitem
=
GetDlgItem
(
hdlg
,
IDC_REALM
);
SetWindowText
A
(
hitem
,
szRealm
);
SetWindowText
W
(
hitem
,
szRealm
);
}
/* extract the name of the proxy server */
if
(
WININET_GetProxyServer
(
params
->
hRequest
,
szServer
,
sizeof
szServer
)
)
szServer
,
sizeof
szServer
/
sizeof
(
WCHAR
)
)
)
{
hitem
=
GetDlgItem
(
hdlg
,
IDC_PROXY
);
SetWindowText
A
(
hitem
,
szServer
);
SetWindowText
W
(
hitem
,
szServer
);
}
WININET_GetSetPassword
(
hdlg
,
szServer
,
szRealm
,
FALSE
);
...
...
@@ -260,25 +273,25 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
if
(
wParam
==
IDOK
)
{
LPWININETHTTPREQA
lpwhr
=
(
LPWININETHTTPREQA
)
params
->
hRequest
;
CHAR
username
[
0x20
],
password
[
0x20
];
W
CHAR
username
[
0x20
],
password
[
0x20
];
username
[
0
]
=
0
;
hitem
=
GetDlgItem
(
hdlg
,
IDC_USERNAME
);
if
(
hitem
)
GetWindowText
A
(
hitem
,
username
,
sizeof
username
);
GetWindowText
W
(
hitem
,
username
,
sizeof
username
/
sizeof
(
WCHAR
)
);
password
[
0
]
=
0
;
hitem
=
GetDlgItem
(
hdlg
,
IDC_PASSWORD
);
if
(
hitem
)
GetWindowText
A
(
hitem
,
password
,
sizeof
password
);
GetWindowText
W
(
hitem
,
password
,
sizeof
password
/
sizeof
(
WCHAR
)
);
hitem
=
GetDlgItem
(
hdlg
,
IDC_SAVEPASSWORD
);
if
(
hitem
&&
SendMessage
A
(
hitem
,
BM_GETSTATE
,
0
,
0
)
&&
SendMessage
W
(
hitem
,
BM_GETSTATE
,
0
,
0
)
&&
WININET_GetAuthRealm
(
params
->
hRequest
,
szRealm
,
sizeof
szRealm
)
&&
szRealm
,
sizeof
szRealm
/
sizeof
(
WCHAR
)
)
&&
WININET_GetProxyServer
(
params
->
hRequest
,
szServer
,
sizeof
szServer
)
)
szServer
,
sizeof
szServer
/
sizeof
(
WCHAR
)
)
)
{
WININET_GetSetPassword
(
hdlg
,
szServer
,
szRealm
,
TRUE
);
}
...
...
@@ -302,17 +315,17 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
*/
static
INT
WININET_GetConnectionStatus
(
HINTERNET
hRequest
)
{
CHAR
szStatus
[
0x20
];
W
CHAR
szStatus
[
0x20
];
DWORD
sz
,
index
,
dwStatus
;
TRACE
(
"%p
\n
"
,
hRequest
);
sz
=
sizeof
szStatus
;
sz
=
sizeof
(
szStatus
)
/
sizeof
(
WCHAR
)
;
index
=
0
;
if
(
!
HttpQueryInfo
A
(
hRequest
,
HTTP_QUERY_STATUS_CODE
,
if
(
!
HttpQueryInfo
W
(
hRequest
,
HTTP_QUERY_STATUS_CODE
,
szStatus
,
&
sz
,
&
index
))
return
-
1
;
dwStatus
=
atoi
(
szStatus
);
dwStatus
=
atoi
W
(
szStatus
);
TRACE
(
"request %p status = %ld
\n
"
,
hRequest
,
dwStatus
);
...
...
dlls/wininet/ftp.c
View file @
09d2d477
...
...
@@ -158,7 +158,7 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
LPCSTR
lpszNewRemoteFile
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -167,7 +167,7 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -204,7 +204,7 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
{
HANDLE
hFile
=
NULL
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
INT
nResCode
;
...
...
@@ -228,7 +228,7 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
goto
lend
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
lpfnStatusCB
)
hIC
->
lpfnStatusCB
(
hConnect
,
lpwfs
->
hdr
.
dwContext
,
INTERNET_STATUS_SENDING_REQUEST
,
NULL
,
0
);
...
...
@@ -287,7 +287,7 @@ lend:
BOOL
WINAPI
FtpSetCurrentDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -298,7 +298,7 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
TRACE
(
"lpszDirectory(%s)
\n
"
,
lpszDirectory
);
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -360,7 +360,7 @@ BOOL WINAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory
{
INT
nResCode
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
DWORD
bSuccess
=
FALSE
;
TRACE
(
"lpszDirectory(%s)
\n
"
,
lpszDirectory
);
...
...
@@ -375,7 +375,7 @@ BOOL WINAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory
/* Clear any error information */
INTERNET_SetLastError
(
0
);
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
!
FTP_SendCommand
(
lpwfs
->
sndSocket
,
FTP_CMD_CWD
,
lpszDirectory
,
hIC
->
lpfnStatusCB
,
hConnect
,
lpwfs
->
hdr
.
dwContext
))
goto
lend
;
...
...
@@ -418,7 +418,7 @@ lend:
BOOL
WINAPI
FtpCreateDirectoryA
(
HINTERNET
hConnect
,
LPCSTR
lpszDirectory
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -427,7 +427,7 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -489,7 +489,7 @@ BOOL WINAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
{
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"
\n
"
);
...
...
@@ -518,7 +518,7 @@ BOOL WINAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
}
lend:
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
&&
hIC
->
lpfnStatusCB
)
{
INTERNET_ASYNC_RESULT
iar
;
...
...
@@ -547,7 +547,7 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
LPCSTR
lpszSearchFile
,
LPWIN32_FIND_DATAA
lpFindFileData
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -556,7 +556,7 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -613,7 +613,7 @@ HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
LPCSTR
lpszSearchFile
,
LPWIN32_FIND_DATAA
lpFindFileData
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
INT
nResCode
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
HINTERNET
hFindNext
=
NULL
;
...
...
@@ -638,7 +638,7 @@ HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
if
(
!
FTP_SendPortOrPasv
(
lpwfs
))
goto
lend
;
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
!
FTP_SendCommand
(
lpwfs
->
sndSocket
,
FTP_CMD_LIST
,
lpszSearchFile
,
hIC
->
lpfnStatusCB
,
hConnect
,
lpwfs
->
hdr
.
dwContext
))
goto
lend
;
...
...
@@ -708,7 +708,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
LPDWORD
lpdwCurrentDirectory
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
TRACE
(
"len(%ld)
\n
"
,
*
lpdwCurrentDirectory
);
...
...
@@ -719,7 +719,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -774,7 +774,7 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrent
{
INT
nResCode
;
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
DWORD
bSuccess
=
FALSE
;
TRACE
(
"len(%ld)
\n
"
,
*
lpdwCurrentDirectory
);
...
...
@@ -791,7 +791,7 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrent
ZeroMemory
(
lpszCurrentDirectory
,
*
lpdwCurrentDirectory
);
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
!
FTP_SendCommand
(
lpwfs
->
sndSocket
,
FTP_CMD_PWD
,
NULL
,
hIC
->
lpfnStatusCB
,
hFtpSession
,
lpwfs
->
hdr
.
dwContext
))
goto
lend
;
...
...
@@ -855,7 +855,7 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
DWORD
dwContext
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -869,7 +869,7 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -929,7 +929,7 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
INT
nDataSocket
;
BOOL
bSuccess
=
FALSE
;
LPWININETFILE
lpwh
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
HINTERNET
handle
=
NULL
;
...
...
@@ -975,7 +975,7 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
if
(
lpwfs
->
lstnSocket
!=
-
1
)
close
(
lpwfs
->
lstnSocket
);
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
&&
hIC
->
lpfnStatusCB
)
{
INTERNET_ASYNC_RESULT
iar
;
...
...
@@ -1013,7 +1013,7 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
DWORD
dwContext
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hInternet
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -1027,7 +1027,7 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -1089,7 +1089,7 @@ BOOL WINAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR l
DWORD
nBytes
;
BOOL
bSuccess
=
FALSE
;
HANDLE
hFile
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"lpszRemoteFile(%s) lpszNewFile(%s)
\n
"
,
lpszRemoteFile
,
lpszNewFile
);
...
...
@@ -1144,7 +1144,7 @@ lend:
if
(
hFile
)
CloseHandle
(
hFile
);
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
&&
hIC
->
lpfnStatusCB
)
{
INTERNET_ASYNC_RESULT
iar
;
...
...
@@ -1172,7 +1172,7 @@ lend:
BOOL
WINAPI
FtpDeleteFileA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszFileName
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -1181,7 +1181,7 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -1215,7 +1215,7 @@ BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
{
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"0x%08lx
\n
"
,
(
ULONG
)
hFtpSession
);
...
...
@@ -1243,7 +1243,7 @@ BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
FTP_SetResponseError
(
nResCode
);
}
lend:
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
&&
hIC
->
lpfnStatusCB
)
{
INTERNET_ASYNC_RESULT
iar
;
...
...
@@ -1271,7 +1271,7 @@ lend:
BOOL
WINAPI
FtpRemoveDirectoryA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszDirectory
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -1280,7 +1280,7 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -1314,7 +1314,7 @@ BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
{
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"
\n
"
);
...
...
@@ -1343,7 +1343,7 @@ BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
}
lend:
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
&&
hIC
->
lpfnStatusCB
)
{
INTERNET_ASYNC_RESULT
iar
;
...
...
@@ -1371,7 +1371,7 @@ lend:
BOOL
WINAPI
FtpRenameFileA
(
HINTERNET
hFtpSession
,
LPCSTR
lpszSrc
,
LPCSTR
lpszDest
)
{
LPWININETFTPSESSIONA
lpwfs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
lpwfs
=
(
LPWININETFTPSESSIONA
)
WININET_GetObject
(
hFtpSession
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -1380,7 +1380,7 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
WORKREQUEST
workRequest
;
...
...
@@ -1414,7 +1414,7 @@ BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest)
{
INT
nResCode
;
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
;
TRACE
(
"
\n
"
);
...
...
@@ -1449,7 +1449,7 @@ BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest)
FTP_SetResponseError
(
nResCode
);
lend:
hIC
=
(
LPWININETAPPINFO
A
)
lpwfs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwfs
->
hdr
.
lpwhparent
;
if
(
hIC
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
&&
hIC
->
lpfnStatusCB
)
{
INTERNET_ASYNC_RESULT
iar
;
...
...
@@ -1482,7 +1482,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
struct
sockaddr_in
socketAddr
;
struct
hostent
*
phe
=
NULL
;
INT
nsocket
=
-
1
,
sock_namelen
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
BOOL
bSuccess
=
FALSE
;
LPWININETFTPSESSIONA
lpwfs
=
NULL
;
HINTERNET
handle
=
NULL
;
...
...
@@ -1491,7 +1491,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
(
ULONG
)
hInternet
,
lpszServerName
,
nServerPort
,
lpszUserName
,
lpszPassword
);
hIC
=
(
LPWININETAPPINFO
A
)
WININET_GetObject
(
hInternet
);
hIC
=
(
LPWININETAPPINFO
W
)
WININET_GetObject
(
hInternet
);
if
(
(
hIC
==
NULL
)
||
(
hIC
->
hdr
.
htype
!=
WH_HINIT
)
)
goto
lerror
;
...
...
dlls/wininet/http.c
View file @
09d2d477
...
...
@@ -205,7 +205,7 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
DWORD
dwFlags
,
DWORD
dwContext
)
{
LPWININETHTTPSESSIONA
lpwhs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
HINTERNET
handle
=
NULL
;
TRACE
(
"(%p, %s, %s, %s, %s, %p, %08lx, %08lx)
\n
"
,
hHttpSession
,
...
...
@@ -225,7 +225,7 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
return
NULL
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
/*
* My tests seem to show that the windows version does not
...
...
@@ -381,7 +381,7 @@ end:
/***********************************************************************
* HTTP_Base64
*/
static
UINT
HTTP_Base64
(
LPC
STR
bin
,
LP
STR
base64
)
static
UINT
HTTP_Base64
(
LPC
WSTR
bin
,
LPW
STR
base64
)
{
UINT
n
=
0
,
x
;
static
LPSTR
HTTP_Base64Enc
=
...
...
@@ -426,26 +426,28 @@ static UINT HTTP_Base64( LPCSTR bin, LPSTR base64 )
*
* Encode the basic authentication string for HTTP 1.1
*/
static
LP
STR
HTTP_EncodeBasicAuth
(
LPCSTR
username
,
LPC
STR
password
)
static
LP
WSTR
HTTP_EncodeBasicAuth
(
LPCWSTR
username
,
LPCW
STR
password
)
{
UINT
len
;
LPSTR
in
,
out
,
szBasic
=
"Basic "
;
LPWSTR
in
,
out
;
WCHAR
szBasic
[]
=
{
'B'
,
'a'
,
's'
,
'i'
,
'c'
,
' '
,
0
};
WCHAR
szColon
[]
=
{
':'
,
0
};
len
=
strlen
(
username
)
+
1
+
strlen
(
password
)
+
1
;
in
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
len
=
lstrlenW
(
username
)
+
1
+
lstrlenW
(
password
)
+
1
;
in
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
in
)
return
NULL
;
len
=
strlen
(
szBasic
)
+
(
strlen
(
username
)
+
1
+
strlen
(
password
))
*
2
+
1
+
1
;
len
=
lstrlenW
(
szBasic
)
+
(
lstrlenW
(
username
)
+
1
+
lstrlenW
(
password
))
*
2
+
1
+
1
;
out
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
out
)
{
strcpy
(
in
,
username
);
strcat
(
in
,
":"
);
strcat
(
in
,
password
);
strcpy
(
out
,
szBasic
);
HTTP_Base64
(
in
,
&
out
[
strlen
(
out
)]
);
lstrcpyW
(
in
,
username
);
lstrcatW
(
in
,
szColon
);
lstrcatW
(
in
,
password
);
lstrcpyW
(
out
,
szBasic
);
HTTP_Base64
(
in
,
&
out
[
strlen
W
(
out
)]
);
}
HeapFree
(
GetProcessHeap
(),
0
,
in
);
...
...
@@ -458,13 +460,19 @@ static LPSTR HTTP_EncodeBasicAuth( LPCSTR username, LPCSTR password)
* Insert the basic authorization field in the request header
*/
BOOL
HTTP_InsertProxyAuthorization
(
LPWININETHTTPREQA
lpwhr
,
LPC
STR
username
,
LPC
STR
password
)
LPC
WSTR
username
,
LPCW
STR
password
)
{
HTTPHEADERA
hdr
;
INT
index
;
INT
index
,
len
;
LPWSTR
authW
;
authW
=
HTTP_EncodeBasicAuth
(
username
,
password
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
authW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
hdr
.
lpszValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
WideCharToMultiByte
(
CP_ACP
,
0
,
authW
,
-
1
,
hdr
.
lpszValue
,
len
,
NULL
,
NULL
);
hdr
.
lpszField
=
"Proxy-Authorization"
;
hdr
.
lpszValue
=
HTTP_EncodeBasicAuth
(
username
,
password
);
hdr
.
wFlags
=
HDR_ISREQUEST
;
hdr
.
wCount
=
0
;
if
(
!
hdr
.
lpszValue
)
...
...
@@ -480,6 +488,7 @@ BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQA lpwhr,
HTTP_InsertCustomHeader
(
lpwhr
,
&
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
hdr
.
lpszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
authW
);
return
TRUE
;
}
...
...
@@ -487,7 +496,7 @@ BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQA lpwhr,
/***********************************************************************
* HTTP_DealWithProxy
*/
static
BOOL
HTTP_DealWithProxy
(
LPWININETAPPINFO
A
hIC
,
static
BOOL
HTTP_DealWithProxy
(
LPWININETAPPINFO
W
hIC
,
LPWININETHTTPSESSIONA
lpwhs
,
LPWININETHTTPREQA
lpwhr
)
{
char
buf
[
MAXHOSTNAME
];
...
...
@@ -500,10 +509,11 @@ static BOOL HTTP_DealWithProxy( LPWININETAPPINFOA hIC,
UrlComponents
.
lpszHostName
=
buf
;
UrlComponents
.
dwHostNameLength
=
MAXHOSTNAME
;
if
(
strncasecmp
(
hIC
->
lpszProxy
,
"http://"
,
strlen
(
"http://"
)))
sprintf
(
proxy
,
"http://%s/"
,
hIC
->
lpszProxy
);
WideCharToMultiByte
(
CP_ACP
,
0
,
hIC
->
lpszProxy
,
-
1
,
buf
,
sizeof
buf
,
NULL
,
NULL
);
if
(
strncasecmp
(
buf
,
"http://"
,
strlen
(
"http://"
)))
sprintf
(
proxy
,
"http://%s/"
,
buf
);
else
strcpy
(
proxy
,
hIC
->
lpszProxy
);
strcpy
(
proxy
,
buf
);
if
(
!
InternetCrackUrlA
(
proxy
,
0
,
0
,
&
UrlComponents
)
)
return
FALSE
;
if
(
UrlComponents
.
dwHostNameLength
==
0
)
...
...
@@ -551,7 +561,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
DWORD
dwFlags
,
DWORD
dwContext
)
{
LPWININETHTTPSESSIONA
lpwhs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETHTTPREQA
lpwhr
;
LPSTR
lpszCookies
;
LPSTR
lpszUrl
=
NULL
;
...
...
@@ -567,7 +577,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
return
NULL
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
lpwhr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WININETHTTPREQA
));
if
(
NULL
==
lpwhr
)
...
...
@@ -641,8 +651,16 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
if
(
hIC
->
lpszAgent
)
{
char
*
agent_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
hIC
->
lpszAgent
)
+
1
+
14
);
sprintf
(
agent_header
,
"User-Agent: %s
\r\n
"
,
hIC
->
lpszAgent
);
int
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
hIC
->
lpszAgent
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
char
*
agent_header
,
*
user_agent
=
"User-Agent: "
;
agent_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
user_agent
)
+
len
+
3
);
strcpy
(
agent_header
,
user_agent
);
WideCharToMultiByte
(
CP_ACP
,
0
,
hIC
->
lpszAgent
,
-
1
,
agent_header
+
strlen
(
user_agent
),
len
,
NULL
,
NULL
);
strcat
(
agent_header
,
"
\r\n
"
);
HttpAddRequestHeadersA
(
handle
,
agent_header
,
strlen
(
agent_header
),
HTTP_ADDREQ_FLAG_ADD
);
HeapFree
(
GetProcessHeap
(),
0
,
agent_header
);
...
...
@@ -1071,7 +1089,7 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
{
LPWININETHTTPREQA
lpwhr
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
TRACE
(
"%p, %p (%s), %li, %p, %li)
\n
"
,
hHttpRequest
,
lpszHeaders
,
debugstr_a
(
lpszHeaders
),
dwHeaderLength
,
lpOptional
,
dwOptionalLength
);
...
...
@@ -1090,7 +1108,7 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
if
(
NULL
==
hIC
||
hIC
->
hdr
.
htype
!=
WH_HINIT
)
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
...
@@ -1162,7 +1180,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQA lpwhr, LPCSTR lpszUrl, LPCSTR
DWORD
dwHeaderLength
,
LPVOID
lpOptional
,
DWORD
dwOptionalLength
)
{
LPWININETHTTPSESSIONA
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
LPWININETAPPINFO
A
hIC
=
(
LPWININETAPPINFOA
)
lpwhs
->
hdr
.
lpwhparent
;
LPWININETAPPINFO
W
hIC
=
(
LPWININETAPPINFOW
)
lpwhs
->
hdr
.
lpwhparent
;
char
path
[
2048
];
HINTERNET
handle
;
...
...
@@ -1295,7 +1313,7 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
INT
headerLength
=
0
;
LPWININETHTTPREQA
lpwhr
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
BOOL
loop_next
=
FALSE
;
int
CustHeaderIndex
;
...
...
@@ -1316,7 +1334,7 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
return
FALSE
;
}
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
if
(
NULL
==
hIC
||
hIC
->
hdr
.
htype
!=
WH_HINIT
)
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
...
@@ -1689,13 +1707,13 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
LPCSTR
lpszPassword
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
HINTERNET
handle
=
NULL
;
TRACE
(
"-->
\n
"
);
hIC
=
(
LPWININETAPPINFO
A
)
WININET_GetObject
(
hInternet
);
hIC
=
(
LPWININETAPPINFO
W
)
WININET_GetObject
(
hInternet
);
if
(
(
hIC
==
NULL
)
||
(
hIC
->
hdr
.
htype
!=
WH_HINIT
)
)
goto
lerror
;
...
...
@@ -1728,7 +1746,7 @@ HINTERNET HTTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
lpwhs
->
hdr
.
dwFlags
=
dwFlags
;
lpwhs
->
hdr
.
dwContext
=
dwContext
;
if
(
hIC
->
lpszProxy
&&
hIC
->
dwAccessType
==
INTERNET_OPEN_TYPE_PROXY
)
{
if
(
strchr
(
hIC
->
lpszProxy
,
' '
))
if
(
strchr
W
(
hIC
->
lpszProxy
,
' '
))
FIXME
(
"Several proxies not implemented.
\n
"
);
if
(
hIC
->
lpszProxyBypass
)
FIXME
(
"Proxy bypass is ignored.
\n
"
);
...
...
@@ -1785,7 +1803,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQA lpwhr)
{
BOOL
bSuccess
=
FALSE
;
LPWININETHTTPSESSIONA
lpwhs
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
TRACE
(
"-->
\n
"
);
...
...
@@ -1798,7 +1816,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQA lpwhr)
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
SendAsyncCallback
(
hIC
,
lpwhr
,
lpwhr
->
hdr
.
dwContext
,
INTERNET_STATUS_CONNECTING_TO_SERVER
,
&
(
lpwhs
->
socketAddress
),
...
...
@@ -2202,14 +2220,14 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQA lpwhr)
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
HINTERNET
handle
;
TRACE
(
"%p
\n
"
,
lpwhr
);
handle
=
WININET_FindHandle
(
&
lpwhr
->
hdr
);
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
SendAsyncCallback
(
hIC
,
lpwhr
,
lpwhr
->
hdr
.
dwContext
,
INTERNET_STATUS_CLOSING_CONNECTION
,
0
,
0
);
...
...
@@ -2234,7 +2252,7 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
{
int
i
;
LPWININETHTTPSESSIONA
lpwhs
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
HINTERNET
handle
;
TRACE
(
"
\n
"
);
...
...
@@ -2244,7 +2262,7 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
handle
=
WININET_FindHandle
(
&
lpwhr
->
hdr
);
lpwhs
=
(
LPWININETHTTPSESSIONA
)
lpwhr
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
SendAsyncCallback
(
hIC
,
handle
,
lpwhr
->
hdr
.
dwContext
,
INTERNET_STATUS_HANDLE_CLOSING
,
lpwhr
,
...
...
@@ -2286,12 +2304,12 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
*/
void
HTTP_CloseHTTPSessionHandle
(
LPWININETHTTPSESSIONA
lpwhs
)
{
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
HINTERNET
handle
;
TRACE
(
"%p
\n
"
,
lpwhs
);
hIC
=
(
LPWININETAPPINFO
A
)
lpwhs
->
hdr
.
lpwhparent
;
hIC
=
(
LPWININETAPPINFO
W
)
lpwhs
->
hdr
.
lpwhparent
;
handle
=
WININET_FindHandle
(
&
lpwhs
->
hdr
);
SendAsyncCallback
(
hIC
,
handle
,
lpwhs
->
hdr
.
dwContext
,
...
...
dlls/wininet/internet.c
View file @
09d2d477
...
...
@@ -72,7 +72,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
#define RESPONSE_TIMEOUT 30
#define GET_HWININET_FROM_LPWININETFINDNEXT(lpwh) \
(LPWININETAPPINFO
A
)(((LPWININETFTPSESSIONA)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
(LPWININETAPPINFO
W
)(((LPWININETFTPSESSIONA)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
typedef
struct
...
...
@@ -336,12 +336,13 @@ BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl,
* The proxy may be specified in the form 'http=proxy.my.org'
* Presumably that means there can be ftp=ftpproxy.my.org too.
*/
static
BOOL
INTERNET_ConfigureProxyFromReg
(
LPWININETAPPINFO
A
lpwai
)
static
BOOL
INTERNET_ConfigureProxyFromReg
(
LPWININETAPPINFO
W
lpwai
)
{
HKEY
key
;
DWORD
r
,
keytype
,
len
,
enabled
;
LPSTR
lpszInternetSettings
=
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Internet Settings"
;
WCHAR
szProxyServer
[]
=
{
'P'
,
'r'
,
'o'
,
'x'
,
'y'
,
'S'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,
0
};
r
=
RegOpenKeyA
(
HKEY_CURRENT_USER
,
lpszInternetSettings
,
&
key
);
if
(
r
!=
ERROR_SUCCESS
)
...
...
@@ -355,31 +356,32 @@ static BOOL INTERNET_ConfigureProxyFromReg( LPWININETAPPINFOA lpwai )
TRACE
(
"Proxy is enabled.
\n
"
);
/* figure out how much memory the proxy setting takes */
r
=
RegQueryValueEx
A
(
key
,
"ProxyServer"
,
NULL
,
&
keytype
,
r
=
RegQueryValueEx
W
(
key
,
szProxyServer
,
NULL
,
&
keytype
,
NULL
,
&
len
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
len
&&
(
keytype
==
REG_SZ
)
)
{
LPSTR
szProxy
,
p
,
szHttp
=
"http="
;
LPWSTR
szProxy
,
p
;
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
'='
,
0
};
szProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
);
RegQueryValueEx
A
(
key
,
"ProxyServer"
,
NULL
,
&
keytype
,
szProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
RegQueryValueEx
W
(
key
,
szProxyServer
,
NULL
,
&
keytype
,
(
BYTE
*
)
szProxy
,
&
len
);
/* find the http proxy, and strip away everything else */
p
=
strstr
(
szProxy
,
szHttp
);
p
=
strstr
W
(
szProxy
,
szHttp
);
if
(
p
)
{
p
+=
strlen
(
szHttp
);
strcpy
(
szProxy
,
p
);
p
+=
lstrlenW
(
szHttp
);
lstrcpyW
(
szProxy
,
p
);
}
p
=
strchr
(
szProxy
,
' '
);
p
=
strchr
W
(
szProxy
,
' '
);
if
(
p
)
*
p
=
0
;
lpwai
->
dwAccessType
=
INTERNET_OPEN_TYPE_PROXY
;
lpwai
->
lpszProxy
=
szProxy
;
TRACE
(
"http proxy = %s
\n
"
,
lpwai
->
lpszProxy
);
TRACE
(
"http proxy = %s
\n
"
,
debugstr_w
(
lpwai
->
lpszProxy
)
);
}
else
ERR
(
"Couldn't read proxy server settings.
\n
"
);
...
...
@@ -401,10 +403,10 @@ static BOOL INTERNET_ConfigureProxyFromReg( LPWININETAPPINFOA lpwai )
* NULL on failure
*
*/
HINTERNET
WINAPI
InternetOpen
A
(
LPC
STR
lpszAgent
,
DWORD
dwAccessType
,
LPC
STR
lpszProxy
,
LPC
STR
lpszProxyBypass
,
DWORD
dwFlags
)
HINTERNET
WINAPI
InternetOpen
W
(
LPCW
STR
lpszAgent
,
DWORD
dwAccessType
,
LPC
WSTR
lpszProxy
,
LPCW
STR
lpszProxyBypass
,
DWORD
dwFlags
)
{
LPWININETAPPINFO
A
lpwai
=
NULL
;
LPWININETAPPINFO
W
lpwai
=
NULL
;
HINTERNET
handle
=
NULL
;
if
(
TRACE_ON
(
wininet
))
{
...
...
@@ -425,8 +427,8 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
const
char
*
access_type_str
=
"Unknown"
;
DWORD
flag_val
=
dwFlags
;
TRACE
(
"(%s, %li, %s, %s, %li)
\n
"
,
debugstr_
a
(
lpszAgent
),
dwAccessType
,
debugstr_
a
(
lpszProxy
),
debugstr_a
(
lpszProxyBypass
),
dwFlags
);
TRACE
(
"(%s, %li, %s, %s, %li)
\n
"
,
debugstr_
w
(
lpszAgent
),
dwAccessType
,
debugstr_
w
(
lpszProxy
),
debugstr_w
(
lpszProxyBypass
),
dwFlags
);
for
(
i
=
0
;
i
<
(
sizeof
(
access_type
)
/
sizeof
(
access_type
[
0
]));
i
++
)
{
if
(
access_type
[
i
].
val
==
dwAccessType
)
{
access_type_str
=
access_type
[
i
].
name
;
...
...
@@ -448,14 +450,14 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
/* Clear any error information */
INTERNET_SetLastError
(
0
);
lpwai
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WININETAPPINFO
A
));
lpwai
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WININETAPPINFO
W
));
if
(
NULL
==
lpwai
)
{
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
goto
lend
;
}
memset
(
lpwai
,
0
,
sizeof
(
WININETAPPINFO
A
));
memset
(
lpwai
,
0
,
sizeof
(
WININETAPPINFO
W
));
lpwai
->
hdr
.
htype
=
WH_HINIT
;
lpwai
->
hdr
.
lpwhparent
=
NULL
;
lpwai
->
hdr
.
dwFlags
=
dwFlags
;
...
...
@@ -474,26 +476,26 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
if
(
NULL
!=
lpszAgent
)
{
lpwai
->
lpszAgent
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpszAgent
)
+
1
);
(
strlenW
(
lpszAgent
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
lpwai
->
lpszAgent
)
strcpy
(
lpwai
->
lpszAgent
,
lpszAgent
);
lstrcpyW
(
lpwai
->
lpszAgent
,
lpszAgent
);
}
if
(
dwAccessType
==
INTERNET_OPEN_TYPE_PRECONFIG
)
INTERNET_ConfigureProxyFromReg
(
lpwai
);
else
if
(
NULL
!=
lpszProxy
)
{
lpwai
->
lpszProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpszProxy
)
+
1
);
(
strlenW
(
lpszProxy
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
lpwai
->
lpszProxy
)
strcpy
(
lpwai
->
lpszProxy
,
lpszProxy
);
lstrcpyW
(
lpwai
->
lpszProxy
,
lpszProxy
);
}
if
(
NULL
!=
lpszProxyBypass
)
{
lpwai
->
lpszProxyBypass
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpszProxyBypass
)
+
1
);
(
strlenW
(
lpszProxyBypass
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
lpwai
->
lpszProxyBypass
)
strcpy
(
lpwai
->
lpszProxyBypass
,
lpszProxyBypass
);
lstrcpyW
(
lpwai
->
lpszProxyBypass
,
lpszProxyBypass
);
}
lend:
...
...
@@ -513,41 +515,44 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
* NULL on failure
*
*/
HINTERNET
WINAPI
InternetOpen
W
(
LPCW
STR
lpszAgent
,
DWORD
dwAccessType
,
LPC
WSTR
lpszProxy
,
LPCW
STR
lpszProxyBypass
,
DWORD
dwFlags
)
HINTERNET
WINAPI
InternetOpen
A
(
LPC
STR
lpszAgent
,
DWORD
dwAccessType
,
LPC
STR
lpszProxy
,
LPC
STR
lpszProxyBypass
,
DWORD
dwFlags
)
{
HINTERNET
rc
=
(
HINTERNET
)
NULL
;
INT
lenAgent
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszAgent
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
INT
lenProxy
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszProxy
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
INT
lenBypass
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszProxyBypass
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
CHAR
*
szAgent
=
(
CHAR
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
lenAgent
*
sizeof
(
CHAR
));
CHAR
*
szProxy
=
(
CHAR
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
lenProxy
*
sizeof
(
CHAR
));
CHAR
*
szBypass
=
(
CHAR
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
lenBypass
*
sizeof
(
CHAR
));
INT
len
;
WCHAR
*
szAgent
=
NULL
,
*
szProxy
=
NULL
,
*
szBypass
=
NULL
;
TRACE
(
"(%s, 0x%08lx, %s, %s, 0x%08lx)
\n
"
,
debugstr_w
(
lpszAgent
),
dwAccessType
,
debugstr_w
(
lpszProxy
),
debugstr_w
(
lpszProxyBypass
),
dwFlags
);
TRACE
(
"(%s, 0x%08lx, %s, %s, 0x%08lx)
\n
"
,
debugstr_a
(
lpszAgent
),
dwAccessType
,
debugstr_a
(
lpszProxy
),
debugstr_a
(
lpszProxyBypass
),
dwFlags
);
if
(
!
szAgent
||
!
szProxy
||
!
szBypass
)
if
(
lpszAgent
)
{
if
(
szAgent
)
HeapFree
(
GetProcessHeap
(),
0
,
szAgent
);
if
(
szProxy
)
HeapFree
(
GetProcessHeap
(),
0
,
szProxy
);
if
(
szBypass
)
HeapFree
(
GetProcessHeap
(),
0
,
szBypass
);
return
(
HINTERNET
)
NULL
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszAgent
,
-
1
,
NULL
,
0
);
szAgent
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszAgent
,
-
1
,
szAgent
,
len
);
}
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszAgent
,
-
1
,
szAgent
,
lenAgent
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszProxy
,
-
1
,
szProxy
,
lenProxy
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszProxyBypass
,
-
1
,
szBypass
,
lenBypass
,
NULL
,
NULL
);
if
(
lpszProxy
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszProxy
,
-
1
,
NULL
,
0
);
szProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszProxy
,
-
1
,
szProxy
,
len
);
}
if
(
lpszProxyBypass
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszProxyBypass
,
-
1
,
NULL
,
0
);
szBypass
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszProxyBypass
,
-
1
,
szBypass
,
len
);
}
rc
=
InternetOpen
A
(
szAgent
,
dwAccessType
,
szProxy
,
szBypass
,
dwFlags
);
rc
=
InternetOpen
W
(
szAgent
,
dwAccessType
,
szProxy
,
szBypass
,
dwFlags
);
if
(
szAgent
)
HeapFree
(
GetProcessHeap
(),
0
,
szAgent
);
if
(
szProxy
)
HeapFree
(
GetProcessHeap
(),
0
,
szProxy
);
if
(
szBypass
)
HeapFree
(
GetProcessHeap
(),
0
,
szBypass
);
return
rc
;
...
...
@@ -749,7 +754,7 @@ HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
*/
BOOL
WINAPI
InternetFindNextFileA
(
HINTERNET
hFind
,
LPVOID
lpvFindData
)
{
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWININETFINDNEXTA
lpwh
;
TRACE
(
"
\n
"
);
...
...
@@ -794,7 +799,7 @@ BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
BOOL
WINAPI
INTERNET_FindNextFileA
(
HINTERNET
hFind
,
LPVOID
lpvFindData
)
{
BOOL
bSuccess
=
TRUE
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
LPWIN32_FIND_DATAA
lpFindFileData
;
LPWININETFINDNEXTA
lpwh
;
...
...
@@ -863,7 +868,7 @@ lend:
* Void
*
*/
VOID
INTERNET_CloseHandle
(
LPWININETAPPINFO
A
lpwai
)
VOID
INTERNET_CloseHandle
(
LPWININETAPPINFO
W
lpwai
)
{
TRACE
(
"%p
\n
"
,
lpwai
);
...
...
@@ -921,7 +926,7 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
switch
(
lpwh
->
htype
)
{
case
WH_HINIT
:
INTERNET_CloseHandle
((
LPWININETAPPINFO
A
)
lpwh
);
INTERNET_CloseHandle
((
LPWININETAPPINFO
W
)
lpwh
);
retval
=
TRUE
;
break
;
...
...
@@ -1461,9 +1466,9 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
HINTERNET
hInternet
,
INTERNET_STATUS_CALLBACK
lpfnIntCB
)
{
INTERNET_STATUS_CALLBACK
retVal
;
LPWININETAPPINFO
A
lpwai
;
LPWININETAPPINFO
W
lpwai
;
lpwai
=
(
LPWININETAPPINFO
A
)
WININET_GetObject
(
hInternet
);
lpwai
=
(
LPWININETAPPINFO
W
)
WININET_GetObject
(
hInternet
);
if
(
!
lpwai
)
return
NULL
;
...
...
@@ -2126,12 +2131,12 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
LPCSTR
lpszHeaders
,
DWORD
dwHeadersLength
,
DWORD
dwFlags
,
DWORD
dwContext
)
{
HINTERNET
ret
=
NULL
;
LPWININETAPPINFO
A
hIC
=
NULL
;
LPWININETAPPINFO
W
hIC
=
NULL
;
TRACE
(
"(%p, %s, %s, %08lx, %08lx, %08lx
\n
"
,
hInternet
,
debugstr_a
(
lpszUrl
),
debugstr_a
(
lpszHeaders
),
dwHeadersLength
,
dwFlags
,
dwContext
);
hIC
=
(
LPWININETAPPINFO
A
)
WININET_GetObject
(
hInternet
);
hIC
=
(
LPWININETAPPINFO
W
)
WININET_GetObject
(
hInternet
);
if
(
NULL
==
hIC
||
hIC
->
hdr
.
htype
!=
WH_HINIT
)
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
goto
lend
;
...
...
dlls/wininet/internet.h
View file @
09d2d477
...
...
@@ -85,14 +85,14 @@ typedef struct _WININETHANDLEHEADER
typedef
struct
{
WININETHANDLEHEADER
hdr
;
LPSTR
lpszAgent
;
LPSTR
lpszProxy
;
LPSTR
lpszProxyBypass
;
LPSTR
lpszProxyUsername
;
LPSTR
lpszProxyPassword
;
LP
W
STR
lpszAgent
;
LP
W
STR
lpszProxy
;
LP
W
STR
lpszProxyBypass
;
LP
W
STR
lpszProxyUsername
;
LP
W
STR
lpszProxyPassword
;
DWORD
dwAccessType
;
INTERNET_STATUS_CALLBACK
lpfnStatusCB
;
}
WININETAPPINFO
A
,
*
LPWININETAPPINFOA
;
}
WININETAPPINFO
W
,
*
LPWININETAPPINFOW
;
typedef
struct
...
...
@@ -382,16 +382,16 @@ INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
void
HTTP_CloseHTTPSessionHandle
(
LPWININETHTTPSESSIONA
lpwhs
);
void
HTTP_CloseHTTPRequestHandle
(
LPWININETHTTPREQA
lpwhr
);
VOID
SendAsyncCallback
(
LPWININETAPPINFO
A
hIC
,
HINTERNET
hHttpSession
,
VOID
SendAsyncCallback
(
LPWININETAPPINFO
W
hIC
,
HINTERNET
hHttpSession
,
DWORD
dwContext
,
DWORD
dwInternetStatus
,
LPVOID
lpvStatusInfo
,
DWORD
dwStatusInfoLength
);
VOID
SendAsyncCallbackInt
(
LPWININETAPPINFO
A
hIC
,
HINTERNET
hHttpSession
,
VOID
SendAsyncCallbackInt
(
LPWININETAPPINFO
W
hIC
,
HINTERNET
hHttpSession
,
DWORD
dwContext
,
DWORD
dwInternetStatus
,
LPVOID
lpvStatusInfo
,
DWORD
dwStatusInfoLength
);
BOOL
HTTP_InsertProxyAuthorization
(
LPWININETHTTPREQA
lpwhr
,
LPC
STR
username
,
LPC
STR
password
);
LPC
WSTR
username
,
LPCW
STR
password
);
BOOL
NETCON_connected
(
WININET_NETCONNECTION
*
connection
);
void
NETCON_init
(
WININET_NETCONNECTION
*
connnection
,
BOOL
useSSL
);
...
...
dlls/wininet/utility.c
View file @
09d2d477
...
...
@@ -212,7 +212,7 @@ static const char *get_callback_name(DWORD dwInternetStatus) {
return
"Unknown"
;
}
VOID
SendAsyncCallbackInt
(
LPWININETAPPINFO
A
hIC
,
HINTERNET
hHttpSession
,
VOID
SendAsyncCallbackInt
(
LPWININETAPPINFO
W
hIC
,
HINTERNET
hHttpSession
,
DWORD
dwContext
,
DWORD
dwInternetStatus
,
LPVOID
lpvStatusInfo
,
DWORD
dwStatusInfoLength
)
{
...
...
@@ -234,7 +234,7 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
VOID
SendAsyncCallback
(
LPWININETAPPINFO
A
hIC
,
HINTERNET
hHttpSession
,
VOID
SendAsyncCallback
(
LPWININETAPPINFO
W
hIC
,
HINTERNET
hHttpSession
,
DWORD
dwContext
,
DWORD
dwInternetStatus
,
LPVOID
lpvStatusInfo
,
DWORD
dwStatusInfoLength
)
{
...
...
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