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
3c2e980d
Commit
3c2e980d
authored
Sep 05, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Call GetAdaptersAddresses() in a loop.
parent
e5df70ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
sock.c
dlls/ws2_32/tests/sock.c
+21
-7
No files found.
dlls/ws2_32/tests/sock.c
View file @
3c2e980d
...
...
@@ -12236,12 +12236,29 @@ static void test_get_interface_list(void)
closesocket
(
s
);
}
static
IP_ADAPTER_ADDRESSES
*
get_adapters
(
void
)
{
ULONG
err
,
size
=
4096
;
IP_ADAPTER_ADDRESSES
*
tmp
,
*
ret
;
if
(
!
(
ret
=
malloc
(
size
)))
return
NULL
;
err
=
GetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
ret
,
&
size
);
while
(
err
==
ERROR_BUFFER_OVERFLOW
)
{
if
(
!
(
tmp
=
realloc
(
ret
,
size
)))
break
;
ret
=
tmp
;
err
=
GetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
ret
,
&
size
);
}
if
(
err
==
ERROR_SUCCESS
)
return
ret
;
free
(
ret
);
return
NULL
;
}
static
void
test_bind
(
void
)
{
const
struct
sockaddr_in
invalid_addr
=
{.
sin_family
=
AF_INET
,
.
sin_addr
.
s_addr
=
inet_addr
(
"192.0.2.0"
)};
const
struct
sockaddr_in
bind_addr
=
{.
sin_family
=
AF_INET
,
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
)};
IP_ADAPTER_ADDRESSES
*
adapters
=
NULL
,
*
adapter
;
ULONG
ip_addrs_size
=
0
;
IP_ADAPTER_ADDRESSES
*
adapters
,
*
adapter
;
struct
sockaddr
addr
;
SOCKET
s
,
s2
;
int
ret
,
len
;
...
...
@@ -12313,11 +12330,8 @@ static void test_bind(void)
closesocket
(
s
);
ret
=
GetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
adapters
,
&
ip_addrs_size
);
ok
(
ret
==
ERROR_BUFFER_OVERFLOW
,
"got error %u
\n
"
,
ret
);
adapters
=
malloc
(
ip_addrs_size
);
ret
=
GetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
adapters
,
&
ip_addrs_size
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
adapters
=
get_adapters
();
ok
(
adapters
!=
NULL
,
"can't get adapters
\n
"
);
for
(
adapter
=
adapters
;
adapter
!=
NULL
;
adapter
=
adapter
->
Next
)
{
...
...
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