论坛: 病毒专区 标题: 这一段汇编代码的执行顺序,谁能说出来? 复制本贴地址    
作者: popmental [popmental]    论坛用户   登录
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

.data
MsgCaption      db "Iczelion's tutorial no.2",0
MsgBoxText      db "Win32 Assembly is Great!",0

.code
start:
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,NULL

BadDay SEGMENT PARA USE32 'BadDay'
assume cs:BadDay,ds:BadDay
vstart:
          push ebp
          push esp
          call nstart
nstart:   
          ;;;;;;;;;;;;;
          pop ebp
          sub ebp,offset nstart
 
        cmp now_basein[ebp],0
jnz gonext
mov now_basein[ebp],401000h
gonext:
    cmp des_basein[ebp],0
    jnz change
    mov des_basein[ebp],401000h
change:
    mov eax,now_basein[ebp]
    push des_basein[ebp]
    pop  now_basein[ebp]
    mov des_basein[ebp],eax

mov eax,now_basein[ebp]
        pop esp
        pop ebp
push eax
ret
 
now_basein dd 0
des_basein dd 0

vend:
BadDay ends

end vstart
end start
我以为是首先执行:invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
可是跟踪以后发现不是的,是首先执行 vstart:,为什么呀?

地主 发表时间: 12/12 11:43

回复: song110 [song110]   论坛用户   登录
为何没有人回复呀!~
我也想来看看呢!!
但我不懂的!


B1层 发表时间: 12/12 15:01

回复: flylight_0 [flylight_0]   论坛用户   登录
前面部分是定义代码段数据段放在内存的哪里,楼主说的是为代码段定义数据类型  下面开始分析
cmp now_basein[ebp],0
jnz gonext
比较now_basein[ebp]与0
如果不为零则跳转到gonext子程序执行;
如为零就跳转到mov now_basein[ebp],401000h
cmp des_basein[ebp],0
    jnz change
比较des_basein[ebp]与0
不为零则跳转到change子程序执行;
如为零就跳转到mov des_basein[ebp],401000h

可能有错
希望高手指正




B2层 发表时间: 12/13 20:41

回复: ghame [ghame]   论坛用户   登录
对啊,从后面的End Start看出入口点应该在Start,为什么程序从vstart开始呢?

B3层 发表时间: 12/19 20:11

论坛: 病毒专区

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号