flat assembler
Message board for the users of flat assembler.

Index > Main > Structs in stack

Author
Thread Post new topic Reply to topic
Mentol



Joined: 08 Jun 2006
Posts: 7
Mentol
Hi, my problem>

i have local struct in stack:
Code:
proc Test
  locals
    s_a : sockaddr_in
  endl
 . . .
endp
    


but, i can't use struct items (s_a.sin_port, s_a.sin_family, etc) because structure address is EBP-based (ebp+10, for example) NOT absolute! (0x00401020 for example).
if this variable was global, i can use:
Code:
mov s_a.sin_port, 0
    

but with ebp-based address i cant use this construction
i see (forgotten place =)) that fasm supports anything about this (что-то типа такого):
Code:
lea eax, [s_a],
mov (sockaddr_in)eax.sin_port, 0
    


HELP!
Post 12 Jun 2006, 17:59
View user's profile Send private message Reply with quote
Mentol



Joined: 08 Jun 2006
Posts: 7
Mentol
i got the problem solved Very Happy

Code:
        lea   eax, [s_a]
        mov  [eax+sockaddr_in.sin_port], 1
    
Post 12 Jun 2006, 18:03
View user's profile Send private message Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk
Have you tried using Privalov's macros? They work, create a faster code (you don't have the register pressure of using eax, you may use ebp directly), and allow you to use

mov s_a.sin_port, 0

.
Post 21 Jun 2006, 04:32
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.