mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
properly set the access token in CreateProcessAsUser()
svn path=/trunk/; revision=13192
This commit is contained in:
parent
955bb3e32e
commit
4da8f45753
1 changed files with 12 additions and 4 deletions
|
@ -30,6 +30,7 @@ CreateProcessAsUserA (HANDLE hToken,
|
|||
LPSTARTUPINFOA lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation)
|
||||
{
|
||||
PROCESS_ACCESS_TOKEN AccessToken;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create the process with a suspended main thread */
|
||||
|
@ -47,11 +48,14 @@ CreateProcessAsUserA (HANDLE hToken,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
AccessToken.Token = hToken;
|
||||
AccessToken.Thread = NULL;
|
||||
|
||||
/* Set the new process token */
|
||||
Status = NtSetInformationProcess (lpProcessInformation->hProcess,
|
||||
ProcessAccessToken,
|
||||
(PVOID)&hToken,
|
||||
sizeof (HANDLE));
|
||||
(PVOID)&AccessToken,
|
||||
sizeof (AccessToken));
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
|
@ -84,6 +88,7 @@ CreateProcessAsUserW (HANDLE hToken,
|
|||
LPSTARTUPINFOW lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation)
|
||||
{
|
||||
PROCESS_ACCESS_TOKEN AccessToken;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create the process with a suspended main thread */
|
||||
|
@ -101,11 +106,14 @@ CreateProcessAsUserW (HANDLE hToken,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
AccessToken.Token = hToken;
|
||||
AccessToken.Thread = NULL;
|
||||
|
||||
/* Set the new process token */
|
||||
Status = NtSetInformationProcess (lpProcessInformation->hProcess,
|
||||
ProcessAccessToken,
|
||||
(PVOID)&hToken,
|
||||
sizeof (HANDLE));
|
||||
(PVOID)&AccessToken,
|
||||
sizeof (AccessToken));
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
|
|
Loading…
Reference in a new issue