Пример #1
0
        public static NamedKey[] GetInstancesRecurse(string path)
        {
            byte[] bytes = RegistryHelper.GetHiveBytes(path);

            NamedKey hiveroot = RegistryHelper.GetRootKey(path);

            return(GetInstances(bytes, hiveroot, true));
        }
Пример #2
0
        public ValueKey[] GetValues()
        {
            if (NumberOfValues > 0)
            {
                byte[] bytes = RegistryHelper.GetHiveBytes(this.HivePath);

                return(GetValues(bytes));
            }

            throw new Exception(string.Format("The key '{0}' has no associated values", this.FullName));
        }
Пример #3
0
 public static NamedKey[] GetInstances(string path, string key)
 {
     if (key == null)
     {
         return(NamedKey.GetInstances(RegistryHelper.GetHiveBytes(path), path));
     }
     else
     {
         return(NamedKey.GetInstances(RegistryHelper.GetHiveBytes(path), path, key.TrimEnd('\\')));
     }
 }
Пример #4
0
 public NamedKey[] GetSubKeys()
 {
     if (NumberOfSubKeys > 0)
     {
         byte[] bytes = RegistryHelper.GetHiveBytes(HivePath);
         return(GetSubKeys(bytes));
     }
     else
     {
         return(null);
     }
 }
Пример #5
0
        public static ValueKey Get(string path, string key, string val)
        {
            byte[] bytes = RegistryHelper.GetHiveBytes(path);

            NamedKey hiveroot = RegistryHelper.GetRootKey(bytes, path);

            NamedKey nk = hiveroot;

            if (key != null)
            {
                foreach (string k in key.Split('\\'))
                {
                    foreach (NamedKey n in nk.GetSubKeys(bytes))
                    {
                        if (n.Name.ToUpper() == k.ToUpper())
                        {
                            nk = n;
                        }
                    }
                }
                if (nk == hiveroot)
                {
                    throw new Exception(string.Format("Cannot find key '{0}' in the '{1}' hive because it does not exist.", key, path));
                }
            }

            ValueKey[] values = nk.GetValues(bytes);

            foreach (ValueKey v in values)
            {
                if (v.Name.ToUpper() == val.ToUpper())
                {
                    return(v);
                }
            }

            throw new Exception(string.Format("Cannot find value '{0}' as a value of '{1}' in the '{2}' hive because it does not exist.", val, key, path));
        }
Пример #6
0
        public static ValueKey[] GetInstances(string path, string key)
        {
            byte[] bytes = RegistryHelper.GetHiveBytes(path);

            NamedKey hiveroot = RegistryHelper.GetRootKey(bytes, path);

            NamedKey nk = hiveroot;

            if (key != null)
            {
                foreach (string k in key.Split('\\'))
                {
                    foreach (NamedKey n in nk.GetSubKeys(bytes))
                    {
                        if (n.Name.ToUpper() == k.ToUpper())
                        {
                            nk = n;
                        }
                    }
                }
            }

            return(nk.GetValues(bytes));
        }
Пример #7
0
 public object GetData()
 {
     return(this.GetData(RegistryHelper.GetHiveBytes(this.HivePath)));
 }
Пример #8
0
 public SecurityDescriptor GetSecurityKey()
 {
     byte[] bytes = RegistryHelper.GetHiveBytes(this.HivePath);
     return(GetSecurityKey(bytes));
 }
Пример #9
0
 public static NamedKey Get(string path, string key)
 {
     return(NamedKey.Get(RegistryHelper.GetHiveBytes(path), path, key.TrimEnd('\\')));
 }