DNS Function

DnsFree Function

The DnsFree function frees memory allocated for DNS records that was obtained using the DnsQuery function.

 函數原型定義:

Parameters

pData

A pointer to the DNS data to be freed.

FreeType

A value that specifies the type of DNS data in pData. For more information and a list of values, see the DNS_FREE_TYPE enumeration.

Return Value

This function does not return a value.

Requirements

Client Requires Windows Vista or Windows XP.
Server Requires Windows Server 2008 or Windows Server 2003.
Header

Declared in Windns.h.

Library

Use Dnsapi.lib.

DLL

Requires Dnsapi.dll.

2   DnsAcquireContextHandle Function

 

The DnsAcquireContextHandle function type acquires a context handle to a set of credentials. Like many DNS functions, the DnsAcquireContextHandle function type is implemented in multiple forms to facilitate different character encoding. Based on the character encoding involved, use one of the following functions:

DnsAcquireContextHandle_A (_A for ANSI encoding)

DnsAcquireContextHandle_W (_W for Unicode encoding)

If the DnsAcquireContextHandle function type is called without its suffix (_A or _W), a compiler error will occur.

 函數原型定義:


Parameters

CredentialFlags

Flag indicating character encoding. Set to TRUE for Unicode, FALSE for ANSI.

Credentials

Pointer to the SEC_WINNT_AUTH_IDENTITY_W structure or the SEC_WINNT_AUTH_IDENTITY_A structure containing the name, domain, and password of the account to be used in a secure dynamic update. If not specified, the credentials of the calling service are used. This parameter is optional.

ContextHandle

Pointer to a handle pointing to the credentials.

Return Value

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

Requirements

 

ClientRequires Windows Vista, Windows XP, or Windows 2000 Professional.
ServerRequires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header

Declared in Windns.h.

Library

Use Dnsapi.lib.

DLL

Requires Dnsapi.dll.

Unicode

Implemented as DnsAcquireContextHandle_W (Unicode) and DnsAcquireContextHandle_A (ANSI).

 

 

3  DnsExtractRecordsFromMessage Function

 

The DnsExtractRecordsFromMessage function type extracts resource records 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 called without its suffix (either _W or _UTF8), a compiler error will occur.

函數定義原型:

DNS_STATUS WINAPI DnsExtractRecordsFromMessage(
  __in     PDNS_MESSAGE_BUFFER pDnsBuffer,
  __in     WORD wMessageLength,
  __inout  PDNS_RECORD* ppRecord
);

Parameters

pDnsBuffer

Pointer to a DNS response message stored in a DNS_MESSAGE_BUFFER structure.

wMessageLength

Size of the message stored in DNS_MESSAGE_BUFFER, in bytes.

ppRecord

Pointer to a pointer to 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.

Requirements

Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header

Declared in Windns.h.

Library

Use Dnsapi.lib.

DLL

Requires Dnsapi.dll.

Unicode

Implemented as DnsExtractRecordsFromMessage_W (Unicode).

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章