判断当前登录用户是否有管理员权限
1个回答
展开全部
代码片段(1) [全屏查看所有代码]
1. [代码][C/C++]代码 跳至 [1] [全屏预览]
view sourceprint?
01
BOOL IsAdministratorUser()
02
{
03
static HMODULE hModule = NULL;
04
if( !hModule )
05
hModule = LoadLibrary(_T("shell32.dll"));
06
if( !hModule )
07
return TRUE;
08
09
typedef BOOL (__stdcall *FunctionIsUserAdmin)();
10
FunctionIsUserAdmin pfnIsUserAnAdmin = (FunctionIsUserAdmin)GetProcAddress(hModule, "IsUserAnAdmin");
11
if (pfnIsUserAnAdmin)
12
return pfnIsUserAnAdmin();
13
return TRUE;
14
}
1. [代码][C/C++]代码 跳至 [1] [全屏预览]
view sourceprint?
01
BOOL IsAdministratorUser()
02
{
03
static HMODULE hModule = NULL;
04
if( !hModule )
05
hModule = LoadLibrary(_T("shell32.dll"));
06
if( !hModule )
07
return TRUE;
08
09
typedef BOOL (__stdcall *FunctionIsUserAdmin)();
10
FunctionIsUserAdmin pfnIsUserAnAdmin = (FunctionIsUserAdmin)GetProcAddress(hModule, "IsUserAnAdmin");
11
if (pfnIsUserAnAdmin)
12
return pfnIsUserAnAdmin();
13
return TRUE;
14
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询