Esempio n. 1
0
 // Token: 0x06000894 RID: 2196 RVA: 0x000436C0 File Offset: 0x000418C0
 public void detect()
 {
     this.subkeyNames          = Registry.CurrentUser.OpenSubKey(this.keyName).GetSubKeyNames();
     this.valueNames           = Registry.CurrentUser.OpenSubKey(this.keyName).GetValueNames();
     this.ChProgressbar1.Value = 0;
     this.Lv1.Items.Clear();
     this.ChProgressbar1.Maximum = this.valueNames.Length;
     string[] array = this.valueNames;
     checked
     {
         for (int i = 0; i < array.Length; i++)
         {
             string        text          = array[i];
             CHProgressbar chProgressbar = this.ChProgressbar1;
             chProgressbar.Value++;
             ListViewItem listViewItem = new ListViewItem();
             new ListViewItem();
             int num = Strings.InStr(Conversions.ToString(Registry.CurrentUser.OpenSubKey(this.keyName).GetValue(text)), "..", CompareMethod.Binary);
             if (num != 0)
             {
                 object objectValue = RuntimeHelpers.GetObjectValue(Registry.CurrentUser.OpenSubKey(this.keyName).GetValue(text));
                 objectValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, null, "replace", new object[]
                 {
                     "\"",
                     ""
                 }, null, null, null));
                 objectValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, null, "replace", new object[]
                 {
                     " ",
                     ""
                 }, null, null, null));
                 objectValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, null, "replace", new object[]
                 {
                     "..",
                     ""
                 }, null, null, null));
                 FileInfo fileInfo = new FileInfo(Conversions.ToString(objectValue));
                 if (File.Exists(fileInfo.FullName))
                 {
                     listViewItem.Text = fileInfo.Name;
                 }
                 else
                 {
                     listViewItem.Text = "Not found";
                 }
                 if (File.Exists(this.startup + "\\" + text + ".exe"))
                 {
                     listViewItem.SubItems.Add(text + ".exe");
                 }
                 else
                 {
                     listViewItem.SubItems.Add("Not found");
                 }
                 object   arg_23A_0 = listViewItem.SubItems;
                 Type     arg_23A_1 = null;
                 string   arg_23A_2 = "Add";
                 object[] array2    = new object[]
                 {
                     RuntimeHelpers.GetObjectValue(objectValue)
                 };
                 object[] arg_23A_3 = array2;
                 string[] arg_23A_4 = null;
                 Type[]   arg_23A_5 = null;
                 bool[]   array3    = new bool[]
                 {
                     true
                 };
                 NewLateBinding.LateCall(arg_23A_0, arg_23A_1, arg_23A_2, arg_23A_3, arg_23A_4, arg_23A_5, array3, true);
                 if (array3[0])
                 {
                     objectValue = RuntimeHelpers.GetObjectValue(array2[0]);
                 }
                 listViewItem.SubItems.Add(Registry.CurrentUser.OpenSubKey(this.keyName).ToString() + "\\" + text);
                 listViewItem.SubItems.Add(text);
                 listViewItem.ImageIndex = 0;
                 this.Lv1.Items.Add(listViewItem);
             }
         }
         this.Lv1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
         ima.F.sl.Text = "Detected  : " + Conversions.ToString(this.Lv1.Items.Count);
         if (this.Lv1.Items.Count == 0)
         {
             this.Button1.Text = "Scan..";
         }
         else if (this.Lv1.Items.Count == 1)
         {
             this.Button1.Text = "Remove";
         }
         else
         {
             this.Button1.Text = "Remove all";
         }
     }
 }
Esempio n. 2
0
        // Token: 0x06000893 RID: 2195 RVA: 0x0004314C File Offset: 0x0004134C
        public void remove()
        {
            this.TT.SelectionStart = this.TT.TextLength;
            this.TT.AppendText("==========================================================\r\nRemove started " + DateTime.Now.ToString() + "\r\n==========================================================\r\n");
            this.ChProgressbar1.Value = 0;
            this.Lv1.Items.Clear();
            this.ChProgressbar1.Maximum = this.valueNames.Length;
            string[] array = this.valueNames;
            checked
            {
                for (int i = 0; i < array.Length; i++)
                {
                    string        text          = array[i];
                    CHProgressbar chProgressbar = this.ChProgressbar1;
                    chProgressbar.Value++;
                    new ListViewItem();
                    new ListViewItem();
                    int num = Strings.InStr(Conversions.ToString(Registry.CurrentUser.OpenSubKey(this.keyName).GetValue(text)), "..", CompareMethod.Binary);
                    if (num != 0)
                    {
                        object objectValue = RuntimeHelpers.GetObjectValue(Registry.CurrentUser.OpenSubKey(this.keyName).GetValue(text));
                        objectValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, null, "replace", new object[]
                        {
                            "\"",
                            ""
                        }, null, null, null));
                        objectValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, null, "replace", new object[]
                        {
                            " ",
                            ""
                        }, null, null, null));
                        objectValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, null, "replace", new object[]
                        {
                            "..",
                            ""
                        }, null, null, null));
                        FileInfo fileInfo = new FileInfo(Conversions.ToString(objectValue));
                        try
                        {
                            if (this.bacup)
                            {
                                File.Copy(this.startup + "\\" + text + ".exe", Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(this.folder, text), ".exe.dup")));
                                File.Copy(Conversions.ToString(objectValue), Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(this.folder, fileInfo.Name), ".exe.dup")));
                            }
                            goto IL_491;
                        }
                        catch (Exception expr_20E)
                        {
                            ProjectData.SetProjectError(expr_20E);
                            ProjectData.ClearProjectError();
                            goto IL_491;
                        }
                        goto IL_21F;
IL_25F:
                        if (File.Exists(this.startup + "\\" + text + ".exe"))
                        {
                            Process[] processesByName = Process.GetProcessesByName(text);
                            for (int j = 0; j < processesByName.Length; j++)
                            {
                                Process process = processesByName[j];
                                process.Kill();
                            }
                        }
                        Thread.Sleep(500);
                        if (File.Exists(fileInfo.FullName))
                        {
                            try
                            {
                                File.Delete(Conversions.ToString(objectValue));
                                this.TT.AppendText(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("- Remove file succeedd (", objectValue), ")"), "\r\n")));
                            }
                            catch (Exception expr_2FE)
                            {
                                ProjectData.SetProjectError(expr_2FE);
                                Exception ex = expr_2FE;
                                this.TT.AppendText("- Remove file succeedd error (" + ex.Message + ")\r\n");
                                ProjectData.ClearProjectError();
                            }
                        }
                        if (File.Exists(this.startup + "\\" + text + ".exe"))
                        {
                            try
                            {
                                File.Delete(this.startup + "\\" + text + ".exe");
                                this.TT.AppendText(string.Concat(new string[]
                                {
                                    "- Remove file succeedd (",
                                    this.startup,
                                    "\\",
                                    text,
                                    ".exe)\r\n"
                                }));
                            }
                            catch (Exception expr_3B0)
                            {
                                ProjectData.SetProjectError(expr_3B0);
                                Exception ex2 = expr_3B0;
                                this.TT.AppendText("- Remove file error (" + ex2.Message + ")\r\n");
                                ProjectData.ClearProjectError();
                            }
                        }
                        try
                        {
                            MyProject.Computer.Registry.CurrentUser.OpenSubKey(this.keyName, true).DeleteValue(text, false);
                            this.TT.AppendText(string.Concat(new string[]
                            {
                                "- Remove RegKey succeedd (",
                                Registry.CurrentUser.OpenSubKey(this.keyName).ToString(),
                                "\\",
                                text,
                                ")\r\n"
                            }));
                        }
                        catch (Exception expr_458)
                        {
                            ProjectData.SetProjectError(expr_458);
                            Exception ex3 = expr_458;
                            this.TT.AppendText("- Remove RegKey error (" + ex3.Message + ")\r\n");
                            ProjectData.ClearProjectError();
                        }
                        goto IL_488;
IL_491:
                        if (!File.Exists(fileInfo.FullName))
                        {
                            goto IL_25F;
                        }
IL_21F:
                        Process[] processesByName2 = Process.GetProcessesByName(fileInfo.Name.Replace(".exe", ""));
                        for (int k = 0; k < processesByName2.Length; k++)
                        {
                            Process process2 = processesByName2[k];
                            process2.Kill();
                        }
                        goto IL_25F;
                    }
                    IL_488 :;
                }
                this.TT.ScrollToCaret();
                ima.F.sl.Text = "Remove server(s) succeeded..";
                this.Lv1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                if (this.Lv1.Items.Count == 0)
                {
                    this.Button1.Text = "Scan..";
                }
                else if (this.Lv1.Items.Count == 1)
                {
                    this.Button1.Text = "Remove";
                }
                else
                {
                    this.Button1.Text = "Remove all";
                }
            }
        }