Old 20th August 2010, 22:09   #1
gringoloco023
Member
 
Join Date: Nov 2009
Posts: 52
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 ?

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.
Attached Files
File Type: nsi GetTLIBATTRstructure.nsi (1.8 KB, 173 views)
gringoloco023 is offline   Reply With Quote
Old 20th August 2010, 23:32   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st August 2010, 05:07   #3
gringoloco023
Member
 
Join Date: Nov 2009
Posts: 52
Thanx for that, it works great now !
it must have been the &g16 thing what was bugging me
gringoloco023 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump