/// // file name: setup.rul // // description: installshield script of create Website and restore database // // Comments: Create a Web site, restore database / // / / /
// incrude header files / # include "ifx.h"
// String defines
Installation declarations ////
// in Order to Have your installscript function executed as a custom // action by the Windows Installer, IT Must Be prototyped as an // entry-point function.
// The keyword export identifies MyFunction () as an entry-point function // The argument it accepts must be a handle to the Installer database / * export prototype MyFunction (HWND);.. * / Export prototype RestoreDataBase (); // To do: DECLARE GLOBAL VARIABLES, Define Constants, and prototype user- // defined and dll functions here.
// ----- DLL Function Prototype -----
// Your DLL Function Prototypes Prototype Number Dbinstall.OpenForm (); // ---- Script Function Prototype -----
// Your Script Function Prototypes Prototype CreateWebsite (String, String); // Create IIS Site // Your Global Variables Bool IsselectedWebApp; Bool IsselectedCreateWebsite; Bool IsselectedDataBase;
///// // 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 () NUMBER nResult, nSetupType, nvSize, nUser; STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile, svResult String SzlicenseFile; String Sz ServerIP, SZSERVERPORT, SVSERVERIP, SVSERVERPORT; List List, ListStartCopy; Bool Bcustom; hwnd hinstall; begin // to do: if you want to e nable background, window title, and caption bar title // SetTitle (@PRODUCT_NAME, 24, WHITE); SetTitle (@PRODUCT_NAME, 0, BACKGROUNDCAPTION); // Enable (FULLWINDOWMODE); // Enable (BACKGROUND); // SetColor ( Background, RGB (0, 128, 128); shell_Object_folder = @Product_name; NSETUPTYPE = Typical;
DLG_SDWELCOME: SZTITLE = "Welcome"; SZMSG = @ ProjectLongName "Information Management Platform"; NRESULT = SDWELCOME (SZTITLE, SZMSG); if (NResult = BACK) GOTO DLG_SDWELCOME; SZTITLE = "User Information"; svname = "; svcompany = ""; DLG_SDCUSTOMERINFORMATION: NRESULT = SDCUSTomerInformation (Sztitle, Svname, Svcompany, Nuse); if (nresult = back) goto dlg_sdwelcome;
Dlg_SetupType: szTitle = "Setup Type"; szMsg = ""; nResult = SetupType (szTitle, szMsg, "", nSetupType, 0); if (nResult = BACK) then goto Dlg_SdCustomerInformation; else nSetupType = nResult; if (nSetupType =! CUSTOM) then nvSize = 0; FeatureCompareSizeRequired (MEDIA, INSTALLDIR, nvSize); if (nvSize = 0) then MessageBox (szSdStr_NotEnoughSpace, WARNING);! goto Dlg_SetupType; endif; bCustom = FALSE; goto Dlg_SdStartCopy; else bCustom = TRUE; endif; Endif;
DLG_SDASKDESTPATH: NRESULT = SDASKDestPath (Sztitle, Szmsg, InstallDir, 0); if (NRESULT = BACK) GOTO DLG_SETUPTYPE;
Dlg_SdFeatureTree: szTitle = ""; szMsg = ""; if (nSetupType = CUSTOM) then nResult = SdFeatureTree (szTitle, szMsg, INSTALLDIR, "", 2); if (nResult = BACK) goto Dlg_SdAskDestPath; // Get IsSelectedWebApp FeatureGetData ( MEDIA, "WebApp", FEATURE_FIELD_SELECTED, IsSelectedWebApp, svResult); // Get IsSelectedDataBase FeatureGetData (MEDIA, "DataBase", FEATURE_FIELD_SELECTED, IsSelectedDataBase, svResult); // Get IsSelectedCreateWebSite FeatureGetData (MEDIA, "CreateWebSite", FEATURE_FIELD_SELECTED, IsSelectedCreateWebSite, svResult) ;
DLG_SDSTARTCOPY: SZTITLE = "Confirmation Information"; SZMSG = "Please confirm if the information is correct"; listStartCopy = listCreate (Stringlist); // the Following IS An Example of How To Add A String (svname) To a list (ListStartCopy). // eg ListAddString (listStartCopy, svName, AFTER); ListAddString. (listStartCopy, "user name:" svName, AFTER); ListAddString (listStartCopy, "the company name:" svCompany, AFTER); ListAddString (listStartCopy, "installation directory : " INSTALLDIR, AFTER); ListAddString (listStartCopy," installation: ", AFTER); if (IsSelectedWebApp) then FeatureGetData (MEDIA," WebApp ", FEATURE_FIELD_DISPLAYNAME, nResult, svResult); ListAddString (listStartCopy," / t " svResult , AFTER); endif; if (IsSelectedDataBase) then FeatureGetData (MEDIA, "DataBase", FEATURE_FIELD_DISPLAYNAME, nResult, svResult); ListAddString (listStartCopy, "/ t" svResult, AFTER); endif; if (IsSelectedCreateWebSite) then FeatureGetData (MEDIA , "CreateWebsite", Feature_field_DisplayName, Nresult, SvResult; ListAddString (ListStartCopy, "/ T" SvResult SzServerIP svServerIP "/ t" szServerPort svServerPort, AFTER); endif; nResult = SdStartCopy (szTitle, szMsg, listStartCopy); ListDestroy (listStartCopy); if (nResult = BACK) then if (bCustom) then goto Dlg_SetupType!; Else Goto DLG_SDFEATURETREE; ENDIF; Endif; DLG_ASKText: // Setting Database Server dialog if (isselectededCreateWebsite "Then Sztitle =" Setting IIS Information Site Information "; SzMsg =" Now set IIS system "; szquestion =" Please enter this server IP address, the installer will set IIS information in accordance with the information you provide.
"; SzServerIP =" Address: "; szServerPort =" Port: "; svServerIP =" 127.0.0.1 "; svServerPort =" 100 "; SetDialogTitle (DLG_ASK_TEXT, szTitle); nResult = SdShowDlgEdit2 (szTitle, szQuestion, szServerIP, szServerPort, svServerIP , svserverport; if (! bcustom) Then goto DLG_SETUPTYPE; Else Goto DLG_SDFEATREE; ENDIF; Endif; Endif; // setup default stat SetStatusWindow (0, "Copying files ..."); Enable (STATUSEX); StatusUpdate (ON, 100); if (IsSelectedCreateWebSite) then CreateWebSite (svServerIP, svServerPort); // start creating the IIS site endif; if (IsSelectedDataBase) then RestoreDataBase (); endif; return 0; end; /// //// FUNCTION: OnFirstUIAfter //// EVENT: FirstUIAfter event is sent after file transfer, when installation // is run for the first time on given machine In this event handler // installation usually displays UI that will inform end user. That // Installation H As been completed successfully.////function onfirstuiafter () String szmsg2, szmsg1, szmsg2, szoption1, szoption2; Number Bopt1, Bopt2; Begin
Disable (statusex);
bOpt1 = FALSE; bOpt2 = FALSE; szMsg1 = SdLoadString (IFX_SDFINISH_MSG1); SdFinishEx (szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); end; ////// FUNCTION: OnBegin //// EVENT: Begin Event is always Sent as the first thing during installation.////function onbegin () begin isselectedWebApp = true; isselected ;.,::::::::::::::::::::::::::::::::::::::::::::
// // Create IIS site // function CreateWebSite (szServerIPDefault, szServerPortDefault) STRING szCmdLine, szWaitTxt; begin if ((szServerIPDefault = "") || (szServerPortDefault = "")) then MessageBox ( "you do not set" @ Product_name "Run server IP address or port !! IIS information service settings failed! / N Please create an IIS site yourself and set the main directory to:" installdir, severe); Else Szwaittxt = "is creating an IIS and settings sites. ... "; szwaittxt, true); delay (2); szcmdline = supportdir ^" mkw3site.vbs " " -r " installdir " -i " SZSERVERIPDEFAULT " -o " SZSERVERPORTDEFAULT " -t " @Product_name; if ("Wscript.exe", Szcmdline, Wait) The MessageBox ("You cannot establish a web virtual directory, no wscript.exe or execute script errors.", Seved; sdif; sdif; szwaittxtXT , False; Endif; Return 0; End; / * /
Function: Restoredatabase
Purpose: Calls a Function To Stream A File Out of the Binary Table, Then Calls Usedll and Unusedll restore database
Implementation:
/ * /
function RestoreDataBase () STRING szBinaryKey, szFileName; NUMBER nResult; begin / * TO DO: Use your Binary key and file name * / szBinaryKey = "BINARYKEY"; szFileName = SUPPORTDIR ^ "DBInstall.dll";
// streamfilefrombinary (hinstall, szbinarykey, szfilename);
NResult = Usedll (SZFileName); / * to do: make your function call here
Be Sure To Prototype your function before you call it, Otherwise the script will fail to compile. * /
NResult = dbinstall.openform (); NRESULT = unusedll (szfilename);
END;
// --- Include Script File Section ---