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
100bd11a
Commit
100bd11a
authored
Feb 16, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Use GetAddrInfoW in GetAddress.
parent
11d09f1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
utility.c
dlls/wininet/utility.c
+11
-20
No files found.
dlls/wininet/utility.c
View file @
100bd11a
...
...
@@ -125,20 +125,12 @@ time_t ConvertTimeString(LPCWSTR asctime)
}
BOOL
GetAddress
(
LPCWSTR
lpszServerName
,
INTERNET_PORT
nServerPort
,
struct
sockaddr
*
psa
,
socklen_t
*
sa_len
)
BOOL
GetAddress
(
const
WCHAR
*
name
,
INTERNET_PORT
port
,
struct
sockaddr
*
psa
,
socklen_t
*
sa_len
)
{
struct
addrinfo
*
res
,
hints
;
char
*
name
;
int
sz
;
ADDRINFOW
*
res
,
hints
;
int
ret
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
lpszServerName
));
sz
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
lpszServerName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
name
=
heap_alloc
(
sz
+
1
)))
return
FALSE
;
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
lpszServerName
,
-
1
,
name
,
sz
,
NULL
,
NULL
);
name
[
sz
]
=
0
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
name
));
memset
(
&
hints
,
0
,
sizeof
(
hints
)
);
/* Prefer IPv4 to IPv6 addresses, since some servers do not listen on
...
...
@@ -146,23 +138,22 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
*/
hints
.
ai_family
=
AF_INET
;
ret
=
getaddrinfo
(
name
,
NULL
,
&
hints
,
&
res
);
ret
=
GetAddrInfoW
(
name
,
NULL
,
&
hints
,
&
res
);
if
(
ret
!=
0
)
{
TRACE
(
"failed to get IPv4 address of %s, retrying with IPv6
\n
"
,
debugstr_w
(
lpszServerN
ame
));
TRACE
(
"failed to get IPv4 address of %s, retrying with IPv6
\n
"
,
debugstr_w
(
n
ame
));
hints
.
ai_family
=
AF_INET6
;
ret
=
getaddrinfo
(
name
,
NULL
,
&
hints
,
&
res
);
ret
=
GetAddrInfoW
(
name
,
NULL
,
&
hints
,
&
res
);
}
heap_free
(
name
);
if
(
ret
!=
0
)
{
TRACE
(
"failed to get address of %s
\n
"
,
debugstr_w
(
lpszServerN
ame
));
TRACE
(
"failed to get address of %s
\n
"
,
debugstr_w
(
n
ame
));
return
FALSE
;
}
if
(
*
sa_len
<
res
->
ai_addrlen
)
{
WARN
(
"address too small
\n
"
);
freeaddrinfo
(
res
);
FreeAddrInfoW
(
res
);
return
FALSE
;
}
*
sa_len
=
res
->
ai_addrlen
;
...
...
@@ -171,14 +162,14 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
switch
(
res
->
ai_family
)
{
case
AF_INET
:
((
struct
sockaddr_in
*
)
psa
)
->
sin_port
=
htons
(
nServerP
ort
);
((
struct
sockaddr_in
*
)
psa
)
->
sin_port
=
htons
(
p
ort
);
break
;
case
AF_INET6
:
((
struct
sockaddr_in6
*
)
psa
)
->
sin6_port
=
htons
(
nServerP
ort
);
((
struct
sockaddr_in6
*
)
psa
)
->
sin6_port
=
htons
(
p
ort
);
break
;
}
freeaddrinfo
(
res
);
FreeAddrInfoW
(
res
);
return
TRUE
;
}
...
...
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