Author: ekohl
Date: Fri Jan 1 14:16:04 2016
New Revision: 70478
URL:
http://svn.reactos.org/svn/reactos?rev=70478&view=rev
Log:
[ADVAPI32]
CreateProcessAsUserA/W: Make hToken optional.
Modified:
trunk/reactos/dll/win32/advapi32/misc/logon.c
Modified: trunk/reactos/dll/win32/advapi32/misc/logon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/misc/lo…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/misc/logon.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/misc/logon.c [iso-8859-1] Fri Jan 1 14:16:04 2016
@@ -125,20 +125,23 @@
return FALSE;
}
- AccessToken.Token = hToken;
- AccessToken.Thread = NULL;
-
- /* Set the new process token */
- Status = NtSetInformationProcess(lpProcessInformation->hProcess,
- ProcessAccessToken,
- (PVOID)&AccessToken,
- sizeof(AccessToken));
- if (!NT_SUCCESS (Status))
- {
- ERR("NtSetInformationProcess failed: 0x%08x\n", Status);
- TerminateProcess(lpProcessInformation->hProcess, Status);
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
+ if (hToken != NULL)
+ {
+ AccessToken.Token = hToken;
+ AccessToken.Thread = NULL;
+
+ /* Set the new process token */
+ Status = NtSetInformationProcess(lpProcessInformation->hProcess,
+ ProcessAccessToken,
+ (PVOID)&AccessToken,
+ sizeof(AccessToken));
+ if (!NT_SUCCESS (Status))
+ {
+ ERR("NtSetInformationProcess failed: 0x%08x\n", Status);
+ TerminateProcess(lpProcessInformation->hProcess, Status);
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
}
/* Resume the main thread */
@@ -190,20 +193,23 @@
return FALSE;
}
- AccessToken.Token = hToken;
- AccessToken.Thread = NULL;
-
- /* Set the new process token */
- Status = NtSetInformationProcess(lpProcessInformation->hProcess,
- ProcessAccessToken,
- (PVOID)&AccessToken,
- sizeof(AccessToken));
- if (!NT_SUCCESS (Status))
- {
- ERR("NtSetInformationProcess failed: 0x%08x\n", Status);
- TerminateProcess(lpProcessInformation->hProcess, Status);
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
+ if (hToken != NULL)
+ {
+ AccessToken.Token = hToken;
+ AccessToken.Thread = NULL;
+
+ /* Set the new process token */
+ Status = NtSetInformationProcess(lpProcessInformation->hProcess,
+ ProcessAccessToken,
+ (PVOID)&AccessToken,
+ sizeof(AccessToken));
+ if (!NT_SUCCESS (Status))
+ {
+ ERR("NtSetInformationProcess failed: 0x%08x\n", Status);
+ TerminateProcess(lpProcessInformation->hProcess, Status);
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
}
/* Resume the main thread */