static bool checkIsAdmin() { try { string name = "Vpn_Check_Admin_Key_NET_" + processId.ToString(); string teststr = Str.GenRandStr(); if (Reg.WriteStr(RegRoot.LocalMachine, "", name, teststr) == false) { return(false); } try { string ret = Reg.ReadStr(RegRoot.LocalMachine, "", name); if (ret == teststr) { return(true); } return(false); } finally { Reg.DeleteValue(RegRoot.LocalMachine, "", name); } } catch { return(false); } }
public bool DeleteValue(string name) { return(Reg.DeleteValue(rootKey, appSubKey, name)); }