From 48ab6b419756c4be0974d447111f373d0cdb7dce Mon Sep 17 00:00:00 2001 From: Gert Doering Date: Sun, 28 Feb 2010 22:48:48 +0100 Subject: env_block(): if PATH is not set, add standard PATH setting to env so that "netsh.exe" can find "framedyn.dll" (needs work) --- win32.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'win32.c') diff --git a/win32.c b/win32.c index 2b7bf7b..cf6cc2d 100644 --- a/win32.c +++ b/win32.c @@ -874,16 +874,21 @@ win_safe_filename (const char *fn) static char * env_block (const struct env_set *es) { + char * force_path = "PATH=C:\\Windows\\System32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem"; + if (es) { struct env_item *e; char *ret; char *p; size_t nchars = 1; + bool path_seen = false; for (e = es->list; e != NULL; e = e->next) nchars += strlen (e->string) + 1; + nchars += strlen(force_path)+1; + ret = (char *) malloc (nchars); check_malloc_return (ret); @@ -895,7 +900,18 @@ env_block (const struct env_set *es) strcpy (p, e->string); p += strlen (e->string) + 1; } + if ( strncmp(e->string, "PATH=", 5 ) == 0 ) + path_seen = true; + } + + /* make sure PATH is set */ + if ( !path_seen ) + { + msg( M_INFO, "env_block: add %s", force_path ); + strcpy( p, force_path ); + p += strlen(force_path) + 1; } + *p = '\0'; return ret; } -- cgit