diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-10-31 03:01:17 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-10-31 03:01:17 +0000 |
commit | c67d59cd5c30534a4108945294284f29df7a6c84 (patch) | |
tree | 00f4471a4eba2fdb39f1c0b4a0021d6824eb2abb /misc.c | |
parent | Changes to Windows build configuration to (diff) | |
download | openvpn-c67d59cd5c30534a4108945294284f29df7a6c84.tar.xz |
Windows reliability changes:
* Added code to make sure that the local PATH environmental
variable points to the Windows system32 directory.
* Added new --ip-win32 adaptive mode which tries 'dynamic'
and then fails over to 'netsh' if the DHCP negotiation fails.
* Made --ip-win32 adaptive the default.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@739 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r-- | misc.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -1372,3 +1372,33 @@ openvpn_sleep (const int n) #endif sleep (n); } + +/* + * Configure PATH. On Windows, sometimes PATH is not set correctly + * by default. + */ +void +configure_path (void) +{ +#ifdef WIN32 + FILE *fp; + fp = fopen ("c:\\windows\\system32\\route.exe", "rb"); + if (fp) + { + const int bufsiz = 512; + struct gc_arena gc = gc_new (); + struct buffer oldpath = alloc_buf_gc (bufsiz, &gc); + struct buffer newpath = alloc_buf_gc (bufsiz, &gc); + DWORD status; + fclose (fp); + status = GetEnvironmentVariable ("PATH", BPTR(&oldpath), (DWORD)BCAP(&oldpath)); + if (status > 0) + { + buf_printf (&newpath, "C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;%s", BSTR(&oldpath)); + SetEnvironmentVariable ("PATH", BSTR(&newpath)); + /*printf ("PATH: %s\n", BSTR(&newpath));*/ + } + gc_free (&gc); + } +#endif +} |