首页
社区
课程
招聘
[旧帖] [求助]新手求救,masmplus编译不通过,是罗云杉的例子 0.00雪花
发表于: 2011-11-12 16:03 1838

[旧帖] [求助]新手求救,masmplus编译不通过,是罗云杉的例子 0.00雪花

2011-11-12 16:03
1838
.386
.model flat,stdcall
option casemap:none
;include 定义
include         windows.inc
include         gdi32.inc
includelib          gdi32.lib
include                user32.inc
includelib                user32.lib
include                kernel32.inc
includelib                kernel32.lib
;数据段
                                .data?
hInstance    dd        ?
hWinMain                 dd        ?
                               
                                .const
szClassName                db 'MyClass',0
szCptionMain        db 'myfirstwindow!',0
szText                        db 'win32 assembly,simpler and powerful',0
;代码段
                                        .code
_ProWinMain  proc uses ebx edi esi ,hWnd,uMsg,wParam,lParam
                                 local @stPs:PAINTSTRUCT
                                 local @stRect:RECT
                                 local @hDc
                                 mov eax,uMsg
                                 
                        .if                 eax  ==  WM_PAINT
                                                         invoke BeginPaint,hWnd,addr @stPs
                                                         mov @hDc,eax
                                                        
                                                         invoke GetClientRect,hWnd,addr @stRect
                                                         invoke DrawText,@hDc,addr szText,-1,\
                                                         addr @stRect,\
                                                         DT_SINGLELINE or DT_DT_CENTER or DTVCENTER
                                                         invoke EndPaint,hWnd,addr @stPs
                                                        
                        .elseif     eax  ==  WM_CLOSE
                                         invoke DestroyWindow,hWinMain
                                         invoke PostQuitMessage,NULL
                                        
                   .else                        invoke DefWindowProc,hWnd,uMsg,wParam,lParam
                                                   ret
                   .endif
                    xor                        eax,eax
                    ret
                    _ProcWinMain endp
                ; _WinMain子程序   
                    _WinMain         proc
                                           local                @stWndClass:WNDCLASSEX
                                           local                @stMsg:MSG
                                          
                                           invoke GetModuleHandle,NULL
                                           mov hInstance,eax
                                           invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
                ;注册窗口类
                                                        invoke         LoadCursor,0,IDC_ARROW
                                                        mov                 @stWndClass.hCursor,eax
                                                        push                hInstance
                                                        pop                @stWndClass.hInstance
                                                        mov                @stWndClass.cbSize,sizeof WNDCLASSEX
                                                        mov                @stWndClass.style,CS_HREDRAW or CS_VREDRAW
                                                        mov                @stWndClass.lpfnWndProc,offset _ProWinMain
                                                        mov                @stWndClass.hbrBackground,COLOR_WINDOW+1
                                                        invoke   RegisterClassEx,addr @stWndClass
;建立并显示窗口
                                                        invoke         CreateWindowEx,WS_EX_CLIENTEDGE,\
                                                                                offset szClassName, offset szCptionMain,\
                                                                                WS_OVERLAPPEDWINDOW,\
                                                                                100,100,600,400,\
                                                                                NULL,NULL,hInstance,NULL
                                                        mov                hWinMain,eax
                                                        invoke   ShowWindow,hWinMain,SW_SHOWNORMAL
                                                        invoke        UpdateWindow,hWinMain
;消息循环
                                                       
                                                        .while         TRUE
                                                        invoke        GetMessage,addr @stMsg,NULL,0,0
                                                        .break        .if        eax==0
                                                        invoke        TranslateMessage,addr @stMsg
                                                        invoke         DispatchMessage,addr @stMsg
                                                        .endw
                                                        ret
_WinMain                                endp

start:
                                                call _WinMain
                                                invoke ExitProcess,NULL
                                                end start       

提示 错误::::::::::::::::::::::::::
C:\Users\Administrator\Desktop\FirstWindow.ASM(34) : error A2114: INVOKE argument type mismatch : argument : 5
C:\Users\Administrator\Desktop\FirstWindow.ASM(44) : error A2008: syntax error : invoke

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (7)
雪    币: 143
活跃值: (25)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
2
代码是你一行行自己敲的吗?
几处敲错了:
_ProWinMain  proc uses ebx edi esi ,hWnd,uMsg,wParam,lParam     [COLOR="green"]  ;这里缺少了个"c"[/COLOR]
......
               invoke GetClientRect,hWnd,addr @stRect
               invoke DrawText,@hDc,addr szText,-1,\
               addr @stRect,\
               DT_SINGLELINE or DT_DT_CENTER or DTVCENTER   [COLOR="SeaGreen"]; 这里应该是DT_CENTER or DT_VCENTER[/COLOR]
......
       .else    invoke DefWindowProc,hWnd,uMsg,wParam,lParam [COLOR="Green"]  ;这里invoke应该换行[/COLOR]
......
_ProcWinMain endp  
2011-11-12 16:52
0
雪    币: 29
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
你这程序错误不只一点点。。。到小4个地方
2011-11-12 16:57
0
雪    币: 29
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
.386
.model flat,stdcall
option casemap:none
;include 定义
include   windows.inc
include   gdi32.inc
includelib    gdi32.lib
include    user32.inc
includelib    user32.lib
include    kernel32.inc
includelib    kernel32.lib
;数据段
        .data?
hInstance    dd  ?
hWinMain     dd  ?
        
        .const
szClassName    db 'MyClass',0
szCptionMain  db 'myfirstwindow!',0
szText      db 'win32 assembly,simpler and powerful',0
;代码段
          .code
_ProcWinMain  proc uses ebx edi esi ,hWnd,uMsg,wParam,lParam
         local @stPs:PAINTSTRUCT
         local @stRect:RECT
         local @hDc
         mov eax,uMsg
         
      .if     eax  ==  WM_PAINT
               invoke BeginPaint,hWnd,addr @stPs
               mov @hDc,eax
               
               invoke GetClientRect,hWnd,addr @stRect
               invoke DrawText,@hDc,addr szText,-1,\
               addr @stRect,\
               DT_SINGLELINE or DT_CENTER or DT_VCENTER    ;这里错了
               invoke EndPaint,hWnd,addr @stPs
               
      .elseif     eax  ==  WM_CLOSE
                 invoke DestroyWindow,hWinMain
                 invoke PostQuitMessage,NULL
                 
       .else      
                       invoke DefWindowProc,hWnd,uMsg,wParam,lParam  ;这里错了
               ret
       .endif
        xor      eax,eax
        ret
        _ProcWinMain endp
    ; _WinMain子程序   
_WinMain   proc
                   local    @stWndClass:WNDCLASSEX
                   local    @stMsg:MSG
                  
                   invoke GetModuleHandle,NULL
                   mov hInstance,eax
                   invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
    ;注册窗口类     >>>>>>这里错了
              invoke   LoadCursor,0,IDC_ARROW
              mov     @stWndClass.hCursor,eax
              push    hInstance
              pop    @stWndClass.hInstance
              mov    @stWndClass.cbSize,sizeof WNDCLASSEX
              mov    @stWndClass.style,CS_HREDRAW or CS_VREDRAW
              mov    @stWndClass.lpfnWndProc,offset _ProcWinMain
              mov    @stWndClass.hbrBackground,COLOR_WINDOW+1
              mov    @stWndClass.lpszClassName,offset szClassName    ;还少这个必须有的东西
              invoke   RegisterClassEx,addr @stWndClass
;建立并显示窗口
              invoke   CreateWindowEx,WS_EX_CLIENTEDGE,\
                    offset szClassName, offset szCptionMain,\
                    WS_OVERLAPPEDWINDOW,\
                    100,100,600,400,\
                    NULL,NULL,hInstance,NULL
              mov    hWinMain,eax
              invoke   ShowWindow,hWinMain,SW_SHOWNORMAL
              invoke  UpdateWindow,hWinMain
;消息循环
              
              .while   TRUE
              invoke  GetMessage,addr @stMsg,NULL,0,0
              .break  .if  eax==0
              invoke  TranslateMessage,addr @stMsg
              invoke   DispatchMessage,addr @stMsg
              .endw
              ret
_WinMain        endp

start:
            call _WinMain
            invoke ExitProcess,NULL
            end start  
;小心一点。。代码不要弄错了
2011-11-12 17:06
0
雪    币: 67
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
真的谢谢,这个仔细为我这个新手解答
2011-11-12 17:53
0
雪    币: 67
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
太感谢你们了
2011-11-12 17:54
0
雪    币: 415
活跃值: (34)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
7
最笨的方法往往是最有效的,最小化程序,加一行编译一次,慢慢解决问题。
2011-11-12 20:31
0
雪    币: 67
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
前辈教育的是
2011-11-12 21:53
0
游客
登录 | 注册 方可回帖
返回
//