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
4f3269f1
Commit
4f3269f1
authored
Aug 05, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Aug 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Use DnsQueryConfig() to retrieve the dns suffix.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
769952df
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
61 deletions
+20
-61
Makefile.in
dlls/iphlpapi/Makefile.in
+1
-1
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+19
-60
No files found.
dlls/iphlpapi/Makefile.in
View file @
4f3269f1
MODULE
=
iphlpapi.dll
IMPORTLIB
=
iphlpapi
IMPORTS
=
advapi32 dnsapi nsi uuid
EXTRALIBS
=
$(
RESOLV_LIBS)
$(
KSTAT_LIBS)
$(PROCSTAT_LIBS)
EXTRALIBS
=
$(KSTAT_LIBS)
$(PROCSTAT_LIBS)
C_SRCS
=
\
icmp.c
\
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
4f3269f1
...
...
@@ -30,12 +30,6 @@
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
...
...
@@ -1223,27 +1217,6 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
return
ERROR_SUCCESS
;
}
#ifdef HAVE_STRUCT___RES_STATE
/* call res_init() just once because of a bug in Mac OS X 10.4 */
/* Call once per thread on systems that have per-thread _res. */
static
CRITICAL_SECTION
res_init_cs
;
static
CRITICAL_SECTION_DEBUG
res_init_cs_debug
=
{
0
,
0
,
&
res_init_cs
,
{
&
res_init_cs_debug
.
ProcessLocksList
,
&
res_init_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": res_init_cs"
)
}
};
static
CRITICAL_SECTION
res_init_cs
=
{
&
res_init_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
void
initialise_resolver
(
void
)
{
EnterCriticalSection
(
&
res_init_cs
);
if
((
_res
.
options
&
RES_INIT
)
==
0
)
res_init
();
LeaveCriticalSection
(
&
res_init_cs
);
}
#endif
static
DWORD
dns_servers_query_code
(
ULONG
family
)
{
if
(
family
==
WS_AF_INET
)
return
DnsConfigDnsServersIpv4
;
...
...
@@ -1305,46 +1278,32 @@ err:
return
err
;
}
#ifdef HAVE_STRUCT___RES_STATE
static
BOOL
is_ip_address_string
(
const
char
*
str
)
static
ULONG
get_dns_suffix
(
WCHAR
*
suffix
,
ULONG
*
len
)
{
struct
in_addr
in
;
int
ret
;
DWORD
err
,
list_len
=
0
,
needed
=
1
;
DNS_TXT_DATAW
*
search
=
NULL
;
ret
=
inet_aton
(
str
,
&
in
);
return
ret
!=
0
;
}
#endif
if
(
suffix
&&
*
len
>
0
)
*
suffix
=
'\0'
;
static
ULONG
get_dns_suffix
(
WCHAR
*
suffix
,
ULONG
*
len
)
{
ULONG
size
;
const
char
*
found_suffix
=
""
;
/* Always return a NULL-terminated string, even if it's empty. */
err
=
DnsQueryConfig
(
DnsConfigSearchList
,
0
,
NULL
,
NULL
,
NULL
,
&
list_len
);
if
(
err
)
goto
err
;
#ifdef HAVE_STRUCT___RES_STATE
{
ULONG
i
;
initialise_resolver
();
for
(
i
=
0
;
!*
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
];
}
}
#endif
search
=
heap_alloc
(
list_len
);
err
=
DnsQueryConfig
(
DnsConfigSearchList
,
0
,
NULL
,
NULL
,
search
,
&
list_len
);
if
(
err
||
!
search
->
dwStringCount
)
goto
err
;
size
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
found_suffix
,
-
1
,
NULL
,
0
)
*
sizeof
(
WCHAR
);
if
(
!
suffix
||
*
len
<
size
)
needed
=
(
strlenW
(
search
->
pStringArray
[
0
]
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
suffix
||
*
len
<
needed
)
{
*
len
=
size
;
return
ERROR_BUFFER_OVERFLOW
;
err
=
ERROR_INSUFFICIENT_BUFFER
;
goto
err
;
}
*
len
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
found_suffix
,
-
1
,
suffix
,
*
len
/
sizeof
(
WCHAR
)
)
*
sizeof
(
WCHAR
);
return
ERROR_SUCCESS
;
memcpy
(
suffix
,
search
->
pStringArray
[
0
],
needed
);
err:
*
len
=
needed
;
heap_free
(
search
);
return
err
;
}
ULONG
WINAPI
DECLSPEC_HOTPATCH
GetAdaptersAddresses
(
ULONG
family
,
ULONG
flags
,
PVOID
reserved
,
...
...
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