flat assembler
Message board for the users of flat assembler.
Index
> Windows > Problem with invoke (masm->fasm) |
Author |
|
vbVeryBeginner 08 Jan 2006, 05:33
Code: format PE GUI 4.0 ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« ;szLeft.asm from ..\masm32\m32lib include '%fasminc%\WIN32AXP.INC' .code ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« proc szLeft src, dst,ln ;stdcall uses edi ecx edx,\ ; src:DWORD,dst:DWORD,ln:DWORD mov ecx, [ln] ; length in ECX mov edx, [src] ; source address add edx, ecx ; add required length mov edi, [dst] ; destination address add edi, ecx ; this also sets the terminator position neg ecx ; invert sign @@: mov al, [edx+ecx] mov [edi+ecx], al add ecx, 1 jnz @B ;mov BYTE PTR [edi], 0 ; write terminator mov byte [edi], 0 ; write terminator mov eax, [dst] ret endp start: stdcall szLeft,szString,szResString,[lpLen] invoke MessageBox,0,eax,"blehbleh",0 invoke ExitProcess,0 ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« .data lpLen dd 6 szString db "okasvialksjdlkajds",0 szResString db ? .end start the above code solve ur problem. check the things i commented. |
|||
08 Jan 2006, 05:33 |
|
Tomasz Grysztar 08 Jan 2006, 12:04
For directly calling the functions defined in your code use "stdcall", not "invoke". fasm's "invoke" macro uses the given label as an address of double word variable containing the address of function (the entry in import table usually).
So "invoke ExitProcess,0" is the same as "stdcall [ExitProcess],0", which is the same as "push 0"/"call [ExitProcess]" pair of instructions. Look here for more details. After changing "invoke szLeft ..." to "stdcall szLeft ..." your code works correctly. okasvi wrote: already hoping that there is bug in fasm which gives the error Bad boy! (just joking) |
|||
08 Jan 2006, 12:04 |
|
okasvi 08 Jan 2006, 14:00
Thank you vbVeryBeginner and Privalov
I was just about giving up on converting m32lib to fasm for my own use. _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
08 Jan 2006, 14:00 |
|
vbVeryBeginner 08 Jan 2006, 23:20
hi okasvi,
you are welcome |
|||
08 Jan 2006, 23:20 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.