NsVersionInfo plugin
Author: Seki (talk, contrib) |
Links
nsVersionInfo plugin setup from my Powerbuilder components page
Presentation
nsVersionInfo is a plugin that can manipulate the VersionInfo resource inside the Windows PE executables (.exe and .dll files), that is, the informations that are displayed when you right-click in explore and look at the "Version" tab. It can get and set information and has the special feature to be able to modify Powerbuilder executables without corrupting them (PB exes contain PB bytecode in an overlay at the end of the exe that is destroyed when using regular Windows resource API to modify the VersionInfo).
You can typically use it to:
- get the version of a file to check during installation
- change the version (or any other value from the VersionInfo) of an application while distributing a patch that only contains upgrade scripts (and you need to upgrade the exe version number for consistency)
Usage
Theses are examples from the sample in the installed files :
var $testexe strcpy $testexe "$WINDIR\notepad.exe" nsVersionInfo::getFixedProductVersion $testexe pop $0 DetailPrint "nsVersionInfo::getFixedProductVersion = $0" nsVersionInfo::getFixedFileVersion $testexe pop $0 DetailPrint "nsVersionInfo::getFixedFileVersion = $0" ;WARNING : do that test with caution !!! ;nsVersionInfo::setFixedFileVersion $testexe 10 20 30 40 ;pop $0 ;DetailPrint "nsVersionInfo::setFixedFileVersion = $0" ;WARNING : do that test with caution !!! ;nsVersionInfo::setFixedProductVersion $testexe 11 22 33 44 ;pop $0 ;DetailPrint "nsVersionInfo::setFixedProductVersion = $0" nsVersionInfo::getStringFileInfo $testexe "FileDescription" pop $0 DetailPrint "nsVersionInfo::getStringFileInfo (FileDescription) = $0" nsVersionInfo::getStringFileInfo $testexe "ProductName" pop $0 DetailPrint "nsVersionInfo::getStringFileInfo (ProductName) = $0" nsVersionInfo::getStringFileInfo $testexe "LegalCopyright" pop $0 DetailPrint "nsVersionInfo::getStringFileInfo (LegalCopyright) = $0" nsVersionInfo::getStringFileInfo $testexe "NonStandardString" pop $0 DetailPrint "nsVersionInfo::getStringFileInfo (NonStandardString) = $0" nsVersionInfo::getLibVersion pop $0 DetailPrint "nsVersionInfo::getLibVersion = $0" ;WARNING : do that test with caution !!! ;nsVersionInfo::setStringFileInfo $testexe "NonStandardStringUnTrucPasVu" "Une valeur a la con" ;pop $0 ;DetailPrint "nsVersionInfo::setStringFileInfo (NonStandardStringUnTrucPasVu) = $0" ;nsVersionInfo::setStringFileInfo $testexe "FileVersion" "42.12" ;pop $0 ;DetailPrint "nsVersionInfo::setStringFileInfo (NonStandardStringUnTrucPasVu) = $0"
Notes
- the plugin dll is built with MinGW.
Download
Exe setup contains the plug-in DLLs as well as documentation, source code and sample script.
libVerInfo the lib I used to make the plugin, it is not needed to rebuild it to build the plugin (a binary .a is already provided in the plugin sources).
Thanks
Fabien POTENCIER (aka User:fabpot) for his Perl_plugin that I reused as a basis for nsVersionInfo.