Menu

#192 Windows service pack versions in WinVer.nsh

closed-accepted
Scripting (12)
5
2008-08-15
2008-08-03
Anonymous
No

Three new macros were added to 'WinVer.nsh' to support Windows service pack versions in addition to Windows versions.

New macros:
AtLeastServicePack
IsServicePack
AtMostServicePack

Example:
${If} ${IsWin2000}
${AndIf} ${AtLeastServicePack} 3
${OrIf} ${AtLeastWinXP}
DetailPrint "Running Win2000 SP3 or above
${EndIf}

Have fun!
Marius Negrutiu (marius.negrutiu@gmail.com)

Discussion

  • Nobody/Anonymous

    Modified WinVer.nsh

     
  • Marius Negrutiu

    Marius Negrutiu - 2008-08-04

    Logged In: YES
    user_id=2168248
    Originator: NO

    A small correction to the previously submitted WinVer.nsh
    ------------------------------------------------------------>>
    !macro __GetWinServicePack
    !insertmacro _LOGICLIB_TEMP

    Push $2
    Push $0
    Push $1

    StrCpy $2 0

    ; $1 = malloc(sizeof(OSVERSIONINFOEXA))
    System::Alloc 156
    Pop $1
    StrCmp $1 0 +6
    ; ($1)->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA)
    System::Call /NOUNLOAD '*$1(&i4 156)'
    ; GetVersionEx($1)
    System::Call /NOUNLOAD 'kernel32::GetVersionEx(i *$1) i.r0'
    StrCmp $0 0 +2
    ; $2 = ($1)->wServicePackMajor
    System::Call /NOUNLOAD '*$1(&t148, &i2.r2)'
    System::Free $1

    StrCpy $_LOGICLIB_TEMP $2
    Pop $1
    Pop $0
    Pop $2
    !macroend
    <<----------------------------------------------------------

     
  • Amir Szekely

    Amir Szekely - 2008-08-15

    Logged In: YES
    user_id=584402
    Originator: NO

    Thanks, added with some minor changes including move to LogicLib to avoid the relative jumps.

     
  • Amir Szekely

    Amir Szekely - 2008-08-15
    • assigned_to: nobody --> kichik
    • status: open --> closed-accepted
     
  • Marius Negrutiu

    Marius Negrutiu - 2008-08-24

    Logged In: YES
    user_id=2168248
    Originator: NO

    Thanks for adding it to NSIS, but removing the relative jumps rendered the macro uncompilable.
    The error message says: "macro "_If" already being inserted!"

     

Log in to post a comment.