Archive: install only on nt/2000/xp?


install only on nt/2000/xp?
Is there a way to create an installer that refuses to install unless the OS is NT-based?


As far as I know is the registry key 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT' only available on NT-based OSes. Try to read this key and if the error flag is set you are on a non NT-based OS.

~ Florian


Originally posted by F. Heidenreich
As far as I know is the registry key 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT' only available on NT-based OSes. Try to read this key and if the error flag is set you are on a non NT-based OS.
Not a good idea. Another program could create that key. You've to look for the "CurrentVersion" value.
Look into functions.htm in your NSIS folder, there's an example how to detect the windows version properly.
Check for the OS in the onInit callback function.

look at the functions.htm file in your NSIS dir. there is a function to figure out what type of OS you have installed. But also i have a Custom version of NSIS 1.9 that does add this at runtime instead of using this function.. it sets a variable $WINOS with either WIN9x or WINNT i can send you the files that i changed so you can compile NSIS with it yourself..


Iim using below code...


IfFileExists $SYSDIR\ntoskrnl.exe WinNT
Goto Win9X

My code:

# Check windows version
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 isnt
MessageBox MB_OK|MB_ICONEXCLAMATION "This version is for Windows NT4/2000/XP only"
Abort
isnt: