flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Call interface ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 22 Jul 2020, 14:37
Code:
section '.bss' readable writeable
        cb1         rd 1

interface coi,\
          QueryInterface,AddRef,Release 
section '.code' code readable writeable executable
cb1_tp EQU coi
comcall cb1,cb1_tp,AddRef,1 ;fasm get error undefined symbol cb1_tp.AddRef

comcall cb1,coi,AddRef,1 ;compile fine
    


Last edited by Roman on 23 Jul 2020, 05:16; edited 2 times in total
Post 22 Jul 2020, 14:37
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 22 Jul 2020, 15:30
I try this
comcall cb1,cb1_tp\#,AddRef,1

But get error invalid address call[eax+coi#.AddRef]
Post 22 Jul 2020, 15:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19096
Location: In your JS exploiting you and your system
revolution 22 Jul 2020, 22:44
Roman wrote:
Code:
 error undefined symbol cb1_tp.AddRef    
You have a dot instead of a comma.

comcall cb1,cb1_tp.AddRef,1
Post 22 Jul 2020, 22:44
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 05:12
I try this:
comcall cb1,cb1_tp.AddRef,1

But get error:
undefined symbol call[eax+cb1_tp.AddRef.1]
Post 23 Jul 2020, 05:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19096
Location: In your JS exploiting you and your system
revolution 23 Jul 2020, 05:37
You need a comma. The dot makes it part of the same argument.
Post 23 Jul 2020, 05:37
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 05:48
Quote:
You need a comma. The dot makes it part of the same argument.

In comcall ? I don't understand what you mean.


Last edited by Roman on 23 Jul 2020, 05:51; edited 1 time in total
Post 23 Jul 2020, 05:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19096
Location: In your JS exploiting you and your system
revolution 23 Jul 2020, 05:51
Oh, I didn't see you EQU in there. Just remove the EQU part. Or try replacing it with FIX.
Post 23 Jul 2020, 05:51
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 05:54
How use FIX ?

Code:
macro VarCom chN,chTp {
       chN EQU Intrfc_offs
       chN#_tp EQU chTp
       ;mov eax,chTp
       Intrfc_offs EQU Intrfc_offs+SzComBits
       }
    

Code:
In code:
VarCom cb1,coi
comcall cb1,cb1_tp,AddRef,1
    
Post 23 Jul 2020, 05:54
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 706
Location: Russian Federation, Sochi
ProMiNick 23 Jul 2020, 07:13
Code:
interface coi,\
          QueryInterface,AddRef,Release
interface cb1_tp,\
          QueryInterface,AddRef,Release  
section '.bss' readable writeable
        cb1         rd 1

section '.code' code readable writeable executable

comcall cb1,coi,AddRef,1 ;compile fine
comcall cb1,cb1_tp,AddRef,1 ;compile fine too    


without
Code:
interface cb1_tp,\
          QueryInterface,AddRef,Release    

could be
Code:
cb1_tp.com.interface = 12
cb1_tp.QueryInterface = 0
cb1_tp.AddRef = 4
cb1_tp.Release = 8    

as thou see equation of symbol cb1_tp to coi is not enought because needed 4 more equations (in current case, with other interface needance could be bigger)
--------------------------
And it is bad practice to place macros that not produce data to one of PE sections.
good style - when thou place them among other includes before 1st PE section.
Post 23 Jul 2020, 07:13
View user's profile Send private message Send e-mail Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 07:51
If write macros mEQUInterface with match ?
mEQUInterface coi,QueryInterface,AddRef,Release

macro mEQUInterface do:

coi.QueryInterface EQU 0
coi.AddRef EQU 4
coi.Release EQU 8
Post 23 Jul 2020, 07:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19096
Location: In your JS exploiting you and your system
revolution 23 Jul 2020, 08:10
I suggest to not use EQU. This is the cause of problems. Use = instead
Post 23 Jul 2020, 08:10
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 09:08
if i write cb1_tp = coi
Fasm get error undefined symbol coi
Post 23 Jul 2020, 09:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19096
Location: In your JS exploiting you and your system
revolution 23 Jul 2020, 09:33
coi is not a simple number.

Did you try FIX?
Post 23 Jul 2020, 09:33
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 09:40
How use FIX in macro com2 ?
Code:
macro com2 handle,interface,proc,[arg]
 { common
    if ~ arg eq
   reverse
     pushd arg
   common
    end if
   ; assert defined interface#.com.interface ; must be a COM interface
    if handle eqtype eax | handle eqtype 0
     push handle
     local ..handle
     label ..handle at handle
     mov eax,[..handle]
    else
     mov eax,handle
     push eax
     mov eax,[eax]
    end if
    ;elccc = interface
    call [eax+interface#.#proc] }  
    
Post 23 Jul 2020, 09:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19096
Location: In your JS exploiting you and your system
revolution 23 Jul 2020, 09:44
cb1_tp fix coi
Post 23 Jul 2020, 09:44
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 23 Jul 2020, 09:53
cb1_tp fix coi
comcall cb1,cb1_tp,AddRef
Work.

But i need do fix in macro.
macro VarCom chN,chTp {
chN EQU Intrfc_offs
chN#_tp EQU chTp
Intrfc_offs EQU Intrfc_offs+SzComBits
}

If i write
macro VarCom chN,chTp {
chN EQU Intrfc_offs
chN#_tp EQU chTp
chN#_tp FIX chTp
Intrfc_offs EQU Intrfc_offs+SzComBits
}
I get fasm error coi fix coi
Post 23 Jul 2020, 09:53
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 706
Location: Russian Federation, Sochi
ProMiNick 23 Jul 2020, 10:47
Roman, existing macros successfully calls interface.
Thou want provide smthing thour own. What for? What syntax thou want?
What in current syntax is problematic for thou? inheritance of interfaces?
Post 23 Jul 2020, 10:47
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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.