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
d193c164
Commit
d193c164
authored
Nov 02, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnsapi: Build the DNS reply records on the PE side.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
aec19e86
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
3 deletions
+73
-3
dnsapi.h
dlls/dnsapi/dnsapi.h
+1
-1
libresolv.c
dlls/dnsapi/libresolv.c
+0
-0
query.c
dlls/dnsapi/query.c
+25
-1
windns.h
include/windns.h
+47
-1
No files found.
dlls/dnsapi/dnsapi.h
View file @
d193c164
...
...
@@ -125,7 +125,7 @@ struct resolv_funcs
{
DNS_STATUS
(
CDECL
*
get_searchlist
)(
DNS_TXT_DATAW
*
list
,
DWORD
*
len
);
DNS_STATUS
(
CDECL
*
get_serverlist
)(
USHORT
family
,
DNS_ADDR_ARRAY
*
addrs
,
DWORD
*
len
);
DNS_STATUS
(
CDECL
*
query
)(
const
char
*
name
,
WORD
type
,
DWORD
options
,
DNS_RECORDA
**
result
);
DNS_STATUS
(
CDECL
*
query
)(
const
char
*
name
,
WORD
type
,
DWORD
options
,
void
*
buf
,
DWORD
*
len
);
DNS_STATUS
(
CDECL
*
set_serverlist
)(
const
IP4_ARRAY
*
addrs
);
};
...
...
dlls/dnsapi/libresolv.c
View file @
d193c164
This diff is collapsed.
Click to expand it.
dlls/dnsapi/query.c
View file @
d193c164
...
...
@@ -168,6 +168,8 @@ DNS_STATUS WINAPI DnsQuery_UTF8( PCSTR name, WORD type, DWORD options, PVOID ser
PDNS_RECORDA
*
result
,
PVOID
*
reserved
)
{
DNS_STATUS
ret
=
DNS_ERROR_RCODE_NOT_IMPLEMENTED
;
unsigned
char
answer
[
4096
];
DWORD
len
=
sizeof
(
answer
);
TRACE
(
"(%s,%s,0x%08x,%p,%p,%p)
\n
"
,
debugstr_a
(
name
),
debugstr_type
(
type
),
options
,
servers
,
result
,
reserved
);
...
...
@@ -177,7 +179,29 @@ DNS_STATUS WINAPI DnsQuery_UTF8( PCSTR name, WORD type, DWORD options, PVOID ser
if
((
ret
=
resolv_funcs
->
set_serverlist
(
servers
)))
return
ret
;
ret
=
resolv_funcs
->
query
(
name
,
type
,
options
,
result
);
ret
=
resolv_funcs
->
query
(
name
,
type
,
options
,
answer
,
&
len
);
if
(
!
ret
)
{
DNS_MESSAGE_BUFFER
*
buffer
=
(
DNS_MESSAGE_BUFFER
*
)
answer
;
if
(
len
<
sizeof
(
buffer
->
MessageHead
))
return
DNS_ERROR_BAD_PACKET
;
DNS_BYTE_FLIP_HEADER_COUNTS
(
&
buffer
->
MessageHead
);
switch
(
buffer
->
MessageHead
.
ResponseCode
)
{
case
DNS_RCODE_NOERROR
:
ret
=
DnsExtractRecordsFromMessage_UTF8
(
buffer
,
len
,
result
);
break
;
case
DNS_RCODE_FORMERR
:
ret
=
DNS_ERROR_RCODE_FORMAT_ERROR
;
break
;
case
DNS_RCODE_SERVFAIL
:
ret
=
DNS_ERROR_RCODE_SERVER_FAILURE
;
break
;
case
DNS_RCODE_NXDOMAIN
:
ret
=
DNS_ERROR_RCODE_NAME_ERROR
;
break
;
case
DNS_RCODE_NOTIMPL
:
ret
=
DNS_ERROR_RCODE_NOT_IMPLEMENTED
;
break
;
case
DNS_RCODE_REFUSED
:
ret
=
DNS_ERROR_RCODE_REFUSED
;
break
;
case
DNS_RCODE_YXDOMAIN
:
ret
=
DNS_ERROR_RCODE_YXDOMAIN
;
break
;
case
DNS_RCODE_YXRRSET
:
ret
=
DNS_ERROR_RCODE_YXRRSET
;
break
;
case
DNS_RCODE_NXRRSET
:
ret
=
DNS_ERROR_RCODE_NXRRSET
;
break
;
case
DNS_RCODE_NOTAUTH
:
ret
=
DNS_ERROR_RCODE_NOTAUTH
;
break
;
case
DNS_RCODE_NOTZONE
:
ret
=
DNS_ERROR_RCODE_NOTZONE
;
break
;
default:
ret
=
DNS_ERROR_RCODE_NOT_IMPLEMENTED
;
break
;
}
}
if
(
ret
==
DNS_ERROR_RCODE_NAME_ERROR
&&
type
==
DNS_TYPE_A
&&
!
(
options
&
DNS_QUERY_NO_NETBT
))
...
...
include/windns.h
View file @
d193c164
...
...
@@ -108,6 +108,18 @@ extern "C" {
#define DNS_QUERY_DNSSEC_CHECKING_DISABLED 0x02000000
#define DNS_QUERY_RESERVED 0xff000000
#define INLINE_WORD_FLIP(out, in) { WORD _in = (in); (out) = (_in << 8) | (_in >> 8); }
#define INLINE_HTONS(out, in) INLINE_WORD_FLIP(out, in)
#define INLINE_NTOHS(out, in) INLINE_WORD_FLIP(out, in)
#define DNS_BYTE_FLIP_HEADER_COUNTS(header) { \
DNS_HEADER *_head = (header); \
INLINE_HTONS( _head->Xid, _head->Xid ); \
INLINE_HTONS( _head->QuestionCount, _head->QuestionCount ); \
INLINE_HTONS( _head->AnswerCount, _head->AnswerCount ); \
INLINE_HTONS( _head->NameServerCount, _head->NameServerCount ); \
INLINE_HTONS( _head->AdditionalCount, _head->AdditionalCount ); }
typedef
enum
_DNS_NAME_FORMAT
{
DnsNameDomain
,
...
...
@@ -182,7 +194,11 @@ typedef struct
#define DNS_ADDRESS_STRING_LENGTH IP6_ADDRESS_STRING_LENGTH
#define IP4_ADDRESS_STRING_BUFFER_LENGTH IP4_ADDRESS_STRING_LENGTH
#define IP6_ADDRESS_STRING_BUFFER_LENGTH IP6_ADDRESS_STRING_LENGTH
#define DNS_MAX_NAME_BUFFER_LENGTH 256
#define DNS_MAX_NAME_LENGTH 255
#define DNS_MAX_LABEL_LENGTH 63
#define DNS_MAX_NAME_BUFFER_LENGTH (DNS_MAX_NAME_LENGTH + 1)
#define DNS_MAX_LABEL_BUFFER_LENGTH (DNS_MAX_LABEL_LENGTH + 1)
typedef
struct
_IP4_ARRAY
{
...
...
@@ -190,6 +206,36 @@ typedef struct _IP4_ARRAY
IP4_ADDRESS
AddrArray
[
1
];
}
IP4_ARRAY
,
*
PIP4_ARRAY
;
#define DNS_OPCODE_QUERY 0
#define DNS_OPCODE_IQUERY 1
#define DNS_OPCODE_SERVER_STATUS 2
#define DNS_OPCODE_UNKNOWN 3
#define DNS_OPCODE_NOTIFY 4
#define DNS_OPCODE_UPDATE 5
#define DNS_RCODE_NOERROR 0
#define DNS_RCODE_FORMERR 1
#define DNS_RCODE_SERVFAIL 2
#define DNS_RCODE_NXDOMAIN 3
#define DNS_RCODE_NOTIMPL 4
#define DNS_RCODE_REFUSED 5
#define DNS_RCODE_YXDOMAIN 6
#define DNS_RCODE_YXRRSET 7
#define DNS_RCODE_NXRRSET 8
#define DNS_RCODE_NOTAUTH 9
#define DNS_RCODE_NOTZONE 10
#define DNS_RCODE_MAX 15
#define DNS_RCODE_BADVERS 16
#define DNS_RCODE_BADSIG 16
#define DNS_RCODE_BADKEY 17
#define DNS_RCODE_BADTIME 18
#define DNS_RCODE_NO_ERROR DNS_RCODE_NOERROR
#define DNS_RCODE_FORMAT_ERROR DNS_RCODE_FORMERR
#define DNS_RCODE_SERVER_FAILURE DNS_RCODE_SERVFAIL
#define DNS_RCODE_NAME_ERROR DNS_RCODE_NXDOMAIN
#define DNS_RCODE_NOT_IMPLEMENTED DNS_RCODE_NOTIMPL
#include <pshpack1.h>
typedef
struct
_DNS_HEADER
{
...
...
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