0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00
openvpn3/openvpn/win/reg.hpp
James Yonan b84b48fb75 Ported to Windows.
Implemented full TunClient class for Windows with TAP driver
support.  For now, we use netsh (rather than TAP driver DHCP)
to set all tunnel adapter properties, as this appears to work
great on Windows 7.

IPv6 is fully supported.

Known isues:

* netsh doesn't have a command for adding DNS search domains, so
  we don't support them yet.

* While we always try to remove routes and added properties from
  TAP adapter instance when we close out the session, for robustness,
  when we bring up TAP adapter, we should try to delete any stale
  routes on interface left over from previous session.

* Right now we call netsh with system().  For security and
  compatibility with Windows apps (not only console apps),
  we should use CreateProcess instead.
2014-02-16 01:13:26 -07:00

41 lines
672 B
C++

//
// reg.hpp
// OpenVPN
//
// Copyright (c) 2014 OpenVPN Technologies, Inc. All rights reserved.
//
// registry utilities for Windows
#ifndef OPENVPN_WIN_REG_H
#define OPENVPN_WIN_REG_H
#include <windows.h>
#include <boost/noncopyable.hpp>
#include <openvpn/common/types.hpp>
namespace openvpn {
namespace Win {
// HKEY wrapper
class RegKey : boost::noncopyable {
public:
RegKey() : key(NULL) {}
bool defined() const { return key != NULL; }
HKEY* ref() { return &key; }
HKEY operator()() { return key; }
~RegKey()
{
if (defined())
RegCloseKey(key);
}
private:
HKEY key;
};
}
}
#endif