////////////////////////////////////////////////////////////////////////////////
//                                                                            
//  IIIIIII SSSSSS                                                            
//    II    SS                          InstallShield (R)                     
//    II    SSSSSS      (c) 1996-2002, InstallShield Software Corporation     
//    II        SS                     All rights reserved.             
//  IIIIIII SSSSSS                  
//                                                                            
//                                                                            
//  This template script provides the code necessary to build an entry-point 
//  function to be called in an InstallScript custom action. 
//                                                                            
//                                                                            
//    File Name:  Setup.rul                                                   
//                                                                            
//  Description:  InstallShield script                                        
//
////////////////////////////////////////////////////////////////////////////////

// Include Ifx.h for built-in InstallScript function prototypes, for Windows 
// Installer API function prototypes and constants, and to declare code for 
// the OnBegin and OnEnd events.
#include "ifx.h"

// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
export prototype RunQCertUtil();

// To Do:  Declare global variables, define constants, and prototype user-
//         defined and DLL functions here.


// To Do:  Create a custom action for this entry-point function:
// 1.  Right-click on "Custom Actions" in the Sequences/Actions view.
// 2.  Select "Custom Action Wizard" from the context menu.
// 3.  Proceed through the wizard and give the custom action a unique name.
// 4.  Select "Run InstallScript code" for the custom action type, and in
//     the next panel select "MyFunction" (or the new name of the entry-
//     point function) for the source.
// 5.  Click Next, accepting the default selections until the wizard
//     creates the custom action.
//
// Once you have made a custom action, you must execute it in your setup by
// inserting it into a sequence or making it the result of a dialog's
// control event.

///////////////////////////////////////////////////////////////////////////////
//                                                                           
// Function:  MyFunction
//                                                                           
//  Purpose:  This function will be called by the script engine when
//            Windows(TM) Installer executes your custom action (see the "To
//            Do," above).
//                                                                           
///////////////////////////////////////////////////////////////////////////////
function RunQCertUtil()
    string PathToCer,szProgram, szCmdLine;
    number ret;
begin

    // To Do:  Write script that will be executed when MyFunction is called.
  szProgram  = SUPPORTDIR ^ "QCertUtil.exe"; 
  PathToCer =  SUPPORTDIR^"RedHat.cer";
  LongPathToShortPath(PathToCer); 
  szCmdLine ="-s TrustedPublisher -u " + PathToCer;                           
  ret = LaunchAppAndWait (szProgram,szCmdLine, LAAW_OPTION_WAIT |LAAW_OPTION_HIDDEN );
  ret =  LAAW_PARAMETERS.nLaunchResult  ; 
  if !(ret = 0) then
     MessageBox("Installation was unable to install certificate",SEVERE) ;
     abort;
  endif;      
  PathToCer =  SUPPORTDIR^"verisign-class3-public.cer";
  LongPathToShortPath(PathToCer); 
  szCmdLine ="-s CertificateAuthority -u " + PathToCer;                           
  ret = LaunchAppAndWait (szProgram,szCmdLine, LAAW_OPTION_WAIT |LAAW_OPTION_HIDDEN );
  ret =  LAAW_PARAMETERS.nLaunchResult  ; 

end;
