DnsWriteQuestionToBuffer_UTF8 function (windns.h)

The DnsWriteQuestionToBuffer function type creates a DNS query message and stores it in a DNS_MESSAGE_BUFFER structure. Like many DNS functions, the DnsWriteQuestionToBuffer function type is implemented in multiple forms to facilitate different character encoding. Based on the character encoding involved, use one of the following functions:

  • DnsWriteQuestionToBuffer_W (_W for Unicode encoding)
  • DnsWriteQuestionToBuffer_UTF8 (_UTF8 for UTF-8 encoding)
If the DnsWriteQuestionToBuffer function type is used without its suffix (either _W or _UTF8), a compiler error will occur.


BOOL DnsWriteQuestionToBuffer_UTF8(
  [in, out] PDNS_MESSAGE_BUFFER pDnsBuffer,
  [in, out] PDWORD              pdwBufferSize,
  [in]      PCSTR               pszName,
  [in]      WORD                wType,
  [in]      WORD                Xid,
  [in]      BOOL                fRecursionDesired


[in, out] pDnsBuffer

A pointer to a DNS_MESSAGE_BUFFER structure that contains a DNS query message stored in a buffer.

[in, out] pdwBufferSize

The size, in bytes, of the buffer allocated to store pDnsBuffer. If the buffer size is insufficient to contain the message, FALSE is returned and pdwBufferSize contains the minimum required buffer size.

[in] pszName

A pointer to a string that represents the name of the owner of the record set being queried.

[in] wType

A value that represents the RR DNS Record Type. wType determines the format of Data. For example, if the value of wType is DNS_TYPE_A, the data type of Data is DNS_A_DATA.

[in] Xid

A value that specifies the unique DNS query identifier.

[in] fRecursionDesired

A BOOL that specifies whether recursive name query should be used by the DNS name server. Set to TRUE to request recursive name query, FALSE to request iterative name query.

Return value

Returns TRUE upon successful execution, otherwise FALSE.


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

    __inout     PDNS_MESSAGE_BUFFER pDnsBuffer,
    __inout     PDWORD              pdwBufferSize,
    __in        PCSTR               pszName,
    __in        WORD                wType,
    __in        WORD                Xid,
    __in        BOOL                fRecursionDesired


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