.486 .model flat,stdcall option casemap:none ; case sensitive ;http://www.popbook.com/wbbs/topic.asp?l_id=5&t_id=2294 include masm32includewindows.inc include masm32includekernel32.inc includelib masm32libkernel32.lib include masm32includeuser32.inc includelib masm32libuser32 ABCCC struct String1 DWORD ? String2 DWORD ? String3 DWORD ? ABCCC ends .const ; dbtext db "hello",0; dbtitle db "title",0; .data testst ABCCC <"A","b","c"> .code start : call main; invoke ExitProcess,eax; testfnvar proc C var_1 ret; testfnvar endp main proc mov esi, OFFSET testst; assume esi:ptr ABCCC; ;给寄存器声明结构 ;类型 pre 变量名 ;转换类型 mov eax, [esi].String1; invoke MessageBox, NULL, addr [esi].String1, addr dbtitle, MB_OK; invoke testfnvar ,1 ; main endp testfn proc local @l1:dword; local @l2:word; local @l3:word; mov eax,@l1; mov ax,@l2; mov bx,@l3; invoke MessageBox ,NULL, addr dbtext,addr dbtitle,MB_OK; ;ret; testfn endp end start
notepad++ 配置
安装 nppexec插件
在插件菜单里添加
npp_save echo $(CURRENT_DIRECTORY) echo $(FILE_NAME) echo $(NAME_PART) cd $(CURRENT_DIRECTORY) D:masm32inml /c /coff /Cp $(FILE_NAME) D:masm32inlink /SUBSYSTEM:WINDOWS /LIBPATH:D:masm32lib $(NAME_PART).obj $(CURRENT_DIRECTORY)$(NAME_PART).exe