传递给 Win32 异步回调函数的结构的字符串编码是什么?
What is the string encoding for structures passed to Win32 async callback functions?
调用 Win32 API DnsQueryEx or DnsServiceBrowse, for async operation you pass in a callback of type DNS_QUERY_COMPLETION_ROUTINE 时,我似乎找不到这方面的文档。此回调接收指针 PDNS_RECORD
(定义不使用 PDNS_RECORDA
或 PDNS_RECORDW
,仅使用 PDNS_RECORD
)。该结构有一个字段 pName
,记录为:
A pointer to a string that represents the domain name of the record set. This must be in the string format that corresponds to the function called, such as ANSI, Unicode, or UTF8.
但是,那些异步函数没有针对不同编码的不同变体,而且我没有构建这个结构,库正在提供它。我怎么知道 pName
字段使用什么编码?
你注意自己
This must be in the string format that corresponds to the function
called, such as ANSI, Unicode, or UTF8.
DnsQueryEx
和 DnsServiceBrowse
将 Unicode 字符串作为输入( DNS_QUERY_REQUEST.QueryName
and DNS_SERVICE_BROWSE_REQUEST.QueryName
). so on output it also must use Unicode format. DNS_QUERY_RESULT.pQueryRecords
指向 DNS_RECORDW
调用 Win32 API DnsQueryEx or DnsServiceBrowse, for async operation you pass in a callback of type DNS_QUERY_COMPLETION_ROUTINE 时,我似乎找不到这方面的文档。此回调接收指针 PDNS_RECORD
(定义不使用 PDNS_RECORDA
或 PDNS_RECORDW
,仅使用 PDNS_RECORD
)。该结构有一个字段 pName
,记录为:
A pointer to a string that represents the domain name of the record set. This must be in the string format that corresponds to the function called, such as ANSI, Unicode, or UTF8.
但是,那些异步函数没有针对不同编码的不同变体,而且我没有构建这个结构,库正在提供它。我怎么知道 pName
字段使用什么编码?
你注意自己
This must be in the string format that corresponds to the function called, such as ANSI, Unicode, or UTF8.
DnsQueryEx
和 DnsServiceBrowse
将 Unicode 字符串作为输入( DNS_QUERY_REQUEST.QueryName
and DNS_SERVICE_BROWSE_REQUEST.QueryName
). so on output it also must use Unicode format. DNS_QUERY_RESULT.pQueryRecords
指向 DNS_RECORDW