Archive: Complex Version Check fails


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:

${IfNot}     ${AtLeastWin7}                ; Windows 7

>${OrIf} ${IsWinXP} ; Windows XP
>${AndIfNot} ${AtLeastServicePack} 3 ; with SP 3
>${OrIf} ${IsWinVista} ; Windows Vista
>${AndIfNot} ${AtLeastServicePack} 2 ; with SP2
>${OrIf} ${IsWin2008} ; Windows Server 2008
>${AndIfNot} ${AtLeastServicePack} 2 ; with SP2
>${OrIf} ${IsWin2008R2} ; Windows Server 2008 R2
>${AndIfNot} ${AtLeastServicePack} 2 ; 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:

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:

${If} ${AtLeastWin7}
${ElseIf} ${IsWinXP}
${AndIf} ${AtLeastServicePack} 3
${ElseIf} ${IsWinVista}
${AndIf} ${AtLeastServicePack} 2
${ElseIf} ${IsWin2008}
${AndIf} ${AtLeastServicePack} 2
${ElseIf} ${IsWin2008R2}
${AndIf} ${AtLeastServicePack} 2
${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. :-)

Thnx MSG.

I've changed the way to check the OS. This works:

StrCpy $bValidOS false

>${If} ${AtLeastWin7} ; Windows 7
StrCpy $bValidOS true

>${ElseIf} ${IsWinXP} ; Windows XP
${If} ${AtLeastServicePack} 3
StrCpy $bValidOS true
${EndIf}

${ElseIf} ${
IsWinVista} ; Windows Vista
${If} ${AtLeastServicePack} 2
StrCpy $bValidOS true
${EndIf}

${ElseIf} ${IsWin2008} ; Windows Server 2008
${If} ${AtLeastServicePack} 2
StrCpy $bValidOS true
${EndIf}

${ElseIf} ${IsWin2008R2} ; Windows Server 2008 R2
${If} ${AtLeastServicePack} 2
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}