Jump to content

$oTypelib=objcreateinterface($tp, $IID_TYPELIB, $tagITypeLib)


junkew
 Share

Recommended Posts

Wondering if by using the new beta AutoIt if by using

$oTypelib=objcreateinterface($tp, $IID_TYPELIB, $tagITypeLib)

you can analyse the typelib of a file

I tried below but (again) missing the point

;~ IID´s
$IID_TYPEINFO="{00020401-0000-0000-C000-000000000046}"
$IID_TYPELIB="{00020402-0000-0000-C000-000000000046}"

;~ Methods of interface ITypelib
$tagITypeLib = "GetTypeInfoCount long();" & _
"GetTypeInfo long(uint;ptr);" & _
"GetTypeInfoType long(uint;ptr);" & _
"GetTypeInfoOfGuid long(ptr;ptr);" & _
"GetLibAttr long(ptr);" & _
"GetTypeComp long(ptr);" & _
"GetDocumentation long(int;ptr;ptr;ptr;ptr);" & _
"IsName long(ptr;ulong;ptr);" & _
"FindName long(ptr;ulong;ptr;ptr;ptr);" & _
"ReleaseTLibAttr long(ptr);"

;~ The file where the type library has to be analysed
$szFile="C:\Windows\System32\UIAutomationCore.dll"
;~ $szFile = FileOpenDialog("Open Type Library", "", "TypeLib Files (*.tlb;*.olb;*.dll;*.ocx;*.exe)|All Files (*.*)", 1)

Local $oleAutDll = DllOpen("oleaut32.dll")

;~ Just load the typelibrary
;~ try 1
$tp = DllStructCreate("ptr")
$result=DllCall($oleAutDll, "ulong", "LoadTypeLib", "wstr", $szFile, "ptr", DllStructGetPtr($tp, 1))

;~ try 2
;~ $tp = ""
;~ $result=DllCall($oleAutDll, "ulong", "LoadTypeLib", "wstr", $szFile, "ptr", $tp)

consolewrite("LoadTypeLib result: "& $result & " error: " & @Error & @crlf)

;~ Try to get the object interface
$oTypelib=objcreateinterface($tp, $IID_TYPELIB, $tagITypeLib)

if isobj($oTypelib) Then
consolewrite("We have the typelib object")
EndIf

I know there are alternatives for analysing typelib but just wondering if this could work with objcreateinterface

Link to comment
Share on other sites

Did get it to work with objcreateinterface

;~ IID´s
$IID_TYPEINFO="{00020401-0000-0000-C000-000000000046}"
$IID_TYPELIB="{00020402-0000-0000-C000-000000000046}"

Global $tp

;~ Methods of interface ITypelib
$tagITypeLib = "GetTypeInfoCount long();" & _
    "GetTypeInfo long(uint;ptr);" & _
    "GetTypeInfoType long(uint;ptr);" & _
    "GetTypeInfoOfGuid long(ptr;ptr);" & _
    "GetLibAttr long(ptr);" & _
    "GetTypeComp long(ptr);" & _
    "GetDocumentation long(int;ptr;ptr;ptr;ptr);" & _
    "IsName long(ptr;ulong;ptr);" & _
    "FindName long(ptr;ulong;ptr;ptr;ptr);" & _
    "ReleaseTLibAttr long(ptr);"

;~ The file where the type library has to be analysed
;~ $szFile="C:\Windows\System32\UIAutomationCore.dll"
$szFile = FileOpenDialog("Open Type Library", "", "TypeLib Files (*.tlb;*.olb;*.dll;*.ocx;*.exe)|All Files (*.*)", 1)
;~ Local $result = DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)

Global Const $oleAutDll = DllOpen("oleaut32.dll")

;~ Just load the typelibrary
;~ try 1
$tp = DllStructCreate("ptr")
$result=DllCall($oleAutDll, "ulong", "LoadTypeLib", "wstr", $szFile, "ptr", DllStructGetPtr($tp, 1))
$tp =DllStructGetData($tp, 1)

consolewrite("LoadTypeLib result: "& $result & " error: " & @Error & @crlf)

;~ Try to get the object interface
$oTypelib=objcreateinterface($tp, $IID_TYPELIB, $tagITypeLib)

if isobj($oTypelib) Then
consolewrite("We have the typelib object" & @crlf)
consolewrite("Count: " & $oTypelib.GetTypeInfoCount & @crlf)
EndIf
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...