Commit c4d85843 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Get the current directory from the process parameters in create_cmd_process().

parent ec0c5a11
...@@ -2469,7 +2469,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES ...@@ -2469,7 +2469,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
* *
* Create a new cmd shell process for a .BAT file. * Create a new cmd shell process for a .BAT file.
*/ */
static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa, static BOOL create_cmd_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup, BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
const RTL_USER_PROCESS_PARAMETERS *params, const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info ) LPPROCESS_INFORMATION info )
...@@ -2480,7 +2480,7 @@ static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSE ...@@ -2480,7 +2480,7 @@ static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSE
static const WCHAR slashscW[] = {' ','/','s','/','c',' ',0}; static const WCHAR slashscW[] = {' ','/','s','/','c',' ',0};
static const WCHAR quotW[] = {'"',0}; static const WCHAR quotW[] = {'"',0};
WCHAR comspec[MAX_PATH]; WCHAR comspec[MAX_PATH];
WCHAR *newcmdline; WCHAR *newcmdline, *cur_dir = NULL;
BOOL ret; BOOL ret;
if (!GetEnvironmentVariableW( comspecW, comspec, ARRAY_SIZE( comspec ))) if (!GetEnvironmentVariableW( comspecW, comspec, ARRAY_SIZE( comspec )))
...@@ -2498,6 +2498,7 @@ static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSE ...@@ -2498,6 +2498,7 @@ static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSE
strcatW( newcmdline, quotW ); strcatW( newcmdline, quotW );
strcatW( newcmdline, params->CommandLine.Buffer ); strcatW( newcmdline, params->CommandLine.Buffer );
strcatW( newcmdline, quotW ); strcatW( newcmdline, quotW );
if (params->CurrentDirectory.DosPath.Length) cur_dir = params->CurrentDirectory.DosPath.Buffer;
ret = CreateProcessW( comspec, newcmdline, psa, tsa, inherit, ret = CreateProcessW( comspec, newcmdline, psa, tsa, inherit,
flags | CREATE_UNICODE_ENVIRONMENT, params->Environment, cur_dir, flags | CREATE_UNICODE_ENVIRONMENT, params->Environment, cur_dir,
startup, info ); startup, info );
...@@ -2705,7 +2706,7 @@ static BOOL create_process_impl( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_A ...@@ -2705,7 +2706,7 @@ static BOOL create_process_impl( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_A
if (!strcmpiW( p, batW ) || !strcmpiW( p, cmdW ) ) if (!strcmpiW( p, batW ) || !strcmpiW( p, cmdW ) )
{ {
TRACE( "starting %s as batch binary\n", debugstr_w(name) ); TRACE( "starting %s as batch binary\n", debugstr_w(name) );
retv = create_cmd_process( cur_dir, process_attr, thread_attr, retv = create_cmd_process( process_attr, thread_attr,
inherit, flags, startup_info, params, info ); inherit, flags, startup_info, params, info );
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment