DNS Function

DnsFree Function

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

 函数原型定义:
void WINAPI DnsFree(
  __inout  PVOID pData,
  __in     DNS_FREE_TYPE FreeType
);
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
ClientRequires Windows Vista or Windows XP.
ServerRequires 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.

 函数原型定义:

DNS_STATUS WINAPI DnsAcquireContextHandle(
  __in      DWORD CredentialFlags,
  __in_opt  PVOID Credentials,
  __out     HANDLE* ContextHandle
);
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
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 DnsExtractRecordsFromMessage_W (Unicode).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值