/// <summary> /// Read the registry sub keys /// </summary> /// <param name="modelRegistryKey"></param> private void ReadRegistrySubKeys(ModelRegistryKey regKeyModel) { // Get the registryKey instance using (RegistryKey rootRegKey = InitializeRegistryKey(regKeyModel.RegsitryPath.RootPath, regKeyModel.RegsitryPath.SubKeyPath, RegistryView.Registry32)) { string[] subkeyNames = rootRegKey.GetSubKeyNames(); if (subkeyNames.Length <= 0) { return; } if (this.QueryFilter.ProcQueryEnum.DoAddAllSubKeys() == true) { if (regKeyModel.SubKeys == null) { regKeyModel.SubKeys = new List <ModelRegistryKey>(); } foreach (string subKeyName in subkeyNames) { ModelRegistryKey subKey = regKeyModel.GetSubKeyObject(subKeyName); ReadRegistry(subKey); } } else { foreach (ModelRegistryKey keyValue in regKeyModel.SubKeys) { ReadRegistry(keyValue); } } } }
/// <summary> /// Read the windows registry for every path entry in the config file and fill the Values. /// </summary> protected void ReadRegistry(ModelRegistryKey regKeyModel) { // Read the registry ReadRegistryValues(regKeyModel); if (this.QueryFilter.ProcQueryEnum.DoAddAllSubKeys() == true || regKeyModel.SubKeys != null || ((this.QueryFilter.LevelSubkeyQuery > regKeyModel.TreeLevel) || this.QueryFilter.LevelSubkeyQuery == -1)) { ReadRegistrySubKeys(regKeyModel); } }
/// <summary> /// Read the windows registry for only one path entry /// </summary> /// <param name="regPathQuery"></param> protected void ReadRegistryValues(ModelRegistryKey regPathQuery) { // Get the registryKey instance using (RegistryKey rootRegKey = InitializeRegistryKey(regPathQuery.RegsitryPath.RootPath, regPathQuery.RegsitryPath.SubKeyPath, RegistryView.Registry32)) { // Add only those values requested for if (this.QueryFilter.ProcQueryEnum.DoAddAllValues() == false) { foreach (ModelRegistryKeyValue keyValue in regPathQuery.KeyValuePairs) { ReadRegistryValue(rootRegKey, keyValue); } } else { // Add all the values foreach (string valueName in rootRegKey.GetValueNames()) { ModelRegistryKeyValue keyValue = regPathQuery.GetValueObject(valueName); ReadRegistryValue(rootRegKey, keyValue); } } } }
/// <summary> /// Using the actual model object created in memory from the config file and the type of process. /// </summary> /// <param name="regKeyModel">The model object reference</param> /// <param name="enumProcQuery">The process query type. Default is NONE.</param> public ProcessRegistryQuery(ModelRegistryKey regKeyModel, ConfiguratorRegistryQuery configurator) { this.RegKey = regKeyModel; this.QueryFilter = configurator; }