网站安装文件制作

来源:互联网 发布:亿和数据 编辑:程序博客网 时间:2024/04/30 10:48

 setup.rul

做的是繁体的 简体下面有些文字显示乱码

将就看吧

不懂的发邮件

 

  1.                                               ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File Name: Setup.rul
  4. //
  5. // Description: InstallShield script
  6. //
  7. // Comments: This script was generated based on the selections you made in
  8. // the Project Wizard. Refer to the help topic entitled "Modify
  9. // the script that the Project Wizard generates" for information
  10. // on possible next steps.
  11. //
  12. ////////////////////////////////////////////////////////////////////////////////
  13. // Include header files
  14. #include "ifx.h"
  15. ////////////////////// string defines ////////////////////////////
  16. //////////////////// installation declarations ///////////////////
  17. // ----- DLL function prototypes -----
  18. // your DLL function prototypes
  19. // ---- script function prototypes -----
  20. // your script function prototypes
  21. prototype CreateDataBase(STRING,STRING,STRING,STRING,STRING);//戈畐
  22. prototype CreateWebSite(STRING,STRING);//IIS
  23. prototype CreateVirtualDir(STRING);//店览ヘ魁
  24. prototype CheckIIS(); //浪代琌杆iis
  25. prototype Checkie(); //浪代ieセ
  26. prototype Checkmdac(); //浪代mdacセ
  27. prototype regcom(); //爹jamil舱ン
  28. prototype DelIIS(STRING);//埃店览ヘ魁
  29. prototype Writeini(STRING,STRING,STRING,STRING,STRING,STRING,BOOL);
  30. prototype DelDataBase(STRING,STRING,STRING,STRING);   
  31. prototype UpdateKey(STRING,STRING,STRING);//戈畐  
  32. prototype BOOL DoesDatabaseExist(STRING, STRING, STRING, STRING, STRING);
  33. prototype STRING GetServiceName();
  34. // your global variables
  35. //////////////////////////////////////////////////////////////////////////////
  36. //
  37. // FUNCTION: OnFirstUIBefore
  38. //
  39. // EVENT: FirstUIBefore event is sent when installation is run for the first
  40. // time on given machine. In the handler installation usually displays
  41. // UI allowing end user to specify installation parameters. After this
  42. // function returns, FeatureTransferData is called to perform file
  43. // transfer.
  44. //
  45. ///////////////////////////////////////////////////////////////////////////////
  46. function OnFirstUIBefore()
  47. number nResult,nSetupType;
  48. string szTitle, szMsg;
  49. string szLicenseFile, szQuestion;
  50. string szName, szCompany, szSerial;
  51. string szFeatures, szTargetdir;
  52. number nLevel;
  53. LIST listStartCopy,list;
  54. number nvSize;
  55. number nUser;
  56. number nOpt,svEdit1,svEdit2;
  57. STRING szServerIP,szServerPort,szServerIPDefault,szServerPortDefault;
  58. STRING szSQLsvr,szSQLusr,szSQLpwd,svSQLsvr,svSQLusr,svSQLpwd , svDatabaseName,svDataOwner;
  59. STRING svName, svCompany, svSerial;
  60. STRING szFile,szTargetPath,szDir,szfolder;
  61. STRING szField1,szField2;
  62. STRING szDefault,svResult;
  63. string szComponents;
  64. OBJECT piisObj;
  65. STRING szTitle1;
  66. STRING szMsg1,szMsg2;
  67. STRING szMsg11, szMsg12, szOpt1, szOpt2;
  68. BOOL bvOpt1, bvOpt2;
  69. begin
  70. // TO DO: if you want to enable background, window title, and caption bar title
  71. //SetTitle( @PRODUCT_NAME, 24, WHITE );
  72. // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );
  73. // Enable( FULLWINDOWMODE );
  74. // Enable( BACKGROUND );
  75. // SetColor(BACKGROUND,RGB (0, 128, 128));
  76. //SetFont (FONT_TITLE, STYLE_NORMAL, "Ш砰");
  77. //SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
  78. TARGETDIR = "C:"^"inetpub"^"infofaq"
  79. szDir = TARGETDIR;         
  80. szName = "刚ノノめ";
  81. szCompany = "infofaq";
  82. Dlg_Start:
  83. // beginning of dialogs label
  84. /*
  85. Dlg_SdWelcome:
  86. szTitle = "";
  87. szMsg = "";
  88. nResult = SdWelcome( szTitle, szMsg );
  89. if (nResult = BACK) goto Dlg_Start;
  90. Dlg_SdLicense:
  91. szLicenseFile = SUPPORTDIR ^ "license.txt";
  92. szTitle = "";
  93. szMsg = "";
  94. szQuestion = "";
  95. nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
  96. if (nResult = BACK) goto Dlg_SdWelcome;
  97. Dlg_SdCustomerInformation:
  98. szMsg = "";
  99. szTitle = "";
  100. nResult = SdCustomerInformation( szTitle, szName, szCompany, nUser );
  101. if (nResult = BACK) goto Dlg_SdLicense;
  102. */
  103. Dlg_SelMode ://砞竚戈畐狝竟 癸杠よ遏    
  104. if !CheckIIS() then
  105.     MessageBox ("筿福⊿Τ杆IIS叫杆刚",SEVERE); 
  106.     abort;
  107. endif;
  108. RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );   
  109. if (RegDBKeyExist ("SOFTWARE//Microsoft//.NETFramework" ) != 1) then  
  110.     /*
  111.     MessageBox ("眤╰参⊿Τ杆.net琜瞷秨﹍杆.NETFramework2.0",INFORMATION);        
  112.     if(LaunchAppAndWait ( SUPPORTDIR ^"dotnetfx.exe " , "" ,WAIT)<0) then
  113.         MessageBox ("杆.net琜祇ネ種叫穝杆",SEVERE);
  114.         abort;
  115.     endif;
  116.     */
  117.     MessageBox ("杆.net琜祇ネ種叫杆刚",SEVERE);
  118. endif;
  119. if !Checkmdac() then//狦竒杆玥铬筁
  120.     if(LaunchAppAndWait (SUPPORTDIR^"mdac_typ.exe","",WAIT)<0) then
  121.         MessageBox ("杆稬硁戈砐拜じン琌祇ネ叫穝杆",SEVERE);
  122.         abort;
  123.     endif;
  124. endif;
  125.               
  126. Dlg_AskOptions://砞竚IIS翴┪店览ヘ魁  
  127.     bvOpt1 = TRUE;
  128.     bvOpt2 = FALSE;                                                   
  129.     nResult = AskOptions (EXCLUSIVE, "叫匡拒眤惠杆セ╰参店览ヘ魁临琌翴""店览ヘ魁", bvOpt1, "IIS翴",bvOpt2);
  130.     if (nResult = BACK) goto Dlg_SelMode;
  131.     Dlg_AskText ://砞竚狝竟癸杠よ遏
  132.     if (bvOpt2) then
  133.         szTitle = "砞竚IIS戈癟狝竟";
  134.         szMsg = "瞷秨﹍砞竚IIS╰参";
  135.         szQuestion=" 叫块セ狝竟诀┪IP,杆祘Α盢酚眤矗ㄑ戈砞竚IIS戈癟狝叭狦眤⊿Τ恶糶杆祘Α盢笆铬筁翴承";
  136.         szServerIP="";
  137.         szServerPort="狠";
  138.         szServerIPDefault="127.0.0.1";
  139.         szServerPortDefault="80";
  140.         SetDialogTitle(DLG_ASK_TEXT,szTitle);
  141.         nResult=SdShowDlgEdit2 (szTitle, szQuestion,szServerIP,szServerPort,szServerIPDefault,szServerPortDefault);
  142.         if (nResult = BACK) goto Dlg_AskOptions;   
  143.     else  
  144.         szTitle = "砞竚店览ヘ魁";
  145.         szMsg = "瞷秨﹍砞竚店览ヘ魁";
  146.         szQuestion="叫块店览ヘ魁嘿";
  147.         szServerIP="店览ヘ魁嘿";
  148.         szServerIPDefault="infofaq";
  149.         SetDialogTitle(DLG_ASK_TEXT,szTitle);
  150.         nResult=SdShowDlgEdit1(szTitle, szQuestion,szServerIP,szServerIPDefault);
  151.         if (nResult = BACK) goto Dlg_AskOptions;  
  152.     endif;
  153. Dlg_AskSQL ://砞竚戈畐狝竟 癸杠よ遏
  154. szTitle = "砞竚戈畐1";
  155. szMsg = "瞷秨﹍砞竚戈畐";
  156. szQuestion="叫龄戈畐狝竟ㄏノ嘿ㄏノ盞絏狦眤矗ㄑㄏノ嘿㎝盞絏琌岿粇杆祘Α盢笆铬筁戈畐砞竚";
  157. szSQLsvr="戈畐";
  158. szSQLusr="ㄏノ嘿";
  159. szSQLpwd="ㄏノ盞絏";
  160. svSQLsvr=".";
  161. svSQLusr="sa";
  162. svSQLpwd=""; ;
  163. SetDialogTitle(DLG_ASK_TEXT,szTitle);
  164. nResult=SdShowDlgEdit3 (szTitle, szQuestion,szSQLsvr,szSQLusr,szSQLpwd,svSQLsvr,svSQLusr,svSQLpwd);
  165. if (nResult = BACK) goto Dlg_AskText;
  166. Dlg_AskSQL2 ://砞竚戈畐狝竟 癸杠よ遏
  167. szTitle = "砞竚戈畐2";
  168. szMsg = "膥尿砞竚戈畐";
  169. szQuestion=" 叫块赣戈畐嘿㎝局Τ局Τぃ恶糶";      
  170. svDatabaseName="InfoFAQ";
  171. svDataOwner="";
  172. SetDialogTitle(DLG_ASK_TEXT,szTitle);
  173. nResult=SdShowDlgEdit2 (szTitle, szQuestion,"戈畐嘿","戈畐局Τ",svDatabaseName,svDataOwner);
  174. if (nResult = BACK) goto Dlg_AskSQL;  
  175. szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /i /""+SUPPORTDIR^"kill.sql/"";
  176. LaunchAppAndWait("osql.exe", szMsg,WAIT);
  177. if(DoesDatabaseExist(svSQLsvr,svDatabaseName, "SQL Server",svSQLusr,svSQLpwd))then
  178.     bvOpt1 = TRUE;       
  179.     nResult = AskOptions (NONEXCLUSIVE, svDatabaseName+"计沮畐竒盢滦籠Τ"+svDatabaseName+"计沮畐琌称Τ"+svDatabaseName+"计沮畐:""称Τ"+svDatabaseName+"计沮畐", bvOpt1);
  180.     if (nResult = BACK) goto Dlg_AskSQL2;
  181.     if (bvOpt1) then  
  182.         szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"backup database /""+svDatabaseName+"/" to disk ='c://"+svDatabaseName+".dmp'/"";
  183.         LaunchAppAndWait("osql.exe", szMsg,WAIT);
  184.         MessageBox ("戈畐竒称c://"+svDatabaseName+".dmp",INFORMATION);
  185.         //szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"DROP DATABASE /""+svDatabaseName+"/"/"" ;
  186.         //szMsg = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"exec sp_dbremove N'"+svDatabaseName+"'" ;
  187.         //LaunchAppAndWait("osql.exe", szMsg,WAIT); 
  188.         DelDataBase(svSQLsvr , svSQLusr,svSQLpwd,svDatabaseName);
  189.     endif; 
  190. endif;
  191. Dlg_SdAskDestPath:
  192. szTitle = "";
  193. szMsg = "";
  194. nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
  195. TARGETDIR = szDir;              
  196. if (nResult = BACK) goto Dlg_AskSQL2;
  197. Dlg_SdStartCopy:
  198. szTitle = "";
  199. szMsg = "";
  200. szTitle1 = "杆ア毖";
  201. szMsg11 = "パ杆祇ネ種旧璓杆ア毖";
  202. szMsg12 = "翴阑ЧΘ癶杆";
  203. szOpt1 = "";
  204. szOpt2 ="";
  205. listStartCopy = ListCreate( STRINGLIST );
  206. //ListAddString(listStartCopy,"ノめ"+szName,AFTER);
  207. //ListAddString(listStartCopy,"そ嘿┯穟戈癟俱Τそ",AFTER);
  208. //ListAddString(listStartCopy,"硁ン嘿絬醚恨瞶╰参",AFTER);
  209. ListAddString(listStartCopy,"ヘ夹ヘ魁"+szDir,AFTER);
  210. //if (svEdit1=TRUE) then
  211. //ListAddString(listStartCopy,"IP"+szServerIPDefault,AFTER);
  212. //ListAddString(listStartCopy,"狠"+szServerPortDefault,AFTER);
  213. //endif;
  214. ListAddString(listStartCopy,"叫絋粄眤恶糶戈癟˙秨﹍狡籹郎",AFTER);
  215. // listStartCopy = ListCreate( STRINGLIST );
  216. //The following is an example of how to add a string(szName) to a list(listStartCopy).
  217. //eg. ListAddString(listStartCopy,szName,AFTER);
  218. nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
  219. ListDestroy(listStartCopy);
  220. if (nResult = BACK) goto Dlg_SdAskDestPath;
  221. Enable(STATUSEX);    
  222. StatusUpdate(ON, 100);                 
  223. // regcom();//爹舱ン                
  224. if (bvOpt2) then 
  225.     CreateWebSite(szServerIPDefault,szServerPortDefault); // 秨﹍承 IIS 翴 
  226. else
  227.     CreateVirtualDir(szServerIPDefault); 
  228. endif;  
  229. if(LaunchAppAndWait("CACLS.exe""/""+TARGETDIR^"uploadFiles/" /T /E /C /G everyone:F",WAIT)<0) then
  230.     MessageBox (TARGETDIR^"uploadFiles"+"ゅンЖ舦砞竚ア毖叫も砞竚糶", SEVERE);
  231. endif;
  232. CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd,svDatabaseName , svDataOwner); // 承㎝ 纔て戈畐
  233. Writeini(svSQLsvr,svSQLusr,svSQLpwd,szServerIPDefault,TARGETDIR , svDatabaseName,bvOpt2);//糶iniゅン   
  234. return 0;
  235. end;
  236. ///////////////////////////////////////////////////////////////////////////////
  237. //
  238. // FUNCTION: OnMaintUIBefore
  239. //
  240. // EVENT: MaintUIBefore event is sent when end user runs installation that
  241. // has already been installed on the machine. Usually this happens
  242. // through Add/Remove Programs applet. In the handler, installation
  243. // usually displays UI allowing end user to modify existing installation
  244. // or uninstall application. After this function returns,
  245. // FeatureTransferData is called to perform file transfer.
  246. //
  247. ///////////////////////////////////////////////////////////////////////////////
  248. function OnMaintUIBefore()
  249. NUMBER nResult, nType;
  250. STRING szTitle, szMsg, svDir, svResult, szCaption , svMatchingFileName;
  251. STRING svip,svuser,svpass , szServerIPDefault,szCmdLine , installpath , svDatabaseName; 
  252. BOOL   bvOpt1;   
  253. begin
  254. // TO DO: if you want to enable background, window title, and caption bar title
  255. // SetTitle( @PRODUCT_NAME, 24, WHITE );
  256. // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );
  257. // SetColor(BACKGROUND,RGB (0, 128, 128));
  258. // Enable( FULLWINDOWMODE );
  259. // Enable( BACKGROUND );
  260. Dlg_Start:
  261. Disable(BACKBUTTON);
  262. nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);
  263. Enable(BACKBUTTON);
  264. if (nType = REMOVEALL) then
  265. svResult = SdLoadString(IFX_MAINTUI_MSG);
  266. szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
  267. nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
  268. if (nResult = IDCANCEL) goto Dlg_Start;
  269. endif;
  270. nResult = NEXT;
  271. Dlg_SdFeatureTree:
  272. if (nType = MODIFY) then
  273. szTitle = "";
  274. szMsg = "";
  275. nResult = SdFeatureTree(szTitle, szMsg, TARGETDIR, "", 2);
  276. if (nResult = BACK) goto Dlg_Start;
  277. endif;
  278. switch(nType)
  279. case REMOVEALL: FeatureRemoveAll();
  280. case REPAIR: FeatureReinstall();
  281. endswitch;       
  282. GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","server", svip);
  283. GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","db_user", svuser);
  284. GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","db_pass", svpass); 
  285. GetProfString (WINSYSDIR^"dbconn.ini""webwork","iis", szServerIPDefault);  
  286. GetProfString (WINSYSDIR^"dbconn.ini""installpath","path", installpath);
  287. GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","db_name",svDatabaseName);
  288. //svall=svip+","+svuser+","+svpass;
  289. // SdShowMsg(svall,WAIT);
  290. // Delay(5);                    
  291. szMsg = "/U "+svuser+" /P "+svpass+" /S "+svip+" /i /""+SUPPORTDIR^"kill.sql/"";
  292. LaunchAppAndWait("osql.exe", szMsg,WAIT);
  293. Disable(BACKBUTTON);
  294. SdShowMsg("タ氨ゎ翴",   TRUE);     
  295. Sprintf(szCmdLine , SUPPORTDIR^"adsutil.vbs STOP_SERVER   w3svc/1/root/"^szServerIPDefault);   
  296. LaunchAppAndWait("CScript.exe",   szCmdLine,   WAIT);   
  297. SdShowMsg("タ氨ゎ翴",   FALSE);   
  298. DelIIS(szServerIPDefault);  
  299. bvOpt1 = FALSE;    
  300. nResult = AskOptions (NONEXCLUSIVE, "琌埃肚郎Ж:""埃"+installpath^"uploadFiles", bvOpt1);
  301. if (bvOpt1) then
  302.     if (DeleteDir (installpath^"uploadFiles", ALLCONTENTS) != 0) then
  303.         MessageBox ("埃ゅンЖ岿叫も笆埃"+installpath^"uploadFiles", SEVERE);
  304.     endif;
  305. endif; 
  306. bvOpt1 = FALSE;       
  307. nResult = AskOptions (NONEXCLUSIVE, "琌埃计沮畐:""埃计沮畐", bvOpt1);
  308. if (bvOpt1) then    
  309.     DelDataBase(svip,svuser,svpass , svDatabaseName);    
  310.     DeleteDir(installpath^"database", ALLCONTENTS);
  311. endif;  
  312. szCmdLine = "/U "+svuser+" /P "+svpass+" /S "+svip+" /Q /"xuweikillspid /""+svDatabaseName +"/"/"";
  313. LaunchAppAndWait("osql.exe", szCmdLine,WAIT);
  314.           
  315. while(FindFile (installpath, "*.*", svMatchingFileName) = 0)
  316.       DeleteFile(installpath^svMatchingFileName);
  317. endwhile;    
  318.      
  319. Enable(STATUSEX);
  320. end;
  321. //////////////////////////   
  322. //   承IIS翴   
  323. //////////////////////////   
  324. function  CreateWebSite(szServerIPDefault,szServerPortDefault)   
  325.     STRING   szCmdLine,szWaitTxt ,strtime;  
  326.     BOOL  bvOpt1;  
  327.     NUMBER nvResult;
  328.     begin    
  329.         szWaitTxt="   タ承翴....";   
  330.         SdShowMsg   (szWaitTxt,   TRUE);   
  331.         Delay(2);    
  332.         GetSystemInfo ( TIME, nvResult, strtime); 
  333.         StrReplace(strtime,":","",0);
  334.         //szCmdLine   =   SUPPORTDIR^"mkw3site.vbs"+"  -r /""+TARGETDIR+"/"   -i "+szServerIPDefault+" -o "+szServerPortDefault+" -t infofaq"+strtime;
  335.         szCmdLine   =   SUPPORTDIR^"mkw3site.vbs"+"  -r /""+TARGETDIR+"/"   -i "+szServerIPDefault+" -o "+szServerPortDefault+" -t infofaq";          
  336.         //szCmdLine   =   SUPPORTDIR^"mkw3site.vbs"+"   -r   /""+TARGETDIR+"   -i   /""+szServerIPDefault+"   -o   /""+szServerPortDefault;     
  337.         if (LaunchAppAndWait("WScript.exe",   szCmdLine,WAIT)   <   0)   then   
  338.             MessageBox   ("ぃミ翴⊿Τт   WScript.exe   ┪磅︽竲セ岿粇.",SEVERE);   
  339.             abort;
  340.         endif;     
  341.         SdShowMsg   (szWaitTxt,   FALSE);  
  342.     return   0;   
  343.     end;   
  344. //////////////////////////   
  345. //   承店览ヘ魁   
  346. //////////////////////////   
  347. function   CreateVirtualDir(VirtualFolder)   
  348.     STRING   szCmdLine,szWaitTxt;    
  349.     BOOL  bvOpt1;
  350.     begin    
  351.         szWaitTxt="   タ承店览ヘ魁....";   
  352.         SdShowMsg   (szWaitTxt,   TRUE);   
  353.         Delay(2);   
  354.         szCmdLine = SUPPORTDIR^"mkwebdir.vbs"+" -w 1 -v /""+VirtualFolder+"/",/""+TARGETDIR+"/"";   
  355.         if(LaunchAppAndWait("WScript.exe",   szCmdLine,WAIT)   <   0)   then   
  356.             MessageBox   ("ぃミWEB   店览ヘ魁⊿Τт   WScript.exe   ┪磅︽竲セ岿粇.",SEVERE);   
  357.             abort;
  358.         endif;           
  359.         SdShowMsg   (szWaitTxt,   FALSE);    
  360.         return   0;   
  361.     end;       
  362.     
  363. //////////////////////////
  364. // 耞计沮畐
  365. //////////////////////////  
  366. function STRING GetServiceName()   
  367. string szKey, szName, svValue;
  368. number nvSize, nvType;
  369. begin
  370.     szKey = "System//CurrentControlSet//Control//ComputerName//ComputerName";
  371.     
  372.     szName = "ComputerName";
  373.     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  374.     RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize);
  375.     return svValue;
  376.     
  377. end;     
  378. //////////////////////////
  379. // 耞计沮畐
  380. //////////////////////////         
  381. function BOOL DoesDatabaseExist(svServerName, svDatabaseName, svDriver, svUserName, svUserPassword) 
  382.     OBJECT pADOConnObj, pADORecordSetObj;
  383.     STRING szADOConnObjID, szADORecordSetObjID, szConnString, szSQL;
  384.     BOOL   bExists;
  385. begin
  386.     bExists = FALSE;
  387.          
  388.     // Create ADO Connection Object to connect to the SQL server                   
  389.         szADOConnObjID = "ADODB.Connection";
  390.         set pADOConnObj = CreateObject(szADOConnObjID);         
  391.     
  392.     // Create the SQL string to complete the connection
  393.     szConnString = "driver={" + svDriver + "};";
  394.     szConnString = szConnString + "server=" + svServerName + ";";
  395.     szConnString = szConnString + "uid=" + svUserName + ";";
  396.     szConnString = szConnString + "pwd=" + svUserPassword + ";";
  397.     szConnString = szConnString + "database=master";
  398.     
  399.     // Open the ADO Connection                    
  400.     pADOConnObj.Open(szConnString);
  401.     
  402.     // Create ADO Recordset object for the return
  403.     szADORecordSetObjID = "ADODB.Recordset";
  404.     set pADORecordSetObj = CreateObject(szADORecordSetObjID);
  405.     // Set some ADO Recordset properties  
  406.     pADORecordSetObj.CursorType = 3;
  407.     pADORecordSetObj.ActiveConnection = pADOConnObj;
  408.     
  409.     // Create the SQL string to retrieve the database if it exists    
  410.     szSQL = "Select name from sysdatabases where name='" + svDatabaseName + "'";    
  411.     
  412.     // Use the recordset to see if the database exists 
  413.     pADORecordSetObj.Open(szSQL);
  414.     if (pADORecordSetObj.RecordCount = 1) then
  415.         bExists = TRUE;
  416.     endif;
  417.       
  418.     return bExists;        
  419. end;              
  420. //////////////////////////
  421. // 承㎝纔て戈畐
  422. //////////////////////////
  423. function CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd,svDatabaseName , svDataOwner)
  424. STRING szCmdLine1,szWaitTxt,szdatabase,szdatabase1,path,path1,path3;   
  425. BOOL  bvOpt1;
  426. begin
  427. path=TARGETDIR^"database//InfoFAQ_Data.mdf";
  428. path3=TARGETDIR^"database//InfoFAQ_Log.ldf";
  429. szWaitTxt=" タ承戈畐....";
  430. SdShowMsg (szWaitTxt, TRUE);
  431. Delay(2);                          
  432. Disable(LOGGING);   
  433. CopyFile(SUPPORTDIR^"InfoFAQ_Data.mdf",TARGETDIR^"database//InfoFAQ_Data.mdf");
  434. CopyFile(SUPPORTDIR^"InfoFAQ_Log.ldf",TARGETDIR^"database//InfoFAQ_Log.ldf");
  435. Enable(LOGGING);  
  436. szdatabase = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"exec sp_attach_db N'"+svDatabaseName+"' , N'"+path+"',N'"+path3+"'/"";
  437. if (LaunchAppAndWait("osql.exe", szdatabase,WAIT)<0) then;
  438.     MessageBox ("戈畐承ア毖叫絋眤╰参い杆 Microsoft SQL Server./nご礚猭秆∕叫羛么╰参ㄑ莱坝",SEVERE);
  439. endif;  
  440. if(svDataOwner != "")then
  441.     szdatabase = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q /"exec sp_addrolemember  db_owner N'"+svDataOwner+"'/"";
  442.     LaunchAppAndWait("osql.exe", szdatabase,WAIT);
  443. endif;
  444. SdShowMsg (szWaitTxt, FALSE);  
  445. return 0;
  446. end;
  447. //
  448. //
  449. //浪代琌杆iis
  450. //
  451. //
  452. function CheckIIS()
  453. NUMBER nvType, nvSize;
  454. STRING svvalue;
  455. begin
  456. RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
  457. if (RegDBKeyExist ("System//CurrentControlSet//Services//IISADMIN" ) = 1) then
  458. return (1);
  459. else
  460. return (0);
  461. endif;
  462. end;
  463. //
  464. //
  465. //浪代ieセ
  466. //
  467. //
  468. function Checkie()
  469. NUMBER nvType, nvSize;
  470. STRING svvalue,szKey,szName;
  471. begin
  472. szKey="SOFTWARE//Microsoft//Internet Explorer";
  473. szName="version";
  474. RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
  475. RegDBGetKeyValueEx(szKey, szName, nvType, svvalue, nvSize );
  476. if(svvalue="6.0.2600.0000")then
  477. return (0);
  478. else
  479. return (1);
  480. endif;
  481. end;
  482. //
  483. //浪代mdacセ
  484. //
  485. //
  486. function Checkmdac()
  487. NUMBER nvType, nvSize;
  488. STRING svvalue,szKey,szName;
  489. begin
  490. szKey="SOFTWARE//Microsoft//DataAccess";
  491. szName="version";
  492. RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
  493. if(RegDBGetKeyValueEx(szKey, szName, nvType, svvalue, nvSize ) < 0 ) then
  494. return (0);
  495. else
  496. return (1);
  497. endif;
  498. end;
  499. //
  500. //
  501. //Write dbconn.ini file
  502. //
  503. //
  504. function Writeini(svSQLsvr,svSQLusr,svSQLpwd ,szServerIPDefault,installpath , svDatabaseName , isiis)
  505. string svDate,iniFile,svResult,szInfo,szWaitTxt;
  506. NUMBER nvResult;
  507. begin
  508. //szWaitTxt="タ皌竚╰参郎叫祔獼....";
  509. iniFile =SUPPORTDIR^"dbconn.ini";
  510. //SdShowMsg (szWaitTxt, TRUE);
  511. // Delay(2);
  512. if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
  513. szInfo = "ぃ眔╰参丁";
  514. else
  515. svDate=svResult+" ";
  516. endif;
  517. if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
  518. szInfo = "ぃ眔╰参丁";
  519. else
  520. svDate=svDate+svResult;
  521. endif;
  522. if (WriteProfString(iniFile,"dbconnection","server", svSQLsvr) <0) then
  523. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  524. endif;
  525. if (WriteProfString(iniFile,"dbconnection","db_user",svSQLusr) <0) then
  526. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  527. endif;
  528. if (WriteProfString(iniFile,"dbconnection","db_pass",svSQLpwd) <0) then
  529. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  530. endif;
  531.     
  532. if (WriteProfString(iniFile,"dbconnection","db_name",svDatabaseName) <0) then
  533. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  534. endif;
  535. if (WriteProfString(iniFile,"webwork","webworkstart", svDate) <0) then
  536. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  537. endif;
  538.   
  539. if (WriteProfString(iniFile,"webwork","iis", szServerIPDefault) <0) then
  540. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  541. endif;     
  542. if (WriteProfInt(iniFile,"webwork","isiis", isiis) <0) then
  543. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  544. endif;
  545. if (WriteProfString(iniFile,"installpath","path", installpath) <0) then
  546. MessageBox("dbconn.ini岿粇╰参盢礚猭笲︽", SEVERE);
  547. endif;  
  548. CopyFile(SUPPORTDIR^"dbconn.ini",WINSYSDIR^"dbconn.ini");
  549. end;
  550. //
  551. //爹舱ン
  552. //
  553. function regcom()
  554. string szLine,szWaitTxt;
  555. begin
  556. szLine=WINSYSDIR^"jmail.dll";
  557. szWaitTxt=" タ爹舱ン....";
  558. SdShowMsg (szWaitTxt, TRUE);
  559. Delay(2);
  560. CopyFile(SUPPORTDIR^"jmail.dll",WINSYSDIR^"jmail.dll");
  561. if (LaunchAppAndWait("regsvr32.exe",szLine,WAIT)<0) then
  562. MessageBox ("爹舱ンア毖叫沽刚も笆爹"+szLine,SEVERE);
  563. // else
  564. // MessageBox ("爹舱ンΘ"+szLine,INFORMATION);
  565. //SdShowMsg (szLine, TRUE);
  566. // Delay(3);
  567. endif;
  568. end;
  569. function DelIIS(VirtualFolder)
  570. STRING szCmdLine;
  571. begin
  572.     //埃竒店览ヘ魁
  573.     szCmdLine = SUPPORTDIR ^"adsutil.vbs delete w3svc/1/root/"^VirtualFolder;
  574.     if(LaunchAppAndWait("CScript.exe", szCmdLine, WAIT)<0) then
  575.         MessageBox ("埃iis戈癟狝叭ア毖叫沽刚も笆埃",INFORMATION);
  576.      endif;
  577. end;
  578. //
  579. //埃戈畐
  580. //
  581. //
  582. function DelDataBase(server,user,pass , svDatabaseName)
  583. STRING szWaitTxt,szdatabase1,szdatabase2,szdatabase3,path1;
  584. begin
  585.                             
  586. szWaitTxt=" タ埃戈畐....";
  587. szdatabase2 = "/U "+user+" /P "+pass+" /S "+server+" /Q /"xuweikillspid /""+svDatabaseName +"/"/"";
  588. LaunchAppAndWait("osql.exe", szdatabase2,WAIT);
  589. //SdShowMsg(szdatabase2,WAIT);
  590. //Delay(3);
  591. szdatabase3 = "/U "+user+" /P "+pass+" /S "+server+" /Q /"DROP Database /"" +svDatabaseName+"/"/"" ;
  592. LaunchAppAndWait("osql.exe", szdatabase3,WAIT);
  593. //SdShowMsg(szdatabase3,WAIT);
  594. //Delay(3);
  595. SdShowMsg (szWaitTxt, FALSE);
  596. return 0;
  597. end;      
  598. //---------------------------------------------------------------------------
  599. // OnSetTARGETDIR
  600. //
  601. // OnSetTARGETDIR is called directly by the framework to initialize
  602. // TARGETDIR to it's default value.
  603. //
  604. // Note: This event is called for all setups.
  605. //---------------------------------------------------------------------------
  606. function OnSetTARGETDIR()
  607. number nId, nIgnore, nResult;
  608. string szId, szTARGETDIR;
  609. begin
  610.     // In maintenance mode the value of TARGETDIR is read from the log file.
  611.     if( MAINTENANCE ) then
  612.         return ISERR_SUCCESS;
  613.     endif;
  614.     // Set TARGETDIR to script default.
  615.     TARGETDIR = "<FOLDER_APPLICATIONS>//<IFX_COMPANY_NAME>//<IFX_PRODUCT_NAME>";
  616.     // Read TARGETDIR from the media.
  617.     nResult = MediaGetData( MEDIA, MEDIA_FIELD_TARGETDIR, nIgnore, szTARGETDIR );
  618.     // Use the TARGETDIR from the media if anything was read.
  619.     if( nResult >= ISERR_SUCCESS && StrLengthChars( szTARGETDIR ) ) then
  620.         TARGETDIR = szTARGETDIR;
  621.     endif;
  622.         
  623.     // Customize the default TARGETDIR for multi-instance application.
  624.     // TODO: If you want something different customize the code below.  
  625.     if( MAINT_OPTION = MAINT_OPTION_MULTI_INSTANCE  && MULTI_INSTANCE_COUNT > 0) then
  626.         // Start with the current multi-instance count plus one.
  627.         nId = MULTI_INSTANCE_COUNT + 1;
  628.         // Find a unique TARGETDIR.
  629.         while( ExistsDir( TARGETDIR ) = EXISTS )
  630.             
  631.             // Convert to string.
  632.             NumToStr( szId, nId );
  633.             
  634.             // Update IFX_MULTI_INSTANCE_SUFFIX
  635.             IFX_MULTI_INSTANCE_SUFFIX = "_" + szId;
  636.         
  637.             // Update TARGETDIR
  638.             TARGETDIR = TARGETDIR + IFX_MULTI_INSTANCE_SUFFIX;
  639.             
  640.             // Update nId
  641.             nId = nId + 1;
  642.         endwhile;
  643.     endif;
  644. end;
  645. //---------------------------------------------------------------------------
  646. // OnFirstUIAfter
  647. //
  648. // First Install UI Sequence - After Move Data
  649. //
  650. // The OnFirstUIAfter event called by OnShowUI after the file transfer
  651. // of the setup when the setup is running in first install mode. By default
  652. // this event displays UI that informs the end user that the setup has been
  653. // completed successfully.
  654. //
  655. // Note: This event will not be called automatically in a
  656. // program...endprogram style setup.
  657. //---------------------------------------------------------------------------
  658. function OnFirstUIAfter()
  659.     STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svSQLsvr ,svpass , svuser,szServerIPDefault,svDatabaseName;
  660.     NUMBER bvOpt1, bvOpt2;
  661.     NUMBER bShowUpdateServiceDlg; 
  662.     BOOL isiis;
  663. begin
  664.     ShowObjWizardPages(NEXT);
  665.     
  666.     szTitle = "";
  667.     szMsg1 = ""
  668.     szMsg2 = "";
  669.     szOpt1 = "";
  670.     szOpt2 = "";
  671.     bvOpt1   = FALSE;
  672.     bvOpt2   = FALSE;  
  673.     isiis = FALSE;  
  674.     // Set this to true if you have the update service enabled, and if you want to check for updates.
  675.     // Note: the ISUS Starter Edition does not support checking for updates programatically.  So, 
  676.     // only set this to true if you have at least the ISUS Professional Edition.
  677.     bShowUpdateServiceDlg = FALSE;
  678.     GetProfString (WINSYSDIR^"dbconn.ini""webwork","iis", szServerIPDefault); 
  679.     GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","server", svSQLsvr);
  680.     GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","db_user", svuser);
  681.     GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","db_pass", svpass);                                                           
  682.     GetProfString (WINSYSDIR^"dbconn.ini""dbconnection","db_name",svDatabaseName);
  683.     GetProfInt (WINSYSDIR^"dbconn.ini""webwork","isiis", isiis);
  684.     UpdateKey(TARGETDIR,"connectionString" ,"<add key=/"connectionString/" value=/""+"Server="+svSQLsvr+";UID="+svuser+";PWD="+svpass+";database="+svDatabaseName+"/"/>");
  685.     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+";/">");
  686.     if(isiis) then
  687.         UpdateKey(TARGETDIR,"zhaofengfaq/login/login.aspx" ,"<forms loginUrl=/"/login/login.aspx/""+" protection=/"All/" timeout=/"30/" slidingExpiration=/"true/"/>");
  688.         UpdateKey(TARGETDIR,"VirPath" ,"<add key=/"VirPath/" value=/"/"/>"); 
  689.     else
  690.         UpdateKey(TARGETDIR,"zhaofengfaq/login/login.aspx" ,"<forms loginUrl=/""+szServerIPDefault+"/login/login.aspx/""+" protection=/"All/" timeout=/"30/" slidingExpiration=/"true/"/>");
  691.         UpdateKey(TARGETDIR,"VirPath" ,"<add key=/"VirPath/" value=/""+szServerIPDefault+"/"/>"); 
  692.     endif;
  693.     //UpdateKey(TARGETDIR,"zhaofengfaq/login/login.aspx" ,"<add key=/"FCKeditor:BasePath/" value=/""+szServerIPDefault^"/FCKeditor//"/>");
  694.     //UpdateKey(TARGETDIR,"FCKeditor:UserFilesPath" ,"<add key=/"FCKeditor:UserFilesPath/" value=/""+szServerIPDefault^"/UserFiles//"/>");
  695.     FileInsertLine(TARGETDIR^"Web.config""<?xml version=/"1.0/"?>",0,REPLACE);
  696.     //{{IS_SCRIPT_TAG(Dlg_SdDinishEx)
  697.         
  698.     Disable(LOGGING); 
  699.     if (ExistsDir (TARGETDIR^"uploadFiles//PIC//admin") != EXISTS) then
  700.         // The directory does not exist; create it.
  701.         if (CreateDir (TARGETDIR^"uploadFiles//PIC//admin") < 0) then           
  702.             MessageBox ("承"+TARGETDIR^"uploadFiles//PIC//admin"+"ゅンЖぃΘ叫も笆承", SEVERE);
  703.         endif;
  704.     endif;  
  705.     Enable(LOGGING);
  706.     
  707.     if ( BATCH_INSTALL ) then
  708.         SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
  709.     else
  710.         
  711.         // If the update service is enabled, show finish dialog that includes
  712.         // update check option.
  713.         if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then
  714.             if( SdFinishUpdateEx( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, TRUE ) ) then
  715.                 // Don't check for updates in silent mode.
  716.                 if( MODE != SILENTMODE ) then
  717.                     UpdateServiceCheckForUpdates( "", FALSE );
  718.                 endif;
  719.             endif;
  720.         else
  721.             SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
  722.         endif;
  723.     endif;
  724.     //}}IS_SCRIPT_TAG(Dlg_SdDinishEx)   
  725. end;   
  726. function UpdateKey( svFilePath, svFindEntry, svNewEntry)
  727. NUMBER nResult, nvLineNumber;
  728. STRING WebConfigFile, svReturnLine;
  729. begin
  730.   // build the path to the Web.Config     
  731.   WebConfigFile = svFilePath ^ "Web.config";
  732.   // search the file for the key we specify
  733.   nResult = FileGrep( WebConfigFile, svFindEntry, svReturnLine, nvLineNumber, RESTART );
  734.   switch(nResult)
  735.    case 0:
  736.     // Since this line normally appears twice in our web.config file, we're 
  737.     // checking for the existence of a 2nd match and updating it instead.
  738.     // If there is no 2nd match, go ahead and update the one we find.
  739.     /*
  740.     if ( svFindEntry = "connectionString" ) then
  741.      nResult = FileGrep( WebConfigFile, svFindEntry , svReturnLine, nvLineNumber, CONTINUE );
  742.      if ( nResult < 0 ) then
  743.       FileGrep( WebConfigFile, svFindEntry, svReturnLine, nvLineNumber, RESTART );
  744.      endif;
  745.     endif;
  746.     */
  747.    
  748.     // once we find the key, update (replace) it with our new values
  749.     if ( FileInsertLine( WebConfigFile, svNewEntry, nvLineNumber, REPLACE ) < 0 ) then
  750.      // hmmm we couldn't update the value of the key
  751.      MessageBox( "Unable to update Web.Config file.", SEVERE );
  752.     endif;         
  753.    case -2:
  754.     // File Not Found
  755.     MessageBox( "Web.Config file not found.", SEVERE );
  756.    case -4:
  757.     // EOF reached
  758.     MessageBox( svFindEntry + " key not found.", SEVERE );
  759.    default:
  760.     //unknown error
  761.     MessageBox( "An unknown error has occurred. The Web.Config file has NOT been updated.", SEVERE );
  762.   endswitch; 
  763. end;
  764. //---------------------------------------------------------------------------
  765. // OnIISCheckRequirements
  766. //
  767. // The OnIISCheckRequirements event is called by Preprogram to make sure
  768. // that the requirements for IIS runtime are met
  769. //---------------------------------------------------------------------------
  770. function OnIISCheckRequirements()
  771. STRING szMsg;                
  772. number nResult;
  773. begin
  774.     // if the version is not adequate, display messagebox and abort 
  775.     if ( IISRTGetIISVersion( IIS_GET_VERSION_MAJOR ) < IIS_VERSION_MAJOR_MIN_SUPPORT ) then
  776.         if(REMOVEALLMODE ==0) then 
  777.             //IOC-000043287 do not abort if this is uninstall
  778.             szMsg = SdLoadString( IDS_IFX_IIS_INADEQUATE_VERSION );
  779.             MessageBox(szMsg, SEVERE);
  780.             abort;
  781.         endif;
  782.     endif;
  783. end;
原创粉丝点击