flat assembler
Message board for the users of flat assembler.

Index > Main > Fasm 1.73 virtual and interface

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1808
Roman 09 Feb 2020, 12:46
I try virtual whit strut.
Work fine.
Code:
Interface Im,\
    R, P, Stop
Virtual at eax
Som Im
End virtual
    

Call [Som. Stop]

In Ida Pro I get call large dword 08h
But not call [eax+8]
Post 09 Feb 2020, 12:46
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 09 Feb 2020, 13:46
interface don`t structurize data!!!
so, Som declared as object by single dword(or qword) in eax, and assumed that is pointed to interface structure.
But interface self is only abstraction - it is ALWAYS zero based structure.
ptrsize=4(32bit)|ptrsize=8(64bit)
So
Som = eax
Som.R = ptrsize*0
Som.P = ptrsize*1
Som.Stop = ptrsize*2

use "call[Som+Im.Stop]" instead.
[edited]I a bit hurried: even that is incorrect.

in eax+ptrsize located another variable.
so we for start should dereference ptr: mov eax,[Som]
and only after that call [eax+Som.Stop] ; Som.Stop equal to Im.Stop
Post 09 Feb 2020, 13:46
View user's profile Send private message Send e-mail 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.