Cita de: SecMAM en 22 Marzo 2010, 03:21 AM
y la pila te la metes por el orto ?![]()
![]()
Restaura la pila luego del wsprintf con cinvoke en ves de invoke .
Mucha memoria para un numero que cabe en 2 bytes y luego no usas GLobalFree :S
No tiene sentido liberar memoria si nanosegundos despues haces un ExitProcess



Lo de la pila tienes razón:
Citar
Note It is important to note that wsprintf uses the C calling convention (_cdecl), rather than the standard call (_stdcall) calling convention. As a result, it is the responsibility of the calling process to pop arguments off the stack, and arguments are pushed on the stack from right to left. In C-language modules, the C compiler performs this task.
Código (asm) [Seleccionar]
include 'win32ax.inc'
.code
start:
;Reservo memoria y guardo en puntero a esa memoria en ebp
;¬¬'
sub esp,2
mov ebp,esp
mov eax,2
mov ebx,5
add eax,ebx
;Guardo en ebx un puntero que apunta hacia eax convertido en cadena
invoke wsprintfA,ebp,"%d",eax
;¬¬'
add esp,0x0C
invoke MessageBoxA,0,ebp,"suma",0
add esp,2
ret
.end start
Saludos