mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-05 20:59:42 +00:00
Transmit current directory settings to newly created processes.
This commit is contained in:
parent
33923f296f
commit
dad709122a
|
@ -155,7 +155,8 @@ extern void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule );
|
|||
extern BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
|
||||
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
|
||||
BOOL inherit, DWORD flags,
|
||||
STARTUPINFOA *startup, PROCESS_INFORMATION *info );
|
||||
STARTUPINFOA *startup, PROCESS_INFORMATION *info,
|
||||
LPCSTR lpCurrentDirectory );
|
||||
|
||||
static inline PDB WINE_UNUSED *PROCESS_Current(void)
|
||||
{
|
||||
|
|
|
@ -949,9 +949,6 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
|
|||
FIXME("(%s,...): PROFILE_KERNEL ignored\n", name);
|
||||
if (dwCreationFlags & PROFILE_SERVER)
|
||||
FIXME("(%s,...): PROFILE_SERVER ignored\n", name);
|
||||
if (lpCurrentDirectory)
|
||||
FIXME("(%s,...): lpCurrentDirectory %s ignored\n",
|
||||
name, lpCurrentDirectory);
|
||||
if (lpStartupInfo->lpDesktop)
|
||||
FIXME("(%s,...): lpStartupInfo->lpDesktop %s ignored\n",
|
||||
name, lpStartupInfo->lpDesktop);
|
||||
|
@ -984,7 +981,7 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
|
|||
retv = PROCESS_Create( -1, name, tidy_cmdline, lpEnvironment,
|
||||
lpProcessAttributes, lpThreadAttributes,
|
||||
bInheritHandles, dwCreationFlags,
|
||||
lpStartupInfo, lpProcessInfo );
|
||||
lpStartupInfo, lpProcessInfo, lpCurrentDirectory );
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -998,7 +995,7 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
|
|||
retv = PROCESS_Create( hFile, name, tidy_cmdline, lpEnvironment,
|
||||
lpProcessAttributes, lpThreadAttributes,
|
||||
bInheritHandles, dwCreationFlags,
|
||||
lpStartupInfo, lpProcessInfo );
|
||||
lpStartupInfo, lpProcessInfo, lpCurrentDirectory);
|
||||
break;
|
||||
|
||||
case SCS_PIF_BINARY:
|
||||
|
|
|
@ -674,7 +674,8 @@ static void exec_wine_binary( char **argv, char **envp )
|
|||
*
|
||||
* Fork and exec a new Unix process, checking for errors.
|
||||
*/
|
||||
static int fork_and_exec( const char *filename, char *cmdline, const char *env )
|
||||
static int fork_and_exec( const char *filename, char *cmdline,
|
||||
const char *env, const char *newdir )
|
||||
{
|
||||
int fd[2];
|
||||
int pid, err;
|
||||
|
@ -690,6 +691,9 @@ static int fork_and_exec( const char *filename, char *cmdline, const char *env )
|
|||
char **argv = build_argv( cmdline, filename ? 0 : 2 );
|
||||
char **envp = build_envp( env );
|
||||
close( fd[0] );
|
||||
|
||||
if (newdir) chdir(newdir);
|
||||
|
||||
if (argv && envp)
|
||||
{
|
||||
if (!filename)
|
||||
|
@ -725,10 +729,11 @@ static int fork_and_exec( const char *filename, char *cmdline, const char *env )
|
|||
BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
|
||||
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
|
||||
BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
|
||||
LPPROCESS_INFORMATION info )
|
||||
LPPROCESS_INFORMATION info, LPCSTR lpCurrentDirectory )
|
||||
{
|
||||
int pid;
|
||||
const char *unixfilename = NULL;
|
||||
const char *unixdir = NULL;
|
||||
DOS_FULL_NAME full_name;
|
||||
HANDLE load_done_evt = -1;
|
||||
struct new_process_request *req = get_req_buffer();
|
||||
|
@ -757,6 +762,17 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
|
|||
req->cmd_show = startup->wShowWindow;
|
||||
req->alloc_fd = 0;
|
||||
|
||||
if (lpCurrentDirectory) {
|
||||
if (DOSFS_GetFullName( lpCurrentDirectory, TRUE, &full_name ))
|
||||
unixdir = full_name.long_name;
|
||||
} else {
|
||||
CHAR buf[260];
|
||||
if (GetCurrentDirectoryA(sizeof(buf),buf)) {
|
||||
if (DOSFS_GetFullName( buf, TRUE, &full_name ))
|
||||
unixdir = full_name.long_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (hFile == -1) /* unix process */
|
||||
{
|
||||
unixfilename = filename;
|
||||
|
@ -772,7 +788,7 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
|
|||
|
||||
/* fork and execute */
|
||||
|
||||
pid = fork_and_exec( unixfilename, cmd_line, env ? env : GetEnvironmentStringsA() );
|
||||
pid = fork_and_exec( unixfilename, cmd_line, env ? env : GetEnvironmentStringsA(), unixdir );
|
||||
|
||||
wait_req->cancel = (pid == -1);
|
||||
wait_req->pinherit = (psa && (psa->nLength >= sizeof(*psa)) && psa->bInheritHandle);
|
||||
|
|
Loading…
Reference in a new issue