Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Complex Version Check fails (http://forums.winamp.com/showthread.php?t=318430)

dbach 15th April 2010 11:13

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?! :cry:

MSG 15th April 2010 11:35

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. :-)

dbach 15th April 2010 12:02

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} 



All times are GMT. The time now is 17:25.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.