假如U盘病毒使用的启动脚本autorun.inf文件,内容为下面代码
====================================[AuToRun]
open=eyi.exe
shell\open=打开(&O) 
shell\open\eyi.exe
shell\explore\eyi.exe====================================
请问用C#如何获取open=后面的可执行文件的(eyi.exe)文件名?小弟初学C#,U盘经常中病毒,想自己写个清除工具!代码越简单越好!复杂了可能看不懂哦!

解决方案 »

  1.   

    不就读取INI文件吗?有API的啊,也可以使用正则表达式
      

  2.   

            using System.Runtime.InteropServices;        [DllImport("kernel32")]
            private static extern bool GetPrivateProfileString(string lpApplicationName,string lpKeyName,string lpDefault,StringBuilder lpReturnedString,int nSize,string lpFileName);        private void button1_Click(object sender, EventArgs e)
            {
                StringBuilder strValue = new StringBuilder(256);
                GetPrivateProfileString("AuToRun", "open", "error", strValue, strValue.Capacity, "c:\\autorun.inf");
                MessageBox.Show(strValue.ToString());
            }
      

  3.   

    读出每条信息到string,然后用string.split()方法按"="分割,然后取第二个字符串就行了.
      

  4.   

    补充一点,然后再用"\"分隔,然后比较一下有没有.exe就以了.