gugaliashashank
18th September 2008 14:42 UTC
Unable to read windows version for vista
Hi All,
I am reading the following registry entry
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
using the following command in Vista OS to chekc whether its Vista or not.
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
but $R0 always return 5.1, which means XP
I checked currentVersion in the registry its 6.0 only not 5.1
I have test this in Vista Ultimate as wwell as Vista Home
I am using NSIS 2.39
One more problem which i faced in Vista is even if i set SetShellVarContext current, the createshortcut are creating shortcuts for all user instead of current user.
Anders
18th September 2008 14:47 UTC
use RequestExectionLevel in your installer
gugaliashashank
19th September 2008 06:02 UTC
I used "RequestExecutionLevel admin" but still i am getting the version as 5.1
I agree that now i am not facing the second problem that is createshortcut
gugaliashashank
19th September 2008 06:23 UTC
Just to add that i also used
Winver.nsh
${if} ${IsWinXp}
${if} ${IsWinVista}
it returns true for Xp in Vista OS
gugaliashashank
19th September 2008 07:22 UTC
I tried using register.dll also , still it did not works
I tried to read
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName"
but instead of returing windows vista (TM) Home Basics
it returns Microsoft Windows XP
Anders
19th September 2008 13:35 UTC
check the properties of your .exe and make sure its not set to compatibility mode
pbingel
19th September 2008 20:23 UTC
Not sure if this will help or not.
nsExec::ExecToStack '"$SYSDIR\cmd.exe" /c systeminfo |find "OS Name:"'
Pop $0
Pop $1
MessageBox MB_OK "$1"
I don't have Vista so wasn't able to test it, but it works on XP. I used systeminfo to recover similar info with help from LoRd_MuldeR for the syntax. You will probally want to use StrCpy to truncate the string also note there is a carriage return on the end of the string.
Edit: If you want the OS version subsitute "OS Version:" in place of "OS Name:"