Beispiel #1
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lvRegItems.SelectedItems == null || lvRegItems.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem currentRegItem = lvRegItems.SelectedItems[0];

            using (RegistryEditForm dialog = new RegistryEditForm())
            {
                dialog.FormMode  = RegistryEditFormMode.EditValue;
                dialog.NewName   = currentRegItem.SubItems[0].Text;
                dialog.ValueKind = GetRegistryValueKind(currentRegItem.SubItems[1].Text);
                dialog.Value     = currentRegItem.SubItems[2].Text;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    SubmitTaskAsync(WriteRegistryElementTaskId, ManagementObject,
                                    new Dictionary <string, string>
                    {
                        { "KeyPath", $"{cbRegRootKey.SelectedItem}\\{tbRegPath.Text}" },
                        { "Action", ((int)WriteRegistryElementAction.SetValue).ToString() },
                        { "OldName", currentRegItem.SubItems[0].Text }, // use original
                        { "NewValue", dialog.Value },
                        { "ValueType", currentRegItem.SubItems[1].Text } // use original
                    }, new OnTaskStatusChangeDelegate(OnWriteRegistryElementTaskChange));
                }
            }
        }
Beispiel #2
0
 private void expandableStringValueToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (RegistryEditForm dialog = new RegistryEditForm())
     {
         dialog.FormMode  = RegistryEditFormMode.NewValue;
         dialog.ValueKind = Microsoft.Win32.RegistryValueKind.ExpandString;
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             StartNewRegValueTask(Microsoft.Win32.RegistryValueKind.ExpandString, dialog.NewName, dialog.Value);
         }
     }
 }
Beispiel #3
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}; Selected items count: {lvRegItems.SelectedItems?.Count ?? -1}");

            if (lvRegItems.SelectedItems != null && lvRegItems.SelectedItems.Count == 1)
            {
                ListViewItem selectedItem = lvRegItems.SelectedItems[0];
                if (selectedItem.SubItems[1].Text == "REG_KEY")
                {
                    string keyName = selectedItem.SubItems[0].Text;
                    if (keyName == "..")
                    {
                        return;
                    }
                    using (RegistryEditForm dialog = new RegistryEditForm())
                    {
                        dialog.FormMode = RegistryEditFormMode.NewName;
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            SubmitTaskAsync(WriteRegistryElementTaskId, ManagementObject,
                                            new Dictionary <string, string>
                            {
                                { "KeyPath", $"{cbRegRootKey.SelectedItem}\\{tbRegPath.Text}" },
                                { "Action", ((int)WriteRegistryElementAction.RenameKey).ToString() },
                                { "OldName", keyName },
                                { "NewName", dialog.NewName }
                            }, new OnTaskStatusChangeDelegate(OnWriteRegistryElementTaskChange));
                        }
                    }
                }
                else
                {
                    using (RegistryEditForm dialog = new RegistryEditForm())
                    {
                        dialog.FormMode = RegistryEditFormMode.NewName;
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            string valueName = selectedItem.SubItems[0].Text;
                            SubmitTaskAsync(WriteRegistryElementTaskId, ManagementObject,
                                            new Dictionary <string, string>
                            {
                                { "KeyPath", $"{cbRegRootKey.SelectedItem}\\{tbRegPath.Text}" },
                                { "Action", ((int)WriteRegistryElementAction.RenameValue).ToString() },
                                { "OldName", valueName },
                                { "NewName", dialog.NewName }
                            }, new OnTaskStatusChangeDelegate(OnWriteRegistryElementTaskChange));
                        }
                    }
                }
            }
        }
Beispiel #4
0
 private void keyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (RegistryEditForm dialog = new RegistryEditForm())
     {
         dialog.FormMode = RegistryEditFormMode.NewName;
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             SubmitTaskAsync(WriteRegistryElementTaskId, ManagementObject,
                             new Dictionary <string, string>
             {
                 { "KeyPath", $"{cbRegRootKey.SelectedItem}\\{tbRegPath.Text}" },
                 { "Action", ((int)WriteRegistryElementAction.CreateKey).ToString() },
                 { "NewName", dialog.NewName }
             }, new OnTaskStatusChangeDelegate(OnWriteRegistryElementTaskChange));
         }
     }
 }