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
d01e619c
Commit
d01e619c
authored
Sep 04, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netprofm: Call GetAdaptersAddresses() in a loop.
parent
e5468c54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
list.c
dlls/netprofm/list.c
+20
-12
No files found.
dlls/netprofm/list.c
View file @
d01e619c
...
@@ -1739,26 +1739,34 @@ static struct connection *create_connection( const GUID *id )
...
@@ -1739,26 +1739,34 @@ static struct connection *create_connection( const GUID *id )
return
ret
;
return
ret
;
}
}
static
IP_ADAPTER_ADDRESSES
*
get_network_adapters
(
void
)
{
ULONG
err
,
size
=
4096
,
flags
=
GAA_FLAG_SKIP_ANYCAST
|
GAA_FLAG_SKIP_MULTICAST
|
GAA_FLAG_SKIP_DNS_SERVER
|
GAA_FLAG_INCLUDE_GATEWAYS
;
IP_ADAPTER_ADDRESSES
*
tmp
,
*
ret
;
if
(
!
(
ret
=
malloc
(
size
)))
return
NULL
;
err
=
GetAdaptersAddresses
(
AF_UNSPEC
,
flags
,
NULL
,
ret
,
&
size
);
while
(
err
==
ERROR_BUFFER_OVERFLOW
)
{
if
(
!
(
tmp
=
realloc
(
ret
,
size
)))
break
;
ret
=
tmp
;
err
=
GetAdaptersAddresses
(
AF_UNSPEC
,
flags
,
NULL
,
ret
,
&
size
);
}
if
(
err
==
ERROR_SUCCESS
)
return
ret
;
free
(
ret
);
return
NULL
;
}
static
void
init_networks
(
struct
list_manager
*
mgr
)
static
void
init_networks
(
struct
list_manager
*
mgr
)
{
{
DWORD
size
=
0
;
IP_ADAPTER_ADDRESSES
*
buf
,
*
aa
;
IP_ADAPTER_ADDRESSES
*
buf
,
*
aa
;
GUID
id
;
GUID
id
;
ULONG
ret
,
flags
=
GAA_FLAG_SKIP_ANYCAST
|
GAA_FLAG_SKIP_MULTICAST
|
GAA_FLAG_SKIP_DNS_SERVER
|
GAA_FLAG_INCLUDE_GATEWAYS
;
list_init
(
&
mgr
->
networks
);
list_init
(
&
mgr
->
networks
);
list_init
(
&
mgr
->
connections
);
list_init
(
&
mgr
->
connections
);
ret
=
GetAdaptersAddresses
(
AF_UNSPEC
,
flags
,
NULL
,
NULL
,
&
size
);
if
(
!
(
buf
=
get_network_adapters
()))
return
;
if
(
ret
!=
ERROR_BUFFER_OVERFLOW
)
return
;
if
(
!
(
buf
=
malloc
(
size
)))
return
;
if
(
GetAdaptersAddresses
(
AF_UNSPEC
,
flags
,
NULL
,
buf
,
&
size
))
{
free
(
buf
);
return
;
}
memset
(
&
id
,
0
,
sizeof
(
id
)
);
memset
(
&
id
,
0
,
sizeof
(
id
)
);
for
(
aa
=
buf
;
aa
;
aa
=
aa
->
Next
)
for
(
aa
=
buf
;
aa
;
aa
=
aa
->
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