Ejemplo n.º 1
0
 /// <summary>
 /// セキュリティ情報を取得
 /// </summary>
 public void LoadSecurity()
 {
     using (RegistryKey regKey = RegistryControl.GetRegistryKey(Path, false, false))
     {
         LoadSecurity(regKey);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 値を取得
 /// </summary>
 public void LoadValues()
 {
     using (RegistryKey regKey = RegistryControl.GetRegistryKey(Path, false, false))
     {
         LoadValues(regKey);
     }
 }
Ejemplo n.º 3
0
        private void LoadSecurity(RegistryKey regKey)
        {
            RegistrySecurity security = regKey.GetAccessControl();

            this.Owner     = security.GetOwner(typeof(NTAccount)).Value;
            this.Access    = RegistryControl.AccessRulesToString(security.GetAccessRules(true, false, typeof(NTAccount)));
            this.Inherited = !security.AreAccessRulesProtected;
        }
Ejemplo n.º 4
0
        private void LoadValues(RegistryKey regKey)
        {
            Values = new SerializableDictionary <string, string>();

            string[] valueNames = regKey.GetValueNames();
            Array.Sort(valueNames, StringComparer.OrdinalIgnoreCase);
            foreach (string name in valueNames)
            {
                RegistryValueKind valueKind = regKey.GetValueKind(name);

                Values[name] = RegistryControl.ValueKindToString(valueKind) + ":" +
                               RegistryControl.RegistryValueToString(regKey, name, valueKind, true);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// PowerShell用のレジストリキーパスを取得
        /// </summary>
        /// <returns></returns>
        public string GetPSPath()
        {
            string keyName = Path.Substring(Path.IndexOf("\\") + 1);

            switch (RegistryControl.GetRootkey(Path).ToString())
            {
            case Item.HKEY_CLASSES_ROOT: return(System.IO.Path.Combine(Item.HKCR_, keyName));

            case Item.HKEY_CURRENT_USER: return(System.IO.Path.Combine(Item.HKCU_, keyName));

            case Item.HKEY_LOCAL_MACHINE: return(System.IO.Path.Combine(Item.HKLM_, keyName));

            case Item.HKEY_USERS: return(System.IO.Path.Combine(Item.HKU_, keyName));

            case Item.HKEY_CURRENT_CONFIG: return(System.IO.Path.Combine(Item.HKCC_, keyName));
            }
            return(string.Empty);
        }