会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
登峰之道
---
简约而不简单
分享阳光,分享快乐
博客园
首页
博问
闪存
新随笔
订阅
管理
文件类型的判断
文件类型的判断
public
bool
isExeDllFile(
string
sFileName)
{
bool
xx
=
false
;
//
default the "sFileName" is not a .exe or .dll file;
FileStream fs
=
new
FileStream(sFileName, FileMode.Open, FileAccess.Read);
BinaryReader r
=
new
BinaryReader(fs);
string
bx
=
""
;
byte
buffer;
try
{
buffer
=
r.ReadByte();
bx
=
buffer.ToString();
buffer
=
r.ReadByte();
bx
=
bx
+
buffer.ToString();
}
catch
{
}
r.Close();
fs.Close();
if
(bx
==
"
7790
"
||
bx
==
"
8297
"
||
bx
==
"
8075
"
)
//
7790:exe 8297:rar 8075:pk
{
xx
=
true
;
}
return
xx;
}
dll:MZ
exe:MZ
rar:Rar
zip:PK
posted on
2005-06-13 08:07
登峰
阅读(
315
) 评论(
0
)
编辑
收藏
举报
刷新页面
返回顶部