Jump to content

help with DllCall


shai
 Share

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

http://msdn.microsoft.com/en-us/library/aa370122(v=vs.85).aspx

thanks for your help.

Link to comment
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'")
    $view.Execute
    $result = $view.Fetch
    Return $result.StringData(1)
EndFunc

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

Edited by shai
Link to comment
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.

Link to comment
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.

http://en.wikipedia.org/wiki/Calling_convention

Edited by MilesAhead
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...