News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

AssocCreate Problem

Started by ToutEnMasm, November 18, 2006, 04:03:44 PM

Previous topic - Next topic

ToutEnMasm

Hello,
i try to use this function but don't find the correct number of parameters.

Quote
HRESULT AssocCreate(          CLSID clsid,
    REFIID riid,
    LPVOID *pqa
);
Parameters

clsid
[in] Class identifier (CLSID) of the object that exposes the interface. This parameter must be set to CLSID_QueryAssociations, which is defined in Shlguid.h.
riid
[in] REFIID of the interface. This parameter must be set to IID_IQueryAssociations, which is defined in Shlguid.h.
pqa
[out] Pointer to the interface

There is two GUID and one adress as arguments.The GUID seems to be pass by value (4 DWORD for each) .The prototype have only 6 DWORD instead of 9.

What is wrong ?
                                   ToutEnMasm


AssocCreate PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD

Quote
sCLSID_QueryAssociations   TEXTEQU   <{0a07034fdh,06caah,04954h,{0ach,03fh,097h,0a2h,072h,016h,0f9h,08ah}}>
.data
CLSID_QueryAssociations GUID sCLSID_QueryAssociations
IID_IQueryAssociations GUID <0C46CA590H,03C3FH,011D2H,<0BEH,0E6H,0H,0H,0F8H,05H,0CAH,057H>>


stanhebben

I don't know how to solve it, but you could make a short c++ program, compile it, and let the compiler generate a listing.

Tedd

WINSHLWAPI HRESULT WINAPI AssocCreate(CLSID,const IID* const,LPVOID*);

CLSID = 4 DWORDs
IID pointer = 1 DWORD
DWORD pointer = 1 DWORD

Total = 6 DWORDs :wink
No snowflake in an avalanche feels responsible.

ToutEnMasm

Thanks,
I can add than CLSID is passed by value and how to pass it on the stack.
                                              ToutEnMasm
Quote
lea edx,CLSID
invoke AssocCreate,[edx],[edx+4],[edx+8],[edx+12],addr IID,addr VOID

akane

ToutEnMasm, you pushed it correctly, here's a small nasm sample
$use "uuid.lib"
extern _CLSID_QueryAssociations
extern _IID_IQueryAssociations
$str_ok:    db "ok",0
$str_failed db "failed",0

main:
push   esi
invoke CoInitialize,0
push   esi             ; IQueryAssociations*
mov    esi,$_CLSID_QueryAssociations
invoke AssocCreate,[esi],[esi+4],[esi+8],[esi+12],$_IID_IQueryAssociations,esp
pop    esi             ; IQueryAssociations*
mov    ecx,$str_ok
mov    edx,$str_failed ; message
and    eax,eax
pushf
cmovz  edx,ecx
invoke MessageBoxA,0,edx,"",0
popf
jnz  .quit
coinvoke esi,IUnknown_Release
.quit:
invoke CoUninitialize
pop    esi
invoke ExitProcess,0

ToutEnMasm

Hello,
I review this post and .....
Seems that this can be solve more easily.
Quote
AssocCreate PROTO :CLSID ,:DWORD,:DWORD
StructPassedByValue CLSID <>
.code
invoke AssocCreate,StructPassedByValue,addr chose,addr ppv

Not ?