When we are impersonating, also set the flag, so that on release, we can kill it.
This hopefully fixes 2nd stage and the whole mess it was causing in privileges.

svn path=/trunk/; revision=58959
This commit is contained in:
Pierre Schweitzer 2013-05-05 22:19:54 +00:00
parent a330845fa1
commit be5914df2f

View file

@ -247,8 +247,9 @@ RtlAcquirePrivilege(IN PULONG Privilege,
goto Cleanup;
}
/* Save said token */
/* Save said token and the fact we have impersonated */
State->Token = ImpersonationToken;
State->Flags |= RTL_ACQUIRE_PRIVILEGE_IMPERSONATE;
ZwClose(ProcessToken);
}
@ -372,7 +373,9 @@ RtlReleasePrivilege(IN PVOID ReturnedState)
DPRINT("RtlReleasePrivilege(%p)\n", ReturnedState);
/* If we had an active impersonation before we acquired privileges */
/* If we had an active impersonation before we acquired privileges
* Or if we have impersonated, quit it
*/
if (State->Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE)
{
/* Restore it for the current thread */