flat assembler
Message board for the users of flat assembler.

Index > Windows > assign struct

Author
Thread Post new topic Reply to topic
ltheonel



Joined: 08 Jul 2011
Posts: 8
ltheonel
Hello,
how can i assign a struct:

local astruct:Mystruct

like this:


//C-style is astruct = (Mystruct) &Dara->FileResourcefirstbyte (first byte of resource) in fasm filepointer is [pRes] but i cant cast and assign this pointer to Mystruct.

Maybe someone can help.
Post 25 Jul 2011, 12:35
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Code:
push ebx
lea ebx,[myLocalStruct]

;since in your case you show that the first field is a byte
; thus it will be

mov [ebx],byteValue ; first byte
;OR
mov [ebx+MyStruct.FileResourcefirstbyte],byteValue
;for other different members, use their index and size
;IE DWORD
mov [ebx+index*4]
;WORD
mov [ebx+index*2]

;restore ebx
pop ebx
    
Post 25 Jul 2011, 14:07
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 GitHub, YouTube, Twitter.

Website powered by rwasa.