From a7a943106cc45cc8d9bbfe813cbcf463a9647e87 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 3 Feb 2010 23:49:22 -0500 Subject: [PATCH] Fix some additional -DUNICODE issues on win32. Brodie's patch didn't catch the ones that were new since 1.4. --- evdns.c | 14 +++++++------- test/tinytest.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/evdns.c b/evdns.c index 2ef955ed..8b22eba2 100644 --- a/evdns.c +++ b/evdns.c @@ -3415,7 +3415,7 @@ evdns_get_default_hosts_filename(void) char *path_out; int len_out; - if (! SHGetSpecialFolderPath(NULL, path, CSIDL_SYSTEM, 0)) + if (! SHGetSpecialFolderPathA(NULL, path, CSIDL_SYSTEM, 0)) return NULL; len_out = strlen(path)+strlen(hostfile); path_out = mm_malloc(len_out+1); @@ -3530,7 +3530,7 @@ load_nameservers_with_getnetworkparams(struct evdns_base *base) GetNetworkParams_fn_t fn; ASSERT_LOCKED(base); - if (!(handle = LoadLibraryA("iphlpapi.dll"))) { + if (!(handle = LoadLibraryA("iphlpapi.dll"))) { log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll"); status = -1; goto done; @@ -3603,13 +3603,13 @@ config_nameserver_from_reg_key(struct evdns_base *base, HKEY key, const char *su int status = 0; ASSERT_LOCKED(base); - if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz) + if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz) != ERROR_MORE_DATA) return -1; if (!(buf = mm_malloc(bufsz))) return -1; - if (RegQueryValueExA(key, subkey, 0, &type, (LPBYTE)buf, &bufsz) + if (RegQueryValueExA(key, subkey, 0, &type, (LPBYTE)buf, &bufsz) == ERROR_SUCCESS && bufsz > 1) { status = evdns_nameserver_ip_add_line(base,buf); } @@ -3641,12 +3641,12 @@ load_nameservers_from_registry(struct evdns_base *base) if (((int)GetVersion()) > 0) { /* NT */ HKEY nt_key = 0, interfaces_key = 0; - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &nt_key) != ERROR_SUCCESS) { log(EVDNS_LOG_DEBUG,"Couldn't open nt key, %d",(int)GetLastError()); return -1; } - r = RegOpenKeyExA(nt_key, "Interfaces", 0, + r = RegOpenKeyExA(nt_key, "Interfaces", 0, KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &interfaces_key); if (r != ERROR_SUCCESS) { @@ -3661,7 +3661,7 @@ load_nameservers_from_registry(struct evdns_base *base) RegCloseKey(nt_key); } else { HKEY win_key = 0; - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0, + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0, KEY_READ, &win_key) != ERROR_SUCCESS) { log(EVDNS_LOG_DEBUG, "Couldn't open registry key, %d", (int)GetLastError()); return -1; diff --git a/test/tinytest.c b/test/tinytest.c index 20f04933..75d589c4 100644 --- a/test/tinytest.c +++ b/test/tinytest.c @@ -107,7 +107,7 @@ _testcase_run_forked(const struct testgroup_t *group, */ int ok; char buffer[LONGEST_TEST_NAME+256]; - STARTUPINFO si; + STARTUPINFOA si; PROCESS_INFORMATION info; DWORD exitcode; @@ -126,7 +126,7 @@ _testcase_run_forked(const struct testgroup_t *group, memset(&info, 0, sizeof(info)); si.cb = sizeof(si); - ok = CreateProcess(commandname, buffer, NULL, NULL, 0, + ok = CreateProcessA(commandname, buffer, NULL, NULL, 0, 0, NULL, NULL, &si, &info); if (!ok) { printf("CreateProcess failed!\n");