Author: tkreuzer Date: Sun Feb 16 08:56:34 2014 New Revision: 62206
URL: http://svn.reactos.org/svn/reactos?rev=62206&view=rev Log: [NTOSKRNL] - Fix logic in PsReferenceEffectiveToken
Modified: trunk/reactos/ntoskrnl/ps/security.c
Modified: trunk/reactos/ntoskrnl/ps/security.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/security.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/ps/security.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/security.c [iso-8859-1] Sun Feb 16 08:56:34 2014 @@ -698,25 +698,7 @@
/* Check if we don't have impersonation info */ Process = Thread->ThreadsProcess; - if (!Thread->ActiveImpersonationInfo) - { - /* Fast Reference the Token */ - Token = ObFastReferenceObject(&Process->Token); - - /* Check if we got the Token or if we got locked */ - if (!Token) - { - /* Lock the Process */ - PspLockProcessSecurityShared(Process); - - /* Do a Locked Fast Reference */ - Token = ObFastReferenceObjectLocked(&Process->Token); - - /* Unlock the Process */ - PspUnlockProcessSecurityShared(Process); - } - } - else + if (Thread->ActiveImpersonationInfo) { /* Lock the Process */ PspLockProcessSecurityShared(Process); @@ -737,6 +719,22 @@ PspUnlockProcessSecurityShared(Process); return Token; } + + /* Unlock the Process */ + PspUnlockProcessSecurityShared(Process); + } + + /* Fast Reference the Token */ + Token = ObFastReferenceObject(&Process->Token); + + /* Check if we got the Token or if we got locked */ + if (!Token) + { + /* Lock the Process */ + PspLockProcessSecurityShared(Process); + + /* Do a Locked Fast Reference */ + Token = ObFastReferenceObjectLocked(&Process->Token);
/* Unlock the Process */ PspUnlockProcessSecurityShared(Process);