flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved] more bother with locals

Author
Thread Post new topic Reply to topic
DergMoney



Joined: 29 Apr 2015
Posts: 34
DergMoney 07 Jun 2015, 15:13
Dang, why is something that should be so easy, not?

I have a global string buffer 'fileName'. When I enter a thread I want to copy the string from 'fileName' to a local buffer '.tmp'. To begin all I want to do is get the address of .tmp

I can't figure how to do it with locals, although I do have a workaround. Just wondered where I'm going wrong. (I am using include "%fasminc%\win32ax.inc" now).


This gives 'error: invalid value'

Code:
proc threadProcessFile
    locals
        .tmp db MAX_PATH dup ?
    endl

        mov     edi, .tmp 
    .finish:
        ret
endp
    


This gives 'error: extra characters on line'

Code:
proc threadProcessFile
    locals
        .tmp db MAX_PATH dup ?
    endl

        mov     edi, addr .tmp

    .finish:
        ret
endp
    


This works but doesn't use locals...

Code:
proc threadProcessFile
        mov     edi, .tmp
    .finish:
        ret

    section '.data' data readable writeable
        .tmp    db MAX_PATH dup ?

    section '.code' code readable executable
        mov     eax, eax
endp
    


Thanks for any help you can give.
Post 07 Jun 2015, 15:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20344
Location: In your JS exploiting you and your system
revolution 07 Jun 2015, 21:52
You need to use LEA.
Code:
lea edi,[.tmp]    
Post 07 Jun 2015, 21:52
View user's profile Send private message Visit poster's website Reply with quote
DergMoney



Joined: 29 Apr 2015
Posts: 34
DergMoney 07 Jun 2015, 22:15
Thanks revolution Smile

Had tried something with lea but it loaded edi with the dword at .tmp Question

Working fine now, thanks again
Post 07 Jun 2015, 22:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.