ISCompareServicePack Example

InstallShield 2022 ยป InstallScript Language Reference

Note:To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the ISCompareServicePack function.

*

* Note: ISCompareServicePack is defined in Sdint.rul.

*

\*--------------------------------------------------------------*/

#define SERVICE_PACK "Service Pack 3"

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

 

export prototype ExFn_ISCompareServicePack(HWND);

 

function ExFn_ISCompareServicePack(hMSI)

    BOOL bWinNT;

    NUMBER nvResult;

    STRING svResult;

begin

 

    // Determine which operating system is running.

    GetSystemInfo (OS, nvResult, svResult);

 

    if (nvResult =  IS_WINDOWSNT) then

        // Running Windows NT.

        bWinNT = TRUE;

 

        // Check if Service Pack 3 is installed.

        nvResult = ISCompareServicePack (SERVICE_PACK);

 

        if (nvResult < 0) then

            MessageBox ("Error: ISCompareServicePack failed.", SEVERE);

        elseif (nvResult = LESS_THAN) then

            MessageBox ("No service pack or the service pack is less than "

                       + SERVICE_PACK, INFORMATION);

        elseif (nvResult = EQUALS) then

            MessageBox ("The service pack is " + SERVICE_PACK, INFORMATION);

        elseif (nvResult = GREATER_THAN) then

            MessageBox ("The service pack is greater than "

                       + SERVICE_PACK, INFORMATION);

        endif;

    else

        MessageBox ("The target system is not running Windows NT.", SEVERE);

    endif;

 

end;