Detect if program is running with full administrator rights

David Chen picture David Chen · Nov 20, 2010 · Viewed 14.8k times · Source

I need to determine if my program is running with full administrator rights. By that I mean if uac is turned on (for win vista/7) that I need to determine if the program actually has admin rights (like if the user right clicked and selected "run as administator") and not limited by uac. How do I do this in C++?

Answer

Anders picture Anders · Nov 20, 2010

Other alternatives are: IsUserAnAdmin or AccessCheck

Checking the TOKEN_ELEVATION* stuff in the token is not required for testing the current process but it is useful if you need to find out if the user could elevate because they have a split token etc.