简体   繁体   中英

In windows - API - How to get/use the current users privileges( or single sign on)

I am using vc++. I am trying to create a "front end" which will create a task and put that in " Window's native Scheduler". The task's action is invoking a backup app. Every task needs some privileges to execute the given program. I need to assign administrator privileges to this task. I can assure that the front end can be run by admin only. Now I want to use assign the current user's(admin) privileges to the task. Upto the dig I did in internet/msdn , the api provides below two options( 3rd option is my assumption)

1) Provide account name,password for that task.

2) Use flag "TASK_FLAG_RUN_ONLY_IF_LOGGED_ON", and give the administrator "account name", and password as NULL.

3)Single Sign on

Now the constraints:

1->It is not a good idea to make the client to type the admin account name and password frequently

2->Admin Account name is not always the same(in XP it is possible to change it). So I can't provide a default admin account name.

3-> I don't know how to achieve it. The "single sign on" is something like once you logged in as admin, then the applications can get the current(logged in) user's privileges.

Searching MSDN for this is like "searching a needle in hay stack". Somebody, please shed a light on the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM