From 7c822c97b6a3d1aa0cec94ee0f18376ef1b78b89 Mon Sep 17 00:00:00 2001 From: Daniel Collins Date: Wed, 21 Sep 2011 21:57:28 +0000 Subject: [PATCH] Tweaked some code and updated changelog. --- changes.txt | 10 +++++----- src/common.c | 20 +++++--------------- src/router.c | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/changes.txt b/changes.txt index 35fcc5e..f42cedd 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,4 @@ -Version ???: +Version 0.3: Cleanup: Moved certain library functions out of ipxwrapper.c and tidied up. Cleanup: Removed winstuff.h, added wsnwlink.h from Wine. @@ -23,7 +23,7 @@ Version ???: Bugfix: Correctly initialise common controls in ipxconfig. - Update: Load interfaces on each bind/getsockopt call to allow configuration + Feature: Load interfaces on each bind/getsockopt call to allow configuration changes without restarting. Bugfix: Load EnumProtocolsA/EnumProtocolsW directly from mswsock.dll to avoid @@ -31,13 +31,13 @@ Version ???: Bugfix: Correctly store protocol names at end of EnumProtocols buffer. - Update: Implemented windows 95/98 WSHEnumProtocols function. + Feature: Implemented windows 95/98 WSHEnumProtocols function. - Update: Implemented connect, send and getpeername functions. + Feature: Implemented connect, send and getpeername functions. Update: Max packet (data) size reduced to 8KiB. - Update: Implemented IPX_RECEIVE_BROADCAST option. + Feature: Implemented IPX_RECEIVE_BROADCAST option. Update: Added ipxconfig icon. diff --git a/src/common.c b/src/common.c index 85d387d..e82c226 100644 --- a/src/common.c +++ b/src/common.c @@ -66,21 +66,8 @@ void reg_close(void) { } char reg_get_char(const char *val_name, char default_val) { - if(!regkey) { - return default_val; - } - char buf; - DWORD size = 1; - - int err = RegQueryValueEx(regkey, val_name, NULL, NULL, (BYTE*)&buf, &size); - - if(err != ERROR_SUCCESS) { - log_printf("Error reading registry value: %s", w32_error(err)); - return default_val; - } - - return size == 1 ? buf : default_val; + return reg_get_bin(val_name, &buf, 1) == 1 ? buf : default_val; } DWORD reg_get_bin(const char *val_name, void *buf, DWORD size) { @@ -91,7 +78,10 @@ DWORD reg_get_bin(const char *val_name, void *buf, DWORD size) { int err = RegQueryValueEx(regkey, val_name, NULL, NULL, (BYTE*)buf, &size); if(err != ERROR_SUCCESS) { - log_printf("Error reading registry value: %s", w32_error(err)); + if(err != ERROR_FILE_NOT_FOUND) { + log_printf("Error reading registry value: %s", w32_error(err)); + } + return 0; } diff --git a/src/router.c b/src/router.c index 6899662..c12ac2d 100644 --- a/src/router.c +++ b/src/router.c @@ -667,7 +667,7 @@ BOOL rclient_start(struct rclient *rclient) { struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - addr.sin_port = htons(global_conf.udp_port); + addr.sin_port = htons(reg_get_dword("control_port", DEFAULT_CONTROL_PORT)); if(connect(rclient->sock, (struct sockaddr*)&addr, sizeof(addr)) == 0) { return TRUE;