Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   ITypeLib->GetLibAttr & TLIBATTR structure (http://forums.winamp.com/showthread.php?t=321838)

gringoloco023 20th August 2010 22:09

ITypeLib->GetLibAttr & TLIBATTR structure
 
1 Attachment(s)
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 ?

PHP Code:

!define COM_CallMethod "!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} $(R0)

    
System::Call *$R0(g.R1,i.R2,i.R3,i.R4,i.R5,i.R6)
    ${
ITypeLib->ReleaseTLibAttr} $()
    
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.

Anders 20th August 2010 23:32

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...

PHP Code:

!include LogicLib.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
        
${ITypeLib->GetLibAttr} $'(.R0).r0'
        
${If} $0
            System
::Call '*$R0(&g16.R1,i.R2,i.R3,&i2.R4,&i2.R5,&i2.R6)'
            
${ITypeLib->ReleaseTLibAttr} $(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} $()
    ${EndIf}
SectionEnd 

Edit: The fact that you need &g16 and not just g in a struct is probably a system plugin bug

gringoloco023 21st August 2010 05:07

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


All times are GMT. The time now is 18:03.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.