网站安装文件制作

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值