projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Error messages.
[tinc]
/
src
/
mingw
/
device.c
diff --git
a/src/mingw/device.c
b/src/mingw/device.c
index
dfda089
..
d2675ef
100644
(file)
--- a/
src/mingw/device.c
+++ b/
src/mingw/device.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.
6 2003/07/29 22:59:01
guus Exp $
+ $Id: device.c,v 1.1.2.
9 2003/08/02 21:01:50
guus Exp $
*/
#include "system.h"
*/
#include "system.h"
@@
-158,7
+158,7
@@
bool setup_device(void)
/* Open registry and look for network adapters */
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CONTROL_NET, 0, KEY_READ, &key)) {
/* Open registry and look for network adapters */
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CONTROL_NET, 0, KEY_READ, &key)) {
- logger(LOG_ERR, _("Unable to read registry
"
));
+ logger(LOG_ERR, _("Unable to read registry
: %s"), winerror(GetLastError()
));
return false;
}
return false;
}
@@
-177,6
+177,8
@@
bool setup_device(void)
len = sizeof(adaptername);
RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len);
len = sizeof(adaptername);
RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len);
+ RegCloseKey(key2);
+
if(device) {
if(!strcmp(device, adapterid)) {
found = true;
if(device) {
if(!strcmp(device, adapterid)) {
found = true;
@@
-201,6
+203,8
@@
bool setup_device(void)
}
}
}
}
+ RegCloseKey(key);
+
if(!found) {
logger(LOG_ERR, _("No Windows tap device found!"));
return false;
if(!found) {
logger(LOG_ERR, _("No Windows tap device found!"));
return false;
@@
-268,7
+272,7
@@
bool setup_device(void)
thread = CreateThread(NULL, 0, tapreader, NULL, 0, NULL);
if(!thread) {
thread = CreateThread(NULL, 0, tapreader, NULL, 0, NULL);
if(!thread) {
- logger(LOG_ERR, _("System call `%s' failed: %s"), "CreateThread",
strerror(errno
));
+ logger(LOG_ERR, _("System call `%s' failed: %s"), "CreateThread",
winerror(GetLastError()
));
return false;
}
return false;
}
@@
-328,7
+332,7
@@
bool write_packet(vpn_packet_t *packet)
packet->len, device_info);
if(!WriteFile(device_handle, packet->data, packet->len, &lenout, &overlapped)) {
packet->len, device_info);
if(!WriteFile(device_handle, packet->data, packet->len, &lenout, &overlapped)) {
- logger(LOG_ERR, _("Error while writing to %s %s
"), device_info, device
);
+ logger(LOG_ERR, _("Error while writing to %s %s
: %s"), device_info, device, winerror(GetLastError())
);
return false;
}
return false;
}