flat assembler
Message board for the users of flat assembler.
Index
> Windows > How to pass a local variable into procedure |
Author |
|
revolution 12 Dec 2014, 14:09
I assume you actually want to use LEA instead of MOVSX.
Code: lea eax, [Text] ;and the same for the other movsx |
|||
12 Dec 2014, 14:09 |
|
rinart73 12 Dec 2014, 14:18
Can you explain the difference, please?
UPD: This isn't works. _memcpy won't change variable Text :/ |
|||
12 Dec 2014, 14:18 |
|
revolution 12 Dec 2014, 14:28
You are putting the arguments for memcpy in the wrong place. You can use the macro cinvoke to do the work for you.
Code: cinvoke _memcpy,Text,addr Text2,9 |
|||
12 Dec 2014, 14:28 |
|
rinart73 12 Dec 2014, 14:40
I don't understand. Why ebp is the wrong place? I found it in tutorials.
And I tried to use "push" and proc _memcpy, arg1,arg2,arg3... cinvoke is fast? What is the difference from "invoke" and "call"? |
|||
12 Dec 2014, 14:40 |
|
revolution 12 Dec 2014, 14:44
Your parameters need to follow ESP not EBP.
invoke is a macro, call is a CPU instruction. cinvoke (ccall convention) and invoke (stdcall convention) only differ in the way the stack is restored when the procedure returns. cinvoke will place the "add esp,12", but invoke won't. This is because of the stdcall and ccall convention differences. |
|||
12 Dec 2014, 14:44 |
|
rinart73 12 Dec 2014, 14:45
cinvoke _memcpy, Text, addr Text2, 9
Error: invalid value : pushd addr ..var?TK cinvoke _memcpy, Text, dword[Text2], 9 Error: operand size not specified: call[_memcpy] |
|||
12 Dec 2014, 14:45 |
|
revolution 12 Dec 2014, 14:48
Oh, sorry, your _memcpy is not the MSVCRT version. In that case use "stdcall _memcpy,...".
Also, don't put the ! in front of the names, it has no meaning unless you define your variable names with the ! also. |
|||
12 Dec 2014, 14:48 |
|
rinart73 12 Dec 2014, 14:53
I use it for reason, believe me
stdcall _memcpy, !Text, dword[!Text2], 9 Result: Crash |
|||
12 Dec 2014, 14:53 |
|
rinart73 12 Dec 2014, 14:53
I use it for reason, believe me
stdcall _memcpy, Text, dword[Text2], 9 Result: Crash |
|||
12 Dec 2014, 14:53 |
|
revolution 12 Dec 2014, 15:09
Use "addr" not "dword":
Code: stdcall _memcpy, Text, addr Text2, 9 |
|||
12 Dec 2014, 15:09 |
|
rinart73 12 Dec 2014, 15:18
all is working thnx
|
|||
12 Dec 2014, 15:18 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.