diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-12-17 22:23:28 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-12-17 22:23:28 +0000 |
commit | a67724cb6dc227a781b76d5c7baaaeacbf395f01 (patch) | |
tree | b0d401d1c0e956bb6a2c6b1988004606c049be62 | |
parent | svn merge -r 845:854 $SO/trunk/openvpn . (diff) | |
download | openvpn-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.c | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -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 |