Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switch process to run under different credentials

Status
Not open for further replies.

jamsek19

Programmer
Feb 4, 2002
35
SI
Hello.
Does anybody know how to programme in C++ a part of code to run under different credentials (ie. Administrator rights).
For example: an .exe is running under momentary account credentials. In some part of code program needs Administrative rights to finished its job. So I have Admin password and a program with that password can switch to Admin credentials and finished its job.
Can anybody help me?

Thanks in advance

Andreo
 
It's not a complete answer: try LogonUser to obtain a token handle then pass it to ImpersonateLoggedOnUser then call RevertToSelf to stop impersonation.
May be it helps...
 
ArkM, thanks. I found these functions in MSDN yesterday and I thought they're used for other purposes.
Now I tried and works just as I wish.
Thanks.
Best regards
Andreo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top