Ejemplo n.º 1
0
        public RegistryInventory[] GetResults()
        {
            List <RegistryInventory> Results = new List <RegistryInventory>();
            RegistryHive             Hive    = new RegistryHive();
            string Path = string.Empty;

            // Extract the Hive and Subkey path from the key string
            if (!RegistryTools.TryGetRegistryHiveAndPath(Rule.Key, ref Hive, ref Path))
            {
                return(Results.ToArray());
            }

            // Get redirection options

            // Get target registry key while validating existence and accurate case for path
            RegistryKey TargetKey = GetTargetKey(Hive, Path);

            // Get values from registry key
            if (TargetKey != null)
            {
                GetKeyValues(Results, TargetKey, Rule.Name);
                TargetKey.Dispose();
            }
            else
            {
                Log.Write($@"Key doesn't exist {Rule.Key}");
            }

            return(Results.ToArray());
        }