The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: denise_amiga on June 09, 2007, 09:39:12 AM

Title: warning: program's end don't aligned get a exception
Post by: denise_amiga on June 09, 2007, 09:39:12 AM
.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
Title: Re: warning: program's end don't aligned get a exception
Post by: hutch-- on June 09, 2007, 09:55:03 AM
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().
Title: Re: warning: program's end don't aligned get a exception
Post by: denise_amiga on June 09, 2007, 10:30:14 AM
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
Title: sorry for this "stupid" topic
Post by: denise_amiga on June 09, 2007, 04:19:51 PM
.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)