News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

ebp-handling at function-entry

Started by gbreuer, November 25, 2013, 12:09:11 AM

Previous topic - Next topic

dedndave

ok - don't mix "the assembler handles the stack frame" with "the programmer handles it" in the same PROC
use one method or the other

in this case, just create a LOCAL or LOCAL's

MyFunc  PROC  dwParm:DWORD

    LOCAL   dwVal1      :DWORD  ;1 dword
    LOCAL   dwVal2      :DWORD  ;1 dword
    LOCAL   abBytes[4]  :BYTE   ;4 bytes

jj2007

Quote from: gbreuer on November 27, 2013, 05:20:28 AM
But this only works, when i move the stackpointer about 12 Bytes. Otherwise i get an
empty MessageBox. (Even the button is empty).

I followed this step by step via ollydbg. But i found no explanation.

In Win32 code, the stack must be DWORD-aligned. Otherwise, you will see such crashes all the time.

gbreuer

Thanks for the hints. I have to learn more. At the moment i will use LOCAL in such cases.

But there is a problem with "LOCAL": How can i make it compatible to underscores in variablenames?

I got a syntax-error for "ebp" as long as i used a name like this: local a_b ...

Then i removed the underscore and it worked.




jj2007

LOCAL a_b works fine with ML 6.14 ... 10.0 and JWasm.

Do you get Error A2056: Symbol already defined: a_b ?
Can you post a complete example?

gbreuer

I got this error:

error A2008: syntax error : ebp

But i found the problem: The length of variablenames, that are used with LOCAL
is limited. It has nothing to do with the underscore. I shortened the name, and it works now.