コード例 #1
0
        private void FillKeys(RegistryKeySnapshot snapshot, RegistryKey key)
        {
            if (key.SubKeyCount != 0)
            {
                RegistryKeySnapshotCollection children;

                children = new RegistryKeySnapshotCollection(snapshot);

                // ReSharper disable once LoopCanBePartlyConvertedToQuery
                foreach (string name in key.GetSubKeyNames())
                {
                    // HACK: Although I thought key names were unique, clearly I was wrong as the scan used to crash on
                    // HKEY_LOCAL_MACHINE\SOFTWARE\Yamaha APO which appears at least twice on my system, although RegEdit
                    // only shows a single copy

                    if (!children.Contains(this.GetShortName(name)))
                    {
                        RegistryKey subKey;

                        subKey = this.GetSubKey(key, name);

                        if (subKey != null)
                        {
                            RegistryKeySnapshot childSnapshot;

                            childSnapshot = this.TakeSnapshot(subKey);

                            children.Add(childSnapshot);
                        }
                    }
                }

                snapshot.SubKeys = children;
            }
        }
コード例 #2
0
        private void SetParents(RegistryKeySnapshot key)
        {
            RegistryKeySnapshotCollection   subKeys;
            RegistryValueSnapshotCollection values;

            values  = key.Values;
            subKeys = key.SubKeys;

            if (values != null)
            {
                values.Parent = key;
            }

            if (subKeys != null)
            {
                subKeys.Parent = key;

                foreach (RegistryKeySnapshot child in subKeys)
                {
                    child.Parent = key;

                    this.SetParents(child);
                }
            }
        }
コード例 #3
0
        private void FillKeys(RegistryKeySnapshot snapshot, RegistryKey key)
        {
            if (key.SubKeyCount != 0)
              {
            RegistryKeySnapshotCollection children;

            children = new RegistryKeySnapshotCollection(snapshot);

            // ReSharper disable once LoopCanBePartlyConvertedToQuery
            foreach (string name in key.GetSubKeyNames())
            {
              // HACK: Although I thought key names were unique, clearly I was wrong as the scan used to crash on
              // HKEY_LOCAL_MACHINE\SOFTWARE\Yamaha APO which appears at least twice on my system, although RegEdit
              // only shows a single copy

              if (!children.Contains(this.GetShortName(name)))
              {
            RegistryKey subKey;

            subKey = this.GetSubKey(key, name);

            if (subKey != null)
            {
              RegistryKeySnapshot childSnapshot;

              childSnapshot = this.TakeSnapshot(subKey);

              children.Add(childSnapshot);
            }
              }
            }

            snapshot.SubKeys = children;
              }
        }
コード例 #4
0
        private RegistryKeySnapshot TakeSnapshot(RegistryKey key)
        {
            RegistryKeySnapshot snapshot;
            string name;

            Trace.WriteLine($"Scanning: {key.Name}");

            name = this.GetShortName(key.Name);

            snapshot = new RegistryKeySnapshot(name);

            this.FillSnapshot(snapshot, key);

            return(snapshot);
        }
コード例 #5
0
        private void FillValues(RegistryKeySnapshot snapshot, RegistryKey key)
        {
            if (key.ValueCount != 0)
            {
                RegistryValueSnapshotCollection children;
                string[] names;

                children = new RegistryValueSnapshotCollection(snapshot);

                try
                {
                    names = key.GetValueNames();
                }
                catch (IOException)
                {
                    // system error, saw this in latest Windows 10
                    // when trying to scan HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\CreativeEventCache\SubscribedContent-314559
                    names = _emptyArray;
                }

                for (int i = 0; i < names.Length; i++)
                {
                    string            name;
                    string            value;
                    RegistryValueKind type;
                    object            rawValue;

                    name     = names[i];
                    type     = key.GetValueKind(name);
                    rawValue = this.GetValue(key, type, name);
                    value    = this.TransformRawValue(type, rawValue);

                    children.Add(new RegistryValueSnapshot(name, value, type));
                }

                snapshot.Values = children;
            }
        }
コード例 #6
0
        private void FillValues(RegistryKeySnapshot snapshot, RegistryKey key)
        {
            if (key.ValueCount != 0)
            {
                RegistryValueSnapshotCollection children;

                children = new RegistryValueSnapshotCollection(snapshot);

                foreach (string name in key.GetValueNames())
                {
                    string            value;
                    RegistryValueKind type;
                    object            rawValue;

                    type     = key.GetValueKind(name);
                    rawValue = this.GetValue(key, type, name);
                    value    = this.TransformRawValue(type, rawValue);

                    children.Add(new RegistryValueSnapshot(name, value, type));
                }

                snapshot.Values = children;
            }
        }
コード例 #7
0
 private void FillSnapshot(RegistryKeySnapshot snapshot, RegistryKey key)
 {
     this.FillKeys(snapshot, key);
     this.FillValues(snapshot, key);
 }
コード例 #8
0
 public RegistryValueSnapshotCollection(RegistryKeySnapshot parent)
     : this()
 {
     this.Parent = parent;
 }
コード例 #9
0
 private void CompareKeys(RegistryKeySnapshot lhs, RegistryKeySnapshot rhs, ICollection <ChangeResult> results)
 {
     this.CompareValues(lhs.Values, rhs.Values, results);
     this.CompareKeys(lhs.SubKeys, rhs.SubKeys, results);
 }
コード例 #10
0
        private void SetParents(RegistryKeySnapshot key)
        {
            RegistryKeySnapshotCollection subKeys;
              RegistryValueSnapshotCollection values;

              values = key.Values;
              subKeys = key.SubKeys;

              if (values != null)
              {
            values.Parent = key;
              }

              if (subKeys != null)
              {
            subKeys.Parent = key;

            foreach (RegistryKeySnapshot child in subKeys)
            {
              child.Parent = key;

              this.SetParents(child);
            }
              }
        }
コード例 #11
0
 private void CompareKeys(RegistryKeySnapshot lhs, RegistryKeySnapshot rhs, ICollection<ChangeResult> results)
 {
     this.CompareValues(lhs.Values, rhs.Values, results);
       this.CompareKeys(lhs.SubKeys, rhs.SubKeys, results);
 }
コード例 #12
0
        private RegistryKeySnapshot TakeSnapshot(RegistryKey key)
        {
            RegistryKeySnapshot snapshot;
              string name;

              Trace.WriteLine($"Scanning: {key.Name}");

              name = this.GetShortName(key.Name);

              snapshot = new RegistryKeySnapshot(name);

              this.FillSnapshot(snapshot, key);

              return snapshot;
        }
コード例 #13
0
        private void FillValues(RegistryKeySnapshot snapshot, RegistryKey key)
        {
            if (key.ValueCount != 0)
              {
            RegistryValueSnapshotCollection children;

            children = new RegistryValueSnapshotCollection(snapshot);

            foreach (string name in key.GetValueNames())
            {
              string value;
              RegistryValueKind type;
              object rawValue;

              type = key.GetValueKind(name);
              rawValue = this.GetValue(key, type, name);
              value = this.TransformRawValue(type, rawValue);

              children.Add(new RegistryValueSnapshot(name, value, type));
            }

            snapshot.Values = children;
              }
        }
コード例 #14
0
 private void FillSnapshot(RegistryKeySnapshot snapshot, RegistryKey key)
 {
     this.FillKeys(snapshot, key);
       this.FillValues(snapshot, key);
 }