diff options
author | Christian Pointner <equinox@anytun.org> | 2009-01-19 20:13:43 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-01-19 20:13:43 +0000 |
commit | 1e12add3e66522b94a5d0eea603c15f93f7dd8cd (patch) | |
tree | 2e73a74953e4a813b75e3e22d8da5b230e34f2a2 /src/win32/tunDevice.cpp | |
parent | some cleanup (diff) |
started to implement windows tunDevice
updated LogErrno to support Windows Error Codes
Diffstat (limited to 'src/win32/tunDevice.cpp')
-rw-r--r-- | src/win32/tunDevice.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/win32/tunDevice.cpp b/src/win32/tunDevice.cpp index c162ac3..86c99ba 100644 --- a/src/win32/tunDevice.cpp +++ b/src/win32/tunDevice.cpp @@ -30,15 +30,30 @@ */ #include <string.h> +#include <sstream> #include "../tunDevice.h" #include "../threadUtils.hpp" +#include "../log.h" +#include "common.h" +#include <windows.h> +#include <winioctl.h> TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_lp, std::string ifcfg_rnmp) : conf_(dev_name, dev_type, ifcfg_lp, ifcfg_rnmp, 1400) { + handle_ = INVALID_HANDLE_VALUE; + HKEY key; + LONG err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key); + if(err) { + std::stringstream msg; + msg << "Unable to read registry: " << LogErrno(err); + throw std::runtime_error(msg.str()); + } + RegCloseKey(key); + if(ifcfg_lp != "" && ifcfg_rnmp != "") do_ifconfig(); } |