|
![]() |
#1 |
Member
Join Date: Oct 2007
Posts: 64
|
Windows version detection reloaded
In generalization of the Windows 8.1 detection issues, I have examined the WinVer.nsh and StdUtils.GetRealOSVersion functions under various compatibility mode settings. Some results:
StdUtils.GetRealOSVersion aims to detect the "real" Windows version, regardless of any compatibility mode setting or any potentially missing OS support GUIDs in the application manifest. In my tests, the function mostly delivers on that promise, with the following exceptions:
|
![]() |
![]() |
![]() |
#2 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
|
Windows 8 does not list server versions!
You can try this: Quote:
IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#3 |
Member
Join Date: Oct 2007
Posts: 64
|
Win7-64 does. There are compatibility modes called "Windows Server 2003" and "Windows Server 2008". However, these modes make WinVer.nsh detect Windows XP and Vista instead of the server versions.
The second line - System::Call 'kernel32::GetVersionExW(pr0)i.r9' - seems to instantaneously quit the installer exe on my WinXP-32-SP3 host. The effect is fully reproducible, so I cannot try further. Am I doing something wrong or do I need a 64-bit host to try this approach? |
![]() |
![]() |
![]() |
#4 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
|
Quote:
IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#5 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
I noticed there is a "major" and "minor" service pack number:
code: Does anybody know whether the "minor" number has ever been actually used for something? My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI Last edited by LoRd_MuldeR; 16th March 2014 at 14:06. |
![]() |
![]() |
![]() |
#6 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Here is a new test version that has Service Pack detection enabled:
http://sourceforge.net/projects/muld...6.zip/download Only the "major" service pack version is returned currently, but I think that is sufficient. My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#7 | |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Quote:
My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
![]() |
![]() |
![]() |
#8 | |
Member
Join Date: Oct 2007
Posts: 64
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#9 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Here is a test version with "Win9x compat mode" workaround:
http://sourceforge.net/projects/muld...4.zip/download My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#10 | |
Member
Join Date: Oct 2007
Posts: 64
|
Quote:
Would be great if you'd find a way to also verify the "real" service pack numbers and build numbers. |
|
![]() |
![]() |
![]() |
#11 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
|
I don't think the service pack minor has ever been used so that is probably safe...
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#12 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
I probably could add the build number too. But what do you need the build number for?
To my understanding, each Windows NT version (and for some NT version also each Service Pack) has a corresponding build number. So the build number doesn't rally give you any additional benefit over knowing the NT version plus the Service Pack version, right? Also, using the VerifyVersionInfo "trick" will probably be much more inefficient with such large values, as used for the build numbers... My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#13 | |
Member
Join Date: Oct 2007
Posts: 64
|
Quote:
Probably true, at least for GetRealOSVersion. But I was more thinking of adding the build number to VerifyOSVersion, which should hopefully be more straightforward. |
|
![]() |
![]() |
![]() |
#14 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
|
Win95 and NT 4 are both 4.0 but then you can check for NT vs 9x, the only place it matters is for 98 vs 98 SE. Starting with Vista the service pack is part of the build number as well...
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#15 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
GetRealOSVersion() will fail, if a pre-NT system is detected, because it's technically impossible to run StdUtils.dll on systems prior to Windows NT. That's because some of the API's it uses, like VerifyVersionInfo(), were not even available on Win 9x.
Consequently I think the build number doesn't give any additional info over the Windows NT version plus the Service Pack number. (I can still add detection of the build number, for purely informational purpose) My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#16 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Okay, I have implemented a halfway efficient way to detect the real Windows build number.
New test version here: http://sourceforge.net/projects/muld...9.zip/download My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#17 |
Member
Join Date: Oct 2007
Posts: 64
|
|
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|