Hi

I try to make a project with Tasm

I have an error with the api CoCreateInstance

;--------------------------------------------------------------
const
;unicode MSMask.MaskEdBox
szMaskProgID_W dw "M","S","M","a","s","k",".","M","a","s","k","E","d","B","o","x",0
udataseg
    GetPtrApp dd ?
dataseg
    ClsidApp GUID <0>
codeseg
    call CLSIDFromProgID, offset szMaskProgID_W, offset ClsidApp
    test eax,eax            ;OK
    jnz  @@Error

    call CoCreateInstance, offset ClsidApp , 0, CLSCTX_ALL , offset sIID_IMSMask,
    test eax,eax
    jnz  @@Error
;--------------------------------------------------------------
and the GUID is define like this in my inc file.

sIID_IMSMask GUID <04D6CC9A0h,0DF77h,011CFh>,<08Eh>,<074h>,<000h>,<0A0h>,<0C9h>,<00Fh>,<026h>,<0F8h>

Does anyone know where my mistake is?

Thank's for your help.
Posted on 2009-01-22 16:31:14 by vulpes87
Hi.. this api is meant to return a pointer to a COM interface.
You must hand it the address where to store the pointer it returns.... your code is handing it the current value of your pointer variable , rather than the address of your pointer variable.

Instead of , use "offset GetAppPtr".


Posted on 2009-01-22 20:02:54 by Homer
Hi

Thank for reply.

I try change "" for "offset GetPtrApp" and i still have the same problem.  :-(

I think the problem is from the 4th parameter,I notice one thing when i debug my project.

5 - push offset ppv  ;ppv
4 - push offset riid  ;riid
3 - push 7            ;dwClsContex
2 - push 0            ;pUnkOuter
1 - push offset clsid ; rclsid
    call CoCreateInstance

The riid give the result who look imcomplet:

riid IID <4D6CC9A0h,0DF77h,011CFh,0>

My GUID structure is

struc GUID
    Data1                      dd ?
    Data2                      dw ?
    Data3                      dw ?
    Data4                      db 8 dup(?)
ends

And my GUID is:
sIID_IMSMask GUID <04D6CC9A0h,0DF77h,011CFh>,<08Eh>,<074h>,<000h>,<0A0h>,<0C9h>,<00Fh>,<026h>,<0F8h>


Maybe is something this structure doesn't like ;-) ? But i don't have any error message when i compile.
I try different ways and so far is does't work.

sIID_IMSMask GUID <04D6CC9A0h,0DF77h,011CFh>,<08Eh,074h,000h,0A0h,0C9h,00Fh,026h,0F8h>>
sIID_IMSMask GUID <{04D6CC9A0h,0DF77h,011CFh,{08Eh,074h,000h,0A0h,0C9h,00Fh,026h,0F8h}}>
...

Does somebody as a sudjestion ?

Thank's for your help.
Posted on 2009-01-22 21:59:55 by vulpes87
Your GUID definition is incorrect.
Do it like this:
ConnectExGuid GUID <25a207b9h,0ddf3h,4660h,{8eh,0e9h,76h,0e5h,8ch,74h,06h,3eh}>

Hint: some time in the very near future, you should take a look at ObjAsm32 - its an extension for MASM that makes writing COM / OOP / C++ compatible code in asm very easy... other people have already rammed their skulls into these kinds of problems ;)

Posted on 2009-01-23 02:16:52 by Homer
The way I do it in TASM is
...
align 4

CLSID_FilterGraph GUID <0E436EBB3h, 0524Fh, 011CEh, 09Fh, 053h, 000h, 020h, 0AFh, 00Bh, 0A7h, 070h>
IID_IGraphBuilder GUID <056A868A9h, 00AD4h, 011CEh, 0B0h, 03Ah, 000h, 020h, 0AFh, 00Bh, 0A7h, 070h>
IID_IMediaControl GUID <056A868B1h, 00AD4h, 011CEh, 0B0h, 03Ah, 000h, 020h, 0AFh, 00Bh, 0A7h, 070h>
IID_IMediaEventEx GUID <056A868C0h, 00AD4h, 011CEh, 0B0h, 03Ah, 000h, 020h, 0AFh, 00Bh, 0A7h, 070h>
IID_IMediaSeeking GUID <036B73880h, 0C2C8h, 011CFh, 08Bh, 046h, 000h, 080h, 05Fh, 06Ch, 0EFh, 060h>
IID_IVideoWindow  GUID <056A868B4h, 00AD4h, 011CEh, 0B0h, 03Ah, 000h, 020h, 0AFh, 00Bh, 0A7h, 070h>
...
Posted on 2009-01-23 07:38:41 by ti_mo_n