DnsExtractRecordsFromMessage_W function (windns.h)

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 DnsExtractRecordsFromMessage_W(
  [in]  PDNS_MESSAGE_BUFFER pDnsBuffer,
  [in]  WORD                wMessageLength,
  [out] PDNS_RECORD         *ppRecord
);

Parameters

[in] pDnsBuffer

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

[in] wMessageLength

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

[out] ppRecord

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

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header windns.h
Library Dnsapi.lib
DLL Dnsapi.dll

See also

DNS_MESSAGE_BUFFER

DNS_RECORD

DnsQuery

DnsRecordListFree

DnsWriteQuestionToBuffer