日期:2014-05-20 浏览次数:20691 次
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinin);
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
/// <summary>
/// 检查是否管理员权限
/// </summary>
private static void CheckRoot()
{
System.Security.Principal.WindowsIdentity wid = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal p = new System.Security.Principal.WindowsPrincipal(wid);
bool isAdmin = (p.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator));
FileConfig.WritetFile(isAdmin ? "管理员" : "非管理员");
}