private void CheckDotNetPE(string path) 
        {
            FileStream fs = new FileStream(path, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);
            fs.Seek(360L, SeekOrigin.Begin);
            int temp = (int)br.ReadUInt32();
            if (temp == 8200)
            {
                MessageBox.Show("该程序由于 C#/VB.NET 编译");
            }
            else
            {
                MessageBox.Show("未知");
            }            br.Close();
            fs.Close(); 
        }
请看下这个函数写得正不正确。请问这样判断.net pe 文件正确吗?

解决方案 »

  1.   

    我觉得用反射好多了。
    VS2005开发的肯定有一个namespace.            try
                {
                    System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile("c:\\regedit.exe");
    //如果不是VS2005开发的程序,第一句都过不去。不信试试
                    System.Reflection.Module[] ms = ass.GetModules();
                    int i = ms.Length;
                }
                catch (Exception ee)
                {
                    MessageBox.Show("This Execute File is Not built by VS2005")
                }
      

  2.   

    如果你真的要深究,请google PEIDhttp://www.3800hk.com/news/w44/136584.html