找传奇、传世资源到传世资源站!

dll文件32位/64位检测工具 源码下载

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

dll文件32位/64位检测工具 源码下载 C#语言基础-第1张using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Linq;using System.Text;using System.Windows.Forms;namespace FileDetect{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string path = System.Environment.CurrentDirectory; DirectoryInfo directory = new DirectoryInfo(path); FileInfo[] fileInfoArray = directory.GetFiles(); StringBuilder sb = new StringBuilder (); foreach (var item in fileInfoArray) { String str = String.Format("{0}: {1}",item.Name,IsPE32(item.FullName)? "32bit":"64bit"); sb.AppendLine(str); } textBox1.Text = sb.ToString(); } public static bool IsPE32(string path) { FileStream stream = File.OpenRead(path); //移动到e_lfanew的位置处 stream.Seek(0x40 - 4, SeekOrigin.Begin); byte[] buf = new byte[4]; stream.Read(buf, 0, buf.Length); //根据e_lfanew的值计算出Machine的位置 int pos = BitConverter.ToInt32(buf, 0) 4; stream.Seek(pos, SeekOrigin.Begin); buf = new byte[2]; stream.Read(buf, 0, buf.Length); //得到Machine的值,0x14C为32位,0x8664为64位 Int16 machine = BitConverter.ToInt16(buf, 0); if (machine == 0x14C) { return true; } else { return false; } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复