fix: windows UNICODE incompatibilities with ares_getaddrinfo (#328)

Fixes the following compatibility issues:
* Use RegQueryValueExA instead of RegQueryValueEx
* Use ExpandEnvironmentStringsA instead of ExpandEnvironmentStrings
* Use RegOpenKeyExA instead of RegOpenKeyExA
* Use GetWindowsDirectoryA instead of GetWindowsDirectoryA

Fix By: Shelley Vohr (@codebytere)
Closes: #327
pull/329/head
shelley vohr 5 years ago committed by GitHub
parent c498c5320f
commit 1c73eccfdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      ares_getaddrinfo.c

@ -456,18 +456,18 @@ static int file_lookup(struct host_query *hquery)
char tmp[MAX_PATH];
HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
&hkeyHosts) == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
}
else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH);
else
return ARES_ENOTFOUND;

Loading…
Cancel
Save