Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th April 2009, 07:58   #1
kando234
Junior Member
 
Join Date: Jan 2009
Posts: 7
Check for Windows 7 / Seven

Hi,

is there any way to check if user is running Windows 7 ?

Thanks
and greets
kando
kando234 is offline   Reply With Quote
Old 24th April 2009, 08:06   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
WinVer.nsh will give you the version number, so check for >=6.1

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th April 2009, 08:46   #3
kando234
Junior Member
 
Join Date: Jan 2009
Posts: 7
How to do that with WinVer.nsh ?

It offers me only the following functions
and not getting the version number to compare it ?

code:

; AtLeastWin<version> checks if the installer is running on Windows version at least as specified.
; IsWin<version> checks if the installer is running on Windows version exactly as specified.
; AtMostWin<version> checks if the installer is running on Windows version at most as specified.
;
; <version> can be replaced with the following values:
;
; 95
; 98
; ME
;
; NT4
; 2000
; XP
; 2003
; Vista
; 2008

kando234 is offline   Reply With Quote
Old 24th April 2009, 15:33   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
It's slightly hidden away / not documented. Near the bottom of WinVer.nsh are the bits you'll want to peek at. Example:

code:

${WinVerGetMajor} $0
${WinVerGetMinor} $1
${WinVerGetBuild} $2
${WinVerGetServicePackLevel} $3
MessageBox MB_OK "$0.$1.$2 SP$3"

Animaether is offline   Reply With Quote
Old 10th May 2009, 13:59   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Windows 7 has settled on 6.1? If so, we should add it to WinVer.nsh.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 10th May 2009, 16:00   #6
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
The Release Candidate, Build 7100, is version 6.1, yes.

For confirmation.. download and install, or poke at a number of websites who have done so and peruse screenshots of the 'about screen'

There was some talk of that 6.1 not being the case if they ever got around to implementing minwin but.. yeah
Animaether is offline   Reply With Quote
Old 10th May 2009, 20:01   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
minwin was never a product, closest you get is server core

We don't know the build number until RTM, but using 6.1.0000 for now would probably work

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th May 2009, 20:16   #8
Pawel
Moderator
 
Pawel's Avatar
 
Join Date: Aug 2004
Location: Poland
Posts: 418
Send a message via ICQ to Pawel
Quote:
Originally posted by Animaether
The Release Candidate, Build 7100, is version 6.1, yes.

For confirmation.. download and install, or poke at a number of websites who have done so and peruse screenshots of the 'about screen'
Here is a screenshot. it is 6.1 for now.

-Pawel
Pawel is offline   Reply With Quote
Old 11th May 2009, 11:14   #9
th_mi
Junior Member
 
Join Date: Sep 2005
Location: Germany
Posts: 35
Quote:
Originally posted by PepeSoft
Here is a screenshot. it is 6.1 for now.
[Image]
-Pawel
And it will be 6.1 later in W7. See here:
http://msdn.microsoft.com/en-us/libr...33(VS.85).aspx
(MSDN documentation "OSVERSIONINFOEX Structure" of function "GetVersionEx")

Even if this piece of software is called "Windows Seven" the internal version number is "6.1"

This signature is currently on vacation!
th_mi is offline   Reply With Quote
Old 11th May 2009, 11:39   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
That MSDN page also says Windows 2008 R2 has the same version number. Need to work around that one like we worked around Vista and 2008. Anders, care to handle this?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th May 2009, 16:47   #11
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
for those that can't wait for the next release, get it from http://nsis.svn.sourceforge.net/view...ude/WinVer.nsh

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 11th May 2009, 17:19   #12
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Also, if anyone has Windows 7 and/or Windows Server 2008 R2, please add it to the WinVer test thread.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th May 2009, 13:18   #13
Pawel
Moderator
 
Pawel's Avatar
 
Join Date: Aug 2004
Location: Poland
Posts: 418
Send a message via ICQ to Pawel
Quote:
Originally posted by kichik
Also, if anyone has Windows 7 and/or Windows Server 2008 R2, please add it to the WinVer test thread.
Kichik,
I want to test it, but what tool should I use?
Should I use WinVer, from that thread? Is it updated to support win7?
-Pawel
Pawel is offline   Reply With Quote
Old 16th May 2009, 14:18   #14
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
The tool from the thread is version independent. The version attached there should work fine on Windows 7 as well.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th June 2009, 15:51   #15
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
I can't seem to get Windows 7 to even show up with I pop the variable. I am using the latest WinVer.nsh that includes Win7 routines.

Any help is greatly appreciated.

Please see my code.

code:

Function .onInit

GetVersion::WindowsName
Pop $R0

;${If} $R1 == "64"
; Goto no64
;${EndIf}
${If} $R0 == "XP"
Goto xp
${ElseIf} $R0 == "XP x64"
Goto go_away
${ElseIf} $R0 == "2000"
Goto go_away
${ElseIf} $R0 == "Server 2003"
Goto go_away
${Elseif} $R0 == "Server 2003 R2"
Goto go_away
${Elseif} $R0 == "Vista"
Goto vista
${Else}
Goto error
${EndIf}
; i suppose i do need to add a win7 block? will there be multiple SKUs like Vista?


xp:
GetVersion::WindowsType
Pop $R0
${If} $R0 == "Professional"
${OrIf} $R0 == "Tablet PC Edition"
Goto go_away
${Else}
Goto non_professional
${EndIf}

non_professional:
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows XP $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done

vista:
GetVersion::WindowsType
Pop $R1

${If} $R1 == "Home Basic Edition"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
${ElseIf} $R1 == "Home Premium Edition"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
${ElseIf} $R1 == "Starter Edition"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
${Else}
Goto go_away
${EndIf}

error:
; generic block for the rest of OS's... 95,98,Me,7, etc. ???
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done

done:
Quit


jweinraub is offline   Reply With Quote
Old 8th June 2009, 16:15   #16
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
You are using GetVersion plug-in and not WinVer.nsh. Use:
code:
!include WinVer.nsh

${If} ${IsWin7}
MessageBox MB_OK 7
${ElseIf} ${IsWin2000}
MessageBox MB_OK 2000
# etc... ${ElseIf}...
${EndIf}


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th June 2009, 17:46   #17
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
oops,
thanks! (i think i used winver at one point in my life but switched i guess, i think my old codebase has it).
jweinraub is offline   Reply With Quote
Old 9th June 2009, 13:46   #18
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
Okay.. I got a couple of more questions.

In GetVersion they have the ability to find home edition detection (probably why i used it to begin with), is WinVer.nsh going to detect the different SKUs of Home/Vista/7 (Home/Pro/Home Basic/Ultimate/...) Is there a way to detect that?

Also, I like to detect anything below Win 95 (Windows 1.0 - 3.11). is there a way to detect < 95? (I know GetVersion does for example)

Since I know GetVersion more, is my logic below correct? How do I get the version to display in the second message?

code:

Function .onInit

; Give warning about Windows 7

${If} ${IsWin7}
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The blah software has not been tested on, and is not supported on Windows 7.$\r$\n$\r$\nFoobar Industries cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you still want to continue with the installation?" \
IDYES go_away IDNO done
${ElseIf} ${AtLeastWin95}
${And} ${AtMostWinME}
MessageBox MB_OK|MB_ICONSTOP "Windows -version- is not supported by the blah software." IDOK ; Anything below 2000 throw error
Quit
; what about below 95 (Win 1 - 3.11)
${EndIf}


done:
Quit

go_away:
; ...



Thanks so much!
jweinraub is offline   Reply With Quote
Old 9th June 2009, 14:12   #19
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
lol, Win v1.

AFAIK, NSIS does not work on anything below v4

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th June 2009, 15:18   #20
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
I thought nsis did work with < 4.
I thought it can with 3.1 at least, though i never verified it. i thought i saw it in some forum.
jweinraub is offline   Reply With Quote
Old 9th June 2009, 15:32   #21
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
Win 3.1 is 16bit, you would have to install Win32s on there

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th June 2009, 19:20   #22
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
Okay but how do I determine the windows version using winver in the output?

code:

${ElseIf} ${AtLeastWin95}
${And} ${AtMostWinME}
MessageBox MB_OK|MB_ICONSTOP "Windows -version- is not supported by the blah software." IDOK ; Anything below 2000 throw error
Quit
${EndIf}



That is generic code, so do i need to make an if for each version?

I can't say : MessageBox MB_OK|MB_ICONSTOP "Windows ${WINVER} is .. " .. ?
jweinraub is offline   Reply With Quote
Old 26th June 2009, 13:54   #23
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
My above code doeswnt seem to work. I tried changing And to AndIf and made no difference other than it allowed me to compile it.

I am unable to execute the installer.
jweinraub is offline   Reply With Quote
Old 27th July 2009, 12:47   #24
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,167
Send a message via ICQ to Yathosho
it would be lovely, if WinVer could make a check if the user is running a 64-bit system (whether its xp, vista or win7 etc.). something like ${Is64bit}/${Is32bit} would be very helpful!
Yathosho is offline   Reply With Quote
Old 27th July 2009, 13:43   #25
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
Quote:
Originally posted by Yathosho
it would be lovely, if WinVer could make a check if the user is running a 64-bit system (whether its xp, vista or win7 etc.). something like ${Is64bit}/${Is32bit} would be very helpful!
x64.nsh

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump