setup.rul
做的是繁体的 简体下面有些文字显示乱码
将就看吧
不懂的发邮件
- //
- // 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"
- // string defines
- installation declarations ///
- // ----- DLL function prototypes -----
- // your DLL function prototypes
- // ---- script function prototypes -----
- // your script function prototypes
- prototype CreateDataBase(STRING,STRING,STRING,STRING,STRING);//戈畐
- prototype CreateWebSite(STRING,STRING);//IIS
- prototype CreateVirtualDir(STRING);//店览ヘ魁
- prototype CheckIIS(); //浪代琌杆iis
- prototype Checkie(); //浪代ieセ
- prototype Checkmdac(); //浪代mdacセ
- prototype regcom(); //爹jamil舱ン
- prototype DelIIS(STRING);//埃店览ヘ魁
- prototype Writeini(STRING,STRING,STRING,STRING,STRING,STRING,BOOL);
- prototype DelDataBase(STRING,STRING,STRING,STRING);
- prototype UpdateKey(STRING,STRING,STRING);//戈畐
- prototype BOOL DoesDatabaseExist(STRING, STRING, STRING, STRING, STRING);
- prototype STRING GetServiceName();
- // 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, FeatureTransferData is called to perform file
- // transfer.
- //
- ///
- function OnFirstUIBefore()
- number nResult,nSetupType;
- string szTitle, szMsg;
- string szLicenseFile, szQuestion;
- string szName, szCompany, szSerial;
- string szFeatures, szTargetdir;
- number nLevel;
- LIST listStartCopy,list;
- number nvSize;
- number nUser;
- number nOpt,svEdit1,svEdit2;
- STRING szServerIP,szServerPort,szServerIPDefault,szServerPortDefault;
- STRING szSQLsvr,szSQLusr,szSQLpwd,svSQLsvr,svSQLusr,svSQLpwd , svDatabaseName,svDataOwner;
- STRING svName, svCompany, svSerial;
- STRING szFile,szTargetPath,szDir,szfolder;
- STRING szField1,szField2;
- STRING szDefault,svResult;
- string szComponents;
- OBJECT piisObj;
- STRING szTitle1;
- STRING szMsg1,szMsg2;
- STRING szMsg11, szMsg12, szOpt1, szOpt2;
- BOOL bvOpt1, bvOpt2;
- begin
- // TO DO: if you want to enable 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));
- //SetFont (FONT_TITLE, STYLE_NORMAL, "Ш砰");
- //SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
- TARGETDIR = "C:"^"inetpub"^"infofaq";
- szDir = TARGETDIR;
- szName = "刚ノノめ";
- szCompany = "infofaq";
- Dlg_Start:
- // beginning of dialogs label
- /*
- Dlg_SdWelcome:
- szTitle = "";
- szMsg = "";
- nResult = SdWelcome( szTitle, szMsg );
- if (nResult = BACK) goto Dlg_Start;
- Dlg_SdLicense:
- szLicenseFile = SUPPORTDIR ^ "license.txt";
- szTitle = "";
- szMsg = "";
- szQuestion = "";
- nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
- if (nResult = BACK) goto Dlg_SdWelcome;
- Dlg_SdCustomerInformation:
- szMsg = "";
- szTitle = "";
- nResult = SdCustomerInformation( szTitle, szName, szCompany, nUser );
- if (nResult = BACK) goto Dlg_SdLicense;
- */
- Dlg_SelMode ://砞竚戈畐狝竟 癸杠よ遏
- if !CheckIIS() then
- MessageBox ("筿福⊿Τ杆IIS叫杆刚",SEVERE);
- abort;
- endif;
- RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
- if (RegDBKeyExist ("SOFTWARE//Microsoft//.NETFramework" ) != 1) then
- /*
- MessageBox ("眤╰参⊿Τ杆.net琜瞷秨﹍杆.NETFramework2.0",INFORMATION);
- if(LaunchAppAndWait ( SUPPORTDIR ^"dotnetfx.exe " , "" ,WAIT)<0) then
- MessageBox ("杆.net琜祇ネ種叫穝杆",SEVERE);
- abort;
- endif;
- */
- MessageBox ("杆.net琜祇ネ種叫杆刚",SEVERE);
- endif;
- if !Checkmdac() then//狦竒杆玥铬筁
- if(LaunchAppAndWait (SUPPORTDIR^"mdac_typ.exe","",WAIT)<0) then
- MessageBox ("杆稬硁戈砐拜じン琌祇ネ叫穝杆",SEVERE);
- abort;
- endif;
- endif;
- Dlg_AskOptions://砞竚IIS翴┪店览ヘ魁
- bvOpt1 = TRUE;
- bvOpt2 = FALSE;
- nResult = AskOptions (EXCLUSIVE, "叫匡拒眤惠杆セ╰参店览ヘ魁临琌翴", "店览ヘ魁", bvOpt1, "IIS翴",bvOpt2);
- if (nResult = BACK) goto Dlg_SelMode;
- Dlg_AskText ://砞竚狝竟癸杠よ遏
- if (bvOpt2) then
- szTitle = "砞竚IIS戈癟狝竟";
- szMsg = "瞷秨﹍砞竚IIS╰参";
- szQuestion=" 叫块セ狝竟诀┪IP,杆祘Α盢酚眤矗ㄑ戈砞竚IIS戈癟狝叭狦眤⊿Τ恶糶杆祘Α盢笆铬筁翴承";
- szServerIP="";
- szServerPort="狠";
- szServerIPDefault="127.0.0.1";
- szServerPortDefault="80";
- SetDialogTitle(DLG_ASK_TEXT,szTitle);
- nResult=SdShowDlgEdit2 (szTitle, szQuestion,szServerIP,szServerPort,szServerIPDefault,szServerPortDefault);
- if (nResult = BACK) goto Dlg_AskOptions;
- else
- szTitle = "砞竚店览ヘ魁";
- szMsg = "瞷秨﹍砞竚店览ヘ魁";
- szQuestion="叫块店览ヘ魁嘿";
- szServerIP="店览ヘ魁嘿";
- szServerIPDefault="infofaq";
- SetDialogTitle(DLG_ASK_TEXT,szTitle);
- nResult=SdShowDlgEdit1(szTitle, szQuestion,szServerIP,szServerIPDefault);
- if (nResult = BACK) goto Dlg_AskOptions;
- endif;
- Dlg_AskSQL ://砞竚戈畐狝竟 癸杠よ遏
- szTitle = "砞竚戈畐1";
- szMsg = "瞷秨﹍砞竚戈畐";
- szQuestion="叫龄戈畐狝竟ㄏノ嘿ㄏノ盞絏狦眤矗ㄑㄏノ嘿㎝盞絏琌岿粇杆祘Α盢笆铬筁戈畐砞竚";
- szSQLsvr="戈畐";
- szSQLusr="ㄏノ嘿";
- szSQLpwd="ㄏノ盞絏";
- svSQLsvr=".";
- svSQLusr="sa";
- svSQLpwd=""; ;
- SetDialogTitle(DLG_ASK_TEXT,szTitle);
- nResult=SdShowDlgEdit3 (szTitle, szQuestion,szSQLsvr,szSQLusr,szSQLpwd,svSQLsvr,svSQLusr,svSQLpwd);
- if (nResult = BACK) goto Dlg_AskText;
- Dlg_AskSQL2 ://砞竚戈畐狝竟 癸杠よ遏
- szTitle = "砞竚戈畐2";
- szMsg = "膥尿砞竚戈畐";
- szQuestion=" 叫块赣戈畐嘿㎝局Τ局Τぃ恶糶";
- svDatabaseName="InfoFAQ";
- svDataOwner="";
- SetDialogTitle(DLG_ASK_TEXT,szTitle);
- nResult=SdShowDlgEdit2 (szTitle, szQuestion,"戈畐嘿","戈畐局Τ",svDatabaseName,svDataOwner);
- if (nResult = BACK) goto Dlg_AskSQL;
- szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /i /""+SUPPORTDIR^"kill.sql/"";
- LaunchAppAndWait("osql.exe", szMsg,WAIT);
- if(DoesDatabaseExist(svSQLsvr,svDatabaseName, "SQL Server",svSQLusr,svSQLpwd))then
- bvOpt1 = TRUE;
- nResult = AskOptions (NONEXCLUSIVE, svDatabaseName+"计沮畐竒盢滦籠Τ"+svDatabaseName+"计沮畐琌称Τ"+svDatabaseName+"计沮畐:", "称Τ"+svDatabaseName+"计沮畐", bvOpt1);
- if (nResult = BACK) goto Dlg_AskSQL2;
- if (bvOpt1) then
- szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"backup database /""+svDatabaseName+"/" to disk ='c://"+svDatabaseName+".dmp'/"";
- LaunchAppAndWait("osql.exe", szMsg,WAIT);
- MessageBox ("戈畐竒称c://"+svDatabaseName+".dmp",INFORMATION);
- //szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"DROP DATABASE /""+svDatabaseName+"/"/"" ;
- //szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"exec sp_dbremove N'"+svDatabaseName+"'" ;
- //LaunchAppAndWait("osql.exe", szMsg,WAIT);
- DelDataBase(svSQLsvr , svSQLusr,svSQLpwd,svDatabaseName);
- endif;
- endif;
- Dlg_SdAskDestPath:
- szTitle = "";
- szMsg = "";
- nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
- TARGETDIR = szDir;
- if (nResult = BACK) goto Dlg_AskSQL2;
- Dlg_SdStartCopy:
- szTitle = "";
- szMsg = "";
- szTitle1 = "杆ア毖";
- szMsg11 = "パ杆祇ネ種旧璓杆ア毖";
- szMsg12 = "翴阑ЧΘ癶杆";
- szOpt1 = "";
- szOpt2 ="";
- listStartCopy = ListCreate( STRINGLIST );
- //ListAddString(listStartCopy,"ノめ"+szName,AFTER);
- //ListAddString(listStartCopy,"そ嘿┯穟戈癟俱Τそ",AFTER);
- //ListAddString(listStartCopy,"硁ン嘿絬醚恨瞶╰参",AFTER);
- ListAddString(listStartCopy,"ヘ夹ヘ魁"+szDir,AFTER);
- //if (svEdit1=TRUE) then
- //ListAddString(listStartCopy,"IP"+szServerIPDefault,AFTER);
- //ListAddString(listStartCopy,"狠"+szServerPortDefault,AFTER);
- //endif;
- ListAddString(listStartCopy,"叫絋粄眤恶糶戈癟˙秨﹍狡籹郎",AFTER);
- // listStartCopy = ListCreate( STRINGLIST );
- //The following is an example of how to add a string(szName) to a list(listStartCopy).
- //eg. ListAddString(listStartCopy,szName,AFTER);
- nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
- ListDestroy(listStartCopy);
- if (nResult = BACK) goto Dlg_SdAskDestPath;
- Enable(STATUSEX);
- StatusUpdate(ON, 100);
- // regcom();//爹舱ン
- if (bvOpt2) then
- CreateWebSite(szServerIPDefault,szServerPortDefault); // 秨﹍承 IIS 翴
- else
- CreateVirtualDir(szServerIPDefault);
- endif;
- if(LaunchAppAndWait("CACLS.exe", "/""+TARGETDIR^"uploadFiles/" /T /E /C /G everyone:F",WAIT)<0) then
- MessageBox (TARGETDIR^"uploadFiles"+"ゅンЖ舦砞竚ア毖叫も砞竚糶", SEVERE);
- endif;
- CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd,svDatabaseName , svDataOwner); // 承㎝ 纔て戈畐
- Writeini(svSQLsvr,svSQLusr,svSQLpwd,szServerIPDefault,TARGETDIR , svDatabaseName,bvOpt2);//糶iniゅン
- return 0;
- 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,
- // FeatureTransferData is called to perform file transfer.
- //
- ///
- function OnMaintUIBefore()
- NUMBER nResult, nType;
- STRING szTitle, szMsg, svDir, svResult, szCaption , svMatchingFileName;
- STRING svip,svuser,svpass , szServerIPDefault,szCmdLine , installpath , svDatabaseName;
- BOOL bvOpt1;
- begin
- // TO DO: if you want to enable background, window title, and caption bar title
- // SetTitle( @PRODUCT_NAME, 24, WHITE );
- // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );
- // SetColor(BACKGROUND,RGB (0, 128, 128));
- // Enable( FULLWINDOWMODE );
- // Enable( BACKGROUND );
- Dlg_Start:
- Disable(BACKBUTTON);
- nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);
- Enable(BACKBUTTON);
- if (nType = REMOVEALL) then
- svResult = SdLoadString(IFX_MAINTUI_MSG);
- szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
- nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
- if (nResult = IDCANCEL) goto Dlg_Start;
- endif;
- nResult = NEXT;
- Dlg_SdFeatureTree:
- if (nType = MODIFY) then
- szTitle = "";
- szMsg = "";
- nResult = SdFeatureTree(szTitle, szMsg, TARGETDIR, "", 2);
- if (nResult = BACK) goto Dlg_Start;
- endif;
- switch(nType)
- case REMOVEALL: FeatureRemoveAll();
- case REPAIR: FeatureReinstall();
- endswitch;
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","server", svip);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","db_user", svuser);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","db_pass", svpass);
- GetProfString (WINSYSDIR^"dbconn.ini", "webwork","iis", szServerIPDefault);
- GetProfString (WINSYSDIR^"dbconn.ini", "installpath","path", installpath);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","db_name",svDatabaseName);
- //svall=svip+","+svuser+","+svpass;
- // SdShowMsg(svall,WAIT);
- // Delay(5);
- szMsg = "/U "+svuser+" /P "+svpass+" /S "+svip+" /i /""+SUPPORTDIR^"kill.sql/"";
- LaunchAppAndWait("osql.exe", szMsg,WAIT);
- Disable(BACKBUTTON);
- SdShowMsg("タ氨ゎ翴", TRUE);
- Sprintf(szCmdLine , SUPPORTDIR^"adsutil.vbs STOP_SERVER w3svc/1/root/"^szServerIPDefault);
- LaunchAppAndWait("CScript.exe", szCmdLine, WAIT);
- SdShowMsg("タ氨ゎ翴", FALSE);
- DelIIS(szServerIPDefault);
- bvOpt1 = FALSE;
- nResult = AskOptions (NONEXCLUSIVE, "琌埃肚郎Ж:", "埃"+installpath^"uploadFiles", bvOpt1);
- if (bvOpt1) then
- if (DeleteDir (installpath^"uploadFiles", ALLCONTENTS) != 0) then
- MessageBox ("埃ゅンЖ岿叫も笆埃"+installpath^"uploadFiles", SEVERE);
- endif;
- endif;
- bvOpt1 = FALSE;
- nResult = AskOptions (NONEXCLUSIVE, "琌埃计沮畐:", "埃计沮畐", bvOpt1);
- if (bvOpt1) then
- DelDataBase(svip,svuser,svpass , svDatabaseName);
- DeleteDir(installpath^"database", ALLCONTENTS);
- endif;
- szCmdLine = "/U "+svuser+" /P "+svpass+" /S "+svip+" /Q /"xuweikillspid /""+svDatabaseName +"/"/"";
- LaunchAppAndWait("osql.exe", szCmdLine,WAIT);
- while(FindFile (installpath, "*.*", svMatchingFileName) = 0)
- DeleteFile(installpath^svMatchingFileName);
- endwhile;
- Enable(STATUSEX);
- end;
- //
- // 承IIS翴
- //
- function CreateWebSite(szServerIPDefault,szServerPortDefault)
- STRING szCmdLine,szWaitTxt ,strtime;
- BOOL bvOpt1;
- NUMBER nvResult;
- begin
- szWaitTxt=" タ承翴....";
- SdShowMsg (szWaitTxt, TRUE);
- Delay(2);
- GetSystemInfo ( TIME, nvResult, strtime);
- StrReplace(strtime,":","",0);
- //szCmdLine = SUPPORTDIR^"mkw3site.vbs"+" -r /""+TARGETDIR+"/" -i "+szServerIPDefault+" -o "+szServerPortDefault+" -t infofaq"+strtime;
- szCmdLine = SUPPORTDIR^"mkw3site.vbs"+" -r /""+TARGETDIR+"/" -i "+szServerIPDefault+" -o "+szServerPortDefault+" -t infofaq";
- //szCmdLine = SUPPORTDIR^"mkw3site.vbs"+" -r /""+TARGETDIR+" -i /""+szServerIPDefault+" -o /""+szServerPortDefault;
- if (LaunchAppAndWait("WScript.exe", szCmdLine,WAIT) < 0) then
- MessageBox ("ぃミ翴⊿Τт WScript.exe ┪磅︽竲セ岿粇.",SEVERE);
- abort;
- endif;
- SdShowMsg (szWaitTxt, FALSE);
- return 0;
- end;
- //
- // 承店览ヘ魁
- //
- function CreateVirtualDir(VirtualFolder)
- STRING szCmdLine,szWaitTxt;
- BOOL bvOpt1;
- begin
- szWaitTxt=" タ承店览ヘ魁....";
- SdShowMsg (szWaitTxt, TRUE);
- Delay(2);
- szCmdLine = SUPPORTDIR^"mkwebdir.vbs"+" -w 1 -v /""+VirtualFolder+"/",/""+TARGETDIR+"/"";
- if(LaunchAppAndWait("WScript.exe", szCmdLine,WAIT) < 0) then
- MessageBox ("ぃミWEB 店览ヘ魁⊿Τт WScript.exe ┪磅︽竲セ岿粇.",SEVERE);
- abort;
- endif;
- SdShowMsg (szWaitTxt, FALSE);
- return 0;
- end;
- //
- // 耞计沮畐
- //
- function STRING GetServiceName()
- string szKey, szName, svValue;
- number nvSize, nvType;
- begin
- szKey = "System//CurrentControlSet//Control//ComputerName//ComputerName";
- szName = "ComputerName";
- RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
- RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize);
- return svValue;
- end;
- //
- // 耞计沮畐
- //
- function BOOL DoesDatabaseExist(svServerName, svDatabaseName, svDriver, svUserName, svUserPassword)
- OBJECT pADOConnObj, pADORecordSetObj;
- STRING szADOConnObjID, szADORecordSetObjID, szConnString, szSQL;
- BOOL bExists;
- begin
- bExists = FALSE;
- // Create ADO Connection Object to connect to the SQL server
- szADOConnObjID = "ADODB.Connection";
- set pADOConnObj = CreateObject(szADOConnObjID);
- // Create the SQL string to complete the connection
- szConnString = "driver={" + svDriver + "};";
- szConnString = szConnString + "server=" + svServerName + ";";
- szConnString = szConnString + "uid=" + svUserName + ";";
- szConnString = szConnString + "pwd=" + svUserPassword + ";";
- szConnString = szConnString + "database=master";
- // Open the ADO Connection
- pADOConnObj.Open(szConnString);
- // Create ADO Recordset object for the return
- szADORecordSetObjID = "ADODB.Recordset";
- set pADORecordSetObj = CreateObject(szADORecordSetObjID);
- // Set some ADO Recordset properties
- pADORecordSetObj.CursorType = 3;
- pADORecordSetObj.ActiveConnection = pADOConnObj;
- // Create the SQL string to retrieve the database if it exists
- szSQL = "Select name from sysdatabases where name='" + svDatabaseName + "'";
- // Use the recordset to see if the database exists
- pADORecordSetObj.Open(szSQL);
- if (pADORecordSetObj.RecordCount = 1) then
- bExists = TRUE;
- endif;
- return bExists;
- end;
- //
- // 承㎝纔て戈畐
- //
- function CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd,svDatabaseName , svDataOwner)
- STRING szCmdLine1,szWaitTxt,szdatabase,szdatabase1,path,path1,path3;
- BOOL bvOpt1;
- begin
- path=TARGETDIR^"database//InfoFAQ_Data.mdf";
- path3=TARGETDIR^"database//InfoFAQ_Log.ldf";
- szWaitTxt=" タ承戈畐....";
- SdShowMsg (szWaitTxt, TRUE);
- Delay(2);
- Disable(LOGGING);
- CopyFile(SUPPORTDIR^"InfoFAQ_Data.mdf",TARGETDIR^"database//InfoFAQ_Data.mdf");
- CopyFile(SUPPORTDIR^"InfoFAQ_Log.ldf",TARGETDIR^"database//InfoFAQ_Log.ldf");
- Enable(LOGGING);
- szdatabase = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"exec sp_attach_db N'"+svDatabaseName+"' , N'"+path+"',N'"+path3+"'/"";
- if (LaunchAppAndWait("osql.exe", szdatabase,WAIT)<0) then;
- MessageBox ("戈畐承ア毖叫絋眤╰参い杆 Microsoft SQL Server./nご礚猭秆∕叫羛么╰参ㄑ莱坝",SEVERE);
- endif;
- if(svDataOwner != "")then
- szdatabase = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"exec sp_addrolemember db_owner N'"+svDataOwner+"'/"";
- LaunchAppAndWait("osql.exe", szdatabase,WAIT);
- endif;
- SdShowMsg (szWaitTxt, FALSE);
- return 0;
- end;
- //
- //
- //浪代琌杆iis
- //
- //
- function CheckIIS()
- NUMBER nvType, nvSize;
- STRING svvalue;
- begin
- RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
- if (RegDBKeyExist ("System//CurrentControlSet//Services//IISADMIN" ) = 1) then
- return (1);
- else
- return (0);
- endif;
- end;
- //
- //
- //浪代ieセ
- //
- //
- function Checkie()
- NUMBER nvType, nvSize;
- STRING svvalue,szKey,szName;
- begin
- szKey="SOFTWARE//Microsoft//Internet Explorer";
- szName="version";
- RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
- RegDBGetKeyValueEx(szKey, szName, nvType, svvalue, nvSize );
- if(svvalue="6.0.2600.0000")then
- return (0);
- else
- return (1);
- endif;
- end;
- //
- //浪代mdacセ
- //
- //
- function Checkmdac()
- NUMBER nvType, nvSize;
- STRING svvalue,szKey,szName;
- begin
- szKey="SOFTWARE//Microsoft//DataAccess";
- szName="version";
- RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
- if(RegDBGetKeyValueEx(szKey, szName, nvType, svvalue, nvSize ) < 0 ) then
- return (0);
- else
- return (1);
- endif;
- end;
- //
- //
- //Write dbconn.ini file
- //
- //
- function Writeini(svSQLsvr,svSQLusr,svSQLpwd ,szServerIPDefault,installpath , svDatabaseName , isiis)
- string svDate,iniFile,svResult,szInfo,szWaitTxt;
- NUMBER nvResult;
- begin
- //szWaitTxt="タ皌竚╰参郎叫祔獼....";
- iniFile =SUPPORTDIR^"dbconn.ini";
- //SdShowMsg (szWaitTxt, TRUE);
- // Delay(2);
- if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
- szInfo = "ぃ眔╰参丁";
- else
- svDate=svResult+" ";
- endif;
- if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
- szInfo = "ぃ眔╰参丁";
- else
- svDate=svDate+svResult;
- endif;
- if (WriteProfString(iniFile,"dbconnection","server", svSQLsvr) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfString(iniFile,"dbconnection","db_user",svSQLusr) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfString(iniFile,"dbconnection","db_pass",svSQLpwd) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfString(iniFile,"dbconnection","db_name",svDatabaseName) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfString(iniFile,"webwork","webworkstart", svDate) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfString(iniFile,"webwork","iis", szServerIPDefault) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfInt(iniFile,"webwork","isiis", isiis) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- if (WriteProfString(iniFile,"installpath","path", installpath) <0) then
- MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
- endif;
- CopyFile(SUPPORTDIR^"dbconn.ini",WINSYSDIR^"dbconn.ini");
- end;
- //
- //爹舱ン
- //
- function regcom()
- string szLine,szWaitTxt;
- begin
- szLine=WINSYSDIR^"jmail.dll";
- szWaitTxt=" タ爹舱ン....";
- SdShowMsg (szWaitTxt, TRUE);
- Delay(2);
- CopyFile(SUPPORTDIR^"jmail.dll",WINSYSDIR^"jmail.dll");
- if (LaunchAppAndWait("regsvr32.exe",szLine,WAIT)<0) then
- MessageBox ("爹舱ンア毖叫沽刚も笆爹"+szLine,SEVERE);
- // else
- // MessageBox ("爹舱ンΘ"+szLine,INFORMATION);
- //SdShowMsg (szLine, TRUE);
- // Delay(3);
- endif;
- end;
- function DelIIS(VirtualFolder)
- STRING szCmdLine;
- begin
- //埃竒店览ヘ魁
- szCmdLine = SUPPORTDIR ^"adsutil.vbs delete w3svc/1/root/"^VirtualFolder;
- if(LaunchAppAndWait("CScript.exe", szCmdLine, WAIT)<0) then
- MessageBox ("埃iis戈癟狝叭ア毖叫沽刚も笆埃",INFORMATION);
- endif;
- end;
- //
- //埃戈畐
- //
- //
- function DelDataBase(server,user,pass , svDatabaseName)
- STRING szWaitTxt,szdatabase1,szdatabase2,szdatabase3,path1;
- begin
- szWaitTxt=" タ埃戈畐....";
- szdatabase2 = "/U "+user+" /P "+pass+" /S "+server+" /Q /"xuweikillspid /""+svDatabaseName +"/"/"";
- LaunchAppAndWait("osql.exe", szdatabase2,WAIT);
- //SdShowMsg(szdatabase2,WAIT);
- //Delay(3);
- szdatabase3 = "/U "+user+" /P "+pass+" /S "+server+" /Q /"DROP Database /"" +svDatabaseName+"/"/"" ;
- LaunchAppAndWait("osql.exe", szdatabase3,WAIT);
- //SdShowMsg(szdatabase3,WAIT);
- //Delay(3);
- SdShowMsg (szWaitTxt, FALSE);
- return 0;
- end;
- //---------------------------------------------------------------------------
- // OnSetTARGETDIR
- //
- // OnSetTARGETDIR is called directly by the framework to initialize
- // TARGETDIR to it's default value.
- //
- // Note: This event is called for all setups.
- //---------------------------------------------------------------------------
- function OnSetTARGETDIR()
- number nId, nIgnore, nResult;
- string szId, szTARGETDIR;
- begin
- // In maintenance mode the value of TARGETDIR is read from the log file.
- if( MAINTENANCE ) then
- return ISERR_SUCCESS;
- endif;
- // Set TARGETDIR to script default.
- TARGETDIR = "<FOLDER_APPLICATIONS>//<IFX_COMPANY_NAME>//<IFX_PRODUCT_NAME>";
- // Read TARGETDIR from the media.
- nResult = MediaGetData( MEDIA, MEDIA_FIELD_TARGETDIR, nIgnore, szTARGETDIR );
- // Use the TARGETDIR from the media if anything was read.
- if( nResult >= ISERR_SUCCESS && StrLengthChars( szTARGETDIR ) ) then
- TARGETDIR = szTARGETDIR;
- endif;
- // Customize the default TARGETDIR for multi-instance application.
- // TODO: If you want something different customize the code below.
- if( MAINT_OPTION = MAINT_OPTION_MULTI_INSTANCE && MULTI_INSTANCE_COUNT > 0) then
- // Start with the current multi-instance count plus one.
- nId = MULTI_INSTANCE_COUNT + 1;
- // Find a unique TARGETDIR.
- while( ExistsDir( TARGETDIR ) = EXISTS )
- // Convert to string.
- NumToStr( szId, nId );
- // Update IFX_MULTI_INSTANCE_SUFFIX
- IFX_MULTI_INSTANCE_SUFFIX = "_" + szId;
- // Update TARGETDIR
- TARGETDIR = TARGETDIR + IFX_MULTI_INSTANCE_SUFFIX;
- // Update nId
- nId = nId + 1;
- endwhile;
- endif;
- end;
- //---------------------------------------------------------------------------
- // OnFirstUIAfter
- //
- // First Install UI Sequence - After Move Data
- //
- // The OnFirstUIAfter event called by OnShowUI after the file transfer
- // of the setup when the setup is running in first install mode. By default
- // this event displays UI that informs the end user that the setup has been
- // completed successfully.
- //
- // Note: This event will not be called automatically in a
- // program...endprogram style setup.
- //---------------------------------------------------------------------------
- function OnFirstUIAfter()
- STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svSQLsvr ,svpass , svuser,szServerIPDefault,svDatabaseName;
- NUMBER bvOpt1, bvOpt2;
- NUMBER bShowUpdateServiceDlg;
- BOOL isiis;
- begin
- ShowObjWizardPages(NEXT);
- szTitle = "";
- szMsg1 = "";
- szMsg2 = "";
- szOpt1 = "";
- szOpt2 = "";
- bvOpt1 = FALSE;
- bvOpt2 = FALSE;
- isiis = FALSE;
- // Set this to true if you have the update service enabled, and if you want to check for updates.
- // Note: the ISUS Starter Edition does not support checking for updates programatically. So,
- // only set this to true if you have at least the ISUS Professional Edition.
- bShowUpdateServiceDlg = FALSE;
- GetProfString (WINSYSDIR^"dbconn.ini", "webwork","iis", szServerIPDefault);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","server", svSQLsvr);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","db_user", svuser);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","db_pass", svpass);
- GetProfString (WINSYSDIR^"dbconn.ini", "dbconnection","db_name",svDatabaseName);
- GetProfInt (WINSYSDIR^"dbconn.ini", "webwork","isiis", isiis);
- UpdateKey(TARGETDIR,"connectionString" ,"<add key=/"connectionString/" value=/""+"Server="+svSQLsvr+";UID="+svuser+";PWD="+svpass+";database="+svDatabaseName+"/"/>");
- UpdateKey(TARGETDIR,"DBConnection" ,"<add key=/"DBConnection/" value=/"Provider=SQLOLEDB.1;Password="+svpass+";Persist Security Info=True;User ID="+svuser+";Initial Catalog="+svDatabaseName+"Data Source="+svSQLsvr+";/">");
- if(isiis) then
- UpdateKey(TARGETDIR,"zhaofengfaq/login/login.aspx" ,"<forms loginUrl=/"/login/login.aspx/""+" protection=/"All/" timeout=/"30/" slidingExpiration=/"true/"/>");
- UpdateKey(TARGETDIR,"VirPath" ,"<add key=/"VirPath/" value=/"/"/>");
- else
- UpdateKey(TARGETDIR,"zhaofengfaq/login/login.aspx" ,"<forms loginUrl=/""+szServerIPDefault+"/login/login.aspx/""+" protection=/"All/" timeout=/"30/" slidingExpiration=/"true/"/>");
- UpdateKey(TARGETDIR,"VirPath" ,"<add key=/"VirPath/" value=/""+szServerIPDefault+"/"/>");
- endif;
- //UpdateKey(TARGETDIR,"zhaofengfaq/login/login.aspx" ,"<add key=/"FCKeditor:BasePath/" value=/""+szServerIPDefault^"/FCKeditor//"/>");
- //UpdateKey(TARGETDIR,"FCKeditor:UserFilesPath" ,"<add key=/"FCKeditor:UserFilesPath/" value=/""+szServerIPDefault^"/UserFiles//"/>");
- FileInsertLine(TARGETDIR^"Web.config", "<?xml version=/"1.0/"?>",0,REPLACE);
- //{{IS_SCRIPT_TAG(Dlg_SdDinishEx)
- Disable(LOGGING);
- if (ExistsDir (TARGETDIR^"uploadFiles//PIC//admin") != EXISTS) then
- // The directory does not exist; create it.
- if (CreateDir (TARGETDIR^"uploadFiles//PIC//admin") < 0) then
- MessageBox ("承"+TARGETDIR^"uploadFiles//PIC//admin"+"ゅンЖぃΘ叫も笆承", SEVERE);
- endif;
- endif;
- Enable(LOGGING);
- if ( BATCH_INSTALL ) then
- SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
- else
- // If the update service is enabled, show finish dialog that includes
- // update check option.
- if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then
- if( SdFinishUpdateEx( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, TRUE ) ) then
- // Don't check for updates in silent mode.
- if( MODE != SILENTMODE ) then
- UpdateServiceCheckForUpdates( "", FALSE );
- endif;
- endif;
- else
- SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
- endif;
- endif;
- //}}IS_SCRIPT_TAG(Dlg_SdDinishEx)
- end;
- function UpdateKey( svFilePath, svFindEntry, svNewEntry)
- NUMBER nResult, nvLineNumber;
- STRING WebConfigFile, svReturnLine;
- begin
- // build the path to the Web.Config
- WebConfigFile = svFilePath ^ "Web.config";
- // search the file for the key we specify
- nResult = FileGrep( WebConfigFile, svFindEntry, svReturnLine, nvLineNumber, RESTART );
- switch(nResult)
- case 0:
- // Since this line normally appears twice in our web.config file, we're
- // checking for the existence of a 2nd match and updating it instead.
- // If there is no 2nd match, go ahead and update the one we find.
- /*
- if ( svFindEntry = "connectionString" ) then
- nResult = FileGrep( WebConfigFile, svFindEntry , svReturnLine, nvLineNumber, CONTINUE );
- if ( nResult < 0 ) then
- FileGrep( WebConfigFile, svFindEntry, svReturnLine, nvLineNumber, RESTART );
- endif;
- endif;
- */
- // once we find the key, update (replace) it with our new values
- if ( FileInsertLine( WebConfigFile, svNewEntry, nvLineNumber, REPLACE ) < 0 ) then
- // hmmm we couldn't update the value of the key
- MessageBox( "Unable to update Web.Config file.", SEVERE );
- endif;
- case -2:
- // File Not Found
- MessageBox( "Web.Config file not found.", SEVERE );
- case -4:
- // EOF reached
- MessageBox( svFindEntry + " key not found.", SEVERE );
- default:
- //unknown error
- MessageBox( "An unknown error has occurred. The Web.Config file has NOT been updated.", SEVERE );
- endswitch;
- end;
- //---------------------------------------------------------------------------
- // OnIISCheckRequirements
- //
- // The OnIISCheckRequirements event is called by Preprogram to make sure
- // that the requirements for IIS runtime are met
- //---------------------------------------------------------------------------
- function OnIISCheckRequirements()
- STRING szMsg;
- number nResult;
- begin
- // if the version is not adequate, display messagebox and abort
- if ( IISRTGetIISVersion( IIS_GET_VERSION_MAJOR ) < IIS_VERSION_MAJOR_MIN_SUPPORT ) then
- if(REMOVEALLMODE ==0) then
- //IOC-000043287 do not abort if this is uninstall
- szMsg = SdLoadString( IDS_IFX_IIS_INADEQUATE_VERSION );
- MessageBox(szMsg, SEVERE);
- abort;
- endif;
- endif;
- end;