dos下的exe文件格式解析
来源:互联网 发布:淘宝数据分析 编辑:程序博客网 时间:2024/06/05 18:09
dos下的exe文件格式解析:
1、源代码
data segment
Msg DB 'Hello 李国雄!$'
data ends
code segment
Start:
MOV AX,data
MOV DS,AX
MOV DX,OFFSET Msg
MOV AH,9
INT 21h
MOV AH,4ch
INT 21h
code ends
END Start
我用的是masm6.15编译生成exe文件
2、exe文件头内容
exe文件头的具体格式可在以下链接得到http://www.delorie.com/djgpp/doc/exe/
以下是本文件exe文件头的具体内容
0000-0001h 4D5A(MZ)
0002-0003h 2000
0004-0005h 0200(the size of file is 1 * 512 + 2 * 16 = 544byte)
0006-0007h 0100(number of relocation)
0008-0009h 2000(the header size of file is 2 * 256 = 512byte)
000A-000Bh 0000
000C-000Dh FFFF
000E-000Fh 0000(initialize the SS register)
0010-0011h 0000(initialize the SP register)
0012-0013h 0000
0014-0015h 0000(initialize the IP register)
0016-0017h 0100(initialize the CS register)
0018-0019h 1E00(offset of the first relocation item in the file)
001A-001Bh 0000
3、debug反汇编exe文件
打开cmd,输入debug *.exe
-r查看ds、es的段地址,即psp段地址,该地址有程序加载器根据内存情况决定,程序事先并不知道,ss的值由psp段地址+0010(psp的大小)+0000(0E-0Fh的值)得到,cs可相应得到,本文件有一个重定位项,在文件偏移001E处,重定位处的内容修改为psp段地址+0010(psp的大小)+重定位处原先的内容。
1、源代码
data segment
Msg DB 'Hello 李国雄!$'
data ends
code segment
Start:
MOV AX,data
MOV DS,AX
MOV DX,OFFSET Msg
MOV AH,9
INT 21h
MOV AH,4ch
INT 21h
code ends
END Start
我用的是masm6.15编译生成exe文件
2、exe文件头内容
exe文件头的具体格式可在以下链接得到http://www.delorie.com/djgpp/doc/exe/
以下是本文件exe文件头的具体内容
0000-0001h 4D5A(MZ)
0002-0003h 2000
0004-0005h 0200(the size of file is 1 * 512 + 2 * 16 = 544byte)
0006-0007h 0100(number of relocation)
0008-0009h 2000(the header size of file is 2 * 256 = 512byte)
000A-000Bh 0000
000C-000Dh FFFF
000E-000Fh 0000(initialize the SS register)
0010-0011h 0000(initialize the SP register)
0012-0013h 0000
0014-0015h 0000(initialize the IP register)
0016-0017h 0100(initialize the CS register)
0018-0019h 1E00(offset of the first relocation item in the file)
001A-001Bh 0000
3、debug反汇编exe文件
打开cmd,输入debug *.exe
-r查看ds、es的段地址,即psp段地址,该地址有程序加载器根据内存情况决定,程序事先并不知道,ss的值由psp段地址+0010(psp的大小)+0000(0E-0Fh的值)得到,cs可相应得到,本文件有一个重定位项,在文件偏移001E处,重定位处的内容修改为psp段地址+0010(psp的大小)+重定位处原先的内容。
- dos下的exe文件格式解析
- DOS下的EXE格式文件
- UNIX、DOS文件格式的区别
- UNIX、DOS文件格式的区别
- DOS下EXE文件的加载与执行过程
- MP4文件格式的解析
- MP4文件格式的解析
- MP4文件格式的解析
- MP4文件格式的解析
- MP4文件格式的解析
- MP4文件格式的解析
- bitmap文件格式的解析
- 在dos下运行.exe程序(C++)
- unix,MAC和dos文件格式的区别
- linux 和 dos 之间的文件格式转换
- 在Dos下运行exe程序的时候出现找不到Cygwin1.dll文件的情况总结
- Linux下的文件格式
- 在DOS命令行下使用的注册表操作工具reg.exe
- hi
- 开始了
- 郁闷,居然这样
- 学习C编程感想
- malloc()
- dos下的exe文件格式解析
- 我要成功
- 常用JavaScript正则表达式
- 初來
- 阅读邮件发邮件的技巧,不读后悔哦
- C语言规则
- 祝全体信管女生三七女生节快乐。。。。
- 加油
- 2010目标