CreateProcess: two fixes
* change to lpCurrentDirectory if set even if no token was supplied * fix wrong check - add missing ! This was part of akallabeth's PR #2714.
This commit is contained in:
parent
fedd59816b
commit
be53e9e029
@ -241,7 +241,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
else
|
||||
{
|
||||
lpszEnvironmentBlock = GetEnvironmentStrings();
|
||||
if (lpszEnvironmentBlock)
|
||||
if (!lpszEnvironmentBlock)
|
||||
goto finish;
|
||||
envp = EnvironmentBlockToEnvpA(lpszEnvironmentBlock);
|
||||
}
|
||||
@ -317,11 +317,12 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
if (token->UserId)
|
||||
setuid((uid_t) token->UserId);
|
||||
|
||||
/* TODO: add better cwd handling and error checking */
|
||||
if (lpCurrentDirectory && strlen(lpCurrentDirectory) > 0)
|
||||
chdir(lpCurrentDirectory);
|
||||
}
|
||||
|
||||
/* TODO: add better cwd handling and error checking */
|
||||
if (lpCurrentDirectory && strlen(lpCurrentDirectory) > 0)
|
||||
chdir(lpCurrentDirectory);
|
||||
|
||||
if (execve(filename, pArgs, envp) < 0)
|
||||
{
|
||||
/* execve failed - end the process */
|
||||
|
Loading…
Reference in New Issue
Block a user