From: Zebediah Figura zfigura@codeweavers.com
DNS_TEXT_DATA contains pointers and is thus not WoW64 compatible. Since the API is internal to Wine, use a simpler format instead of fixing our WoW64 translation.
The problem was found by Brendan Shanks; this solution was suggested by Hans Leidekker. --- dlls/dnsapi/dnsapi.h | 2 +- dlls/dnsapi/libresolv.c | 21 ++++++++------------- dlls/iphlpapi/iphlpapi_main.c | 6 +++--- 3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/dlls/dnsapi/dnsapi.h b/dlls/dnsapi/dnsapi.h index f27cce9a99d..a81cb712f3e 100644 --- a/dlls/dnsapi/dnsapi.h +++ b/dlls/dnsapi/dnsapi.h @@ -128,7 +128,7 @@ extern const char *debugstr_type( unsigned short ) DECLSPEC_HIDDEN;
struct get_searchlist_params { - DNS_TXT_DATAW *list; + WCHAR *list; DWORD *len; };
diff --git a/dlls/dnsapi/libresolv.c b/dlls/dnsapi/libresolv.c index 51a44f88aa5..fd645d53fd7 100644 --- a/dlls/dnsapi/libresolv.c +++ b/dlls/dnsapi/libresolv.c @@ -125,16 +125,15 @@ static DNS_STATUS map_h_errno( int error ) static NTSTATUS resolv_get_searchlist( void *args ) { const struct get_searchlist_params *params = args; - DNS_TXT_DATAW *list = params->list; - DWORD i, needed, str_needed = 0; + WCHAR *list = params->list; + DWORD i, needed = 0; WCHAR *ptr, *end;
init_resolver();
for (i = 0; i < MAXDNSRCH + 1 && _res.dnsrch[i]; i++) - str_needed += (strlen(_res.dnsrch[i]) + 1) * sizeof(WCHAR); - - needed = FIELD_OFFSET(DNS_TXT_DATAW, pStringArray[i]) + str_needed; + needed += (strlen(_res.dnsrch[i]) + 1) * sizeof(WCHAR); + needed += sizeof(WCHAR); /* null terminator */
if (!list || *params->len < needed) { @@ -143,16 +142,12 @@ static NTSTATUS resolv_get_searchlist( void *args ) }
*params->len = needed; - list->dwStringCount = i;
- ptr = (WCHAR *)(list->pStringArray + i); - end = ptr + str_needed / sizeof(WCHAR); + ptr = list; + end = ptr + needed / sizeof(WCHAR); for (i = 0; i < MAXDNSRCH + 1 && _res.dnsrch[i]; i++) - { - list->pStringArray[i] = ptr; - ptr += ntdll_umbstowcs( _res.dnsrch[i], strlen(_res.dnsrch[i]) + 1, - list->pStringArray[i], end - ptr ); - } + ptr += ntdll_umbstowcs( _res.dnsrch[i], strlen(_res.dnsrch[i]) + 1, ptr, end - ptr ); + *ptr = 0; /* null terminator */ return ERROR_SUCCESS; }
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 65d3793011b..a95a581532f 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -1138,7 +1138,7 @@ static DWORD dns_info_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG family, ULONG flags DWORD err, i, size, attempt, sockaddr_len; WCHAR name[MAX_ADAPTER_NAME_LENGTH + 1]; DNS_ADDR_ARRAY *servers; - DNS_TXT_DATAW *search; + WCHAR *search;
while (aa) { @@ -1192,9 +1192,9 @@ static DWORD dns_info_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG family, ULONG flags (search = heap_alloc( size ))) { if (!DnsQueryConfig( DnsConfigSearchList, 0, name, NULL, search, &size ) && - search->dwStringCount && wcslen( search->pStringArray[0] ) < MAX_DNS_SUFFIX_STRING_LENGTH) + search[0] && wcslen( search ) < MAX_DNS_SUFFIX_STRING_LENGTH) { - wcscpy( aa->DnsSuffix, search->pStringArray[0] ); + wcscpy( aa->DnsSuffix, search ); } heap_free( search ); }