Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Upgrade Property


5 replies to this topic

PHYOE2004

PHYOE2004
  • Full Members
  • 12 posts

Posted 05 June 2012 - 04:24

Hi All,

The InstallScript MSI Project can be used Upgrades features if I have some InstallScript on my project?

Regards,
Phyoe

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 June 2012 - 09:29

I'm not sure I understand your question.

In general, the "InstallScript MSI" project type should be avoided, in my opinion.

If you have a "Basic MSI" project with some InstallScript custom actions, you can also use "Basic MSI" to upgrade it.

PHYOE2004

PHYOE2004
  • Full Members
  • 12 posts

Posted 05 June 2012 - 10:02

Dear Stefan,

Initially, I am using Basic MSI Project (.msi) . On that time my installer don't ask any popup message - To allow user to choose Install Drive (C or D)
1- Server Name ( To define at the config file)
2- Let user to choose specific application to install (Setup Type)
3- Checking Excel.exe path
4- Checking previous version's application is still running or not.
5- Writing some configuration to the config file during installation.

We only do
A- upgrade (completely uninstall previous version and install new one)
B- Custom Action (New Exe) to register


So we decided to move to InstallScript MSI Project. Then we allow 1 to 5 plus A and B features. So I write most of the features at the InstallScript. Except Item A the rest are working well. I try to find this problem at the forum but cannot get any answer.

Please Help.

BTW. My IS version is InstallShield Developer 8

Thanks & Regards,
Phyoe

Here is My Install Script Code.

CODE

////////////////////////////////////////////////////////////////////////////////
//                                                                            
//  File Name: Setup.rul                                                  
//                                                                            
//  Description: InstallShield script                                        
//                                                                            
//  Comments: This script was generated based on the selections you made in
//            the Project Wizard.  Refer to the help topic entitled "Modify      
//            the script that the Project Wizard generates" for information
//    on possible next steps.
//
/////////////////////////////////////////////////////////////////////////////////
// Include header files
#include "ifx.h"
#define HWND_BROADCAST 0xffff
#define WM_WININICHANGE 0x001A
#define VERSIONID

////////////////////// global defines ////////////////////////////
string svHostname,svHomeairport;
number nXpSp2installed, nAcceptPorts;
string EXCELDIR, XSYSDIR, XTMPDIR, XAPPDIR, XCEDA;
string svLocal;
//number nFidasInstalled, nFipsInstalled,nCheck1,nCheck2,nCheck3,nCheck4,nCheck5,nCheck6;  

//////////////////// installation declarations ///////////////////
//
//////////////////// user function declarations ///////////////////
prototype CheckXPSp2();
prototype GetExcelPath();
prototype SetEnvironment();
prototype DelEnvironment();
prototype WriteToCedaIni();
prototype WriteToTelexPoolIni();
prototype CheckDotNet2();
prototype CheckDotNet4();
//////////////////// installation declarations ///////////////////
// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
// your script function prototypes
// your global variables
//////////////////////////////////////////////////////////////////////////////
//                                                                          
//  FUNCTION:   OnFirstUIBefore                                            
//                                                                          
//  EVENT:      FirstUIBefore event is sent when installation is run for the first
//              time on given machine. In the handler installation usually displays
//              UI allowing end user to specify installation parameters. After this
//              function returns, ComponentTransferData is called to perform file
//              transfer.
//                                                                          
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()    
LIST    listStartCopy,listComponents;
string  Installdrive,svDrive,svDisk,svTimeSetting;
string szName,svRes1,svRes2,szEnv,szComponents;
string szTargetdir,szTitle,szMsg,szPath,szKey;
string szLicenseFile, szQuestion,szHost,szHopo,szSetupType;
POINTER pEnv;
number  bvCheck1,bvCheck2,custResult,nCustCheck1;
number nCustCheck2, nVar,k, nResult,number_foo;
number number_Result(24),nvResult,nvUTC, nvLocal;
   
begin
// TO DO: if you want to enable background, window title, and caption bar title
//Initialize Variables
//szSetupType = "";   //Set Setup-Type custom or
SdProductName ("®");  // Set ProductName for %P
 
//New installation
if !MAINTENANCE then  
 szHost="YourServerName";
 szHopo="XXX";
 listComponents =  ListCreate(STRINGLIST);      
endif;    
   //IF MAINTENANCE
   // Check for WINDOWS XP Service Pack 2
CheckXPSp2();

// Check for .NET Framework 2.0
nResult = CheckDotNet2();
if nResult < 0 then  
 nResult = AskYesNo(".NET Framework 2.0 not found. Do you want to install .NET Framework 2.0?",YES);
 if nResult = YES then
  if (LaunchAppAndWait(SUPPORTDIR^"dotnetfx20.exe"," /q:a /c:\"install /qb\"", WAIT) < 0) then
      MessageBox ("Unable to install the .NET 2.0 Framework.\nPlease contact your System-Administrator",SEVERE);  
  endif;
  else
   MessageBox ("Please make sure, that the .NET Framework 2.0 is installed.", SEVERE);
   abort;
 endif;
endif;  
   
//Check for .NET Framework 4.0
nResult = CheckDotNet4();
if nResult < 0 then      
 nResult = AskYesNo(".NET Framework 4.0 Client Profile not found. Do you want to install .NET Framework 4.0 Client Profile?",YES);
 if nResult = YES then
  if (LaunchAppAndWait(SUPPORTDIR^"dotNetFx40_Client_x86_x64.exe"," /q:a /c:\"install /qb\"", WAIT) < 0) then
       MessageBox ("Unable to install the .NET 4.0 Framework Client Profile.\nPlease contact your System-Administrator",SEVERE);  
     endif;
  else
   MessageBox ("Please make sure, that the .NET Framework Client Profile 4.0 is installed.", SEVERE);
   abort;
 endif;
endif;      
 
//Read Excel Path from Registry
GetExcelPath();
         
// Beginning of dialogs label
Dlg_SdWelcome:
szTitle = VERSIONID;
szMsg   = "The Install Shield® Wizard will install ® \n" +
"on your workstation. To continue click Next";
nResult = SdWelcome( szTitle, szMsg );

//Ask for Firewall configuration if Windows XP + Sp 2 is installed and the firewall is actve
 if nXpSp2installed = 1 then
 nResult = AskYesNo("The -Setup has detected that the WINDOWS Firewall is installed on your workstation. \n"+  
     "To run the ®-Client Applications properly if the WINDOWS Firewall is active,\n®-Setup has to open ports through the WINDOWS Firewall.\n"+
   "Do you allow ®-Setup open ports for the ®-Client Applications?",YES);
 if nResult = NO then
  nResult = AskYesNo("Do you wish to install ®-Client Applications on your workstation\nand configure the WINDOWS Firewall manually? \n"+
   "If you do NOT aggree, ®-Setup will terminate immediately!",YES);
  if nResult = YES then
   nAcceptPorts = 0;
  else
   abort;
  endif;
 else
     nAcceptPorts = 1;
 endif;
endif;  

//License dialog
Dlg_SdLicense: Enable (BACKBUTTON);
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle    = "";
szMsg      = "";
szQuestion = "";
nResult    = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
if nResult = BACK goto Dlg_SdWelcome;              

svDrive = "C"; //igu on 22/03/2012      
   //Define variables for the X Environment
   INSTALLDIR = svDrive + ":\\";  //Set Installation Directory
   XSYSDIR = INSTALLDIR + "\X\\System";
   XTMPDIR = INSTALLDIR + "\Tmp";
   XAPPDIR = INSTALLDIR + "\X\\Appl";
   XCEDA   = INSTALLDIR + "\X\\System\\Ceda.Ini";
   
   // Choose Complete or Custom Installation
Dlg_SetupType:
szTitle    = "";
szMsg      = "";
   nResult = SetupType2 ( szTitle , szMsg ,"", COMPLETE , 0 );
//if nResult = BACK goto Dlg_AskDrive;
if nResult = BACK goto Dlg_SdLicense;
   if nResult = CUSTOM then
   
// CUSTOM -Dialog                        
Dlg_SdComponentTree:
 szTitle    = "";
 szMsg      = "";
 szTargetdir = INSTALLDIR;
 szComponents = "";
 nResult = SdFeatureDialog2(szTitle, szMsg, szTargetdir, szComponents);
 if nResult = BACK goto Dlg_SetupType;  
 number_foo = 0;
 number_Result(0) = FeatureIsItemSelected(MEDIA,"Bdps_Sec");
 number_Result(1) = FeatureIsItemSelected(MEDIA,"Bdps_Uif");
 number_Result(2) = FeatureIsItemSelected(MEDIA,"Bdps_Pass");
 number_Result(3) = FeatureIsItemSelected(MEDIA,"Fips");
 number_Result(4) = FeatureIsItemSelected(MEDIA,"RulesEditorFips");
 number_Result(5) = FeatureIsItemSelected(MEDIA,"TelexPool");
 number_Result(6) = FeatureIsItemSelected(MEDIA,"GroupEditor");
 number_Result(7) = FeatureIsItemSelected(MEDIA,"StatusManager");
 number_Result(8) = FeatureIsItemSelected(MEDIA,"FlightPermits");
 number_Result(9) = FeatureIsItemSelected(MEDIA,"LogTabViewer");
 number_Result(10) = FeatureIsItemSelected(MEDIA,"RulesChecker");  
 number_Result(11) = FeatureIsItemSelected(MEDIA,"AIMSViewer");
 number_Result(12) = FeatureIsItemSelected(MEDIA,"ExportTool");            
 number_Result(13) = FeatureIsItemSelected(MEDIA,"ImportTool");

 for k = 0 to 13
  if number_Result(k) = 1 then
   number_foo = 1;
  endif;
 endfor;
   
 if number_foo = 0 then  
  MessageBox ("Please select at least one option!",INFORMATION);        
  goto Dlg_SdComponentTree;
 endif;
 szSetupType = "CUSTOM";
else
    //Complete selection
    szSetupType = "COMPLETE";
 endif;                        

//Dialog for input the Hostname        
Dlg_AskHost:
 SetDialogTitle ( DLG_ASK_TEXT, "Enter the Hostname" );
 nResult = AskText ( "Please insert the name(s) of the host(s) you will be connected to. \n"+
      "Please make sure that you can connect to the host(s) by using the given name(s). \n"+
      "If you are unsure what to insert here, leave the default or contact your administrator."
      ,szHost, svRes1);
 svHostname = svRes1;
    if nResult = BACK goto Dlg_SetupType;

//Dialog for input the Homeairport  
Dlg_AskHopo:
 SetDialogTitle ( DLG_ASK_TEXT, "Enter the Homeairport" );
 nResult = AskText ( "Please insert the value for your home-airport. \n"+
      "The value has to be 3 characters long and is usually the 3-letter code of your airport.\n"+
      "If you are unsure what to insert here, leave the default or contact your administrator."
      ,szHopo, svRes2);
 svHomeairport = svRes2;
 if (nResult = BACK) goto Dlg_AskHost;                          

 //Dialog for choosing UTC/Local
Dlg_AskTimeSetting:
  nvUTC = TRUE;
   nvLocal = FALSE;
 
 SetDialogTitle ( DLG_ASK_OPTIONS, "Select Time Setting" );
 nResult = AskOptions ( EXCLUSIVE,"Please select the default time setting:",
        "UTC", nvUTC,
        "Local", nvLocal);  
 if (nvUTC = TRUE) then
  svLocal = "FALSE";
  svTimeSetting = "UTC";
 else
  svTimeSetting = "Local";
  svLocal = "TRUE";
 endif;  
 if (nResult = BACK) goto Dlg_AskHopo;
   
//Show Installation-parameter
Enable(BACKBUTTON);
 
szTitle = "Check Setup Information";
szMsg   =  "Setup has enough information to begin the file-transfer operation.\n" +
             "If you want to review or change any of the settings, click Back.\n" +
            "If you are satisfied with the settings, click Next to begin copying files.";
listStartCopy = ListCreate( STRINGLIST );
szName = "X® client application setup ... ready to install!";  
ListAddString(listStartCopy,"Setup Type:  " + szSetupType,AFTER);
ListAddString(listStartCopy,"Host Name:   " + svHostname,AFTER);
ListAddString(listStartCopy,"Homeairport: " + svHomeairport,AFTER);
ListAddString(listStartCopy,"Time Setting: " + svTimeSetting,AFTER);
ListAddString(listStartCopy,"Install Dir:     " + INSTALLDIR + "X",AFTER);
ListAddString(listStartCopy," ",AFTER);
ListAddString(listStartCopy,szName,AFTER);

nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);
if (nResult = BACK) goto Dlg_AskTimeSetting;        
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
return 0;      
end;

///////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   OnEnd
//
//  EVENT:      End event is the last event. It is not sent if the installation
//              has been aborted. In this case Abort event is sent
//
///////////////////////////////////////////////////////////////////////////////
function OnEnd()
LIST list_comp;
string list(50),svDir,szProgram,szCmdLine,svresult;
string ListApp(50),szRunOnce,szKey;
number i,j,nResult;

begin
if !MAINTENANCE then
 // setting ceda.ini entries
 nResult = WriteToCedaIni();

    if nResult < 0 then
     MessageBox ("Setting X®-Configuration failed(CEDA INI)! Please contact your System-Administrator",SEVERE);
    endif;
   
    // setting Telexpool.ini entries
 nResult = WriteToTelexPoolIni();
    if nResult < 0 then
     MessageBox ("Setting X®-Configuration failed(TELEX POOL CONFIG)! Please contact your System-Administrator",SEVERE);
    endif;
   
    //Check for Tmp-folder and create if not exist
    if ExistsDir (XTMPDIR) =! 0 then
     CreateDir (XTMPDIR);
    endif;        
   
    // Registering components
    SdShowMsg ("Registering necessary X®-Components . . .",TRUE);
   
 // all this is inside winnt\system32 dir
 // leave the atl.dll as first component to be registered
 list(0) = WINSYSDIR + "\\atl.dll";
  list(1) = WINSYSDIR + "\\MSWINSCK.ocx";
 list(2) = WINSYSDIR + "\\MSCOMCTL.ocx";
 list(3) = WINSYSDIR + "\\Mscomct2.ocx";
 list(4) = WINSYSDIR + "\\Mscal.ocx";
 list(5) = WINSYSDIR + "\\MSCHRT20.ocx";
 list(6) = WINSYSDIR + "\\Msstdfmt.dll";
 list(7) = WINSYSDIR + "\\SYSINFO.ocx";
 list(8) = WINSYSDIR + "\\COMDLG32.ocx";
 list(9) = WINSYSDIR + "\\Comctl32.ocx";
 list(10) = WINSYSDIR + "\\Tabctl32.ocx";
 list(11) = WINSYSDIR + "\\Ogocxgrd.ocx";
 list(12) = WINSYSDIR + "\\ardespro2.dll";
 list(13) = WINSYSDIR + "\\arpro2.dll";
 list(14) = WINSYSDIR + "\\Arview2.ocx";
 list(15) = WINSYSDIR + "\\PropList.ocx";
 list(16) = WINSYSDIR + "\\exclexpt.dll";
 list(17) = WINSYSDIR + "\\htmlexpt.dll";
 list(18) = WINSYSDIR + "\\pdfexpt.dll";
 list(19) = WINSYSDIR + "\\rtfexpt.dll";
 list(20) = WINSYSDIR + "\\textexpt.dll";
 list(21) = XSYSDIR + "\\XCom.ocx";
 list(22) = XSYSDIR + "\\TAB.ocx";
 list(23) = XSYSDIR + "\\AATLogin.ocx";
 list(24) = XSYSDIR + "\\UGantt.ocx";
 list(25) = XSYSDIR + "\\UCom.ocx";
   
   
 szProgram = "regsvr32.exe";
 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

 //register all ActiveX-components
 for i = 0 to 25
  szCmdLine = "/s " + "\"" + list(i) + "\"";
  nResult = LaunchAppAndWait (szProgram, szCmdLine, WAIT);
  if nResult < 0 then
      szRunOnce = szProgram + " /s " + list(i);
      nResult = RegDBSetKeyValueEx(szKey, list(i), REGDB_STRING, szRunOnce, -1);
  endif;
 endfor;
   
    nResult = LaunchAppAndWait (XSYSDIR + "\\BcProxy.exe", "/REGSERVER",WAIT);
 if nResult < 0 then
  MessageBox ("BcProxy.exe not unregistered! \n",WARNING);  
 endif;

 nResult = LaunchAppAndWait (XSYSDIR + "\\XAppMng.exe", "/REGSERVER",WAIT);  
 if nResult < 0 then
  MessageBox ("XAppMng.exe not unregistered! \n",WARNING);  
 endif;
 
 SdShowMsg ("",FALSE); //Hide Message-Window

 //Set X-Ports in WINDOWS Firewall-Configuration
 if (nXpSp2installed = 1 && nAcceptPorts = 1) then
  SdShowMsg("Configure X®-Ports...",TRUE);
  Delay(2);
  Disable(LOGGING);
  szKey    = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
  nResult = RegDBSetKeyValueEx(szKey, "3350:TCP", REGDB_STRING, "3350:TCP:*:Enabled:X", -1);                                
       szKey    = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
  nResult = RegDBSetKeyValueEx(szKey, "3351:UDP", REGDB_STRING, "3351:UDP:*:Enabled:X_BC", -1);
  szKey    = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
  nResult = RegDBSetKeyValueEx(szKey, "3352:UDP", REGDB_STRING, "3352:UDP:*:Enabled:X_BC2", -1);
       szKey    = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
  nResult = RegDBSetKeyValueEx(szKey, "3357:TCP", REGDB_STRING, "3357:TCP:*:Enabled:X_BCR", -1);
  szKey    = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
  nResult = RegDBSetKeyValueEx(szKey, "3358:TCP", REGDB_STRING, "3358:TCP:*:Enabled:X_BCQ", -1);
  Enable(LOGGING);
  SdShowMsg ("",FALSE);
 endif;
               
 //Set Environment variables
    nResult = SetEnvironment();
    if nResult < 0 then
     MessageBox ("Setting X®-Environment failed! Please contact your System-Administrator",SEVERE);
     abort;
    endif;    
                                 
    //Reboot system if wanted  
    if (SdFinishReboot ("Thank you for choosing X® for your airport-operation.", "Setup has completed installing X®-Client Applications.", SYS_BOOTMACHINE, "Click Finish to exit X® setup.", 0) < 0) then
        MessageBox ("Reboot failed. Please call your administrator.", SEVERE);
    endif;
   
    /*
    MessageBox("Thank you for choosing X® for your airport-operation.\n\n"+
       "Setup has finished installing X® client applications on your workstation and will terminate now.\n\n"+
       "Do not forget to restart your computer before using X®-client applications.\n\n\n"+
       "© X Airport Solutions GmbH",INFORMATION);
    */
endif;
// if maintenance
end;    

///////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   OnMaintUIBefore
//
//  EVENT:      MaintUIBefore event is sent when end user runs installation that
//              has already been installed on the machine. Usually this happens
//              through Add/Remove Programs applet. In the handler installation
//              usually displays UI allowing end user to modify existing installation
//              or uninstall application. After this function returns,
//              ComponentTransferData is called to perform file transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIBefore()
   NUMBER nResult,nReturn,nType,nvType,nvSize,i;
   STRING list(50),svDir,svResult,svValue;
   STRING szTitle,szPath,szMsg,szKey,szProgram,szCmdLine;
   
begin
// TO DO: if you want to enable background, window title, and caption bar title          
// SetTitle( @TITLE_MAIN, 24, WHITE );    
// SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );    
// SetColor(BACKGROUND,RGB (0, 128, 128));    
//Enable( FULLWINDOWMODE );
//SetFont(FONT_TITLE,STYLE_SHADOW,"Arial");      
//SetTitle( VERSIONID, 16, WHITE );                                        
//Enable( BACKGROUND );  

//Read the X Path from Environment
if (GetEnvVar ("XSYSTEM",XSYSDIR)) < 0 then
 XSYSDIR = "C:\\X\\System";     //not found? Set to default
endif;

//Any X-Application still running?
if (Is (FILE_LOCKED, (XSYSDIR + "\\bcserv32.exe"))) = TRUE then
     MessageBox("One or more X® client applications are already running. Close these applications before uninstalling X®", WARNING);
     abort;
endif;  

if (Is (FILE_LOCKED, (XSYSDIR + "\\BCComServer.exe"))) = TRUE then
 MessageBox("One or more X® client applications are already running. Close these applications before uninstalling X®", WARNING);
    abort;
endif;    

if (Is (FILE_LOCKED, (XSYSDIR + "\\BcProxy.exe"))) = TRUE then
 MessageBox("One or more X® client applications are already running. Close these applications before uninstalling X®", WARNING);
    abort;
endif;
/////////////////////////////

   // Remove all X-Components      
SetDialogTitle(DLG_ASK_TEXT, "Remove X®-Components from Workstation");
 nResult = AskYesNo("This will remove all X® components and the complete X® directory " + INSTALLDIR + "\X\ from your Workstation!\n"+  
      "Please make sure to have saved all files you need from those directories or from related subdirectories!\n"+
      "Do you wish to proceed ? (If you do NOT aggree setup will terminate immediately!)",NO);  
     
//Unregister X-Components
if nResult = YES then
 list(0) = XSYSDIR + "\\AATLogin.ocx";
 list(1) = XSYSDIR + "\\TAB.ocx";
 list(2) = XSYSDIR + "\\XCom.ocx";
 list(3) = XSYSDIR + "\\UGantt.ocx";
 list(4) = XSYSDIR + "\\UCom.ocx";  
 list(5) = WINSYSDIR + "\\ardespro2.dll";
 list(6) = WINSYSDIR + "\\arpro2.dll";
 list(7) = WINSYSDIR + "\\Arview2.ocx";
 list(8) = WINSYSDIR + "\\PropList.ocx";
 list(9) = WINSYSDIR + "\\exclexpt.dll";
 list(10) = WINSYSDIR + "\\htmlexpt.dll";
 list(11) = WINSYSDIR + "\\pdfexpt.dll";
 list(12) = WINSYSDIR + "\\rtfexpt.dll";
 list(13) = WINSYSDIR + "\\textexpt.dll";            
             
 SdShowMsg ("Unregistering X®-Components . . .",TRUE);
     
 //nResult = LaunchAppAndWait (XSYSDIR + "\\BcProxy.exe", "/UNREGSERVER",WAIT);
 //if nResult < 0 then
 // MessageBox ("BcProxy.exe not unregistered! \n",WARNING);
 //else
 // MessageBox ("BcProxy.exe unregistered successfully! \n",INFORMATION);
 //endif;

 //nResult = LaunchAppAndWait (XSYSDIR + "\\XAppMng.exe", "/UNREGSERVER",WAIT);  
 //if nResult < 0 then
 // MessageBox ("XAppMng.exe not unregistered! \n",WARNING);
 //else
 // MessageBox ("XAppMng.exe unregistered successfully! \n",INFORMATION);
 //endif;
       
 szProgram = "regsvr32.exe";
 // remove all X-components
 for i = 0 to 13
  szCmdLine = "-s -u " + "\"" + list(i) + "\"";
  nResult = LaunchAppAndWait (szProgram, szCmdLine, WAIT);
  if nResult < 0 then
   MessageBox (list(i) + "\nComponent not unregistered ! \n",WARNING);
  // else
   // MessageBox (list(i) + "\nComponent unregistered successfully! \n",INFORMATION);
  endif;
 endfor;
 
 SdShowMsg ("",FALSE);  
 
 //Delete X-Ports from Registry when set
 szKey = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
 Disable(LOGGING);
 
 nReturn = RegDBGetKeyValueEx(szKey, "3350:TCP", nvType, svValue, nvSize);
 if (nReturn = 0) then
  SdShowMsg("Remove X®-Ports...",TRUE);
  Delay(2);
       RegDBDeleteValue(szKey, "3350:TCP");
      endif;
       
   nReturn = RegDBGetKeyValueEx(szKey, "3351:UDP", nvType, svValue, nvSize);
   if (nReturn = 0) then
       RegDBDeleteValue(szKey, "3351:UDP");
   endif;
       
   nReturn = RegDBGetKeyValueEx(szKey, "3352:UDP", nvType, svValue, nvSize);
 if (nReturn = 0) then
  RegDBDeleteValue(szKey, "3352:UDP");
 endif;        
 
 nReturn = RegDBGetKeyValueEx(szKey, "3357:TCP", nvType, svValue, nvSize);
   if (nReturn = 0) then
    RegDBDeleteValue(szKey, "3357:TCP");
   endif;
   
   nReturn = RegDBGetKeyValueEx(szKey, "3358:TCP", nvType, svValue, nvSize);
 if (nReturn = 0) then
  RegDBDeleteValue(szKey, "3358:TCP");
  SdShowMsg ("",FALSE);
 endif;  
 
 Enable(LOGGING);
 
 //Delete X Environment variables
    nResult = DelEnvironment();
    if nResult < 0 then
     MessageBox ("Deleting X®-Environment failed! Please contact your System-Administrator",SEVERE);
    endif;  
 
 /*
 //  Save CEDA.INI
 nResult = AskYesNo("Would you like to save your CEDA.INI? ",YES);
 if nResult = YES then
 
  Disable (LOGGING); // Protokollierung ausschalten      
  nResult = CopyFile ("c:\\X\\system\\ceda.ini", "c:\\tmp\\Cedaini.bak");
  if nResult < 0 then
   MessageBox ("Ceda.Ini could not be copied! \n",WARNING);
  else
   MessageBox ("Ceda.ini copied successfully as Cedaini.bak at C:\\Tmp \n",INFORMATION);
  endif;
 endif;
 Enable (LOGGING);  // Protokollierung einschalten
 */                  
 
 //Remove all features
 FeatureRemoveAll();
           
       //Delete X-Folder with all subfolder    
       szPath = INSTALLDIR + "\\X";
   nResult = ExistsDir (szPath);
   if nResult = 0 then
    if (DeleteDir(szPath,ALLCONTENTS) < 0) then
      MessageBox ("X®-Application setup could not remove all directories/files !\nPlease make sure to (re)move those directories/files before next X®-Application setup!",INFORMATION);
     endif;
   endif;
   
 else
   SdShowMsg ("Terminating X®-Setup...",TRUE);
 Delay(2);
 SdShowMsg ("",FALSE);
 abort;
 endif;  
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
end;
//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   OnFileLocked
//
//  EVENT:      FileLocked event is sent during file transfer when a file that needs
//              to be overwritten or removed is in use by other application.
//              This event will not be sent for files that are in file group
//              marked as potentially locked. In this case operation is automatically
//              performed after reboot.
//
//  ARGUMENTS:  File - full path of file that is locked
//
//  RETURN:     ERR_IGNORE - engine should ignore the file and continue file transfer
//              ERR_RETRY  - engine should retry to perform operation on the file
//              ERR_ABORT  - file transfer should be aborted
//              ERR_PERFORM_AFTER_REBOOT - necessary operation should be performed
//                                         after system is rebooted
//
///////////////////////////////////////////////////////////////////////////////
function OnFileLocked(File)
begin
return ERR_PERFORM_AFTER_REBOOT;//SdExceptions(LOCKED, File);
end;

//////////////////////////////////////////////////////////////////////////////
// FUNCTION: OnError
//
//  EVENT:      The Error event is triggered from the External UI handler
//              when MSI sends an INSTALLMESSAGE_ERROR message.
/////////////////////////////////////////////////////////////////////////////
function OnError(szMessage, nButtons_Icons)
string szTitle;
begin
szTitle = SdLoadString(STR_STR_DEFERRORTITLE); //"Error"
szTitle = @PRODUCT_NAME + " " + szTitle;
return SprintfBox(nButtons_Icons|MB_ICONHAND, szTitle, szMessage);
end;
//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   OnBegin
//
//  EVENT:      Begin event is always sent as the first event during installation.
//
//////////////////////////////////////////////////////////////////////////////
function OnBegin()
begin
// TO DO: you may change default non-UI setting, for example
//
// You may also perform your custom initialization steps, check requirements, etc.

//Set X-Logo
DialogSetInfo(DLG_INFO_ALTIMAGE, SUPPORTDIR ^ "Xlogo.bmp", TRUE);

//Check Administrator-Rights
   if (Is (USER_ADMINISTRATOR, "") != TRUE) then
 MessageBox("You must have local administrator " +
     "privileges to run this setup. \n Please login as local administrator or call your administrator \n to install this software!", SEVERE);
 abort;
endif;
end;

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   CheckXPSp2
//
//  EVENT:      Function checks for existing WINDOWS XP Service Pack 2 Installation
//    with active WINDOWS Firewall
//
//////////////////////////////////////////////////////////////////////////////
function CheckXPSp2()
string szKey, szNumName, svNumValue, szMsg;
number nResult, nvType, nvSize;

begin

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey    = "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile";
szNumName = "EnableFirewall";

nResult = RegDBGetKeyValueEx (szKey, szNumName, nvType, svNumValue, nvSize);
if nResult < 0 then
 nXpSp2installed = 0;
else
 nXpSp2installed = 1;
endif;    

end;  

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   CheckDotNet4
//
//  EVENT:      Function checks for existing .NET Framework 2.0 Installation
//    
//
//////////////////////////////////////////////////////////////////////////////
function CheckDotNet4()
string szKey;
number nResult;

begin
// Registry Key for .NET 4.0
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey    = "SOFTWARE\\Microsoft\\.NETFramework\\Policy\\v4.0";

nResult = RegDBKeyExist ( szKey );
if nResult < 0 then
 return (-1);
else
 return(0);
endif;    

end;

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   WriteToCedaIni
//
//  EVENT:      Function writes etries to the Ceda.Ini
//    
//
//////////////////////////////////////////////////////////////////////////////
function WriteToCedaIni()

STRING ListApp(50), szFileName, szSectionName, szKeyName1,szKeyName2,szKeyName3, szReplaceValue1,szReplaceValue2,szReplaceValue3;
number j, nResult, nvType, nvSize;

begin  
//Check for Ceda.Ini
   if (Is (FILE_EXISTS, (XSYSDIR + "\\Ceda.Ini")) = FALSE) then
    return -1;
endif;
   
//SprintfBox(INFORMATION," Excel Suche","Excel gefunden in Pfad: %s",svNumValue);
//Write HOSTNAME, HOMEAIRPORT and HOSTTYPE inti the Ceda.Ini sections
// setting ceda.ini entries
ListApp(0) = "GLOBAL";
ListApp(1) = "BDPS-SEC";
ListApp(2) = "BDPSPASS";
ListApp(3) = "BDPS-UIF";
ListApp(4) = "FIPS";
ListApp(5) = "Rules";
ListApp(6) = "EXPORT";
ListApp(7) = "BcProxy";
ListApp(8) = "XAPPMAN";
ListApp(9) = "LOGTABVIEWER";
ListApp(10) = "HUBMANAGER";
ListApp(11) = "GRP";


szFileName      = XCEDA;
   szKeyName1   = "HOSTNAME";
   szKeyName2   = "HOMEAIRPORT";
   szKeyName3      = "HOSTTYPE";
   
   szReplaceValue1 = svHostname;
   szReplaceValue2 = svHomeairport;
   szReplaceValue3 = "Solaris 9";
   
   SdShowMsg("Setting X®-Config parameter ...",TRUE);
Delay(2);
 
   for j = 0 to 11
 szSectionName   = ListApp(j);  
 WriteProfString (szFileName, szSectionName, szKeyName1, szReplaceValue1);
 WriteProfString (szFileName, szSectionName, szKeyName2, szReplaceValue2);
    WriteProfString (szFileName, szSectionName, szKeyName3, szReplaceValue3);
   endfor;


//Write parameter to the sections
WriteProfString (szFileName, "GLOBAL", "HelpDirectory", INSTALLDIR + "X\\Help");
WriteProfString (szFileName, "GLOBAL", "  ##XVersion", VERSIONID);
WriteProfString (szFileName, "BDPS-SEC", "INIFILE", INSTALLDIR + "X\\System\\BDPS_SEC.CFG");
WriteProfString (szFileName, "BDPS-UIF", "GROUPING", INSTALLDIR + "X\\Appl\\GRP.EXE");
WriteProfString (szFileName, "BDPS-UIF", "EXCEL", EXCELDIR);
WriteProfString (szFileName, "FIPS", "BDPS-UIF", INSTALLDIR + "X\\Appl\\BDPSUIF.EXE");
WriteProfString (szFileName, "FIPS", "TELEXPOOL", INSTALLDIR + "X\\Appl\\TELEXPOOL.EXE");
WriteProfString (szFileName, "FIPS", "PASSINFO", INSTALLDIR + "X\\Appl\\BDPSPASS");
WriteProfString (szFileName, "FIPS", "RULES", INSTALLDIR + "X\\Appl\\RULES.EXE");
WriteProfString (szFileName, "FIPS", "IMPORTFLIGHTS", INSTALLDIR + "X\\Appl\\IMPORTFLIGHTS.EXE");
WriteProfString (szFileName, "FIPS", "BDPS-UIF", INSTALLDIR + "X\\Appl\\BDPSUIF.EXE");
WriteProfString (szFileName, "FIPS", "LOATABVIEWER", INSTALLDIR + "X\\Appl\\LOADTABVIEWER.EXE");
WriteProfString (szFileName, "FIPS", "LOGTABVIEWER", INSTALLDIR + "X\\Appl\\LOGTAB_VIEWER.EXE");
WriteProfString (szFileName, "FIPS", "FLIGHTPERMITS", INSTALLDIR + "X\\Appl\\FLIGHTPERMITS.EXE");
WriteProfString (szFileName, "FIPS", "CHECK_LIST_PROCESSING", INSTALLDIR + "X\\Appl\\CheckListProcessing.exe");
WriteProfString (szFileName, "FIPS", "EXCEL", EXCELDIR);
WriteProfString (szFileName, "FIPS", "DEBUG", INSTALLDIR + "Tmp\\Fips.Log");
WriteProfString (szFileName, "FIPS", "LOGO", INSTALLDIR + "X\\System\\Airportlogo.bmp");
WriteProfString (szFileName, "XAPPMAN", "TLX_LAUNCH_STR", INSTALLDIR + "X\\Appl\\TELEXPOOL.EXE /CONNECTED");
WriteProfString (szFileName, "EXPORT", "TextPath", INSTALLDIR + "X\\System");
WriteProfString (szFileName, "STATUSMANAGER", "CHECK_LIST_PROCESSING", INSTALLDIR + "X\\Appl\\CheckListProcessing.exe");
WriteProfString (szFileName, "STATUSMANAGER", "PRINTLOGO", INSTALLDIR + "X\\System\\Airportlogo.bmp");
WriteProfString (szFileName, "GATPOS", "BlockedBitmap1", INSTALLDIR + "X\\System\\notvalid1.bmp");
WriteProfString (szFileName, "GATPOS", "BlockedBitmap2", INSTALLDIR + "X\\System\\notvalid2.bmp");
WriteProfString (szFileName, "GATPOS", "BlockedBitmap3", INSTALLDIR + "X\\System\\notvalid3.bmp");
WriteProfString (szFileName, "GATPOS", "BlockedBitmap4", INSTALLDIR + "X\\System\\notvalid4.bmp");
WriteProfString (szFileName, "GATPOS", "BlockedBitmap5", INSTALLDIR + "X\\System\\notvalid5.bmp");
WriteProfString (szFileName, "GATPOS", "BlockedBitmap6", INSTALLDIR + "X\\System\\notvalid6.bmp");    
WriteProfString (szFileName, "FlightPermits", "PRINTLOGO", INSTALLDIR + "X\\System\\Airportlogo.bmp");
WriteProfString (szFileName, "HUBMANAGER", "PRINTLOGO", INSTALLDIR + "X\\System\\Airportlogo.bmp");

//Set the time setting                                      
WriteProfString (szFileName, "FIPS", "SEASONLOCAL", svLocal);
WriteProfString (szFileName, "FIPS", "DAILYLOCAL", svLocal);
WriteProfString (szFileName, "FIPS", "GATPOSLOCAL", svLocal);

SdShowMsg ("",FALSE);


   
end;  

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   WriteToTelexPoolIni
//
//  EVENT:      Function writes path entries to the TelexPool.Ini
//    
//
//////////////////////////////////////////////////////////////////////////////
function WriteToTelexPoolIni()

STRING szFileName;
number nResult, nvType, nvSize;

begin  
//Check for Telexpool.Ini
   if (Is (FILE_EXISTS, (XSYSDIR + "\\Telexpool.Ini")) = FALSE) then
    return -1;
endif;

szFileName = XSYSDIR + "\\Telexpool.Ini";

//Write path-entries
WriteProfString (szFileName, "MAIN_WINDOW", "LOADTAB_VIEWER", INSTALLDIR + "X\\Appl\\LoadTabViewer.exe");
//WriteProfString (szFileName, "MAIN_WINDOW", "IMPORT_TOOL", INSTALLDIR + "X\\Appl\\Importflights.exe");
end;

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   SetEnvironment
//
//  EVENT:      Function sets the X Environment-Variables in the Registry
//    
//
//////////////////////////////////////////////////////////////////////////////
function SetEnvironment()

string szKey,lsv_GetPathVarialble;
number nResult;

begin
   SdShowMsg("Setting X®-Environment...",TRUE);
Delay(2);
Disable(LOGGING);
   szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";    
 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  nResult = RegDBSetKeyValueEx(szKey, "XSYSTEM", REGDB_STRING, XSYSDIR, -1);    
   if (nResult < 0) then
    return -1;
   endif;
   nResult = RegDBSetKeyValueEx(szKey, "XAPPL", REGDB_STRING, XAPPDIR, -1);    
   if (nResult < 0) then
    return -1;
   endif;
   nResult = RegDBSetKeyValueEx(szKey, "XTMP", REGDB_STRING, XTMPDIR, -1);    
   if (nResult < 0) then
    return -1;
   endif;
   nResult = RegDBSetKeyValueEx(szKey, "CEDA", REGDB_STRING, XCEDA, -1);    
   if (nResult < 0) then
    return -1;
   endif;
   
   //Read path-variable from registry
   nResult = GetEnvVar ("Path",lsv_GetPathVarialble);
if (nResult < 0) then
   return -1;
endif;

//SprintfBox (INFORMATION, "Test", "XSYSDIR: %s ",XSYSDIR);
 
if (!(lsv_GetPathVarialble % XSYSDIR)) then
 //Append X-Systempath to path-variable
 lsv_GetPathVarialble = XSYSDIR + ";" + lsv_GetPathVarialble;
 //Write new path-variable to registry
 nResult = RegDBSetKeyValueEx(szKey, "Path", REGDB_STRING, lsv_GetPathVarialble, -1);
 if (nResult < 0) then
  return -1;
 endif;
//else
// MessageBox ("X-Path schon vorhanden", SEVERE);
endif;
Enable(LOGGING);
SdShowMsg ("",FALSE);
   
end;


//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   DelEnvironment
//
//  EVENT:      Function deletes the X Environment-Variables from the Registry
//    
//
//////////////////////////////////////////////////////////////////////////////
function DelEnvironment()

string szKey,svValue;
number nResult,nvType,nvSize;

begin
   SdShowMsg("Delete X®-Environment...",TRUE);
Delay(2);
Disable(LOGGING);
   szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";    
 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  nResult = RegDBGetKeyValueEx(szKey, "XSYSTEM", nvType, svValue, nvSize);
  if (nResult = 0) then
      RegDBDeleteValue(szKey, "XSYSTEM");
  endif;
  nResult = RegDBGetKeyValueEx(szKey, "XAPPL", nvType, svValue, nvSize);
  if (nResult = 0) then
      RegDBDeleteValue(szKey, "XAPPL");
  endif;                                  
  nResult = RegDBGetKeyValueEx(szKey, "XTMP", nvType, svValue, nvSize);
  if (nResult = 0) then
      RegDBDeleteValue(szKey, "XTMP");
  endif;
  nResult = RegDBGetKeyValueEx(szKey, "CEDA", nvType, svValue, nvSize);
  if (nResult = 0) then
      RegDBDeleteValue(szKey, "CEDA");
  endif;                              
 
   Enable(LOGGING);
SdShowMsg ("",FALSE);
   
end;

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   Check Excel-Path
//
//  EVENT:      Function checks for existing the Excel-Path in the Registry
//    
//
//////////////////////////////////////////////////////////////////////////////
function GetExcelPath()

string szKey, szNumName, svNumValue, szMsg, szFileName;
number nResult, nvType, nvSize;

begin
   
   szFileName = "Excel.exe";


RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey    = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Excel.exe";
szNumName = "Path";

nResult = RegDBGetKeyValueEx (szKey, szNumName, nvType, svNumValue, nvSize);
if nResult < 0 then
 MessageBox ("Excel not found!!", SEVERE);
else
 //SprintfBox(INFORMATION," Excel Suche","Excel gefunden in Pfad: %s",svNumValue);
 EXCELDIR = svNumValue + "Excel.exe";
endif;    

   
end;

//////////////////////////////////////////////////////////////////////////////
//
//  FUNCTION:   CheckDotNet2
//
//  EVENT:      Function checks for existing .NET Framework 2.0 Installation
//    
//
//////////////////////////////////////////////////////////////////////////////
function CheckDotNet2()
string szKey;
number nResult;
begin
// Registry Key for .NET 2.0
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey    = "SOFTWARE\\Microsoft\\.NETFramework\\Policy\\v2.0";

nResult = RegDBKeyExist ( szKey );
if nResult < 0 then
 return (-1);
else
 return(0);
endif;    

end;


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 06 June 2012 - 16:59

I think you have to add a "Major Upgrade" item in the releases view (or something like that, I don't exactly recall Developer 8).

PHYOE2004

PHYOE2004
  • Full Members
  • 12 posts

Posted 07 June 2012 - 02:43

Dear Stefan,

Thanks for your reply. Yes I do Major Upgrade and I always change Product Code upon new Installer generation. What I do I suspect is, during Un-installation he removed all the files then he goes to OnEnd() Event. OnEnd() Event has writing some config on the application's configuration file and some other registration (you can check on my script) and raise error. Then he continue to process the installation.

at OnEnd() Event I already put if !MAINTENANCE then condition why he still process? How can I avoid for it?

Thanks for your support.

Thanks & Regards,
Phyoe

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 07 June 2012 - 08:10

I'm not sure. Did you verify the value of MAINTENANCE in the debugger? I don't know what script events are called in which order during a major upgrade of an InstallScript MSI project. Variables like MAINTENANCE might even be shared between the two installations.