判断是否是Guest用户
来源:互联网 发布:淘宝收获了怎么退换货 编辑:程序博客网 时间:2024/05/19 23:18
In Win32, call GetTokenInformation, passing a token handle and the TokenUser constant. It will fill in aTOKEN_USER structure for you. One of the elements in there is the user's SID. It's a BLOB (binary), but you can turn it into a string by using ConvertSidToStringSid.
To get hold of the current token handle, use OpenThreadToken or OpenProcessToken.
If you prefer ATL, it has the CAccessToken class, which has all sorts of interesting things in it.
.NET has the Thread.CurrentPrinciple property, which returns an IPrincipal reference. You can get the SID:
IPrincipal principal = Thread.CurrentPrincipal;
WindowsIdentity identity = principal.Identity as WindowsIdentity;
if (identity != null)
Console.WriteLine(identity.User);
Also in .NET, you can use WindowsIdentity.GetCurrent(), which returns the current user ID:
WindowsIdentity identity = WindowsIdentity.GetCurrent();
if (identity != null)
Console.WriteLine(identity.User);
- 判断是否是Guest用户
- 判断用户是否是测试用户
- 如何判断用户是否是一个管理员
- 如何判断当前用户是否是系统管理员
- C# 判断当前用户是否是管理员
- 判断用户浏览器是否是XP SP2的IE6
- 不用trycatch判断用户输入的是否是整数
- 判断用户设备是否是 iPhone 4 Retina 屏
- 如何判断用户输入的字符串是否是IP地址
- Javascript:判断用户输入的年份是否是闰年
- js判断来访用户是否是手机端
- php网站判断用户是否是手机访问的方法
- 用户输入一个年份,判断这个年是否是闰年。
- 用户输入一个数字,判断这个数字是否是质数。
- PHP 判断用户的设备是否是移动设备
- PHP 判断用户的设备是否是移动设备
- 判断用户是否是第一次打开该app
- 判断用户是否是第一次进入某个页面
- redmine安装介绍
- 大博门槛高,毕业难!
- SQL Helper
- ORA-3136
- C#版Seven Segment LED(Display)
- 判断是否是Guest用户
- 什么是库(library)?
- Android source
- MalformedURLException错误
- Eclipse开发Android的安装配置。
- MySQL锁概述(转载)
- Java动态程序设计:反射介绍
- UNIX/LINUX 平台可执行文件格式分析
- stm8触摸按键调试笔记(1)