From 4da8f45753f3c28a18c71a14533e79a5714bedfc Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Fri, 21 Jan 2005 20:31:24 +0000 Subject: [PATCH] properly set the access token in CreateProcessAsUser() svn path=/trunk/; revision=13192 --- reactos/lib/advapi32/misc/logon.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/reactos/lib/advapi32/misc/logon.c b/reactos/lib/advapi32/misc/logon.c index 316f41ad1c0..97db084b306 100644 --- a/reactos/lib/advapi32/misc/logon.c +++ b/reactos/lib/advapi32/misc/logon.c @@ -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));