Archive: ITypeLib->GetLibAttr & TLIBATTR structure


ITypeLib->GetLibAttr & TLIBATTR structure
  In addition to yesterdays tread about 'Playing with COM', I am hoping to get some help.

I'm trying to get the TLIBATTR structure by loading a dll. I'm able to get the GUID but non of the other members.
There must be something wrong with the way I allocate the TLIBATTR structure ?


"!insertmacro _COM_CallMethod "

>!macro _COM_CallMethod _vto _ParamsDecl _IFacePtr _Params
System
::Call `${_IFacePtr}->${_vto}${_ParamsDecl} ${_Params}`
!macroend

>!define ITypeLib->GetLibAttr "${COM_CallMethod}7 (i)i. "
>!define ITypeLib->ReleaseTLibAttr "${COM_CallMethod}12 ()i. "

>Section
StrCpy$0 msxml.dll
System::Call Oleaut32::LoadTypeLib(wr0,*i.r1)

System::call *(g,i,i,i,i,i)i.R0 ; TLIBATTR structure
${ITypeLib->GetLibAttr} $1 (R0)

System::Call *$R0(g.R1,i.R2,i.R3,i.R4,i.R5,i.R6)
${ITypeLib->ReleaseTLibAttr} $1 ()
System::free $R0

DetailPrint 'TLIBATTR structure'
DetailPrint GUID=$R1
DetailPrint CLID=$R2
DetailPrint SYSKIND=$R3
DetailPrint MajorVerNum=$R4
DetailPrint MinorVerNum=$R5
DetailPrint LibFlags=$R6
SectionEnd
>
Or use the attached file for a complete test script.

The TLIBATTR struct is probably more like *(&g16,i,i,&i2,&i2,&i2), but that is only half your problem. GetLibAttr will allocate the struct for you...


nsh


>!define IUnknown->Release "${COM_CallMethod}2 ()i. "
>!define ITypeLib->GetLibAttr "${COM_CallMethod}7 (*i)i. "
>!define ITypeLib->ReleaseTLibAttr "${COM_CallMethod}12 (i)i. "

>Section
System
::Call 'Oleaut32::LoadTypeLib(w "msxml.dll",*i.r1)i.r0'
${If} $0 = 0
${ITypeLib->GetLibAttr} $1 '(.R0).r0'
${If} $0 = 0
System::Call '*$R0(&g16.R1,i.R2,i.R3,&i2.R4,&i2.R5,&i2.R6)'
${ITypeLib->ReleaseTLibAttr} $1 (R0)

DetailPrint 'TLIBATTR structure'
DetailPrint GUID=$R1
DetailPrint CLID=$R2
DetailPrint SYSKIND=$R3
DetailPrint MajorVerNum=$R4
DetailPrint MinorVerNum=$R5
DetailPrint LibFlags=$R6
${EndIf}
${IUnknown->Release} $1 ()
${EndIf}
>SectionEnd
>
Edit: The fact that you need &g16 and not just g in a struct is probably a system plugin bug

Thanx for that, it works great now !
it must have been the &g16 thing what was bugging me :(