Old 15th April 2010, 11:13   #1
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Complex Version Check fails

Hi Forum.

I've got a problem. Specified is to allow installation on:
Win2003 Server, Win2008 Server w/ SP2+, Win2008 Server R2 w/ SP2+, WinVista w/ SP2+, WinXP w/ SP3+, Win7+

This is the code:
PHP Code:
${IfNot}     ${AtLeastWin7}                ; Windows 7
${OrIf}        ${IsWinXP}                    ; Windows XP
${AndIfNot} ${AtLeastServicePack3        with SP 3
${OrIf}        ${IsWinVista}                ; Windows Vista 
${AndIfNot} ${AtLeastServicePack2        with SP2
${OrIf}        ${IsWin2008}                ; Windows Server 2008
${AndIfNot} ${AtLeastServicePack2        with SP2
${OrIf}        ${IsWin2008R2}                ; Windows Server 2008 R2
${AndIfNot} ${AtLeastServicePack2        with SP2
${OrIfNot}    ${IsWin2003}                ; Windows Server 2003
    
${If} $LANGUAGE == ${LANG_GERMAN}
       
MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "The operating system is unsupported by ${PRODUCT_NAME} ${PRODUCT_VERSION}."
    
${Else}
       
MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "Das Betriebssystem wird von ${PRODUCT_NAME} ${PRODUCT_VERSION} nicht unterstützt."
    
${EndIf}
Abort

${EndIf} 
But it isn't working (on my testsystems: Win2008R2, Win7). What am I doing wrong?!
dbach is offline   Reply With Quote
Old 15th April 2010, 11:35   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Are you sure the OrIf and AndIf statements can be used in the way you want to use them? Since you cannot put (brackets) around them, it depends on LogicLib.nsh how your code will be interpreted.

I suggest trying something that's simpler to visualize (as far as understanding what the precompiler is doing, that is). Like this:
PHP Code:
${If} ${AtLeastWin7}
${ElseIf} ${
IsWinXP}
${
AndIf} ${AtLeastServicePack3
${ElseIf} ${IsWinVista}
${
AndIf} ${AtLeastServicePack2
${ElseIf} ${IsWin2008}
${
AndIf} ${AtLeastServicePack2
${ElseIf} ${IsWin2008R2}
${
AndIf} ${AtLeastServicePack2
${ElseIf} ${IsWin2003}
${Else}
  ${If} 
$LANGUAGE == ${LANG_GERMAN}
     
MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "The operating system is unsupported by ${PRODUCT_NAME} ${PRODUCT_VERSION}."
  
${Else}
     
MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "Das Betriebssystem wird von ${PRODUCT_NAME} ${PRODUCT_VERSION} nicht unterstützt."
  
${EndIf}
  
Abort
${EndIf} 
Edit: Also, you have English and German strings reversed. :-)
MSG is offline   Reply With Quote
Old 15th April 2010, 12:02   #3
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Thnx MSG.

I've changed the way to check the OS. This works:
PHP Code:
StrCpy $bValidOS false
${If}     ${AtLeastWin7}                    ; Windows 7
    StrCpy $bValidOS true

${ElseIf} ${IsWinXP}                    ; Windows XP
    
${If}     ${AtLeastServicePack3    
        StrCpy $bValidOS true
    
${EndIf}
    
${ElseIf} ${
IsWinVista}                    ; Windows Vista
    
${If}     ${AtLeastServicePack2    
        StrCpy $bValidOS true
    
${EndIf}
    
${ElseIf} ${
IsWin2008}                    ; Windows Server 2008
    
${If}     ${AtLeastServicePack2    
        StrCpy $bValidOS true
    
${EndIf}    
    
${ElseIf} ${
IsWin2008R2}                ; Windows Server 2008 R2
    
${If}     ${AtLeastServicePack2    
        StrCpy $bValidOS true
    
${EndIf}    
    
${ElseIf} ${
IsWin2003}                    ; Windows Server 2008
    StrCpy $bValidOS true
    
${EndIf}    

${If} 
$bValidOS == false
    
${If} $LANGUAGE == ${LANG_GERMAN}
       
MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "Das Betriebssystem wird von ${PRODUCT_NAME} ${PRODUCT_VERSION} nicht unterstützt."
    
${Else}
       
MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "The operating system is unsupported by ${PRODUCT_NAME} ${PRODUCT_VERSION}."
    
${EndIf}
    
    
Abort
${EndIf} 
dbach is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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