如何在C ++中检查帐户是否为admin

问题描述:



我有一个用户名,我需要检查用户名是否为管理员用户帐户.
如何检查?
任何API.我搜索了但没有得到.

Hi,

i have one username, i need to check that username is admin user account or not.
how to check?
Any API. I searched, but i didn''t get.

也许 [ ^ ]会帮助您吗? :)
Maybe it[^] will help you ? :)


下面的CodeProject文章很好地涵盖了这个主题:

过程强制性级别检查和自我快速入门指南-UAC下的海拔高度

如果通过允许传递任意访问令牌来概括IsUserInAdminGroup,则可以实现所需的功能.
The following CodeProject article covers nicely this subject:

A Quick-Start Guide of Process Mandatory Level Checking and Self-elevation under UAC

If you generalize the IsUserInAdminGroup by allowing an arbitrary access token to be passed, you can achieve what you asked for.