Detect admin privilege due to elevation?

  • Thread starter Thread starter Frank S
  • Start date Start date
F

Frank S

What API can I use to distinguish between having administrator privilege normally, versus having
administrator privilege due to elevation (where a user is prompted to enter an admin account and
password)?
 
None. There is no difference between the two. You could look to see if UAC is
enabled and surmise from that.
 
Frank said:
What API can I use to distinguish between having administrator privilege
normally, versus having administrator privilege due to elevation (where a
user is prompted to enter an admin account and password)?

You can use GetTokenElevation() with a TOKEN_INFORMATION_CLASS of
TokenElevation or TokenElevationType to determine if and how a token is
elevated. The Windows SDK does not seem to have these values documented, so
you may have to look at winnt.h to see what can be returned for these.
 
Back
Top