fix returning the new token handle in DuplicateTokenEx

svn path=/trunk/; revision=18833
This commit is contained in:
Thomas Bluemel 2005-10-28 14:31:38 +00:00
parent 6ee31ba0a4
commit b1f73ba822

View file

@ -258,7 +258,6 @@ DuplicateTokenEx (IN HANDLE ExistingTokenHandle,
OUT PHANDLE DuplicateTokenHandle) OUT PHANDLE DuplicateTokenHandle)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE NewToken;
NTSTATUS Status; NTSTATUS Status;
SECURITY_QUALITY_OF_SERVICE Sqos; SECURITY_QUALITY_OF_SERVICE Sqos;
@ -291,7 +290,7 @@ DuplicateTokenEx (IN HANDLE ExistingTokenHandle,
&ObjectAttributes, &ObjectAttributes,
FALSE, FALSE,
TokenType, TokenType,
&NewToken); DuplicateTokenHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
@ -344,7 +343,7 @@ CheckTokenMembership(IN HANDLE ExistingTokenHandle,
}; };
PACL Dacl; PACL Dacl;
ULONG SidLen; ULONG SidLen;
HANDLE hToken; HANDLE hToken = NULL;
NTSTATUS Status, AccessStatus; NTSTATUS Status, AccessStatus;
/* doesn't return gracefully if IsMember is NULL! */ /* doesn't return gracefully if IsMember is NULL! */
@ -484,7 +483,7 @@ CheckTokenMembership(IN HANDLE ExistingTokenHandle,
} }
Cleanup: Cleanup:
if (hToken != ExistingTokenHandle) if (hToken != NULL && hToken != ExistingTokenHandle)
{ {
NtClose(hToken); NtClose(hToken);
} }