.386
.model flat, stdcall
option casemap: none
include windows.inc
include kernel32.inc
include masm32.inc
include debug.inc
includelib kernel32.lib
includelib masm32.lib
includelib debug.lib
.code
foo PROC
add eax,1
add edx,2 ;comment this line a works fine (program's end aligned)
ret
foo endp
start:
mov eax,55555555h
PrintHex eax
call foo
PrintHex eax
;program's end don't aligned and filled with 'CC'
;if you don't force exit you get a exception
;ret
END start
It runs OK on my win2000. Displays the debug window. CLose that and it seems to close with no problems.
None the less you should exit a windows app with ExitProcess().
you are right (changed ret to ExitProcess).
(http://www.imagewoof.com/view_thumb/1c4e2854/bug1.png) (http://www.imagewoof.com/view_image/1c4e2854/bug1.png) (http://www.imagewoof.com/view_thumb/ec1ad559/bug12.png) (http://www.imagewoof.com/view_image/ec1ad559/bug12.png)
windows xp sp2
.386
.model flat, stdcall
option casemap: none
INCLUDE kernel32.inc
includelib kernel32.lib
.code
foo PROC
add eax,1
ret
foo endp
start:
mov eax,55555555h
call foo
;if you don't force exit you get a exception
;invoke ExitProcess,0
END start
(http://www.imagewoof.com/view_thumb/5e1ca1127/Dibujo21.png) (http://www.imagewoof.com/view_image/5e1ca1127/Dibujo21.png) (http://www.imagewoof.com/view_thumb/2fe681101/Dibujo22.png) (http://www.imagewoof.com/view_image/2fe681101/Dibujo22.png)
naturally exitprocess is necessary, the failure was mine to remove code in original example (vkdebug demo) and remove ret (in seh handler)