概述private void Search() { try { this.listBox1.Items.Add(""); this.listBox1.Items.Add("
扫描指定的目录
文件"); RegistryKey scan = Registry.LocalMachine.OpenSubKey("SOFTWARE\Honeydogchen\.Dog\Scan",true); string strdir = scan.GetValue("FolderSelect").ToString(); if(this.checkBox2.Checked==true) { RegistryKey microsoft = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft",true); RegistryKey currentversion1 = microsoft.OpenSubKey("Windows NT\CurrentVersion",true); RegistryKey currentversion2 = microsoft.OpenSubKey("Windows\CurrentVersion",true); try { string system32dir = currentversion1.GetValue("SystemRoot").ToString(); GetSystemFiles(system32dir+"\SYSTEM32"); } catch(Exception) { } try { string systemdir = currentversion2.GetValue("SystemRoot").ToString(); GetSystemFiles(systemdir+"\SYSTEM"); } catch(Exception) { } } GetCommonFiles(strdir); this.textBox1.Text = strdir; this.label1.Enabled = true; this.label4.Enabled = true; this.Cursor = System.Windows.Forms.Cursors.Default; if(a==0) { this.listBox1.Items.Add(" 恭喜恭喜,没有发现可疑文件"); } else { this.listBox1.Items.Add(" 共发现"+a+"个可疑文件,请用专业反病毒软件查杀"); } this.listBox1.Items.Add(""); this.listBox1.Items.Add("扫描结束,"+"共扫描了"+d+"个进程,"+b+"个文件"); this.listBox1.Items.Add(""); this.listBox1.Items.Add("反病毒技术支持"); this.listBox1.Items.Add(" Email:honeydogchen@163.com"); } catch(Exception) { } } private void GetCommonFiles(string strDir) { string path = Application.StartupPath; Share.Ini ini = new Share.Ini(path+"\Virus.dat"); DirectoryInfo dir = new DirectoryInfo(strDir); int number = Convert.ToInt16(ini.IniReadValue("VirusList","Number")); FileInfo[] exefiles = dir.GetFiles("*.exe"); foreach(FileInfo f in exefiles) { this.textBox1.Text = f.FullName.ToString(); this.textBox1.Refresh(); for(int i=0;i<number;i++) { string name = Convert.ToString(ini.IniReadValue("VirusList","Name"+i)); if(f.Name.ToLower().EndsWith(name)) { this.listBox1.Items.Add(" 名称:"+f.Name.ToString()); this.listBox1.Items.Add(" 路径:"+strDir+"\"+f.Name.ToString()); a++; } } b++; } if(this.checkBox3.Checked==true) { DirectoryInfo[] dir1List = dir.GetDirectories(); for(int i = 0;i<dir1List.Length;i++) { GetCommonFiles(strDir+"\"+dir1List[i].Name); } } } private void GetSystemFiles(string strDir) { string path = Application.StartupPath; Share.Ini ini = new Share.Ini(path+"\Virus.dat"); DirectoryInfo dir = new DirectoryInfo(strDir); int number = Convert.ToInt16(ini.IniReadValue("VirusList","Number")); FileInfo[] exefiles = dir.GetFiles("*.exe"); foreach(FileInfo f in exefiles) { this.textBox1.Text = f.FullName.ToString(); this.textBox1.Refresh(); for(int i=0;i<number;i++) { string name = Convert.ToString(ini.IniReadValue("VirusList","Name"+i)); if(f.Name.ToLower().EndsWith(name)) { this.listBox1.Items.Add(" 名称:"+f.Name.ToString()); this.listBox1.Items.Add(" 路径:"+strDir+"\"+f.Name.ToString()); a++; } } b++; } } private void CheckRegistry() { int h = 0; int i = 0; int j = 0; int k = 0; int l = 0; int n = 0; this.listBox1.Visible = true; try { this.listBox1.Items.Clear(); this.listBox1.Items.Add("扫描注册表的启动项"); RegistryKey hklm = Registry.LocalMachine; RegistryKey hkcu = Registry.CurrentUser; RegistryKey hkcr = Registry.ClassesRoot; RegistryKey run1 = hklm.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); foreach(string sValName1 in run1.GetValueNames()) { this.listBox1.Items.Add(" "+sValName1+":"+run1.GetValue(sValName1)); } RegistryKey run2 = hkcu.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run"); foreach(string sValName2 in run2.GetValueNames()) { this.listBox1.Items.Add(" "+sValName2+":"+run2.GetValue(sValName2)); } this.listBox1.Items.Add(""); this.listBox1.Items.Add("扫描文件的关联状况"); RegistryKey currentversion1 = hklm.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion",true); RegistryKey winlogon = currentversion1.OpenSubKey("Winlogon",true); RegistryKey windowstoo = currentversion1.OpenSubKey("Windows",true); try { RegistryKey currentversion2 = hklm.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion",true); string systemdir = currentversion2.GetValue("SystemRoot").ToString(); if(systemdir!="") { Shar
<Font size="2">private voID Search() { try { this.@R_419_6818@Box1.Items.Add(""); this.@R_419_6818@Box1.Items.Add("扫描指定的目录文件");
总结
以上是内存溢出为你收集整理的实战Registry和RegistryKey类,一个简单的可疑文件扫描程序全部内容,希望文章能够帮你解决实战Registry和RegistryKey类,一个简单的可疑文件扫描程序所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
评论列表(0条)