如果发现用户拥有管理员权限 [英] Discover if user has Admin rights
本文介绍了如果发现用户拥有管理员权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能确定当前用户(用户在运行我的应用程序)具有管理员权限(即是管理员组的成员)?我需要以不同的注册一些COM组件具有有限访问权限的用户。我使用C ++(WTL和Win32)。
How can I determine if the current user (the user running my application) has admin rights (i.e. is a member of the Administrator group)? I need to register some COM components differently for users with limited access. I am using C++ (WTL and Win32).
推荐答案
IsUserAnAdmin ()是快速简便的方法,但MSDN警告说,它可能消失在未来,所以你可能要调用的 CheckTokenMembership()在你的线程/进程令牌,而不是(用的为管理员组众所周知的SID )
IsUserAnAdmin() is the fast and easy way, but MSDN warns that it might go away in the future, so you might want to call CheckTokenMembership() on your thread/process token instead (Comparing with a well known sid for the admin group)
这篇关于如果发现用户拥有管理员权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文