Click here to Skip to main content
Licence CPOL
First Posted 29 Jun 2010
Views 5,534
Downloads 228
Bookmarked 4 times

Run an application under current logon user's privileges

By | 29 Jun 2010 | Article
3 solutions provided for running an application under current logon user's privileges

Introduction

The task was to run an application in the current user's privileges even though it was scheduled as a system account. It required 1.5 days R&D to get a proper solution. I have provided 3 solutions to this.

Solution 1

The application must be run as a local system account (use AT command). This is the prerequisite for successful execution of APIs.

Take sessionId of the current session, then find the current user's token, then impersonate as logon user.

Solution 2

I have taken the token of explorer.exe and then impersonated as a logon user.

Solution 3

I have taken the token of logon user and then impersonated as a logon user.
Solution by: Nitin Lokhande

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Sagar G



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmemberdigital man0:23 30 Jun '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 30 Jun 2010
Article Copyright 2010 by Sagar G
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid