flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [FIXED]At least one macro has this bug (cominvk)

Author
Thread Post new topic Reply to topic
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg
When using cominvk to call a COM method, while giving it a local label, generates the following error: "Error: assertion failed"
When using invoke, it doesn't have this bug.

The failed assertion is in "com32.inc" at line 11:
Code:
assert defined com.interface.#interface ; must be a COM interface    

Obviously, it has problems with the period sign.
Code:
format PE GUI 5.0
include "win32a.inc" 

struc GUID def 
 {  
   match d1-d2-d3-d4-d5, def  
    \{  
      dd 0x\#d1 
      dw 0x\#d2 
      dw 0x\#d3 
      db 0x\#d4 shr 8,0x\#d4 and 0FFh 
      db 0x\#d5 shr 40,0x\#d5 shr 32 and 0FFh,0x\#d5 shr 24 and 0FFh,0x\#d5 shr 16 and 0FFh,0x\#d5 shr 8 and 0FFh,0x\#d5 and 0FFh 
    \}  
 } 

interface IFileOpenDialog,\ 
          QueryInterface,\  
          AddRef,\  
          Release,\  
          Show,\ 
          SetFileTypes,\  
          SetFileTypeIndex,\  
          GetFileTypeIndex,\  
          Advise,\  
          Unadvise,\  
          SetOptions,\  
          GetOptions,\  
          SetDefaultFolder,\  
          SetFolder,\  
          GetFolder,\  
          GetCurrentSelection,\  
          SetFileName,\  
          GetFileName,\  
          SetTitle,\  
          SetOkButtonLabel,\  
          SetFileNameLabel,\  
          GetResult,\  
          AddPlace,\  
          SetDefaultExtension,\  
          Close,\  
          SetClientGuid,\  
          ClearClientData,\  
          SetFilter,\  
          GetResults,\  
          GetSelectedItems 

invoke CoInitialize, 0 
invoke CoCreateInstance, testing.CLSID_FileOpenDialog, 0, 1, testing.IID_IFileOpenDialog, testing.examplelabel 
cominvk testing.examplelabel,GetOptions,testing.fos ;This line generates the error 
invoke ExitProcess, 0 

;Data 
testing: 
.examplelabel IFileOpenDialog 
.fos dd ? 
;GUIDs 
;File Open Dialog identifier 
.CLSID_FileOpenDialog GUID DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7 
;IFileOpenDialog identifier 
.IID_IFileOpenDialog GUID d57c7288-d4ad-4768-be02-9d969532d960 

section '.idata' import data readable writeable 

library kernel32,'KERNEL32.DLL',\
        ole,'OLE32.DLL' 

        include "api\kernel32.inc"

        import ole,\ 
               CoInitialize,'CoInitialize',\ 
               CoCreateInstance,'CoCreateInstance'    


Last edited by rohagymeg on 21 Oct 2012, 11:46; edited 1 time in total
Post 21 Oct 2012, 00:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Post 21 Oct 2012, 07:19
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
toching the Mod/RM is not good. wher the dot is a special beast of symbol.
Code:
 ;--- call com method 
 ;--- .pUnk->QueryInterface
 macro @comcall argmeth{
  match p->meth,argmeth\{
    mov rcx,[p]
    mov rax,[rcx]
    sub rsp,20h
    call [rax+p\#.\#meth-p]
    add rsp,20h
  \} 
 }
    

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 21 Oct 2012, 09:00
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
This macro did not work at all with dotted labels. But please try with the new version in updated fasmw 1.71.05 package I just uploaded.
Post 21 Oct 2012, 09:39
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
Tomasz Grysztar wrote:
This macro did not work at all with dotted labels. But please try with the new version in updated fasmw 1.71.05 package I just uploaded.

before suggesting people to use your macro, fasm should be featured to
handle this case.
Code:
handle equ rbp+16
if handle eqtype rax | handle eqtype 0
  display "feature enhanced fasm"  ;<--- never displayed
end if
    

and that is not an option. because with COM almost all is stack-based.

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 21 Oct 2012, 10:00
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
ah,yes, the else branch too.
ok

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 21 Oct 2012, 10:05
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
hopcode: if you report a bug, please try to make it a bit more clear. It took me a while before I realized that you were reporting a problem with making a "comcall rbp+16,..." type calls.
Post 21 Oct 2012, 10:43
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
Tomasz Grysztar wrote:
...a problem with making a "comcall rbp+16,..." type calls.
the problem doesnt affect your comcall macro, becase it is this way:
Code:
 macro comcall handle,interface,proc,[arg]     
eventual problems are others.

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 21 Oct 2012, 11:21
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
hopcode wrote:
...eventual problems are others.

but i cannot find it now on board. i posted some solutions concerning nesting of interfaces.

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 21 Oct 2012, 11:28
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
Then I don't know what you had in mind, but still you brought my attention to the case when "handle" parameter for "comcall" macro was register-based label. It looks like a rare usage scenario, but I made it work anyway.
Post 21 Oct 2012, 11:36
View user's profile Send private message Visit poster's website Reply with quote
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg
Anyways, it now works. Thanks for the fix, Tomasz!
Post 21 Oct 2012, 11:47
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.