php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #50271
Patch proc_open_COMSPEC.patch revision 2010-03-26 13:35 UTC by rquadling@php.net
Patch TSRM_Win32_COMSPEC.patch revision 2010-03-26 13:05 UTC by rquadling@php.net

Patch TSRM_Win32_COMSPEC.patch for Program Execution Bug #50271

Patch version 2010-03-26 13:05 UTC

Return to Bug #50271 | Download this patch
Patch Revisions:

Developer: rquadling@php.net

Index: tsrm_win32.c
===================================================================
--- tsrm_win32.c	(revision 296837)
+++ tsrm_win32.c	(working copy)
@@ -42,12 +42,19 @@
 
 static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
 {
+	char dummybuf;
+	int size;
+
 	globals->process = NULL;
 	globals->shm	 = NULL;
 	globals->process_size = 0;
 	globals->shm_size	  = 0;
-	globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
 
+	SetLastError(0);
+	size = GetEnvironmentVariableA("COMSPEC", &dummybuf, 0);
+	globals->comspec = malloc(size);
+	GetEnvironmentVariableA("COMSPEC", globals->comspec, size);
+
 	/* Set it to INVALID_HANDLE_VALUE
 	 * It will be initialized correctly in tsrm_win32_access or set to 
 	 * NULL if no impersonation has been done.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 22:01:28 2024 UTC