MASM will accept Start...
Start:
mov eax,0
INVOKE ExitProcess,eax
END Start
or a PROC...
_main PROC
mov eax,0
INVOKE ExitProcess,eax
_main ENDP
END _main
i prefer the later, as it allows for the use of LOCAL vars
it also looks neater and, i think, is more readable :P
when you use LOCAL, the assembler generates a prologue
it also generates an epilogue anywhere RET is used in that PROC
seeing as the _main PROC rarely has a RET, no epilogue is generated
as you know, when the assembler generates one of the prologues, it uses stack space
normally, the stack space is released in the epilogue
seeing as there is no RET and no epilogue, there is no balancing of the stack
however, ExitProcess releases any stack space used by the process thread
this may not apply for PROC's used in threads
i.e., the operating system may not free the stack for ExitThread the same way as for ExitProcess
this can cause a memory leak
when i write a thread PROC, i am careful not to use any parameters or USED on the PROC line
i am also careful not to use LOCAL in thread PROCs
when you start a thread, there may be one caller parameter available in [ESP+4], however
when i terminate a thread, i make sure the stack is balanced