[PATCH 2/2] dnsapi: DnsQueryEx partial implementation (ver.3)
Donat Enikeev
donat at enikeev.net
Fri Jan 15 02:35:35 CST 2016
Avoid warnings on MacOS
Signed-off-by: Donat Enikeev <donat at enikeev.net>
---
dlls/dnsapi/query.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/dlls/dnsapi/query.c b/dlls/dnsapi/query.c
index 7fafb48..39d438a 100644
--- a/dlls/dnsapi/query.c
+++ b/dlls/dnsapi/query.c
@@ -672,8 +672,49 @@ static const char *debugstr_query_request(const DNS_QUERY_REQUEST *req)
*/
DNS_STATUS WINAPI DnsQueryEx(DNS_QUERY_REQUEST *request, DNS_QUERY_RESULT *result, DNS_QUERY_CANCEL *cancel)
{
- FIXME("(%s %p %p)\n", debugstr_query_request(request), result, cancel);
- return DNS_ERROR_RCODE_NOT_IMPLEMENTED;
+ DNS_STATUS status;
+ PIP4_ARRAY p_dns_server = NULL;
+
+ TRACE("(%s %p %p)\n", debugstr_query_request(request), result, cancel);
+ if (!request || !result)
+ return ERROR_INVALID_PARAMETER;
+
+ if (request->pQueryCompletionCallback)
+ FIXME("Asynchronous DNS queries not implemented. (%s %p)\n", debugstr_query_request(request), result);
+
+ if (request->pDnsServerList && request->pDnsServerList->AddrCount)
+ {
+ if ( request->pDnsServerList->Family == AF_INET )
+ {
+ SOCKADDR_IN *p_sockaddr;
+
+ if (request->pDnsServerList->AddrCount > 1)
+ FIXME("Only first DNS server from the list will be used, %d given \n", request->pDnsServerList->AddrCount);
+
+ p_sockaddr = (SOCKADDR_IN *)&request->pDnsServerList->AddrArray[0].MaxSa;
+
+ p_dns_server = heap_alloc(sizeof(IP4_ARRAY));
+ if ( !p_dns_server ) return ERROR_NOT_ENOUGH_MEMORY;
+
+ p_dns_server->AddrArray[0] = p_sockaddr->sin_addr.WS_s_addr;
+ p_dns_server->AddrCount = 1;
+
+ TRACE("DNS address to use %hhu.%hhu.%hhu.%hhu (%u) \n",
+ p_sockaddr->sin_addr.WS_s_impno, p_sockaddr->sin_addr.WS_s_lh,
+ p_sockaddr->sin_addr.WS_s_host, p_sockaddr->sin_addr.WS_s_net, p_sockaddr->sin_addr.WS_s_addr);
+ } else
+ FIXME("Families other than IPv4 (AF_INET) are not implemented so far, %d given \n", request->pDnsServerList->Family );
+ }
+
+ status = DnsQuery_W( request->QueryName, request->QueryType, request->QueryOptions, p_dns_server, &result->pQueryRecords, NULL);
+
+ result->Version = DNS_QUERY_RESULTS_VERSION1;
+ result->QueryStatus = status;
+ result->QueryOptions = request->QueryOptions;
+
+ heap_free(p_dns_server);
+
+ return status;
}
/******************************************************************************
--
2.5.0
More information about the wine-patches
mailing list