aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-12-17 22:23:28 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-12-17 22:23:28 +0000
commita67724cb6dc227a781b76d5c7baaaeacbf395f01 (patch)
treeb0d401d1c0e956bb6a2c6b1988004606c049be62
parentsvn merge -r 845:854 $SO/trunk/openvpn . (diff)
downloadopenvpn-a67724cb6dc227a781b76d5c7baaaeacbf395f01.tar.xz
Fixed bug in automatic Win32 PATH setting code.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@856 e7ae566f-a301-0410-adde-c780ea21d3b5
-rw-r--r--misc.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/misc.c b/misc.c
index 6184208..b7eaae9 100644
--- a/misc.c
+++ b/misc.c
@@ -1465,19 +1465,31 @@ configure_path (void)
fp = fopen ("c:\\windows\\system32\\route.exe", "rb");
if (fp)
{
- const int bufsiz = 512;
+ const int bufsiz = 4096;
struct gc_arena gc = gc_new ();
struct buffer oldpath = alloc_buf_gc (bufsiz, &gc);
struct buffer newpath = alloc_buf_gc (bufsiz, &gc);
+ const char* delim = ";";
DWORD status;
fclose (fp);
status = GetEnvironmentVariable ("PATH", BPTR(&oldpath), (DWORD)BCAP(&oldpath));
- if (status > 0)
+#if 0
+ status = 0;
+#endif
+ if (!status)
{
- buf_printf (&newpath, "C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;%s", BSTR(&oldpath));
- SetEnvironmentVariable ("PATH", BSTR(&newpath));
- /*printf ("PATH: %s\n", BSTR(&newpath));*/
+ *BPTR(&oldpath) = '\0';
+ delim = "";
}
+ buf_printf (&newpath, "C:\\WINDOWS\\System32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem%s%s",
+ delim,
+ BSTR(&oldpath));
+ SetEnvironmentVariable ("PATH", BSTR(&newpath));
+#if 0
+ status = GetEnvironmentVariable ("PATH", BPTR(&oldpath), (DWORD)BCAP(&oldpath));
+ if (status > 0)
+ printf ("PATH: %s\n", BSTR(&oldpath));
+#endif
gc_free (&gc);
}
#endif