gpt4 book ai didi

c++ - 如何知道自己是否有windows的admin权限?

转载 作者:可可西里 更新时间:2023-11-01 10:09:41 27 4
gpt4 key购买 nike

windows有没有API可以检测当前用户(current now)是否有admin权限?

BOOL IsHasAuthority(){

非常感谢!

最佳答案

How to Determine Whether a Process or Thread Is Running As an Administrator

Use this solution when you are writing an application that must determine whether any of the following is true:

  • The current user can perform administrative tasks. The current
    user is a member of the
  • Administrators group. A supplied token handle represents an
    administrator with an elevated token.
  • A token handle represents a user who is a member of the Administrators group.
  • The program is running with an elevated token or needs to spawn a
    child program that is elevated so it
    can perform administrative tasks.

关于c++ - 如何知道自己是否有windows的admin权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3078176/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com