News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problem with STRUCT

Started by BlackVortex, February 05, 2010, 12:14:22 AM

Previous topic - Next topic

BlackVortex

I've gotten confused again.

At the end of my data section I have declared and initiated a structure :

TestS STRUCT
offs dd 00000053h
org  dd 43h
fin  dd 57h
ENDS


How can I get its offset ?

I'm trying various things, like
lea eax, TestS
lea eax, addr TestS

EDIT: Hey,
lea eax, TestS.offs
worked
EDIT:
No, it didn't

oex

LOCAL BlahBlahBlah:TestS

lea eax, BlahBlahBlah
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

oex

BlahBlahBlah:
TestS STRUCT
offs dd 00000053h
org  dd 43h
fin  dd 57h
ENDS

lea eax, BlahBlahBlah
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

BlackVortex

Ah, thanks, that should work.

(I was only getting the offset of the member from the start of the struct, arrgghhh.

BlackVortex

What the ?

I'm using :
TestS STRUCT
offs dd 0FFFFFFFFh
org  dd 0EEEEEEEEh
fin  dd 0DDDDDDDDh
ENDS

at the end of my data section, and I don't see the data in the debugger (it should be after the other data?)  Why isn't it initialized at those values ?

dedndave

#5
you defined the structure type
maybe you have to declare it in the data segment

.data
BlahBlahBlah TestS <>
.code
mov eax,offset BlahBlahBlah

BlackVortex

Oohh, now it all makes sense   :green

Now I can easily get its offset and its member's values   :cheekygreen:

I got caught in red tape it seems.