cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
us-vpn
Level 3

InstallScript Question

Hi,
I have an old VB6 Install Script project and I want to allow setup to run only on the following operating systems:

Windows XP, Windows Server 2003
Windows Vista, Windows Server 2008
Windows 7, Windows Server 2008 R2
Windows 8, Windows Server 2012
Windows 8.1, Windows Server 2012 R2

Since the newer Windows versions are not listed there, I have wrote a code, is this correct?

-------------
Before Move Data > On Begin
-------------

BOOL osAccept;

osAccept = FALSE;

if (SYSINFO.nOSMajor = 5) then
if (SYSINFO.nOSMinor = 1) || (SYSINFO.nOSMinor = 2) then
osAccept = TRUE;
endif;
endif;

if (SYSINFO.nOSMajor = 6) then
if (SYSINFO.nOSMinor = 0) || (SYSINFO.nOSMinor = 1) || (SYSINFO.nOSMinor = 2) || (SYSINFO.nOSMinor = 3) then
osAccept = TRUE;
endif;
endif;

if osAccept = FALSE then
MessageBox("Application is not compatible with the current operating system.", SEVERE);
abort;
endif;
Labels (1)
0 Kudos
(3) Replies
phill_mn
Level 7

There are many different ways to approach this issue. In my case I have rather specific tests for certain service pack levels and certain editions of the OS which I test on OnBegin. However in your case it appears that all you really need to test is that the OS is not pre-Windows XP, since you are accepting every variation of operating systems since XP. So why not simplify your test to:

BOOL osAccept;

osAccept = TRUE;

/*accept any version of OS 5.1 or later, reject Win 2K or earlier*/
if ((SYSINFO.nOSMajor = 5) && (SYSINFO.nOSMinor < 1) || (SYSINFO.nOSMajor < 5)) then
osAccept = FALSE;
endif;


if osAccept = FALSE then
MessageBox("Application is not compatible with the current operating system.", SEVERE);
abort;
endif;

I did not look at Win 8.1 yet to see how the version information is defined in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion.

Generally I would not create a test for a specific version of a future OS, rather I would use < or > than to allow my setup to run on all future versions until I know of a problem that needs to be addressed. In an InstallScript project you can indicate which versions of the OS are not supported under Project Setting Platform tab.
0 Kudos
us-vpn
Level 3

Thanks dude,
So it means if I just wanna install on said operating systems and prevent future ones my code is also correct?
0 Kudos
phill_mn
Level 7

I do not know what the version values at the registry key indicated are set to for Windows 8.1 or Windows Server 2012 R2, or if 6.3 has been confirmed to be the correct value. Other than that the code will have the effect that you indicated to block any version not specifically listed in the code.
0 Kudos