SetTokenInformation

Giganews Newsgroups
Subject: SetTokenInformation
Posted by:  Kishore (kishore…@hotmail.com)
Date: Wed, 30 Aug 2006

Hi,

I am getting a "Invalid Parameter" exception (Error Code 87) when I try to
use SetTokenInformation or GetTokenInformation inside a windows NT Service.
The service is running with administrator rights.

HANDLE  hToken;
SECURITY_IMPERSONATION_LEVEL imp_level;
imp_level = SecurityIdentification;
if ( OpenProcessToken( GetCurrentProcess(), TOKEN_WRITE, &hToken))
{
  SetTokenInformation( hToken, TokenImpersonationLevel, (LPVOID) &imp_level,
sizeof(imp_level)); //This line returns an error code of 87
}

Has anybody come across this error? Any help will be greatly appreciated.

Thanks,
K

Replies