My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time?
相关问题
- How to Debug/Register a Permanent WMI Event Which
- the application was unable to start correctly 0xc0
- Windows 7: How can I get a list of all Windows use
- How to ask for Administrator privileges in Windows
- SVN+SSH checkout over VPN using tortoise SVN, Smar
相关文章
- Looking for documentation on the “right” way to in
- PHP 7 FTP extension is not loaded in Windows 7
- Does winapi's bcrypt.h actually support bcrypt
- Viewing the Process Tree - tlist/tasklist [closed]
- The module “.dll” was loaded but the entry-point w
- node.js and npm has no network access in windows 7
- Unable to Create or Write to a file as standard us
- How to use vscode remote containers with Docker To
Here is a VB6 implementation of a check if a (current) process is elevated
The following C++ function can do that:
I do not think elevation type is the answer you want. You just want to know if it is elevated. Use TokenElevation instead of TokenElevationType when you call GetTokenInformation. If the structure returns a positive value, the user is admin. If zero, the user is normal elevation.
Here is a Delphi solution:
For those of us working in C#, in the Windows SDK there is a "UACDemo" application as a part of the "Cross Technology Samples". They find if the current user is an administrator using this method:
(Note: I refactored the original code to be a property, rather than an "if" statement)