Archive: OS and IE Version checking


I've customized NSIS (based on the 1.1z codebase) to forbid installations that don't have at least certain versions of the OS and/or IE browser.

What is the procedure for submitting it for inclusion into the NSIS mainline?

I've bracketed all the new code with NSIS_SUPPORT_VERSION_CHECKING #ifdef blocks so that it doesn't increase the header size for folks who don't want or need this functionality.

I'd also appreciate comments/suggestions to make it better.

Should I send a copy to this list as an attachment? Or should I make it available via a URL?

Preferences?

thanks,
mike rizzi
Contract Software Engineer for
Kenamea, Inc.

For interested parties, here are example NSI file entries with documentation comments (unfortunately, the tab/spaces get scrunched in the forum display format). Note that Windows has two different product lines (9x and NT) with overlapping version numbers, hence the need for separate commands for each.

;VersionCheckWin9xBased major_version [minor_version]
; example values
; OS major_version minor_version
; -- ------------- -------------
; win95 4 0
; win98 4 10
; winME 4 90
VersionCheckWin9xBased 4 10

;VersionCheckWinNTBased major_version [minor_version] [service_pack_level]
; example values
; OS major_version minor_version
; -- ------------- -------------
; winNT 4 or less
; win2000 5 0
; winXP 5 1
VersionCheckWinNTBased 4 0 4

;IEVersionCheck major_version_allowed [minor_version_allowed]
; NOTE:
; Unfortunately, the major version numbers aren't in sync with
; the common names for Internet Explorer before version 5
; for example
; IEVersionCheck 4 70 ;(for Internet Explorer 3.x)
; IEVersionCheck 4 71 ;(for Internet Explorer 4.0)
; IEVersionCheck 4 72 ;(for Internet Explorer 4.01)
; IEVersionCheck 5 0 ;(for Internet Explorer 5.0)
; IEVersionCheck 5 5 ;(for Internet Explorer 5.5)
IEVersionCheck 4 71


Source Code Now Available
I've finally put the source code for the OS and IE browser checking up for y'all to get, use, and/or comment on.
It can be found at

http://www.browbeat.com/kenamea/KenameaNSISSource.zip

I've tried to mimic Justins coding style as much as possible, though it probably could be tightened up a bit to reduce the header size.

Any comments appreciated. Thanks.
Mike Rizzi

p.s. here is the text of the ReadMe file I included

Kenamea Read Me
---------------
18 April 2001
Mike Rizzi

This modified version of NSIS was created to allow
for OS and IE Browser version checking at the beginning
of the installation process.

The modifications are based on version 1.1z of NSIS.

Kenamea modified portions of the code are commented or
bracketed thusly
x = 1; // KENAMEA_ADDED_CODE
or
// BEGIN_KENAMEA_ADDED_CODE
if ( x == 1 )
do_something();
// END_KENAMEA_ADDED_CODE

The files we modified are:
makenssi.cpp
makenssi.dsp
tokens.h
exehead\Main.c
exehead\config.h
exehead\exehead.dsp
exehead\fileform.h

Also, we've added two source files versioncheck.c and
versioncheck.h

The file OS_IE_VersionSample.nsi contains documentation
on the new commands that were added. It isn't a complete
NSI file, it is an excerpt sample.


OS/IE version check merged into released NSIS?
Any idea when/if these changes for checking the OS and IE versions will be merged into the latest NSIS?


Maybe this provides an answer to the question of glenncarr.

-Hendri.


:( bummer... guess I'll have to maintain my own version for a while.


Why would you want to add this to NSIS when you got a Extension DLL that will do this for you..
http://forums.winamp.com/showthread.php?threadid=70361


Sorry, didn't see that.

Is there one for getting the IE version? That's what I really need more than the OS. If not, I guess I'll have to write one.


It could be added to my sysinfo dll (info here - although this page will be moving this weekend sometime to my main nsis archive)

Actually I'll add it to that anyway sometime soon just for completeness.


Sorry I keep moving stuff around on that server at the mo - the big reshuffle is this weekend - the file that page talks about is here

(I would've edited my post but of course I can't :igor:)


Cool. The GetDLLVersion function says it requires a full path to the DLL. Is that really true? Will it possibly try to find it in the PATH? If so, I can just use GetDLLVersion with shdocvw.dll.


If you are referring to GetDllVersion in my sysinfo DLL it will work on a path because it calls LoadLibrary on the DLL. *However* not all DLLs support the GetDllVersion mechanism. The DLL has to export a method called DllGetVersion - if it doesn't then this method will not return any version information.

In that case you have to fall back to one of the other means of querying the DLL for a version number, i.e. GetFileVersion.

I can't be sure if GetFileVersion will search the default paths or not, it's a bit hard to tell from the Win32 API docs. Basically they say that GetModuleHandle which it calls does not need a path, it doesn't say what happens if it doesn't have one.

I *believe* it will search the default path since that whole chunk of the Win32 API is connected with loading and using DLLs which involves obeying path information.

I'll have to update those docs when I move them across to the new database, thanks for spotting that.


Grr wish I could edit posts, first line should say "it will work *without* a path".


Just checked - shdocvw.dll *does* support the DllGetVersion mechanism... check the attached text file for full version info on that dll using my code.


:D Great! Thanks a ton.

Glenn


So, I've determined that I can do what I want with this:

GetDLLVersion "shdocvw.dll" $1 $4
IntOp $2 $1 & 0xffff0000
IntOp $2 $2 / 0x10000
IntOp $3 $1 & 0x0000ffff
IntOp $5 $4 & 0xffff0000
IntOp $5 $5 / 0x10000
IntOp $6 $4 & 0x0000ffff
DetailPrint 'IE Version: $2.$3.$5.$6'


Nice one, no point using a DLL if you don't need to. The DLL of mine was written for me for a specific use, it can provide access to version strings embedded in executables, the other functionality was related so in my installer instead of using two mechanisms I just used the one.