Jump to content
Sign in to follow this  

help with DllCall

Recommended Posts

i try use dllcall for call MsiGetFileVersion func from msi.dll.

but i dont get it.

this is me trying code:

$a = DllCall("msi.dll","long","MsiGetFileVersion","str","c:\anymsifile.msi",Binary(1024),Binary(4),0,0)

MsgBox(0,'', $a)

 this is a article in microsoft about this function


thanks for your help.

Share this post

Link to post
Share on other sites

i write this func for the get version of msi file:

Func get_msiversion($FilePath)
    If Not FileExists($FilePath) Then Return SetError(1, 0, 0)
    Dim $installer, $database, $view, $result
    $installer = ObjCreate("WindowsInstaller.Installer")
    $database = $installer.OpenDatabase ($FilePath, 0)
    if @error Then Return SetError(2, 0, 0)
    $view = $database.OpenView ("SELECT Value FROM Property WHERE Property='ProductVersion'")
    $result = $view.Fetch
    Return $result.StringData(1)

but I prefer use dllcall. sameone can help me to do this?

Edited by shai

Share this post

Link to post
Share on other sites

MsiGetFileVersion is a function that reads the version resource information from a PE file (.exe or .dll) the same way the Windows Installer does. It will not get you the version information out of an MSI. Use the MsiGetProduct... functions to get this information.

Share this post

Link to post
Share on other sites

you mean "return type"?


No.  Calling convention has to do with order of parameters passed to function calls.  If the calling program and called function don't use the same conventions the data passed in will be scrambled.  Also it can cause the program to crash.  For detailed explanation you should search.

Edit:  this should get you started.


Edited by MilesAhead

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...