flat assembler
Message board for the users of flat assembler.

Index > Main > [solved] struc error if sizeof.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
I have struc:
Code:
struc ClassZi {.VTab dd 0
.Init dd 0
.b dd 0
.b1 dd 0
.c dd 0
.d dd 0
.d1 dd 0
.name db 256 dup (0) }
    

When i write mov eax,sizeof.ClassZi i get error.
I try do:
Jim ClassZi
and mov eax,sizeof.Jim i get error
Post 22 Aug 2020, 13:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17624
Location: In your JS exploiting you and your system
revolution
struc doesn't define anything else other than the structure itself.
Code:
virtual at 0
  ClassZi ClassZi ; instantiate
  sizeof.ClassZi = $ ; measure the size
end virtual    
Post 22 Aug 2020, 13:08
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
Wow !
Thanks.
Work.
Post 22 Aug 2020, 13:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17624
Location: In your JS exploiting you and your system
revolution
Another way to give the length/size for each instantiation is this:
Code:
struc foo arg {
        .begin  = $
        .text   db `arg,0
        sizeof.#. = $ - .begin
}
jim     foo jim
Roman   foo Roman
;...
mov ecx,sizeof.jim
mov edx,sizeof.Roman    
Post 23 Aug 2020, 03:59
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
Thanks.
Very nice example !
Post 23 Aug 2020, 07:26
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.