日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

趋势杀毒的后遗症

發布時間:2023/12/16 编程问答 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 趋势杀毒的后遗症 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2006年7月上旬,FDT的電腦爆發病毒,趨勢殺毒后,所有的EXE文件都不能執行。雙擊后會彈出DOS窗口,一閃及過。我也沒有能幸免。

索性先研究一下:

??? Ultra Edit等工具打開正常的EXE文件會發現EXE文件均是以十六進制4D開頭。

???? EXE文件被修改以后,大家會發現文件大小并未改變或者只增加了1K

???? Ultra Edit打開被修改后的EXE文件,發現頭被修改為00 00 00 00 00 00 00 00 00,把這部分去掉,保存文件。EXE文件就恢復了以前的面貌。

?

??? 因此可以確定,只要將文件修改后即可恢復正常使用。無需重新安裝或拷貝正常的EXE文件。

自己索性寫了個小東西:

//修復列表框里的exe文件
????? private void button1_Click(object sender, EventArgs e)
??????? {
??????????? int nFile = this.listBox1.Items.Count;
??????????? int rFile = 0;
??????????? if (this.listBox1.Items.Count < 1)
??????????? {
??????????????? MessageBox.Show("請添加需要修復的exe文件");
??????????????? return;
??????????? }
??????????? for (int i = 0; i < this.listBox1.Items.Count; i++)
??????????? {
??????????????? bool succ = repairFile(this.listBox1.Items[i].ToString());
??????????????? if (succ == true)
??????????????? {
??????????????????? this.listBox1.Items.RemoveAt(i);
??????????????????? rFile++;
??????????????? }
??????????? }
??????????? if (rFile == nFile)
??????????? {
??????????????? MessageBox.Show("修復完成");
??????????? }
??????????? else
??????????? {
??????????????? MessageBox.Show("修復過程中發生錯誤,有幾項并未修復完成,如右側列表所示");
??????????? }
??????? }

??????? /// <summary>
??????? /// 修復文件
??????? /// </summary>
??????? /// <param name="fileName">文件名稱及詳細路徑</param>
??????? /// <returns>false失敗? false 成功</returns>
??????? private bool repairFile(string fileName)
??????? {
??????????? if (File.Exists(fileName) == false)
??????????? {
??????????????? MessageBox.Show("指定的文件不存在");
??????????????? return false;
??????????? }
??????????? string bkfile = fileName.Substring(0, fileName.LastIndexOf(@"/"))? + fileName.Substring(fileName.LastIndexOf(@"/")) + ".bak";
??????????? if (File.Exists(bkfile)==true)
??????????? {
??????????????? File.Delete(bkfile);
??????????? }
??????????? try
??????????? {
??????????????? File.Copy(fileName, bkfile);
??????????? }
??????????? catch(Exception ex)
??????????? {
??????????????? MessageBox.Show("發生錯誤:" + ex.Message);
??????????????? return false;
??????????? }
??????????? byte[] tmp = new byte[1024];
??????????? bool flag = false;
??????????? FileStream fs = new FileStream(bkfile, FileMode.Open);
??????????? FileStream fs2 = new FileStream(fileName, FileMode.Open);
??????????? int time = 0;
??????????? int lng = 1024;
??????????? while (time * 1024 <= fs.Length)
??????????? {
??????????????? if (time == 0 && tmp[0].ToString("X") == "4D")
??????????????? {
??????????????????? return true;
??????????????? }
??????????????? fs.Read(tmp, 0, lng);
??????????????? time = time + 1;
??????????????? if (flag == true)
??????????????? {
??????????????????? fs2.Write(tmp, 0, tmp.Length);
??????????????????? continue;
??????????????? }
??????????????? for (int i = 0; i < tmp.Length; i++)
??????????????? {
??????????????????? string t = tmp[i].ToString("X");
??????????????????? if (t == "4D")
??????????????????? {
??????????????????????? fs2.Write(tmp, i, 1024 - i);
??????????????????????? flag = true;
??????????????????????? break;
??????????????????? }
??????????????????? Console.WriteLine(t);
??????????????? }
??????????? }

??????????? fs.Close();
??????????? fs2.Close();
??????????? return true;
??????? }

//添加要修復的文件到列表框?
??????? private void button2_Click(object sender, EventArgs e)
??????? {
??????????? this.openFileDialog1.ShowDialog();
??????????? bool flag = false;
??????????? for (int i = 0; i < this.listBox1.Items.Count; i++)
??????????? {
??????????????? if (this.listBox1.Items[i].ToString() == this.openFileDialog1.FileName.ToString())
??????????????? {
??????????????????? flag = true;
??????????????? }
??????????? }
??????????? if (flag == true)
??????????? {
??????????????? MessageBox.Show("已經添加了這個文件");
??????????? }
??????????? else
??????????? {
??????????????? this.listBox1.Items.Add(this.openFileDialog1.FileName.ToString());
??????????? }
??????? }

//選擇要修復的目錄?
?????? private void button3_Click(object sender, EventArgs e)
??????? {
??????????? this.folderBrowserDialog1.ShowDialog();
??????????? this.textBox1.Text = this.folderBrowserDialog1.SelectedPath.ToString();
??????? }

//修復整個文件夾的文件 ?
?????? private void button4_Click(object sender, EventArgs e)
??????? {
??????????? if (Directory.Exists(this.textBox1.Text) == false)
??????????? {
??????????????? MessageBox.Show("選擇的目錄不存在,請重新選擇");
??????????????? return;
??????????? }
??????????? repFoFile(this.textBox1.Text);
??????????? MessageBox.Show("修復完成,不能修復的EXE文件如列表");
??????? }

//遍歷文件夾進行修復
??????? private void repFoFile(string folder)
??????? {
??????????? DirectoryInfo myFolder = new DirectoryInfo(folder);
??????????? foreach (FileInfo NextFile in myFolder.GetFiles("*.exe"))
??????????? {
??????????????? bool succ = repairFile(NextFile.FullName);
??????????????? if (succ == false)
??????????????? {
??????????????????? this.listBox2.Items.Add(NextFile.Name);
??????????????? }
??????????? }
??????????? foreach (DirectoryInfo NextDir in myFolder.GetDirectories())
??????????? {
??????????????? repFoFile(NextDir.FullName);
??????????? }
??????? }

?

總結

以上是生活随笔為你收集整理的趋势杀毒的后遗症的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。