From 16ba2ba0ab0291bfda46db0c79b3f928425116d0 Mon Sep 17 00:00:00 2001 From: StingRaptor Date: Fri, 22 Jan 2016 22:23:58 +0100 Subject: [PATCH] Added support for creating different types of registry values. --- Client/Core/Commands/RegistryHandler.cs | 4 +- Client/Core/Registry/RegistryEditor.cs | 6 +- Server/Forms/FrmRegistryEditor.Designer.cs | 5 ++ Server/Forms/FrmRegistryEditor.cs | 45 ++++++++++++++ Server/Forms/FrmRegistryEditor.resx | 72 +++++++++++----------- 5 files changed, 91 insertions(+), 41 deletions(-) diff --git a/Client/Core/Commands/RegistryHandler.cs b/Client/Core/Commands/RegistryHandler.cs index 6ea3b388..95fe2054 100644 --- a/Client/Core/Commands/RegistryHandler.cs +++ b/Client/Core/Commands/RegistryHandler.cs @@ -140,8 +140,8 @@ public static void HandleCreateRegistryValue(xClient.Core.Packets.ServerPackets. errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; - - responsePacket.Value = new RegValueData(newKeyName, packet.Kind.RegistryTypeToString(), null); + object valueData = packet.Kind.GetDefault(); + responsePacket.Value = new RegValueData(newKeyName, packet.Kind.RegistryTypeToString(), packet.Kind.RegistryTypeToString(valueData)); responsePacket.KeyPath = packet.KeyPath; responsePacket.Execute(client); diff --git a/Client/Core/Registry/RegistryEditor.cs b/Client/Core/Registry/RegistryEditor.cs index c25ce33c..a480b587 100644 --- a/Client/Core/Registry/RegistryEditor.cs +++ b/Client/Core/Registry/RegistryEditor.cs @@ -193,16 +193,16 @@ public static bool CreateRegistryValue(string keyPath, RegistryValueKind kind, o //Try to find available names int i = 1; - string testName = String.Format("New Key #{0}", i); + string testName = String.Format("New Value #{0}", i); while (key.ContainsValue(testName)) { i++; - testName = String.Format("New Key #{0}", i); + testName = String.Format("New Value #{0}", i); } name = testName; - bool success = key.CreateValueSafe(name, "", kind); + bool success = key.CreateValueSafe(name, kind.GetDefault(), kind); //Child could not be created if (!success) diff --git a/Server/Forms/FrmRegistryEditor.Designer.cs b/Server/Forms/FrmRegistryEditor.Designer.cs index f46cc1c9..68b3580b 100644 --- a/Server/Forms/FrmRegistryEditor.Designer.cs +++ b/Server/Forms/FrmRegistryEditor.Designer.cs @@ -218,30 +218,35 @@ private void InitializeComponent() this.binaryValueToolStripMenuItem.Name = "binaryValueToolStripMenuItem"; this.binaryValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.binaryValueToolStripMenuItem.Text = "Binary Value"; + this.binaryValueToolStripMenuItem.Click += new System.EventHandler(this.createBinaryRegistryValue_Click); // // dWORD32bitValueToolStripMenuItem // this.dWORD32bitValueToolStripMenuItem.Name = "dWORD32bitValueToolStripMenuItem"; this.dWORD32bitValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.dWORD32bitValueToolStripMenuItem.Text = "DWORD (32-bit) Value"; + this.dWORD32bitValueToolStripMenuItem.Click += new System.EventHandler(this.createDwordRegistryValue_Click); // // qWORD64bitValueToolStripMenuItem // this.qWORD64bitValueToolStripMenuItem.Name = "qWORD64bitValueToolStripMenuItem"; this.qWORD64bitValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.qWORD64bitValueToolStripMenuItem.Text = "QWORD (64-bit) Value"; + this.qWORD64bitValueToolStripMenuItem.Click += new System.EventHandler(this.createQwordRegistryValue_Click); // // multiStringValueToolStripMenuItem // this.multiStringValueToolStripMenuItem.Name = "multiStringValueToolStripMenuItem"; this.multiStringValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.multiStringValueToolStripMenuItem.Text = "Multi-String Value"; + this.multiStringValueToolStripMenuItem.Click += new System.EventHandler(this.createMultiStringRegistryValue_Click); // // expandableStringValueToolStripMenuItem // this.expandableStringValueToolStripMenuItem.Name = "expandableStringValueToolStripMenuItem"; this.expandableStringValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.expandableStringValueToolStripMenuItem.Text = "Expandable String Value"; + this.expandableStringValueToolStripMenuItem.Click += new System.EventHandler(this.createExpandStringRegistryValue_Click); // // toolStripSeparator1 // diff --git a/Server/Forms/FrmRegistryEditor.cs b/Server/Forms/FrmRegistryEditor.cs index d0db2b74..c0083bf1 100644 --- a/Server/Forms/FrmRegistryEditor.cs +++ b/Server/Forms/FrmRegistryEditor.cs @@ -488,6 +488,51 @@ private void createStringRegistryValue_Click(object sender, EventArgs e) } } + private void createBinaryRegistryValue_Click(object sender, EventArgs e) + { + if (tvRegistryDirectory.SelectedNode != null) + { + //Request the creation of a new Registry value of type REG_BINARY + new xServer.Core.Packets.ServerPackets.DoCreateRegistryValue(tvRegistryDirectory.SelectedNode.FullPath, RegistryValueKind.Binary).Execute(_connectClient); + } + } + + private void createDwordRegistryValue_Click(object sender, EventArgs e) + { + if (tvRegistryDirectory.SelectedNode != null) + { + //Request the creation of a new Registry value of type REG_DWORD + new xServer.Core.Packets.ServerPackets.DoCreateRegistryValue(tvRegistryDirectory.SelectedNode.FullPath, RegistryValueKind.DWord).Execute(_connectClient); + } + } + + private void createQwordRegistryValue_Click(object sender, EventArgs e) + { + if (tvRegistryDirectory.SelectedNode != null) + { + //Request the creation of a new Registry value of type REG_QWORD + new xServer.Core.Packets.ServerPackets.DoCreateRegistryValue(tvRegistryDirectory.SelectedNode.FullPath, RegistryValueKind.QWord).Execute(_connectClient); + } + } + + private void createMultiStringRegistryValue_Click(object sender, EventArgs e) + { + if (tvRegistryDirectory.SelectedNode != null) + { + //Request the creation of a new Registry value of type REG_MULTI_SZ + new xServer.Core.Packets.ServerPackets.DoCreateRegistryValue(tvRegistryDirectory.SelectedNode.FullPath, RegistryValueKind.MultiString).Execute(_connectClient); + } + } + + private void createExpandStringRegistryValue_Click(object sender, EventArgs e) + { + if (tvRegistryDirectory.SelectedNode != null) + { + //Request the creation of a new Registry value of type REG_QWORD + new xServer.Core.Packets.ServerPackets.DoCreateRegistryValue(tvRegistryDirectory.SelectedNode.FullPath, RegistryValueKind.ExpandString).Execute(_connectClient); + } + } + #endregion #endregion diff --git a/Server/Forms/FrmRegistryEditor.resx b/Server/Forms/FrmRegistryEditor.resx index 92ada8fa..e006c7bc 100644 --- a/Server/Forms/FrmRegistryEditor.resx +++ b/Server/Forms/FrmRegistryEditor.resx @@ -124,41 +124,41 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm - BwAAAk1TRnQBSQFMAwEBAAH4AQAB+AEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA - AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA - AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA - AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm - AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ - AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgABzAFm - AgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYBAAEz - AQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQABMwFm - AgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMBmQFm - AQABMwKZAQABMwGZAcwBAAEzAZkB/wEA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