Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a process has elevated privileges in windows 7 using native C++?

How can I check if a process has elevated privileges in Windows 7 (using native C++, not C#/C++.net) ?

I've been looking for an answer for quite sometimes, but all I can find are the answers that use the .NET framework.

like image 566
TCS Avatar asked Nov 16 '10 16:11

TCS


People also ask

What is the best way to determine if your program is running with elevated privileges?

Start Task Manager and switch to the Details tab. The new Task Manager has a column called "Elevated" which directly informs you which processes are running as administrator. To enable the Elevated column, right click on any existing column and click Select columns. Check the one called "Elevated", and click OK.


1 Answers

The simplest approach is to call the IsUserAnAdmin function. If you need more precision you can also use GetTokenInformation but in most cases that is overkill.

like image 65
Kenny Kerr Avatar answered Nov 08 '22 10:11

Kenny Kerr