little fix

svn path=/trunk/; revision=10495
This commit is contained in:
Thomas Bluemel 2004-08-11 08:32:48 +00:00
parent 05d68bd490
commit 2f6a9da97d

View file

@ -73,13 +73,18 @@ RosEnableThreadPrivileges(HANDLE *hPreviousToken,
LocalFree((HLOCAL)privs); LocalFree((HLOCAL)privs);
/* Perform the impersonation */ /* Perform the impersonation */
Ret = SetThreadToken(NULL, hToken); Ret = SetThreadToken(NULL, hNewToken);
if(Ret) if(Ret)
{ {
/* only copy the previous token handle on success */ /* only copy the previous token handle on success */
*hPreviousToken = hToken; *hPreviousToken = hToken;
} }
else
{
/* We don't return the previous token handle on failure, so close it here */
CloseHandle(hToken);
}
/* We don't need the handle to the new token anymore */ /* We don't need the handle to the new token anymore */
CloseHandle(hNewToken); CloseHandle(hNewToken);