flat assembler
Message board for the users of flat assembler.

Index > Windows > USECOM Example for CommonDialog

Author
Thread Post new topic Reply to topic
Hicel



Joined: 09 Sep 2004
Posts: 55
Hicel
ups.. deleted all by edit.. anyway I wanted to figure out how to usw common dialog with usecom example but it doesn' work..

Code:
format PE GUI 4.0
entry start

include 'c:\fasmw16723\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,[CommonDialog]
        push ebx
        mov eax,[ebx]
        call dword [eax+ShowColor]

        mov ebx,[CommonDialog]
        push ebx
        mov eax,[ebx]
        call dword [eax+ShowOpen]

        mov ebx,[CommonDialog]
        push ebx
        mov eax,[ebx]
        call dword [eax+Release]

        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'
    


Last edited by Hicel on 21 Feb 2008, 15:24; edited 4 times in total
Post 21 Feb 2008, 00:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17473
Location: In your JS exploiting you and your system
revolution
Afterr the call to CoCreateInstance you need to check for errors.

I get a REGDB_E_CLASSNOTREG error returned. So from there any action will cause your app to fail.
Post 21 Feb 2008, 00:23
View user's profile Send private message Visit poster's website Reply with quote
Hicel



Joined: 09 Sep 2004
Posts: 55
Hicel
Thanks. you are right. I updated the code to stop running if Createinstance fails. But why does it fail. The GUID is correct the interface is correct. Hmm COM seems not as easy as I thought.. I bet I must go a complete different way.. any help is welcome.. meanwhile I will try to figure it out Shocked
Post 21 Feb 2008, 00:44
View user's profile Send private message Reply with quote
Hicel



Joined: 09 Sep 2004
Posts: 55
Hicel
Hmm code updated again. I got it working to show the about box or you can use ShowColor method it works also of the common dialog but still ShowOpen method doesn't work Sad
Post 21 Feb 2008, 06:48
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 YouTube, Twitter.

Website powered by rwasa.