Access Is Denied in WTSQueryUserToken and Windows 2003 Ent SP1
Hello,
I have a service that needs to get the current user's token. I do this by using the HandlerEx along with the WTS notifications that occur during any Logon/Logoff/Lock/etc.. to get the SessionId and call WTSQueryUserToken with that SessionId. This code works fine on the XP Sp1 and Sp2 operating systems, but for some reason, whenever I call it with Windows 2003 enterprise SP1, the code fails to run, returning an error of Access Is Denied.
I looked it up and saw that Access Is Denied means that I either don't have the Local System user or the SE_TCB_NAME privilege enabled. I have both of them enabled, and it still doesn't work.
I'm really lost, can anyone please help?
Thanks
Re: Access Is Denied in WTSQueryUserToken and Windows 2003 Ent SP1
Hello,
After installing the service check that it actually runs in the context of the LocalSystem account (it's not enough to just have the LocalSystem account present)
In services.msc->Properties->Log On Tab->Log on as.
If yes, check that LocalSystem account has all the privileges required by WTSQueryUserToken() enabled.