Jump to content

Recommended Posts

Posted

FileGetVersion() gets $FV_FILEVERSION ("FileVersion") and $FV_PRODUCTVERSION ("ProductVersion") from 2nd place. How i can get those versions from 1st place ? (see dll *rc file)

 

VS_VERSION_INFO VERSIONINFO
    FILEVERSION    1,2,3,4 <--------------(1)
    PRODUCTVERSION 1,2,3,4 <--------------(1)
{
    BLOCK "StringFileInfo"
    {
        BLOCK "040904b0"
        {
            VALUE "CompanyName",        "My Inc.\0"
            VALUE "FileDescription",    "MyProg\0"
            VALUE "FileVersion",        "1.0.0.0\0"                                   <--------------(2)
            VALUE "LegalCopyright",     "© 2013 My Inc. All Rights Reserved\0"
            VALUE "OriginalFilename",   "MyProg.exe\0"
            VALUE "ProductName",        "My Program\0"
            VALUE "ProductVersion",     "1.0.0.0\0"                                   <--------------(2)
        }
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x409, 1200
    }
}

 

Posted (edited)

Try to use '_WinAPI_VerQueryRoot()'

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Posted (edited)

This should work.

#include <WinAPIRes.au3>
#include <WinAPISys.au3>

Local $pData = 0

_WinAPI_GetFileVersionInfo(@AutoItExe, $pData)
Local $tFixedFileInfo = _WinAPI_VerQueryRoot($pData)
_WinAPI_FreeMemory($pData)

Local $FileVersionMS = DllStructGetData($tFixedFileInfo, "FileVersionMS")
Local $FileVersionLS = DllStructGetData($tFixedFileInfo, "FileVersionLS")

Local $ProductVersionMS = DllStructGetData($tFixedFileInfo, "ProductVersionMS")
Local $ProductVersionLS = DllStructGetData($tFixedFileInfo, "ProductVersionLS")


Local $FV_Major = _WinAPI_HiWord($FileVersionMS)
Local $FV_Minor = _WinAPI_LoWord($FileVersionMS)
Local $FV_Build = _WinAPI_HiWord($FileVersionLS)
Local $FV_Revision = _WinAPI_LoWord($FileVersionLS)

Local $PV_Major = _WinAPI_HiWord($ProductVersionMS)
Local $PV_Minor = _WinAPI_LoWord($ProductVersionMS)
Local $PV_Build = _WinAPI_HiWord($ProductVersionLS)
Local $PV_Revision = _WinAPI_LoWord($ProductVersionLS)

ConsoleWrite("FileVersion:" & @TAB & $FV_Major & "." & $FV_Minor & "." & $FV_Build & "." & $FV_Revision & @CRLF)
ConsoleWrite("ProductVersion:" & @TAB & $PV_Major & "." & $PV_Minor & "." & $PV_Build & "." & $PV_Revision & @CRLF)

 

Edit: Forgot to free memory

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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
  • Recently Browsing   0 members

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