开发者

Call API in particular windows credentials

I want to call an API in particular Windows credentials,

One way is, write particular piece of code or API in another EXE and then execu开发者_Python百科te the EXE in particular windows credentials. Please let me know if you are aware of any other solution.

Thanks in advance.


It's hard to understand what you're asking for, because I'm not sure what you mean by 'Windows credentials,' but you may want to look up 'impersonation.'

The MSDN page is here http://msdn.microsoft.com/en-us/library/aa376391%28v=vs.85%29.aspx; you can see the different types of impersonation and pick what fits your situation best.

In this case, it sounds like you want the ImpersonateLoggedOnUser function.


You could use LogonUser(), then ImpersonateLoggenOnUser(), then call your code, then call RevertToSelf() to get back to the original credentials. You can do that either in your thread, or create a separate thread and do it there. The latter is preferred so that you have the thread exited after that and not skip the RevertToSelf() call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜