|
|
|
|
#1 |
|
Senior Member
Join Date: Jul 2003
Posts: 152
|
Before installation of My NSIS program is it possible to check the version of an exisiting exe to see if its the correct version?
I don't really mean by checking it through the Reg though, as this does not show the correct version info. The original game is version 1.0.0.0, there are two updates for this game which will change the version to 2.0.0.1 or 2.0.0.2 I only want my NSIS program to install if the version is 2.0.0.2 otherwize you will get a message saying that you will need to update the game before you can install my NSIS program then quit If it is the correct version it will install normally At the momment My NSIS program checks the reg to see if the game is the correct version then installs using this bit of script PHP Code:
See in the Reg the "version" is either 1 for the original or 2 if either update has been added. Which makes checking the reg pointless Like I said the only real way to check this would be from the Games EXE as this shows the true version. Any help would be greatly appriciated plus showing me how the script should look Thanks in advance -Tony |
|
|
|
|
|
#2 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
So you need to check the version information resource? It could be possible using the System plug-in or you can write your own plug-in.
Is there no registry key / configuration file available with the version number? |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jul 2003
Posts: 152
|
Yes it shows the version number
HKLM "SOFTWARE\Game software\v1.0" "Version" 1.0 but if the game updates are applied it only shows to 2.0 so even if the 2.01 patch is install my program will still install, which I don't want it to do Thats why I would like to check the exe which shows the exact version. As I'm new to all this I have no way of knowing how to write a plug-in or which commands to use if any sorry, just a thick noobie |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
NSIS plugins are usually written in C++/Delphi.
If you do not know about creating you're own plugin, then the System plugin will do your job. You should also try using the SysInfo plugin (get on NSIS Archive) which can get the version of specified files. -Stu |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2003
Posts: 152
|
I don't know how to use it though
This is the reason, I'm asking for help Its not too much to ask |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
http://nsis.sourceforge.net/archive/...ysinfo.dll.zip
Extract just the dll to your Plugins dir. Now, in your script use: sysinfo::GetFileVersion "x:\path\to\exe" Pop $0 ;file version If $0 is empty ("") then try: sysinfo::GetFileVersionValue "FileVersion" "x:\path\to\exe" Pop $0 ;file version -Stu |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Jul 2003
Posts: 152
|
Thanks for pointing me in the right direction Afrow UK
![]() I figured out how to use the script you provided but the next bit was a liitle harder PHP Code:
Tried god knows how many differrent combinations of IntCmp, IntCmpU, StrCpy plus a few others, I was about to give up on it, when I came upon the combination above which works. So once again thanks
|
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Just a thought, what happens if 2.0.0.3 comes out.
You're installer will think that the user has an older version. You should remove the dot (.) from the version, and use IntCmp instead. To remove the dots, use the StrReplace function: code: IntCmp works like this: IntCmp $0 2002 [goto if $0=2002] [goto if $0<2002] [goto if $0>2002] -Stu |
|
|
|
|
|
#9 |
|
Major Dude
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
|
How about using the code Smile2Me created ages ago to compare dotted versions?
http://nsis.sourceforge.net/archive/....php?pageid=57 |
|
|
|
|
|
#10 |
|
Junior Member
Join Date: May 2003
Location: Charleston, SC
Posts: 11
|
If the executable has an actual 'version' resource in it (and it's maintained correctly), Couldn't you use GetDLLVersion?
|
|
|
|
|
|
#11 |
|
NSIS Dev
Join Date: Apr 2003
Location: Portugal
Posts: 110
|
Yes, you can use GetDLLVersion, for example you can use the previous uninstall.exe version info, by detecting the file location through the registry and than decide if the update can run or not.
good luck |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: May 2003
Location: Charleston, SC
Posts: 11
|
Why not just compare the version of the file you are going to install verses the file that is installed? Just like upgrading a DLL.
|
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Jul 2003
Posts: 152
|
No chance of a update to 2.0.0.3 unless a miricale happens
It's a oldish game The code know looks like this code: With the StrReplace script underneath it Hope this is what you meant, it works anyhow thanks again ![]() Thanks again Afrow Sunjammer I looked at the code you suggested, thanks, but Afrow's code is fine. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|