WPE|52wpe|我爱WPE

 找回密码
 注册会员
搜索
  • 2004查看
  • 0回复

主题

好友

1204

积分

金牌会员

发表于 2010-2-2 13:59:32 |显示全部楼层
BOOL IsUserAdmin()
{
BOOL isAdmin = FALSE;
PSID psid = NULL;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;

BOOL bSuccess = AllocateAndInitializeSid(&NtAuthority, // A handle to an access token
2, // Specifies the number of subauthorities to place in the SID
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&psid);
if (TRUE == bSuccess)
{
bSuccess = CheckTokenMembership(NULL, psid, &isAdmin);
isAdmin = (TRUE == bSuccess) ? isAdmin : FALSE;
FreeSid(psid);
}

return isAdmin;
}

快速发帖

您需要登录后才可以回帖 登录 | 注册会员

手机版|Archiver|WPE|52wpe|我爱WPE ( 闽ICP备15009081号 )

GMT+8, 2024-5-3 00:22 , Processed in 0.049685 second(s), 16 queries .

返回顶部