win32 asm Hello World Demo

编译和链接选项

ml.exe /c /coff /nologo /Fo

link.exe /SUBSYSTEM:WINDOWS /nologo /OUT

Hello World Demo Compiled with MASMPlus

.386
.model flat, stdcall
option casemap :none
include windows.inc
include user32.inc
include kernel32.inc
include masm32.inc
include gdi32.inc
includelib gdi32.lib
includelib user32.lib
includelib kernel32.lib
includelib masm32.lib
include macro.asm
.data
szTitle db 'Title',0
szMessage db 'Hello World',0
.code
START:
	;1.push and call
	push MB_OK or MB_ICONINFORMATION
	push offset szTitle
	push offset szMessage
	push NULL
	call MessageBox
	;2.invoke伪指令
	;invoke MessageBox,NULL,offset szMessage,offset szTitle,MB_OK or MB_ICONINFORMATION
	invoke ExitProcess,0
end START

  

此段反汇编结果:程序入口点在0x401000,先是4个push,然后是call MessageBoxA

返回值到EAX,为ID_OK=1,从图中寄存器可见。

posted @ 2011-06-21 22:01  OYJJ  阅读(311)  评论(0编辑  收藏  举报