Пример #1
0
        /// <summary>
        /// Edit an existing registry key mapping
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnEditKey_Click(object sender, EventArgs e)
        {
            // Get the mapping that is to be edited
            UltraListViewItem editItem = lvRegistryKeys.SelectedItems[0];
            string            key      = editItem.Text;
            string            value    = editItem.SubItems[0].Text;

            // ...and invoke a form to edit it
            FormShadedAskInput2 form = new FormShadedAskInput2("Please enter the registry key name and value name to be audited.  You should include the registry hive (e.g. HKEY_LOCAL_MACHINE)"
                                                               , "Enter Registry Key"
                                                               , "Registry Key Name:"
                                                               , "Value Name"
                                                               , key
                                                               , value
                                                               , Properties.Resources.application_serial_number_corner,
                                                               false);

            if (form.ShowDialog() == DialogResult.OK)
            {
                // Remove the existing item from the list
                int index = editItem.Index;
                lvRegistryKeys.Items.Remove(editItem);

                // ...and add in the new item
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[1];
                subItemArray[0]       = new UltraListViewSubItem();
                subItemArray[0].Value = form.Value2Entered();
                UltraListViewItem item = new UltraListViewItem(form.Value1Entered(), subItemArray);
                lvRegistryKeys.Items.Add(item);
            }
        }
Пример #2
0
        /// <summary>
        /// Called when we want to add a new registry mapping
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnAddKey_Click(object sender, EventArgs e)
        {
            FormShadedAskInput2 form = new FormShadedAskInput2("Please enter the registry key name and value name to map to the application.  Do not specify the registry hive as HKEY_LOCAL_MACHINE is assumed."
                                                               , "Enter Registry Key (beneath HKEY_LOCAL_MACHINE)"
                                                               , "Registry Key Name:", "Value Name", "", "", Properties.Resources.application_serial_number_corner
                                                               , true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                // OK add the new mapping to our list
                RegistryMapping        mapping      = new RegistryMapping(form.Value1Entered(), form.Value2Entered());
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[1];
                subItemArray[0]       = new UltraListViewSubItem();
                subItemArray[0].Value = mapping.ValueName;
                UltraListViewItem item = new UltraListViewItem(mapping.RegistryKey, subItemArray);
                item.Tag = mapping;
                lvRegistryKeys.Items.Add(item);

                // Build the mappings string
                String mappingString = BuildMappingString();

                // ..and update the configuration file
                _applicationsFile.SetString(cbApplications.SelectedItem.ToString(), mappingString, true);
            }
        }
Пример #3
0
        /// <summary>
        /// Edit an existing registry key mapping
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnEditKey_Click(object sender, EventArgs e)
        {
            // Get the mapping that is to be edited
            UltraListViewItem editItem    = lvRegistryKeys.SelectedItems[0];
            RegistryMapping   editMapping = editItem.Tag as RegistryMapping;

            // ...and invoke a form to edit it
            //FormAskInput2 form = new FormAskInput2("Please enter the registry key name and value name to map to the application.  Do not specify the registry hive as HKEY_LOCAL_MACHINE is assumed"
            //                                     , "Enter Registry Key (beneath HKEY_LOCAL_MACHINE)"
            //                                     , "Registry Key Name:"
            //                                     , "Value Name"
            //                                     , editMapping.RegistryKey
            //                                     , editMapping.ValueName);
            FormShadedAskInput2 form = new FormShadedAskInput2("Please enter the registry key name and value name to map to the application.  Do not specify the registry hive as HKEY_LOCAL_MACHINE is assumed"
                                                               , "Enter Registry Key (beneath HKEY_LOCAL_MACHINE)"
                                                               , "Registry Key Name:"
                                                               , "Value Name"
                                                               , editMapping.RegistryKey
                                                               , editMapping.ValueName
                                                               , Properties.Resources.application_serial_number_corner
                                                               , true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                // Remove the existing item from the list
                int index = editItem.Index;
                lvRegistryKeys.Items.Remove(editItem);

                // ...and add in the new item
                RegistryMapping        mapping      = new RegistryMapping(form.Value1Entered(), form.Value2Entered());
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[1];
                subItemArray[0]       = new UltraListViewSubItem();
                subItemArray[0].Value = mapping.ValueName;
                UltraListViewItem item = new UltraListViewItem(mapping.RegistryKey, subItemArray);
                item.Tag = mapping;
                lvRegistryKeys.Items.Insert(index, item);

                // Build the mappings string
                String mappingString = BuildMappingString();

                // ..and update the configuration file
                _applicationsFile.SetString(cbApplications.SelectedItem.ToString(), mappingString, true);
            }
        }
Пример #4
0
        /// <summary>
        /// Called when we want to add a new registry mapping
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnAddKey_Click(object sender, EventArgs e)
        {
            FormShadedAskInput2 form = new FormShadedAskInput2("Please enter the registry key name and value name to be audited.  You should include the registry hive (e.g. HKEY_LOCAL_MACHINE)"
                                                               , "Enter Registry Key"
                                                               , "Registry Key Name:"
                                                               , "Value Name"
                                                               , ""
                                                               , ""
                                                               , Properties.Resources.application_serial_number_corner,
                                                               false);

            if (form.ShowDialog() == DialogResult.OK)
            {
                // OK add the new mapping to our list
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[1];
                subItemArray[0]       = new UltraListViewSubItem();
                subItemArray[0].Value = form.Value2Entered();
                UltraListViewItem item = new UltraListViewItem(form.Value1Entered(), subItemArray);
                lvRegistryKeys.Items.Add(item);
            }
        }