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
39340a10
Commit
39340a10
authored
Oct 11, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Oct 13, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Return DNS suffix for all non-loopback adapters.
parent
19eea5fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
2 deletions
+61
-2
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+61
-2
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
39340a10
...
...
@@ -968,11 +968,56 @@ static ULONG get_dns_server_addresses(PIP_ADAPTER_DNS_SERVER_ADDRESS address, UL
return
ERROR_SUCCESS
;
}
static
BOOL
is_ip_address_string
(
const
char
*
str
)
{
struct
in_addr
in
;
int
ret
;
ret
=
inet_aton
(
str
,
&
in
);
return
ret
!=
0
;
}
static
ULONG
get_dns_suffix
(
WCHAR
*
suffix
,
ULONG
*
len
)
{
ULONG
size
,
i
;
char
*
found_suffix
=
NULL
;
initialise_resolver
();
/* Always return a NULL-terminated string, even if it's empty. */
size
=
sizeof
(
WCHAR
);
for
(
i
=
0
,
found_suffix
=
NULL
;
!
found_suffix
&&
i
<
MAXDNSRCH
+
1
&&
_res
.
dnsrch
[
i
];
i
++
)
{
/* This uses a heuristic to select a DNS suffix:
* the first, non-IP address string is selected.
*/
if
(
!
is_ip_address_string
(
_res
.
dnsrch
[
i
]))
found_suffix
=
_res
.
dnsrch
[
i
];
}
if
(
found_suffix
)
size
+=
strlen
(
found_suffix
)
*
sizeof
(
WCHAR
);
if
(
!
suffix
||
*
len
<
size
)
{
*
len
=
size
;
return
ERROR_BUFFER_OVERFLOW
;
}
*
len
=
size
;
if
(
found_suffix
)
{
char
*
p
;
for
(
p
=
found_suffix
;
*
p
;
p
++
)
*
suffix
++
=
*
p
;
}
*
suffix
=
0
;
return
ERROR_SUCCESS
;
}
ULONG
WINAPI
GetAdaptersAddresses
(
ULONG
family
,
ULONG
flags
,
PVOID
reserved
,
PIP_ADAPTER_ADDRESSES
aa
,
PULONG
buflen
)
{
InterfaceIndexTable
*
table
;
ULONG
i
,
size
,
dns_server_size
,
total_size
,
ret
=
ERROR_NO_DATA
;
ULONG
i
,
size
,
dns_server_size
,
dns_suffix_size
,
total_size
,
ret
=
ERROR_NO_DATA
;
TRACE
(
"(%d, %08x, %p, %p, %p)
\n
"
,
family
,
flags
,
reserved
,
aa
,
buflen
);
...
...
@@ -1003,11 +1048,17 @@ ULONG WINAPI GetAdaptersAddresses(ULONG family, ULONG flags, PVOID reserved,
get_dns_server_addresses
(
NULL
,
&
dns_server_size
);
total_size
+=
dns_server_size
;
}
/* Since DNS suffix also isn't really per adapter, get enough space for a
* single copy of it.
*/
get_dns_suffix
(
NULL
,
&
dns_suffix_size
);
total_size
+=
dns_suffix_size
;
if
(
aa
&&
*
buflen
>=
total_size
)
{
ULONG
bytes_left
=
size
=
total_size
;
PIP_ADAPTER_ADDRESSES
first_aa
=
aa
;
PIP_ADAPTER_DNS_SERVER_ADDRESS
firstDns
;
WCHAR
*
dnsSuffix
;
for
(
i
=
0
;
i
<
table
->
numIndexes
;
i
++
)
{
...
...
@@ -1025,7 +1076,7 @@ ULONG WINAPI GetAdaptersAddresses(ULONG family, ULONG flags, PVOID reserved,
}
if
(
!
(
flags
&
GAA_FLAG_SKIP_DNS_SERVER
))
{
firstDns
=
(
PIP_ADAPTER_DNS_SERVER_ADDRESS
)((
BYTE
*
)
aa
+
total_size
-
dns_server_size
);
firstDns
=
(
PIP_ADAPTER_DNS_SERVER_ADDRESS
)((
BYTE
*
)
aa
+
total_size
-
dns_server_size
-
dns_suffix_size
);
get_dns_server_addresses
(
firstDns
,
&
dns_server_size
);
for
(
aa
=
first_aa
;
aa
;
aa
=
aa
->
Next
)
{
...
...
@@ -1033,6 +1084,14 @@ ULONG WINAPI GetAdaptersAddresses(ULONG family, ULONG flags, PVOID reserved,
aa
->
FirstDnsServerAddress
=
firstDns
;
}
}
aa
=
first_aa
;
dnsSuffix
=
(
WCHAR
*
)((
BYTE
*
)
aa
+
total_size
-
dns_suffix_size
);
get_dns_suffix
(
dnsSuffix
,
&
dns_suffix_size
);
for
(;
aa
;
aa
=
aa
->
Next
)
{
if
(
aa
->
IfType
!=
IF_TYPE_SOFTWARE_LOOPBACK
&&
aa
->
OperStatus
==
IfOperStatusUp
)
aa
->
DnsSuffix
=
dnsSuffix
;
}
ret
=
ERROR_SUCCESS
;
}
if
(
*
buflen
<
total_size
)
ret
=
ERROR_BUFFER_OVERFLOW
;
...
...
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