DnsExtractRecordsFromMessage function

The DnsExtractRecordsFromMessage function type extracts resource records (RR) from a DNS message, and stores those records in a DNS_RECORD structure. Like many DNS functions, the DnsExtractRecordsFromMessage function type is implemented in multiple forms to facilitate different character encoding. Based on the character encoding involved, use one of the following functions:

  • DnsExtractRecordsFromMessage_W (_W for Unicode encoding)

  • DnsExtractRecordsFromMessage_UTF8 (_UTF8 for UTF-8 encoding)

If the DnsExtractRecordsFromMessage function type is used without its suffix (either _W or _UTF8), a compiler error will occur.

Syntax


DNS_STATUS WINAPI DnsExtractRecordsFromMessage_W(
  _In_   PDNS_MESSAGE_BUFFER pDnsBuffer,
  _In_   WORD wMessageLength,
  _Out_  PDNS_RECORD *ppRecord
);

Parameters

pDnsBuffer [in]

A pointer to a DNS_MESSAGE_BUFFER structure that contains the DNS response message.

wMessageLength [in]

The size, in bytes, of the message in pDnsBuffer.

ppRecord [out]

A pointer to a DNS_RECORD structure that contains the list of extracted RRs. To free these records, use the DnsRecordListFree function.

Return value

Returns success confirmation upon successful completion. Otherwise, returns the appropriate DNS-specific error code as defined in Winerror.h.

Remarks

The DnsExtractRecordsFromMessage function is designed to operate on messages in host byte order. As such, received messages should be converted from network byte order to host byte order before extraction, or before retransmission onto the network. Use the DNS_BYTE_FLIP_HEADER_COUNTS macro to change byte ordering.

The following declaration for DnsExtractRecordsFromMessage_UTF8 can be found in Windns.h.

DNS_STATUS
WINAPI
DnsExtractRecordsFromMessage_UTF8(
    __in            PDNS_MESSAGE_BUFFER pDnsBuffer,
    __in            WORD                wMessageLength,
    __deref_out     PDNS_RECORD *       ppRecord
    );

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Windns.h

Library

Dnsapi.lib

DLL

Dnsapi.dll

See also

DnsRecordListFree
DnsWriteQuestionToBuffer
DnsQuery
DNS_MESSAGE_BUFFER
DNS_RECORD

 

 

Community Additions

ADD
Show:
© 2014 Microsoft