I have a small lab based Active Directory environment with 3 devices.
They have the following OS installed.
DC running Windows Server 2022 hosting my AD server.
1.Endpoint running Windows 10 Pro (22H2 Build 19045.4780) [English US installation and default computer name is “Endpoint1”]
2.Endpoint running Windows 11 Pro (23H2 Build 22631.2861) [English US installation and default computer name is “Endpoint2”]
3.Endpoint running Windows 10 (22H2 Build 19045.4780) [Chinese-Traditional installed and dfault and computer name is “通用的用户”]
Both the devices are connected to the Active Directory server hosted on the DC.
I have confirmed that the reverse lookup zones are properly set in the DNS Manager on the DC and they have proper entries .
I have a following test code that uses the GetNameInfoW windows API from winsock.
void func() {
struct sockaddr_in sa;
char str[INET_ADDRSTRLEN];
wchar_t host[NI_MAXHOST];
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(80);
if (inet_pton(AF_INET, "CORRECT_IP_HERE", &sa.sin_addr) <= 0) {
std::cerr << "Error in inet_pton" << std::endl;
exit(EXIT_FAILURE);
}
if (GetNameInfoW((struct sockaddr*)&sa, sizeof(sa), host, NI_MAXHOST, NULL, 0, NI_NAMEREQD) == 0) {
std::wcout << "hostname: " << host << std::endl;
}
else {
std::cerr << "Error in getnameinfo: " << WSAGetLastError() << std::endl;
}
std::wstring wstr{ host };
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
cout << strTo << endl;
}
int main()
{
WSADATA wsaData;
auto ret = WSAStartup(MAKEWORD(2, 2), &wsaData);
func();
WSACleanup();
return 0;
}
I am trying to perform a reverse DNS lookup for XYZ reasons from each of the endpoints to see if the other endpoint is accessible and resolves to the correct name.
I am running the above code on both the endpoints, as well as a 3rd endpoint (completely for testing) and i am able to see the resolution result correctly for 1 but not for 2.
Outputs [Endpoint1.ITDR.local]:
C:UsersAdministratorDesktop>reverse_dns
hostname: 通用的用户.ITDR.local
Outputs [Endpoint2.ITDR.local]:
C:UsersAdministratorDesktop>reverse_dns
hostname: Error in getnameinfo: 10014
In both the endpoints above I Expect the SAME output. because the DNS Server is the same entity for both the endpoints.
I tried adding multiple fake reverse lookups with different values for english and chinese characters, weirdly for windows 10 all of them returned the expected responses while for windows 11, the non-english reverselookups all failed, while the english ones passed.
This is not a language pack issue, because nslookup is able to get the expected outputs and i have the chinese-t language packs installed on all the 3 endpoints.
Is this a microsoft bug?? Or am I doing something wrong ??
6