summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosh Cepek <josh.cepek@usa.net>2013-05-16 09:09:23 -0500
committerGert Doering <gert@greenie.muc.de>2013-05-19 14:23:30 +0200
commita19e35a95bf4a0177ae115535a3755d3acd894e9 (patch)
treedde20ef770b51aa237c7e5680ae530f3466b3aef /src
parenteb95f367348f4c2aae301cfa7c3adc8e0f2e711e (diff)
Fix Windows script execution when called from script hooks
Console applications under Windows, such as batch scripts, require the CREATE_NO_WINDOW process flag when run without an actual console window present. This change allows such scripts to execute and impact the hook status by way of their return code. Fixes bug #240. Signed-off-by: Josh Cepek <josh.cepek@usa.net> Acked-by: Heiko Hund <heiko.hund@sophos.com> Message-Id: <kn2pao$5sv$1@ger.gmane.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/7594 Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src')
-rw-r--r--src/openvpn/win32.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index 2db96a8..178e2c3 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -879,7 +879,10 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i
start_info.dwFlags = STARTF_USESHOWWINDOW;
start_info.wShowWindow = SW_HIDE;
- if (CreateProcessW (cmd, cl, NULL, NULL, FALSE, 0, env, NULL, &start_info, &proc_info))
+ /* this allows console programs to run, and is ignored otherwise */
+ DWORD proc_flags = CREATE_NO_WINDOW;
+
+ if (CreateProcessW (cmd, cl, NULL, NULL, FALSE, proc_flags, env, NULL, &start_info, &proc_info))
{
DWORD exit_status = 0;
CloseHandle (proc_info.hThread);