News:

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

Pushing too many params?

Started by Mark Jones, February 27, 2006, 05:59:40 AM

Previous topic - Next topic

Mark Jones

Q: Is it necessarily bad if you push a few too many values to the stack? i.e.


.code
    invoke GetHandle,STD_OUTPUT_HANDLE
    mov hConsole,eax

    push eax
    push ecx
    push MyVar
    push GeorgeW.Bush

    invoke ExitProcess,0


What happens to those values, does ExitProcess clean up all the stack space used or simply increment past it? Thanks.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Maeser

Well...if memory serves...the stack wouldn't be balanced. But since you're exiting I would assume it would be ignored

zooba

Presumably it loads the appropriate stack pointer from a fixed memory location (relative to FS probably) or changes context and simply frees all of the memory. If it doesn't crash on exit, it's probably all right.

Tedd

It seems you can mess up the stack all you want - pushing or popping (as long as you don't get an exception as a result of those actions.)
ExitProcess destroys 'your' stack and ignores.
No snowflake in an avalanche feels responsible.