public void DeleteKey(BaseRegistryKey baseKey, string name) { if (_keyMap.ContainsKey(baseKey)) { _keyMap[baseKey].RemoveAll(m => m.Name == name); } }
public void AddFakeKey(BaseRegistryKey baseKey, MockRegistryKey fakeKey) { if (!_keyMap.ContainsKey(baseKey)) { _keyMap.Add(baseKey, new List<MockRegistryKey>()); } _keyMap[baseKey].Add(fakeKey); }
public void AddFakeKey(BaseRegistryKey baseKey, MockRegistryKey fakeKey) { if (!_keyMap.ContainsKey(baseKey)) { _keyMap.Add(baseKey, new List <MockRegistryKey>()); } _keyMap[baseKey].Add(fakeKey); }
public IRegistryKey OpenSubKey(BaseRegistryKey baseKey, string name) { foreach (MockRegistryKey key in _keyMap[baseKey]) { if (key.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { return key; } } return null; }
public IRegistryKey OpenSubKey(BaseRegistryKey baseKey, string name) { foreach (MockRegistryKey key in _keyMap[baseKey]) { if (key.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { return(key); } } return(null); }
public IRegistryKey CreateSubKey(BaseRegistryKey baseKey, string name) { uint action; UIntPtr subKey; int retValue = RegCreateKeyEx(new UIntPtr((uint)baseKey), name, 0, null, 0, (int)RegWow64Options.KeyWow6464Key | (int)RegistryRights.WriteKey | (int)RegistryRights.ReadKey, 0, out subKey, out action); if (retValue == 0) { return(new RegistryKey(subKey)); } return(null); }
public IRegistryKey CreateSubKey(BaseRegistryKey baseKey, string name) { if (!_keyMap.ContainsKey(baseKey)) { _keyMap.Add(baseKey, new List<MockRegistryKey>()); } foreach (MockRegistryKey key in _keyMap[baseKey]) { if (key.Name.Equals(name,StringComparison.InvariantCultureIgnoreCase)) { return key; } } MockRegistryKey newKey = new MockRegistryKey(name); _keyMap[baseKey].Add(newKey); return newKey; }
private RegistryKey OpenNewBaseKey() { RegistryHive key = BaseRegistryKey.ToString().ToUpper() switch { "HKEY_CLASSES_ROOT" => RegistryHive.ClassesRoot, "HKEY_USERS" => RegistryHive.Users, "HKEY_CURRENT_USER" => RegistryHive.CurrentUser, "HKEY_LOCAL_MACHINE" => RegistryHive.LocalMachine, _ => RegistryHive.LocalMachine, }; if (RemotePC != null) { return(RegistryKey.OpenRemoteBaseKey(key, RemotePC, BaseRegistryView)); } else { return(RegistryKey.OpenBaseKey(key, BaseRegistryView)); } }
public IRegistryKey CreateSubKey(BaseRegistryKey baseKey, string name) { if (!_keyMap.ContainsKey(baseKey)) { _keyMap.Add(baseKey, new List <MockRegistryKey>()); } foreach (MockRegistryKey key in _keyMap[baseKey]) { if (key.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { return(key); } } MockRegistryKey newKey = new MockRegistryKey(name); _keyMap[baseKey].Add(newKey); return(newKey); }
public IRegistryKey OpenSubKey(BaseRegistryKey baseKey, string name) { UIntPtr subKey; int retValue = RegOpenKeyEx( new UIntPtr((uint)baseKey), name, 0, (int)RegWow64Options.KeyWow6464Key | (int)RegistryRights.ReadKey | (int)RegistryRights.WriteKey, out subKey); if (retValue == 0) { return new RegistryKey(subKey); } return null; }
public void DeleteKey(BaseRegistryKey baseKey, string name) { DeleteKeyRecursive(new UIntPtr((uint)baseKey), name); }