.386
.model flat,stdcall
Option CaseMap:None
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
.data
szstr db 'the num is %x',0
szCaption db 'windows',0
buff dd 100 dup(0)
.code
start:
mov ax,123
mov ax,2
invoke wsprintf,addr buff,addr szstr,ax
invoke MessageBox,NULL,offset v,offset szCaption,MB_OK
invoke ExitProcess,NULL
end start


why to change eax to ax,the program would error?
Posted on 2004-06-13 02:22:54 by cccer
invoke ( or push ) expects 32-bit instructions. You need to use eax.
Posted on 2004-06-13 03:37:47 by Vortex
The stack should be aligned to dword. When you push a word, the stack is no longer aligned to dword.
Posted on 2004-06-13 11:31:53 by roticv