mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Make Libevent 1.4.12 build on win32 with Unicode enabled.
This patch fixes calls to the win32 api to explicitly call the char* versions of the functions. This fixes build failures when libevent is built with the UNICODE define.
This commit is contained in:
parent
bd03d0682c
commit
bce58d61c8
12
evdns.c
12
evdns.c
@ -2846,7 +2846,7 @@ load_nameservers_with_getnetworkparams(void)
|
||||
IP_ADDR_STRING *ns;
|
||||
GetNetworkParams_fn_t fn;
|
||||
|
||||
if (!(handle = LoadLibrary("iphlpapi.dll"))) {
|
||||
if (!(handle = LoadLibraryA("iphlpapi.dll"))) {
|
||||
log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
|
||||
status = -1;
|
||||
goto done;
|
||||
@ -2916,13 +2916,13 @@ config_nameserver_from_reg_key(HKEY key, const char *subkey)
|
||||
DWORD bufsz = 0, type = 0;
|
||||
int status = 0;
|
||||
|
||||
if (RegQueryValueEx(key, subkey, 0, &type, NULL, &bufsz)
|
||||
if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz)
|
||||
!= ERROR_MORE_DATA)
|
||||
return -1;
|
||||
if (!(buf = malloc(bufsz)))
|
||||
return -1;
|
||||
|
||||
if (RegQueryValueEx(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(buf);
|
||||
}
|
||||
@ -2952,12 +2952,12 @@ load_nameservers_from_registry(void)
|
||||
if (((int)GetVersion()) > 0) { /* NT */
|
||||
HKEY nt_key = 0, interfaces_key = 0;
|
||||
|
||||
if (RegOpenKeyEx(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 = RegOpenKeyEx(nt_key, "Interfaces", 0,
|
||||
r = RegOpenKeyExA(nt_key, "Interfaces", 0,
|
||||
KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
|
||||
&interfaces_key);
|
||||
if (r != ERROR_SUCCESS) {
|
||||
@ -2972,7 +2972,7 @@ load_nameservers_from_registry(void)
|
||||
RegCloseKey(nt_key);
|
||||
} else {
|
||||
HKEY win_key = 0;
|
||||
if (RegOpenKeyEx(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;
|
||||
|
@ -73,7 +73,7 @@ main (int argc, char **argv)
|
||||
#ifdef WIN32
|
||||
HANDLE socket;
|
||||
// Open a file.
|
||||
socket = CreateFile("test.txt", // open File
|
||||
socket = CreateFileA("test.txt", // open File
|
||||
GENERIC_READ, // open for reading
|
||||
0, // do not share
|
||||
NULL, // no security
|
||||
|
Loading…
x
Reference in New Issue
Block a user