properly set the access token in CreateProcessAsUser()

svn path=/trunk/; revision=13192
This commit is contained in:
Thomas Bluemel 2005-01-21 20:31:24 +00:00
parent 955bb3e32e
commit 4da8f45753

View file

@ -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));