首页
社区
课程
招聘
[求助]窗口过程已经死循环了,窗口居然还可以移动!
发表于: 2008-4-16 17:14 4918

[求助]窗口过程已经死循环了,窗口居然还可以移动!

2008-4-16 17:14
4918
代码如下,将对话框的OK按键的处理过程设为死循环,程序运行点Ok后,程序会死一会,但是过了段时间,对话框又可以移动了,,,用spy观察,从点OK后,直到窗口关闭都没有任何message。
    系统这里是如何让对话框移动的?如果仅从单线程看,这好像是不可能的。
        .386
        .model flat,stdcall
        option casemap:none
include         windows.inc
include         user32.inc
includelib      user32.lib
include         kernel32.inc
includelib      kernel32.lib

        .code

ProcDlg        proc        hWnd,wMsg,wParam,lParam
        LOCAL        @nm:NMHDR
        mov        eax,wMsg
        .if        eax==WM_CLOSE
                invoke        EndDialog,hWnd,NULL
        .elseif        eax==WM_COMMAND
                mov        eax,wParam               
                .if        ax==1
                LOP:
                        inc ebx
                        jmp LOP
                .endif
        .else
                mov        eax,FALSE
                ret
        .endif
        mov        eax,TRUE
        ret
ProcDlg endp

start:
        invoke        GetModuleHandle,NULL
        invoke        DialogBoxParam,eax,101,NULL,offset ProcDlg,NULL
        invoke        ExitProcess,NULL
        end        start

[课程]Linux pwn 探索篇!

上传的附件:
收藏
免费 0
支持
分享
最新回复 (9)
雪    币: 145
活跃值: (85)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
2
自己感觉好象已经被抛弃的东西.
2008-4-16 18:00
0
雪    币: 88
活跃值: (136)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
3
把死循环换成长时间 sleep也是如此,也许是被系统接管了。
2008-4-17 10:45
0
雪    币: 88
活跃值: (136)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
4
通过MessageBox试验,发现MessageBox还没返回之前,窗口过程又继续被调用了,,,好像貌似单线程的程序,还可以多线程运行
2008-4-17 14:03
0
雪    币: 88
活跃值: (136)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
5
这段代码会出现两个MessageBox
        .386
        .model flat,stdcall
        option casemap:none
include         windows.inc
include         user32.inc
includelib      user32.lib
include         kernel32.inc
includelib      kernel32.lib

        .data
szCaption        db        'yes',0
hInstance        dd        ?
dwCount                dd        ?
        .code

ProcDlg        proc        hWnd,wMsg,wParam,lParam
        LOCAL        @nm:NMHDR
        cmp        dwCount,1
        jnz        ProcNext
        inc        dwCount
        invoke        MessageBox,NULL,offset szCaption,offset szCaption,MB_OK

ProcNext:
        mov        eax,wMsg
        .if        eax==WM_CLOSE
                invoke        EndDialog,hWnd,NULL
        .elseif        eax==WM_COMMAND
                mov        eax,wParam               
                .if        ax==1
                LOP:
                        inc        dwCount
                        invoke        MessageBox,hWnd,offset szCaption,offset szCaption,MB_OK
                        inc        dwCount
                .endif
        .else
                mov        eax,FALSE
                ret
        .endif
        mov        eax,TRUE
        ret
ProcDlg endp

start:
        invoke        GetModuleHandle,NULL
        mov        hInstance,eax
        mov        dwCount,0
        invoke        DialogBoxParam,eax,101,NULL,offset ProcDlg,NULL
        invoke        ExitProcess,NULL
        end        start
2008-4-17 14:12
0
雪    币: 88
活跃值: (136)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
6
MessageBox 问题已经解决,其实是递归调用了窗口过程,死循环过程还没解决,,
2008-4-17 16:01
0
雪    币: 331
活跃值: (57)
能力值: ( LV7,RANK:100 )
在线值:
发帖
回帖
粉丝
7
MessageBox也是一个窗口,但它的窗口过程并不是我们程序设定的那个,可以用spy++查得
2008-4-18 13:04
0
雪    币: 119
活跃值: (298)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
定层窗口!!
2008-4-18 13:32
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
The Windows XP Ghost Window feature creates ghost windows on behalf of a program when the program does not respond correctly to window messages within several seconds and is considered to be hung. This feature may not correctly restore the properties of a minimized window, and may create a second minimized title bar window beside the original window but not overwrite it.
2008-4-22 16:31
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
See PeekMessage Function description in MSDN
2008-4-22 16:32
0
游客
登录 | 注册 方可回帖
返回
//