News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

warning: program's end don't aligned get a exception

Started by denise_amiga, June 09, 2007, 09:39:12 AM

Previous topic - Next topic

denise_amiga

.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

hutch--

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().
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

denise_amiga

#2
you are right (changed ret to ExitProcess).

 

windows xp sp2

denise_amiga

#3
.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


 

naturally exitprocess is necessary, the failure was mine to remove code in original example (vkdebug demo) and remove ret (in seh handler)