InstallShiled Setup脚本收藏

  1. //===========================================================================
  2. //
  3. //  File Name:    Setup.rul
  4. //
  5. //  Description:  Blank setup main script file
  6. //
  7. //  Comments:     Blank setup is an empty setup project. If you want to
  8. //                create a new project via. step-by step instructions use the
  9. //                Project Assistant.
  10. //
  11. //===========================================================================
  12. // Included header files ----------------------------------------------------
  13. #include "ifx.h"
  14. //原型创建卸载快捷方式
  15. prototype CreateUninstallShortcut();   
  16. //注册第三方DLL函数
  17. prototype CallRegsterThirdDLL();   
  18. prototype CallUnRegsterThirdDLL(); 
  19. //先安装的组件函数
  20. prototype SetupPreCompontDLLorExe();
  21. //---------------------------------------------------------------------------                                                                        
  22. // OnFirstUIBefore
  23. // 第一个窗体之前  执行事件
  24. // First Install UI Sequence - Before Move Data
  25. //
  26. // The OnFirstUIBefore event is called by OnShowUI when the setup is
  27. // running in first install mode. By default this event displays UI allowing
  28. // the end user to specify installation parameters.
  29. //
  30. // Note: This event will not be called automatically in a
  31. // program...endprogram style setup.
  32. //---------------------------------------------------------------------------
  33. function OnFirstUIBefore()
  34.     number  nResult, nLevel, nSize, nSetupType;
  35.     string  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
  36.     string  szName, szCompany, szTargetPath, szDir, szFeatures;
  37.     BOOL    bLicenseAccepted;   
  38. begin   
  39.    
  40.     nSetupType = COMPLETE;  
  41.     szDir = TARGETDIR;
  42.     szName = "";
  43.     szCompany = "";
  44.     bLicenseAccepted = FALSE;  
  45.     
  46.     //调用 先安装的组件函数  
  47.     SetupPreCompontDLLorExe();  
  48.     
  49.       
  50. // Beginning of UI Sequence
  51. Dlg_Start:
  52.     nResult = 0;
  53. Dlg_SdWelcome:
  54.     szTitle = "";
  55.     szMsg = "";
  56.     //{{IS_SCRIPT_TAG(Dlg_SdWelcome)
  57.     nResult = SdWelcome( szTitle, szMsg );
  58.     //}}IS_SCRIPT_TAG(Dlg_SdWelcome)
  59.     if (nResult = BACK) goto Dlg_Start;
  60. Dlg_SdLicense2:
  61.     szTitle = "";
  62.     szOpt1 = "";
  63.     szOpt2 = "";
  64.     //{{IS_SCRIPT_TAG(License_File_Path)
  65.     szLicenseFile = SUPPORTDIR ^ "Eula.rtf";
  66.     //}}IS_SCRIPT_TAG(License_File_Path)
  67.     //{{IS_SCRIPT_TAG(Dlg_SdLicense2)
  68.     nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
  69.     //}}IS_SCRIPT_TAG(Dlg_SdLicense2)
  70.     if (nResult = BACK) then
  71.         goto Dlg_SdWelcome;
  72.     else
  73.         bLicenseAccepted = TRUE;
  74.     endif;
  75. Dlg_SdRegisterUser:
  76.     szMsg = "";
  77.     szTitle = "";
  78.     //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)   
  79.    // nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
  80.     //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
  81.     if (nResult = BACK) goto Dlg_SdLicense2;
  82. Dlg_SetupType2:   
  83.     szTitle = "";
  84.     szMsg = "";
  85.     nResult = CUSTOM;
  86.     //{{IS_SCRIPT_TAG(Dlg_SetupType2)   
  87.     nResult = SetupType2( szTitle, szMsg, "", nSetupType, 0 );     //完整/自定义安装
  88.     //}}IS_SCRIPT_TAG(Dlg_SetupType2)
  89.     if (nResult = BACK) then
  90.         goto Dlg_SdRegisterUser;
  91.     else
  92.         nSetupType = nResult;
  93.         if (nSetupType != CUSTOM) then
  94.             szTargetPath = TARGETDIR;
  95.             nSize = 0;
  96.             FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );
  97.             if (nSize != 0then      
  98.                 MessageBox( szSdStr_NotEnoughSpace, WARNING );
  99.                 goto Dlg_SetupType2;
  100.             endif;
  101.         endif;   
  102.     endif;
  103. Dlg_SdAskDestPath2:
  104.     if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
  105.     szTitle = "";
  106.     szMsg = "";
  107.     if (nSetupType = CUSTOM) then
  108.                 //{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)   
  109.         nResult = SdAskDestPath2( szTitle, szMsg, szDir );
  110.                 //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
  111.         TARGETDIR = szDir;
  112.     endif;
  113.     if (nResult = BACK) goto Dlg_SetupType2;
  114. Dlg_SdFeatureTree: 
  115.     if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2;
  116.     szTitle = "";
  117.     szMsg = "";
  118.     szFeatures = "";
  119.     nLevel = 2;
  120.     if (nSetupType = CUSTOM) then
  121.         //{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)    
  122.         nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
  123.         //}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
  124.         if (nResult = BACK) goto Dlg_SdAskDestPath2;  
  125.     endif;
  126. Dlg_SQLServer:
  127.     nResult = OnSQLServerInitialize( nResult );
  128.     if( nResult = BACK ) goto Dlg_SdFeatureTree;
  129. Dlg_ObjDialogs:
  130.     nResult = ShowObjWizardPages( nResult );
  131.     if (nResult = BACK) goto Dlg_SQLServer;
  132.     
  133. Dlg_SdStartCopy2:
  134.     szTitle = "";
  135.     szMsg = "";
  136.     //{{IS_SCRIPT_TAG(Dlg_SdStartCopy2) 
  137.     nResult = SdStartCopy2( szTitle, szMsg );   
  138.     //}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
  139.     if (nResult = BACK) goto Dlg_ObjDialogs;
  140.     // Added in 11.0 - Set appropriate StatusEx static text.
  141.     SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
  142.     return 0;
  143. end;
  144. //定义 先安装的组件函数
  145. function SetupPreCompontDLLorExe()   
  146. string  szDotNetFx,SzLanguagePack; 
  147. string  szAERRealVersion,szAERSpNumber; 
  148. string  svNumber;
  149. number  nvType,nvSize;
  150. string szOfficeLastProduct,svOfficeValue;  
  151. string szWinInstallerExe;
  152. begin 
  153.     //安装Window Installer 3.1   有哪些任兄知道的说一下谢谢!
  154.     //szWinInstallerExe=SUPPORTDIR ^ "WINDOWSINSTALLER-KB893803-V2-X86.EXE";
  155.     //RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );   
  156.     //if (RegDBKeyExist ("SOFTWARE//Classes//Msi.Package" ) < 0) then 
  157.     //  SdShowMsg("正在安装Window Installer 3.1,请稍候......",TRUE); 
  158.     //  LaunchAppAndWait(szWinInstallerExe,"",WAIT);  
  159.     //endif;
  160.         
  161.     
  162.     //安装.NetFramework2.0
  163.     szDotNetFx = SUPPORTDIR ^ "dotnetfx.exe";
  164.     SzLanguagePack = SUPPORTDIR ^ "langpack.exe";
  165.     //szMDAC = SUPPORTDIR ^ "MDAC2.8.EXE";   //v1.1 
  166.     RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );   
  167.     if (RegDBKeyExist ("SOFTWARE//Microsoft//.NETFramework//policy//v2.0" ) < 0then             
  168.         SdShowMsg("正在安装.Net2.0运行环境,请稍候......",TRUE); 
  169.         LaunchAppAndWait(szDotNetFx,"",WAIT);
  170.         LaunchAppAndWait(SzLanguagePack,"",WAIT);    
  171.     endif;
  172.     //安装MDAC2.8
  173.     //RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );   
  174.     //if (RegDBKeyExist ("SOFTWARE//Classes//MDACVer.Version.2.80" ) < 0) then     
  175.     //  LaunchAppAndWait(szMDAC,"",WAIT);    
  176.     //endif;   
  177.     //判断是否安装了ArcEngine9.2+SP3补丁包 
  178.     szAERRealVersion="9.2"; 
  179.     szAERSpNumber="3";
  180.     nvSize=-1;
  181.     RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );   
  182.     if (RegDBGetKeyValueEx ("SOFTWARE//ESRI//ArcGIS Engine Runtime","RealVersion",nvType,svNumber,nvSize) < 0then 
  183.         MessageBox ("未安装ArcEngine9.2+SP3补丁包,请本安装完成后再安装!", SEVERE);
  184.     else
  185.         if(svNumber!=szAERRealVersion) then
  186.             MessageBox ("未安装ArcEngine9.2+SP3补丁包,请本安装完成后再安装!", SEVERE); 
  187.         else
  188.             if(RegDBGetKeyValueEx ("SOFTWARE//ESRI//ArcGIS Engine Runtime","SPNumber",nvType,svNumber,nvSize) < 0then  
  189.                MessageBox ("未安装ArcEngine9.2+SP3补丁包,请本安装完成后再安装!", SEVERE);
  190.             else    
  191.                if(svNumber!=szAERSpNumber) then
  192.                     MessageBox ("未安装ArcEngine9.2+SP3补丁包,请本安装完成后再安装!", SEVERE);
  193.                endif; 
  194.             endif; 
  195.         endif;
  196.     endif;  
  197.     //判断是否安装了Microsoft Office 2003 V11.0+SP2及以上版本 
  198.     szOfficeLastProduct="11.0.7969.0";  //sp2 版本号    
  199.     RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE ); 
  200.     if (RegDBKeyExist ("SOFTWARE//Microsoft//Office//11.0//Common//ProductVersion" ) < 0then             
  201.         MessageBox ("未安装Microsoft Office 2003 V11.0+SP2及以上版本,请本安装完成后再安装!", SEVERE); 
  202.     else
  203.         if(RegDBGetKeyValueEx ("SOFTWARE//Microsoft//Office//11.0//Common//ProductVersion","LastProduct",nvType,svOfficeValue,nvSize) < 0then 
  204.             MessageBox ("未安装Microsoft Office 2003 V11.0+SP2及以上版本,请本安装完成后再安装!", SEVERE); 
  205.         else    
  206.            if(svOfficeValue<szOfficeLastProduct) then
  207.                 MessageBox ("未安装Microsoft Office 2003 V11.0+SP2及以上版本,请本安装完成后再安装!", SEVERE); 
  208.            endif; 
  209.         endif;
  210.     endif; 
  211. end
  212. //注册第三方DLL函数
  213. function CallRegsterThirdDLL() 
  214. string szDevExpress_Dll,szmicrosoft_mshtml_dll;
  215. begin
  216.     //安装完后注册 DevExpress_Dll
  217.     szDevExpress_Dll = TARGETDIR ^ "//devexpress_dll//reg.bat";
  218.     //SdShowMsg("正在注册 DevExpress_Dll,请稍候......",TRUE); 
  219.     //Delay(2);
  220.     if(LaunchAppAndWait(szDevExpress_Dll,"",WAIT)<0then
  221.     endif;     
  222.     
  223.     //安装完后注册 microsoft_mshtml_dll
  224.     szmicrosoft_mshtml_dll = TARGETDIR ^ "//microsoft_mshtml_dll//reg.bat";
  225.     //SdShowMsg("正在注册 microsoft_mshtml_dll,请稍候......",TRUE); 
  226.     //Delay(2);
  227.     if(LaunchAppAndWait(szmicrosoft_mshtml_dll,"",WAIT)<0then
  228.     endif;  
  229. end;
  230. //调用 卸载第三方组件
  231. function CallUnRegsterThirdDLL() 
  232. string szDevExpress_Dll,szmicrosoft_mshtml_dll;
  233. begin
  234.     //安装完后注册 DevExpress_Dll
  235.     szDevExpress_Dll = TARGETDIR ^ "//devexpress_dll//unreg.bat";
  236.     //SdShowMsg("正在注册 DevExpress_Dll,请稍候......",TRUE);   
  237.     //Delay(2);
  238.     if(LaunchAppAndWait(szDevExpress_Dll,"",WAIT)<0then
  239.     endif;  
  240.     
  241.     //LaunchApp(szDevExpress_Dll,"");   
  242.     
  243.     //安装完后注册 microsoft_mshtml_dll
  244.     szmicrosoft_mshtml_dll = TARGETDIR ^ "//microsoft_mshtml_dll//unreg.bat";
  245.     //SdShowMsg("正在注册 microsoft_mshtml_dll,请稍候......",TRUE);
  246.     //Delay(2);         
  247.     //NOWAIT 
  248.     if(LaunchAppAndWait(szmicrosoft_mshtml_dll,"",WAIT) <0then
  249.     endif;  
  250. end;
  251. //定义创建卸载快捷方式
  252. function CreateUninstallShortcut()   
  253.  string strCmdLine;  
  254.  LIST lstPath; 
  255.  begin   
  256.  // For an InstallScript installation:
  257.  strCmdLine = DISK1TARGET ^ "Setup.exe";    
  258.  // For an InstallScript MSI installation:
  259.  strCmdLine = UNINSTALL_STRING;    
  260.  // The path has to be handled differently if you are running   
  261.  // an InstallScript MSI installation on Windows 9X.  
  262.  if (SYSINFO.WIN9X.bWin9X ) then   
  263.      lstPath = ListCreate( STRINGLIST );  
  264.     StrGetTokens( lstPath, UNINSTALL_STRING, "/" );    
  265.     
  266.     ListGetFirstString( lstPath, strCmdLine );  
  267.     LongPathToQuote( strCmdLine, TRUE );    
  268.     
  269.     strCmdLine = strCmdLine + " /M" + PRODUCT_GUID; 
  270. endif;  
  271.  // Create the shortcut. 
  272.  AddFolderIcon(FOLDER_PROGRAMS ^ "XXXXX系统","卸载XXXXX系统V1.0",strCmdLine,"",TARGETDIR ^ "//remove.ico",0,"",REPLACE);  
  273. end;   
  274. //---------------------------------------------------------------------------
  275. // OnFirstUIAfter
  276. //
  277. // First Install UI Sequence - After Move Data
  278. //
  279. // The OnFirstUIAfter event called by OnShowUI after the file transfer
  280. // of the setup when the setup is running in first install mode. By default
  281. // this event displays UI that informs the end user that the setup has been
  282. // completed successfully.
  283. //
  284. // Note: This event will not be called automatically in a
  285. // program...endprogram style setup.
  286. //---------------------------------------------------------------------------
  287. function OnFirstUIAfter()
  288.     STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
  289.     NUMBER bvOpt1, bvOpt2;
  290.     NUMBER bShowUpdateServiceDlg;  
  291. begin
  292.     ShowObjWizardPages(NEXT);
  293.     
  294.     szTitle = "";
  295.     szMsg1 = ""; 
  296.     szMsg2 = "";
  297.     szOpt1 = "";
  298.     szOpt2 = "";
  299.     bvOpt1   = FALSE;
  300.     bvOpt2   = FALSE;    
  301.     // Set this to true if you have the update service enabled, and if you want to check for updates.
  302.     // Note: the ISUS Starter Edition does not support checking for updates programatically.  So, 
  303.     // only set this to true if you have at least the ISUS Professional Edition.
  304.     bShowUpdateServiceDlg = FALSE; 
  305.      
  306.     //调用 创建卸载快捷方式
  307.     CreateUninstallShortcut(); 
  308.                               
  309.     //调用第三方组件 函数  
  310.     CallRegsterThirdDLL(); 
  311.                               
  312.     //{{IS_SCRIPT_TAG(Dlg_SdDinishEx)   
  313.     
  314.     if ( BATCH_INSTALL ) then
  315.         SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
  316.     else
  317.         
  318.         // If the update service is enabled, show finish dialog that includes
  319.         // update check option.
  320.         if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then
  321.             if( SdFinishUpdateEx( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, TRUE ) ) then
  322.                 // Don't check for updates in silent mode.
  323.                 if( MODE != SILENTMODE ) then
  324.                     UpdateServiceCheckForUpdates( "", FALSE );
  325.                 endif;
  326.             endif;
  327.         else
  328.             SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
  329.         endif;
  330.     endif;
  331.     //}}IS_SCRIPT_TAG(Dlg_SdDinishEx)   
  332. end;
  333. //---------------------------------------------------------------------------
  334. // OnSetTARGETDIR
  335. //
  336. // OnSetTARGETDIR is called directly by the framework to initialize
  337. // TARGETDIR to it's default value.
  338. //
  339. // Note: This event is called for all setups.
  340. //---------------------------------------------------------------------------
  341. function OnSetTARGETDIR()
  342. number nId, nIgnore, nResult;
  343. string szId, szTARGETDIR;
  344. begin
  345.     // In maintenance mode the value of TARGETDIR is read from the log file.
  346.     if( MAINTENANCE ) then
  347.         return ISERR_SUCCESS;
  348.     endif;
  349.     // Set TARGETDIR to script default.
  350.     TARGETDIR = "<FOLDER_APPLICATIONS>//XXXX系统";
  351.     // Read TARGETDIR from the media.
  352.     nResult = MediaGetData( MEDIA, MEDIA_FIELD_TARGETDIR, nIgnore, szTARGETDIR );
  353.     // Use the TARGETDIR from the media if anything was read.
  354.     if( nResult >= ISERR_SUCCESS && StrLengthChars( szTARGETDIR ) ) then
  355.         TARGETDIR = szTARGETDIR;
  356.     endif;
  357.         
  358.     // Customize the default TARGETDIR for multi-instance application.
  359.     // TODO: If you want something different customize the code below.  
  360.     if( MAINT_OPTION = MAINT_OPTION_MULTI_INSTANCE  && MULTI_INSTANCE_COUNT > 0then
  361.         // Start with the current multi-instance count plus one.
  362.         nId = MULTI_INSTANCE_COUNT + 1;
  363.         // Find a unique TARGETDIR.
  364.         while( ExistsDir( TARGETDIR ) = EXISTS )
  365.             
  366.             // Convert to string.
  367.             NumToStr( szId, nId );
  368.             
  369.             // Update IFX_MULTI_INSTANCE_SUFFIX
  370.             IFX_MULTI_INSTANCE_SUFFIX = "_" + szId;
  371.         
  372.             // Update TARGETDIR
  373.             TARGETDIR = TARGETDIR + IFX_MULTI_INSTANCE_SUFFIX;
  374.             
  375.             // Update nId
  376.             nId = nId + 1;
  377.         endwhile;
  378.     endif;
  379. end;
  380. //---------------------------------------------------------------------------
  381. // OnMoved
  382. //
  383. // The OnMoved event is called as a result of the setup calling
  384. // FeatureTransferData or FeatureMoveData. The event is called when
  385. // all file transfer operations are completed except for batch
  386. // self-registration which is performed immediately after this event returns.
  387. // During uninstallation this event sent after uninstallation is completed,
  388. // therefore you should not modify system state in this event.
  389. //---------------------------------------------------------------------------
  390. function OnMoved()
  391. begin  
  392. end;
  393. //---------------------------------------------------------------------------
  394. // OnSetUpdateMode
  395. //
  396. // OnSetUpdateMode is called directly by the framework to set the UPDATEMODE
  397. // InstallShield system variable appropriately to control which UI events
  398. // are called by OnShowUI.
  399. //
  400. // Note: This event is called for all setups.
  401. //---------------------------------------------------------------------------
  402. function OnSetUpdateMode()
  403.     number  nIgnore, nMediaFlags, nInstalledVersion, nUpdateVersion, nResult;
  404.     string  szVersion, szIgnore, szMsg;
  405. begin
  406.     
  407.     UPDATEMODE = FALSE; // Non-update mode by default.
  408.     // Added 11.5 - Don't set UPDATEMODE when running from Add/Remove
  409.     if( ADDREMOVE ) then
  410.         return ISERR_SUCCESS;
  411.     endif;
  412.     // Added 11.5 - Don't set UPDATEMODE when REMOVEONLY is specified
  413.     if( REMOVEONLY ) then
  414.         return ISERR_SUCCESS;
  415.     endif;
  416.     // Get the media flags.
  417.     MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );
  418.     if( ! ( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) ) then
  419.         return ISERR_SUCCESS; // Update mode not supported by the setup.
  420.     endif;
  421.     // TODO: If you are updating an application that was installed by a previous
  422.     // version of InstallShield, IFX_INSTALLED_VERSION will be empty, and
  423.     // VERSION_COMPARE_RESULT_NOT_INSTALLED will be returned by
  424.     // VerProductCompareVersions. Change the value of IFX_INSTALLED_VERSION (and
  425.     // IFX_INSTALLED_DISPLAY_VERSION) here based on application specific version
  426.     // information determined by the setup. Only do this if IFX_INSTALLED_VERSION
  427.     // is empty.
  428.     //if ( !StrLengthChars( IFX_INSTALLED_VERSION ) && MAINTENANCE ) then
  429.     //  IFX_INSTALLED_VERSION = "X.XX.XXX";
  430.     //  IFX_INSTALLED_DISPLAY_VERSION = IFX_INSTALLED_VERSION;
  431.     //endif;
  432.     // Verify that the installed version is valid.
  433.     if( !StrLengthChars( IFX_INSTALLED_VERSION ) && MAINTENANCE ) then
  434.         // If this error occurs, IFX_INSTALLED_VERSION needs to be set manually.
  435.         szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_NO_INSTALLED_VERSION );
  436.         MessageBox( szMsg, SEVERE );
  437.         abort;
  438.     endif;
  439.     // Verify that the product version is valid.
  440.     if( !StrLengthChars( IFX_PRODUCT_VERSION ) ) then
  441.         // If this error occures, IFX_PRODUCT_VERSION was not initialized correctly.
  442.         szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_NO_PRODUCT_VERSION );
  443.         MessageBox( szMsg, SEVERE );
  444.         abort;
  445.     endif;
  446.     // Do the version comparison.
  447.     nResult = VerProductCompareVersions();
  448.     // Make sure that valid data was returned by VerProductCompareVersions
  449.     if( nResult < ISERR_SUCCESS ) then
  450.         szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_VERSION_COMPARE_FAILURE );
  451.         MessageBox( szMsg, SEVERE );
  452.         abort;
  453.     endif;
  454.     // Set update mode if this is a differential media or the product is already installed and the versions do not match.
  455.     UPDATEMODE = ( nMediaFlags & MEDIA_FLAG_FORMAT_DIFFERENTIAL || ( MAINTENANCE && ( nResult != VERSION_COMPARE_RESULT_SAME ) ) );
  456. end;
  457. //---------------------------------------------------------------------------
  458. // OnCheckMediaPassword
  459. //
  460. // Displays a password dialog if the media is password protected.
  461. //
  462. // Note: This event is called for all setups.
  463. //---------------------------------------------------------------------------
  464. function OnCheckMediaPassword()
  465. string szResult, szMsg;
  466. BOOL bValidated;
  467. begin
  468.     // Check whether the setup author selected this option.
  469.     if( !SHOW_PASSWORD_DIALOG ) then;
  470.         return ISERR_SUCCESS;
  471.     endif;
  472.     // Check whether the password has been specified previously.
  473.     LogReadCustomString( MEDIA_PASSWORD_KEY, szResult );
  474.     if( FeatureValidate( MEDIA, "", szResult ) == 0 ) then
  475.         return ISERR_SUCCESS;
  476.     endif;
  477.     // "Back" button should be disabled.
  478.     Disable( BACKBUTTON );
  479.     // Attempt to validate the media.
  480.     bValidated = FALSE;
  481.     // Loop until the password is validated.
  482.     while( !bValidated )
  483.         // Prompt for password.
  484.         if( EnterPassword( "", "", szResult ) < ISERR_SUCCESS ) then
  485.             abort; // Failed to display password dialog
  486.         endif;
  487.         // Attempt to validate the media.
  488.         if( FeatureValidate( MEDIA, "", szResult ) == 0 ) then
  489.             
  490.             // Store the media password for maintenance mode.
  491.             LogWriteCustomString( MEDIA_PASSWORD_KEY, szResult );
  492.             bValidated = TRUE;
  493.         else
  494.             szMsg = SdLoadString( IDS_IFX_ERROR_INVALID_MEDIA_PASSWORD );
  495.             MessageBox( szMsg, INFORMATION );
  496.         endif;
  497.     endwhile;
  498.     // Enable "Back" button.
  499.     Enable( BACKBUTTON );
  500. end;
  501. //---------------------------------------------------------------------------
  502. // OnEnd
  503. //
  504. // The OnEnd event is called at the end of the setup. This event is not
  505. // called if the setup is aborted.
  506. //---------------------------------------------------------------------------
  507. function OnEnd()  
  508. begin 
  509. end;  
  510. //---------------------------------------------------------------------------
  511. // OnUninstall
  512. //
  513. // The OnUninstall event is called when the setup is run with the -uninst
  514. // switch, in this case this is the only event that will be called.
  515. //---------------------------------------------------------------------------
  516. function OnUninstall()
  517. string szIgnore, szMsg;
  518. number nResult;
  519. BOOL bOpt1, bOpt2;
  520. begin
  521.     // Hide the initial progress dialog.
  522.     Disable( DIALOGCACHE );
  523.     
  524.     // Show Uninstall Confirmation Dialog
  525.     if( MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO ) != IDYES ) then
  526.         abort;
  527.     endif;
  528.     
  529.     //调用反安装函数
  530.     CallUnRegsterThirdDLL();
  531.     // Remove all features.
  532.     FeatureRemoveAllInMediaAndLog();
  533.     // Added in 11.0, disable the cancel button during uninstall.
  534.     if( REMOVEALLMODE ) then
  535.         Disable( CANCELBUTTON );
  536.     endif;
  537.     
  538.     // Added in 11.0 - Set appropriate StatusEx static text.
  539.     // Moved in 12.1 - Set before calling Enable( STATUSEX ) to ensure proper product name updating.
  540.     SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );
  541.     // Show Status
  542.     SetStatusWindow( 0, "" );
  543.     Enable( STATUSEX );
  544.     StatusUpdate( ON, 100 );
  545.     // Uninstall
  546.     nResult = FeatureTransferData( MEDIA );
  547.     // Handle move data error and abort if error occured.
  548.     if( nResult < ISERR_SUCCESS ) then
  549.         OnComponentError();
  550.         abort;
  551.     endif;
  552.     // Disable Status
  553.     Disable( STATUSEX );
  554.     // Show final dialog.
  555.     if ( BATCH_INSTALL ) then
  556.         SdFinishReboot( SdLoadString(IFX_SDFINISH_REMOVE_TITLE), SdLoadString(IFX_SDFINISH_REMOVE_MSG2), SYS_BOOTMACHINE, "", 0 );
  557.     else    
  558.         SdFinish( SdLoadString(IFX_SDFINISH_REMOVE_TITLE), SdLoadString(IFX_SDFINISH_REMOVE_MSG1), "", "" , "", bOpt1 , bOpt2 );
  559.     endif;
  560. end;
  561.         
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值