您的位置:首页 > 其它

create an process with administrator privilege from service in Vista

2012-02-17 13:22 423 查看
I did it as the following:

1.Get the session if of the active console user (WTSGetActiveConsoleSessionId)

2.Get the user's token (WTSQueryUserToken),the user has administrator privilege

3.duplicate the token ((DuplicateTokenEx)

4.Get the linked token of ther user token. The linked token has admin privilege.

-----------------------------------------------------------------------------------------------------------------------------------------

TOKEN_LINKED_TOKEN admin;

GetTokenInformation(hUserToken, TokenLinkedToken, &admin, sizeof(TOKEN_LINKED_TOKEN), &len)) ;

HANDLE AdminToken = admin.LinkedToken;

--------------------------------------------------------------------------------------------------------------------------------------------

5. create the user process (createProcessAsUser)

http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/6fcdff4d-7c63-4ea0-b883-5a660ec8d4af
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐