6.22打包建立ISS虚拟目录,安装完运行你想运行的程序
http://installshield.jaron.cn/forum/dispbbs.asp?boardID=3&ID=284614&page=1
#include "ifx.h"??
#define Emty??"" //宏定義DOS功能把Emty 替換為""??
prototype RegUnInstall(STRING);
string szDir, szVirtual;
prototype void CheckRequirements(); //檢測系統必備.net和iis??
prototype void CreateVirtualDir(STRING,string);//創建虛擬目錄 參數1虛擬目錄名 參數2物理路徑
function OnFirstUIBefore()????
????number??nResult,nSetupType;
????string??szName, szCompany;
????string??szTargetPath;
????string??szComponents, szTargetdir;
????number??nLevel;
????LIST????listStartCopy;
????number??nvSize;??
??
begin
???? CheckRequirements();
Dlg_SdWelcome:??
????SetTitle (@TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION);????????
????nResult = SdWelcome( "歡迎使用愛普管理系統安裝向導","以下將在你的計算機上安裝開源愛普ERP,若要繼續安裝,請點擊下一步......" );
??
????Dlg_SdLicense:??
??????
??
????nResult= SdLicense( Emty, Emty, Emty,??SUPPORTDIR ^ "license.txt" );
????if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdRegisterUserEx:
??
????nResult = SdRegisterUser( Emty, Emty, szName, szCompany );
????if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SdAskDestPath:
????TARGETDIR = PROGRAMFILES^@PRODUCT_NAME;
????szDir = TARGETDIR;??
????nResult = AskDestPath( Emty, Emty, szDir,0 );
????TARGETDIR = szDir;
????if (nResult = BACK) goto Dlg_SdRegisterUserEx;
Dlg_SetupType:??
??????
?????? nSetupType = TYPICAL; //默認安裝類型
????nResult = SetupType ( Emty , Emty , Emty , nSetupType , 0 );
????if (nResult = BACK) then
????????goto Dlg_SdAskDestPath;
????else
????????nSetupType = nResult;
????????if (nSetupType != CUSTOM) then
????????szTargetPath = TARGETDIR;
????????nvSize = 0;
????????ComponentCompareSizeRequired(MEDIA,szTargetPath,nvSize);
????????if (nvSize != 0) then??????
????????????????MessageBox( szSdStr_NotEnoughSpace, WARNING );
????????????goto Dlg_SetupType;
????????????endif;
????????endif;??
????endif;
Dlg_SdComponentTree:
????if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType;??????
????szTargetdir = TARGETDIR;
????szComponents = "";
????nLevel = 2;
????if (nSetupType = CUSTOM) then
??????nResult = SdComponentTree(Emty, Emty, szTargetdir, szComponents, nLevel);
??????if (nResult = BACK) goto Dlg_SetupType;??
????endif;
????
Dlg_AskText :??
szVirtual=@PRODUCT_NAME;????
SetDialogTitle(DLG_ASK_TEXT,Emty);
nResult=SdShowDlgEdit1 ("設置虛擬目錄", "請輸入虛擬目錄名,安裝程序將設置IIS信息服務.\n如果您沒有填寫,安裝程序將按默認方式創建!","虛擬目錄名稱:",szVirtual);
Dlg_SdStartCopy:
????if (szVirtual = "") then
??MessageBox ("請輸入虛擬目錄的名稱!",INFORMATION) ;??
??goto?? Dlg_AskText;
??endif;
?? listStartCopy = ListCreate( STRINGLIST );
????ListAddString(listStartCopy,"用戶名:"+szName,AFTER);
???? ListAddString(listStartCopy,"公司名稱:"+szCompany,AFTER);??
????ListAddString(listStartCopy,"目標目錄:"+szDir,AFTER);??
????ListAddString(listStartCopy,"請確認您填寫的信息,按下一步開始復制文件",AFTER);
????nResult = SdStartCopy( "", "", listStartCopy );
????ListDestroy(listStartCopy);
????if (nResult = BACK) goto Dlg_SdComponentTree;??????????
???? SetStatusWindow(0, "");
?????? Enable(STATUSEX);
?????? StatusUpdate(ON, 100);
???????? return 0;
end;
function OnMoving()
????string szAppPath;
begin
???? RegUnInstall("");
????szAppPath = TARGETDIR;
????RegDBSetItem(REGDB_APPPATH, szAppPath);
????RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);
end;??
function void CheckRequirements()??
begin??
SdShowMsg ("安裝程序正在檢測系統必備組件......",TRUE);
Delay(1);??
SdShowMsg (Emty,FALSE);
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
if (RegDBKeyExist ("System\\CurrentControlSet\\Services\\IISADMIN" ) != 1) then
??if(SprintfBox(MB_OK,"檢測系統環境","你的計算機沒有被安裝IIS,請安裝后重試,安裝程序將退出!")=IDOK)
then exit;??
endif;??
endif;
if (RegDBKeyExist ("SOFTWARE\\Microsoft\\.NETFramework\\policy\\v1.1" ) != 1) then????????
??if(LaunchAppAndWait ( SUPPORTDIR ^"dotnetfx.exe" , "/q:a/l" ,WAIT)<0) then
???? SprintfBox(MB_OK,".NET安裝","安裝.net框架時發生意外,請重新安裝!");
?? endif;
?? endif;??????
end;??
function??void CreateVirtualDir(VirtualFolder, szDir)
begin
if (VirtualFolder = "") then
MessageBox ("請輸入虛擬目錄的名稱!",INFORMATION) ;
else
SdShowMsg (" 正在創建虛擬目錄"+VirtualFolder+"請不要關閉....", TRUE);
Delay(1);
LaunchAppAndWait(SUPPORTDIR^"Create.exe", VirtualFolder+" \""+TARGETDIR+"\" ",WAIT);
//AddFolderIcon (FOLDER_DESKTOP , "愛普管理系統" ,"http://localhost"^VirtualFolder^"Default.aspx" ,Emty, Emty, 0, Emty, REPLACE|RUN_MINIMIZED);
??//這里不知道為什么 只要創建快捷方式就很卡 得等待很久
//AddFolderIcon ( FOLDER_PROGRAMS , "愛普管理系統" ,"http://localhost"^VirtualFolder^"Default.aspx" ,Emty, Emty, 0, Emty, REPLACE|RUN_MINIMIZED);
SdShowMsg (Emty,FALSE);
endif;
end;
function RegUnInstall(szKey)
?? STRING svUninstLogFile;??
begin
????//反安裝的注冊
?????? InstallationInfo(@COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY);
?????? DeinstallStart(TARGETDIR, svUninstLogFile, "", 0);
?????? RegDBSetItem(REGDB_UNINSTALL_NAME, @PRODUCT_NAME);
?????? DeinstallSetReference (TARGETDIR ^ @PRODUCT_KEY);????
end;????
function OnFirstUIAfter()
??????
???? NUMBER bOpt1, bOpt2,nResult, nDefOptions;
????
???? begin??
???? Disable(STATUSEX);
???? CreateVirtualDir(szVirtual, szDir);//這里會出現Dos窗口
???? if (!BATCH_INSTALL) then
???? bOpt1 = FALSE;
???? bOpt2 = TRUE;
????
???? nResult = SdFinish( "安裝完成","已經成功安裝愛普管理系統,單擊完成以退出安裝向導", Emty, "閱讀Readme文件", "立刻運行程序", bOpt1, bOpt2 );
????
???? if bOpt1 = TRUE then
???? CopyFile (SUPPORTDIR^"Readme.txt" , "Readme.txt" );
???? LaunchApp ( WINDIR^"Notepad.exe" , TARGETDIR^"Readme.txt" );
???? endif;
???? if??bOpt2=TRUE then
??????LaunchAppAndWait(SUPPORTDIR^"IEXPLORE.EXE","localhost"^szVirtual^"default.aspx",NOWAIT) ;
??????endif;
??????return 0;
???? endif;
????end;
function OnMaintUIAfter()
????STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
????NUMBER bOpt1, bOpt2;
begin
Disable(STATUSEX);
????ShowObjWizardPages(NEXT);
bOpt1?? = FALSE;
????bOpt2?? = FALSE;
????szMsg1??= SdLoadString(IFX_SDFINISH_MAINT_MSG1);
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
????SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
end;
下面這個是建ISS虛擬目錄用到的CREATE.EXE的源代碼
#include<stdio.h>
#include <stdlib.h>
char *??concat(const char * dos,const char * argv)
{char *str;
int i,j,dos_len,argv_len,length;
dos_len=strlen(dos);
argv_len=strlen(argv);
length=dos_len+argv_len;
str=(char *)malloc(length+1);
??for(i=0,j=argv_len;i<dos_len||j>=0;)
{
??if(i<dos_len)??
????str[i]=dos[i++];
??if(j>=0)
?? str[length--]=(argv)[j--];
}
??return str;
}
main(int argc, char* argv[])
{
if(argc>2)
{
char *str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs delete w3svc/1/root/",*++argv);??
system("@echo off");
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs create_vdir w3svc/1/root/",*argv);
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs set w3svc/1/root/",*argv);
str=concat(str,"/path \"");
str=concat(str,*++argv);
str=concat(str,"\"");
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs APPCREATEPOOLPROC w3svc/1/root/",*--argv);
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs set w3svc/1/root/",*argv);
str=concat(str,"/AccessScript TRUE");
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs set w3svc/1/root/",*argv);
str=concat(str,"/AccessFlags 513");
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs set w3svc/1/root/",*argv);
str=concat(str,"/AuthFlags 5");
system(str);
free(str);
str=concat("@cscript.exe %SystemDrive%/Inetpub/AdminScripts/adsutil.vbs set w3svc/1/root/",*argv);
str=concat(str,"/DefaultDoc \"Default.aspx\"");
system(str);
free(str);
system("@cls");
system("@exit");
}
}
轉載于:https://www.cnblogs.com/draeag/archive/2007/07/07/809606.html
總結
以上是生活随笔為你收集整理的6.22打包建立ISS虚拟目录,安装完运行你想运行的程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 原神寻宝仙灵如何汲取能量
- 下一篇: 做性激素六项检查什么时候去查最好?