I am trying to work out to use COM Objects in Assembler and I got it working more or less.. below is a code written in fasm that creates the Common Dialog and everything just works fine it is created with no problems and I can call the ShowColor method without problems the dialog appears but if I want to call the ShowOpen method it just doesn't show up... it tried everything even setting all parameters like filter filterindex and so on .. but the problem is I cannot figure out why it doesn't show up. If someone can see why or have some tip.. I would be very happy..


format PE GUI 4.0
entry start

include 'win32a.inc'

CLSCTX_INPROC_SERVER        = 0x1

;VTABLE OFFSETS
AboutBox      = 292
ShowOpen      = 268
ShowColor      = 276
Release        = 8

struc GUID def {
  match d1-d2-d3-d4-d5, def
    \{.Data1 dd 0x\#d1
      .Data2 dw 0x\#d2
      .Data3 dw 0x\#d3
      .Data4 db 0x\#d4 shr 8,0x\#d4 and 0FFh
      .Data5 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
    \}}

section '.data' data readable writeable

CLSID_CommonDialog GUID F9043C85-F6F2-101A-A3C9-08002B2F49FB
IID_ICommonDialog GUID 083039C2-13F4-11D1-8B7E-0000F8754DA1
CommonDialog dd 0

section '.code' code readable executable

start:

        invoke  CoInitialize,NULL
        invoke  CoCreateInstance,CLSID_CommonDialog,0,CLSCTX_INPROC_SERVER,IID_ICommonDialog,CommonDialog


        mov ebx,
        push ebx
        mov eax,
        call dword

        mov ebx,
        push ebx
        mov eax,
        call dword

        mov ebx,
        push ebx
        mov eax,
        call dword

        invoke  ExitProcess,0

section '.idata' import data readable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          ole,'OLE32.DLL'

  import kernel,\
        ExitProcess,'ExitProcess'

  import user,\
        MessageBox,'MessageBoxA'

  import ole,\
        CoInitialize,'CoInitialize',\
        CoCreateInstance,'CoCreateInstance'
Posted on 2008-02-21 10:42:23 by Emod
As far as I understand it ICommonDialog is an IClassFactory2 type interface that requires licensing so I can't test it here. However a quick google shows that you are not the only person who has had this problem.
Posted on 2008-02-23 11:51:16 by donkey