入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

InstallShield打包源码公布

创建时间:2018-01-31 投稿人: 浏览次数:280

InstallShield打包源码公布包含重量级别的内容。

Setup.rul 内容

#include "ifx.h"
#include "global.h"




BOOL   gb_ShowCheckPort;
prototype ExFn_UFWelcome(HWND);
prototype ExFn_UFDetector(HWND);
prototype ExFn_UFEnvCheck(HWND,NUMBER);
prototype ExFn_UFSetupType(HWND, BYREF STRING);    
prototype ExFn_UFSetupTypeMode(HWND, BYREF STRING); 
prototype ExFn_UFStartCopy2(HWND);
prototype IsCustomType(string);
prototype string ExFn_UFGetFeatureStr(string);
prototype void ExFn_PreSetRegs();
//prototype NUMBER ExFn_UFWelcomeMain(HWND, NUMBER);
prototype ExFn_DelStrException(string);






//设置安装目录 ...
//---------------------------------------------------------------------------
// 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,messageboxshowstr;
BOOL isintall,inuninstall,isshutvirus,iscupmerroryadapt,isadapt;  
STRING cmdline;
LIST listNosysDiskID;  
NUMBER nCountNoDisk; 
string svString,svStringnoslash;




begin
     
    /*
    UseDLL(ENVCHECK_DLL);  
      RunNoBlock("CMD /C taskkill /F /IM explorer.exe"); 
      //RunNoBlock("CMD /C explorer.exe");
UnUseDLL(ENVCHECK_DLL);  
*/
    //nosetup
    g_bDebug = TRUE;  
    //是否是调试状态,不安装MSI包.只测试流程如果为TRUE ,正式安装修改为FALSE
    g_bIsDeugU8=FALSE;
    if(!g_bDebug) then  
     //安装模式..
     if !MAINTENANCE then
       cmdline=CMDLINE;  
       if(StrFindEx(cmdline,"nosetup",0)<0)  then  
          LaunchAppAndWait(SRCDIR^"SetupShell.exe","",LAAW_OPTION_NOWAIT);
          abort;  
        endif;   
      endif;
    endif;
    //MessageBox(cmdline,INFORMATION);  
    
    ExFn_SetReStartTip();
    
    isintall=FALSE; inuninstall=FALSE;  isshutvirus=FALSE; iscupmerroryadapt=FALSE;
    messageboxshowstr="";
    //如果是维护模式(修改和卸载)
    if MAINTENANCE then
     // 判断是否是系统管理员权限   SYSINFO.WINNT.bAdmin_Logged_On管理员组    bPowerUser_Logged_On管理员Administrator
     if (!SYSINFO.WINNT.bAdmin_Logged_On)then 
        inuninstall=TRUE;
        messageboxshowstr=messageboxshowstr+@ID_MINISTRATORUninstalll+" ";
     endif;
    endif; 
    //如果是安装模式。
    if !MAINTENANCE then
     // 判断是否是系统管理员权限   SYSINFO.WINNT.bAdmin_Logged_On管理员组    bPowerUser_Logged_On管理员Administrator
     if (!SYSINFO.WINNT.bAdmin_Logged_On)then 
        isintall=TRUE;   
        messageboxshowstr=messageboxshowstr+@ID_STRINGADMINISTRATOR+" "+" ";
     endif;  
           
   endif; 
    //删除趋势
    //停止趋势服务
    StopServiceU8("tmlisten");  
    StopServiceU8("ntrtscan"); 
    StopServiceU8("TmProxy"); 
    
    UseDLL(ENVCHECK_DLL);
    //删除趋势进程 
    RunNoBlock("CMD /C taskkill /F /IM PccNTMon.exe");
    UnUseDLL(ENVCHECK_DLL);
    //关闭杀毒软件提示!
    if !isshutvirus then 
      isshutvirus=TRUE;
      messageboxshowstr=messageboxshowstr+@ID_Killvirusinfo+" "+" ";
    endif;
    
    //检查CPU及内存是否达到推荐配置要求, 不是卸载或者修改的时候提示。
    if !MAINTENANCE then   
        UseDLL(ENVCHECK_DLL);  
        isadapt= GetCPUClockPerMillisecond()&&GetMemory();
        if !isadapt then
         messageboxshowstr=messageboxshowstr+@ID_Cupmerroryadapt+" "; 
         iscupmerroryadapt=TRUE;  
        endif;
        UnUseDLL(ENVCHECK_DLL);
    endif;
    
    if(inuninstall||isintall) then
      SetDialogTitle (DLG_MSG_INFORMATION, @ID_STRING79);  
      SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
      MessageBox (messageboxshowstr,INFORMATION);
      abort;  
    else
      SetDialogTitle (DLG_MSG_INFORMATION, @ID_STRING79); 
      SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
      MessageBox (messageboxshowstr,INFORMATION); 
    endif;
     
    
    // 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;






    try
      //修改默认安装路径为非系统盘
      listNosysDiskID=GetEliminateSystemDisk();
      nCountNoDisk = ListCount(listNosysDiskID);
      if nCountNoDisk>=1 then
         nResult = ListGetFirstString(listNosysDiskID, svString);
         StrRemoveLastSlash(svString);
          TARGETDIR=svString+"U8SOFT"; 
       endif;  
    catch
       ExFn_WriteLog("GetEliminateSystemDisk:","ERROE"); 
    endcatch;   
 
 
// 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;




function OnBegin()
string strSysDir, svResult,regkeygrantpri,szMsg,svUsername;
NUMBER nStart,nLast; 
NUMBER nErr,nBuffer; 
NUMBER nvResult;
STRING svResultinfo,svResultinfoDATA,szInfotime,szInfodata;    
/////////////////////添加测试变量//////////////////////////   


NUMBER m_return;
/////////////////////结束添加测试变量//////////////////////
begin      
g_bDebug = FALSE;   
g_bSystemlangid=SYSINFO.nSystemLangID;  

//////////////////添加测试代码//////////////////// 
    
///////////////结束添加测试代码//////////////////

//日期时间
if (GetSystemInfo (TIME, nvResult, svResultinfo) < 0) then
       szInfotime = "Couldn"t get TIME info.";
       ExFn_WriteLog("szInfo:",szInfotime); 
    else
        Sprintf(szInfotime, "TIME: %s", svResultinfo);
        ExFn_WriteLog("szInfo:",szInfotime); 
    endif;
    
    if (GetSystemInfo (DATE, nvResult, svResultinfoDATA) < 0) then
       szInfodata = "Couldn"t get DATE info.";
       ExFn_WriteLog("szInfodata:",szInfodata); 
    else
        Sprintf(szInfodata, "TIME: %s", svResultinfoDATA);
        ExFn_WriteLog("szInfodata:",szInfodata); 
    endif;
    


    ExFn_WriteLog("start DATA TIME :",szInfodata+szInfotime);
DialogSetInfo (DLG_INFO_ALTIMAGE, "", TRUE);
DialogSetInfo (DLG_INFO_ALTIMAGE, SUPPORTDIR ^ "Setup.bmp", TRUE);     
if (FindFile ("c:\", "u8111.setup.debug", svResult) >= 0) then 
g_bDebug = TRUE;
MessageBox("Setup in Debug", INFORMATION);
      if (FindFile (TARGETDIR+"\EAI\Tools\EnvDetector", "UFIDA.U8.EAI.EnvDetector.exe", svResult) < 0) then
    nErr =DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\企业应用集成(EAI)","U8EAI环境检测与修复工具"); 
    if(nErr != 0)  then
    svResult =FormatMessage(nErr);
    endif;
    endif;  
    endif;
              
ExFn_WriteLog("The disk date is Start Setup","2016-09-01");  

if(g_bDebug) then
ExFn_WriteLog("*****Warning*******","It"s Debug Version");
endif; 
    
    //check os version, below win2000 exit
if (SYSINFO.nOSMajor < 5 || (SYSINFO.nOSMajor == 5 && SYSINFO.nOSMinor < 1)) then
MessageBox ( @STR_NOSUPPORT_OS2000, INFORMATION );
exit;
endif;

    


strSysDir=WINSYSDIR;
    //Kernel32.GetSystemDirectory(strSysDir,261);

    
StrRemoveLastSlash(strSysDir);
m_WinDir = strSysDir;
nStart = StrFind(strSysDir,"\");
while(nStart>=0)
nLast = nLast+nStart+1;
StrSub(strSysDir,strSysDir,nLast,StrLength(strSysDir)-nLast);
nStart = StrFind(strSysDir,"\");
endwhile;
StrSub(m_WinDir,m_WinDir,0,nLast);
StrRemoveLastSlash(m_WinDir);
    ExFn_WriteLog("m_WinDir",m_WinDir);  
  ExFn_InitAllInstalled();   
 
  ///////////////////////////////////////////////////////////////////  
    
  ///////////////////////////////////////////////////////////////////
 
    SetOsSafeControl();      //设置系统的安全属性。    lilf  在 runcommad.rul文件中  
    SetUAC();                //设置UAC权限降低到最小,放大注册表的读写权限..
    SetDontshowUI();         //设置启动错误报告机制
    if !MAINTENANCE then     
         CopyVS2011RuntimeDLL();
    endif;
   // SetFTHRegister();
    UseDLL(ENVCHECK_DLL);  
      if (ExistsDir (m_WinDir^"Installer") = EXISTS) then 
  EnableDirectoryACL(m_WinDir+"\Installer");   
 endif;
UnUseDLL(ENVCHECK_DLL);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);  
ExFn_WriteLog("设置安装写日志,添加注册表值 ","SoftWare\Ufsoft\WF\V8.700\Install\EnableLogs");  
    if RegDBKeyExist ("SoftWare\Ufsoft\WF\V8.700\Install\EnableLogs") < 0 then
    g_bInstallLog = FALSE;   
    ExFn_WriteLog("不写日志 "," g_bInstallLog = FALSE");
    else
    g_bInstallLog = TRUE;  
    ExFn_WriteLog("写安装日志  "," g_bInstallLog = TRUE");
    endif;
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);    
    ExFn_WriteLog("NoEnvCheck  ","SoftWare\Ufsoft\WF\V8.700\Install\NoEnvCheck");  
    if RegDBKeyExist ("SoftWare\Ufsoft\WF\V8.700\Install\NoEnvCheck") == 1 then       
    g_bNoEnvCheck = TRUE;  
    ExFn_WriteLog("不进行环境检测 "," g_bNoEnvCheck = TRUE");
    else
    g_bNoEnvCheck = FALSE;   
    ExFn_WriteLog("进行环境检测"," g_bNoEnvCheck = FALSE");
    endif;
    
    Dlg_Windows64Support:
    if g_bNoEnvCheck=FALSE then
      if ( SYSINFO.bIsWow64 != 0 ) then
         ExFn_WriteLog("读取操作系统位数"," 64位系统");
      else
        ExFn_WriteLog("读取操作系统位数"," 位系统");
        if (IDYES = SprintfBox(MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2, @TITLE_CAPTIONBAR, @SystemNotSupportWindows32position)) then
           Do(EXIT);
        else
           MessageBox (@SystemNotSupportWindows32position, SEVERE);
           Do(EXIT);
        endif;
      endif;
      
    endif;
    if g_bNoEnvCheck=FALSE then
      if ( SYSINFO.bIsWow64 != 0 ) then
         ExFn_WriteLog("读取操作系统位数"," 64位系统");
      else
         ExFn_WriteLog("读取操作系统位数"," 位系统");
         goto Dlg_Windows64Support;
      endif;
    endif;
    
    //跳过清除...
    ExFn_WriteLog("Nocleaning  ","SoftWare\Ufsoft\WF\V8.700\Install\nocleaning");  
    if RegDBKeyExist ("SoftWare\Ufsoft\WF\V8.700\Install\nocleaning") == 1 then       
    g_bNoCleaning = TRUE;  
    ExFn_WriteLog("跳过清除 "," g_bNoCleaning = TRUE");
    else
    g_bNoCleaning = FALSE;   
    ExFn_WriteLog("清除"," g_bNoCleaning = FALSE");
    endif;   
    
    //读取操作系统如果是Server版本不让安装科迈..
    if(SYSINFO.nOSProductType=VER_NT_SERVER) then
        g_bIsServerIOS=TRUE;
        ExFn_WriteLog("读取操作系统如果是Server版本让安装科迈"," g_bIsServerIOS=TRUE");
    else
        g_bIsServerIOS=FALSE;
        ExFn_WriteLog("读取操作系统如果不是Server版本不让安装科迈"," g_bIsServerIOS=FALSE");
    endif; 
    
end;


function OnFirstUIBefore()
    number  nResult,nResultsmartclient,nModeResult, nLevel, nSize, nSetupType;
    string  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile, svSetupType,killAcroRd32process,killnotepadprocess;
    string  szName, szCompany, szTargetPath, szDir,svTarget, szFeatures;
    BOOL    bLicenseAccepted;
    BOOL    bHasUFInstalled;
    string  szExistProduct;
    STRING  msiStr;
    NUMBER  nDiskSpace,nFeatureSize;    
    STRING  str1,str2;
    string  szFile;
    _DISK_INFO diWinDisk;
    string sFeatureSize,sDiskSpace,sInfo;
    BOOL bConfirmEmptyDirectory; 
    STRING svSetupModeType; 
    string svDrive; 
    NUMBER  nHwnd; 
    
    BOOL iseisonly;
begin
    gb_ShowCheckPort = FALSE;
    nSetupType = COMPLETE;
    svSetupModeType=@ID_STRING2001;
    svSetupType = "Complete";
    szDir = TARGETDIR;
    szName = "";
    szCompany = "";
    bLicenseAccepted = FALSE;
    bHasUFInstalled = FALSE;
    szExistProduct = "";
    SetTitle (@TITLE_MAIN, 0, BACKGROUNDCAPTION);



Dlg_Start:
    nResult = 0;
    
Dlg_SdWelcome:
    szTitle = "";
    szMsg = "";
    nResult = ExFn_UFWelcome(NULL);
    if (nResult = BACK)
    goto Dlg_Start;    
    
Dlg_SdLicense2:
    szTitle = "";
    //szOpt1 = @IDS__DialogId_12069_ControlId_1000_1;
    //szOpt2 = @IDS__DialogId_12069_ControlId_1000_2;
    //szLicenseFile = SUPPORTDIR ^ "License.txt";
    bLicenseAccepted=FALSE;
    //nResult = SdLicense2Ex( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted,FALSE);
    nResult=ExFn_SdLicenseSelf();
    if (nResult = BACK) then
        goto Dlg_SdWelcome;
    else
        bLicenseAccepted = TRUE;
    endif;
    //删除adpreader程序..
    killAcroRd32process="AcroRd32.exe"; 
    ExFn_TaskKillProcess(killAcroRd32process);
    //删除记事本.
    killnotepadprocess="notepad.exe"; 
    ExFn_TaskKillProcess(killnotepadprocess);
    //删除进程中msiexec.exe 执行程序。
    StopMsiexecInTaskKill();
    //添加soapsdk.msi供iis检测需要.
    ExFn_SetUpSoapsdk();
      
    //判断是否安装过智能客户端
    if(CheckIsInstallU8SmartClient()=TRUE) then
       MessageBox (@ID_SmartClientSetup, WARNING);
       abort;
    endif;    
    
UseDLL(SUPPORTDIR^"EnvCheckDLL.dll");   
if (!g_bNoEnvCheck) then
 if !MAINTENANCE then
   if(g_bNoCleaning=FALSE) then   
          //历史版本判断
          //调试的时候可以注释调
   bHasUFInstalled = MultiCheckUFInstalled(SUPPORTDIR) || ExFn_MsiExist();  
 //调试的时候可以注释调
endif;
DeleteFile(WINSYSDIR^"U8.ico"); 
 endif;
//bHasUFInstalled=TRUE;
endif;
UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
//ExFn_ClearU8Reg(); 
//ExFn_DeleteAllWebs();

//监测msdtc服务的状态,如果是停止,则开启它。
  //suggested by zhengyun added by pengwc 2008.8.18
  //UseDLL(SUPPORTDIR^"EnvCheckDLL.dll"); 
  //checkMSDTCservice(); 
//UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
    


////清除历史版本信息
Dlg_UFDetector:
if(g_bDebug) then
bHasUFInstalled = FALSE; //Added for debug  
endif;  
if(bHasUFInstalled) then
nResult = ExFn_UFDetector(NULL);
if (nResult = BACK)
goto Dlg_SdLicense2;


UseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
if(!g_bDebug) then 
 if !MAINTENANCE then
  if(g_bNoCleaning=FALSE) then
   //历史版本清除处理
   //调试的时候可以注释调
 Cleaning(SUPPORTDIR);  //Commented for debug
//调试的时候可以注释调
  endif;
 endif;
endif;
ExFn_ClearAllMsiReg(); 
UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
endif;


Dlg_SdRegisterUser:
    szMsg = "";
    szTitle = ""; 
    szName="yonyou";
    szCompany="yonyou";
    nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
    ExFn_ClearU8Reg(); 
    if (nResult = BACK) goto Dlg_SdLicense2;


Dlg_SdAskDestPath2:
szTitle = "";
    szMsg = "";
nResult = SdAskDestPath2( szTitle, szMsg, szDir );  

if StrLength(szDir) < 4 then
   if (nResult = BACK) goto Dlg_SdRegisterUser; 
   SetDialogTitle (DLG_MSG_INFORMATION, @ID_PathValidate);
MessageBox(@STR_NOT_INSTALL_EMPTY, INFORMATION);
goto Dlg_SdAskDestPath2;
endif;

    if ExFn_CheckDirName(szDir) == FALSE then
      if (nResult = BACK) goto Dlg_SdRegisterUser;    
      SetDialogTitle (DLG_MSG_INFORMATION, @ID_PathValidate);
      MessageBox(@STR_NOT_VALID_PATH, INFORMATION);
      goto Dlg_SdAskDestPath2;
     endif;
     
ExFn_RemoveFrontBlanks(szDir);
 
if StrFindEx (szDir, "\", 0) < 0 then
StrSub(str1, szDir,0,2);
StrSub(str2, szDir,2,StrLength(szDir)-2);
szDir = str1 + "\" + str2;
endif;
    
    //如果选择C:Program Files 不添加可能把其它文件清除...
    StrToUpper(svTarget, szDir);
    if(StrFindEx(svTarget,"U8SOFT",0)<0)  then 
        svTarget=svTarget+"\U8SOFT";   
    endif;
    
    TARGETDIR = svTarget;    
    ExFn_WriteLog("TARGETDIR-----PATH",TARGETDIR);
    ////////////////////添加测试代码////////////////////////////////////////////////




    ////////////////////////////////////////////////////////////////////
    if(StrFindEx(TARGETDIR,"U8SOFT",0)>0)  then 
     if (nResult != BACK)  then 
      ExFn_WriteLog("DeleteTargirFilesInformation-----installshield",SUPPORTDIR+"::"+TARGETDIR);                                               
      UseDLL(ENVCHECK_DLL);  
       if !MAINTENANCE then  
        DeleteTargirFilesInformation(SUPPORTDIR,TARGETDIR); 
       endif;
  //RunNoBlock("CMD /C rmdir /s/q " +"""+TARGETDIR+""");
 UnUseDLL(ENVCHECK_DLL); 
 ExFn_WriteLog("DeleteTargirFilesInformation-----installshield","END");     
 //安装前删除所有的DLL,ocx,exe文件.. 
      //ExFn_ALLDELETEDirAndFiles(); 
      //ExFn_DELETEDirAndFiles(TARGETDIR);
     endif;
endif;   
ExFn_WriteLog("ExFn_FeatureCost-----","START");
ExFn_FeatureCost();
ExFn_WriteLog("ExFn_FeatureCost-----","END");
    if (nResult = BACK) goto Dlg_SdRegisterUser;   
    
//应用模式选择
Dlg_SetupModeType:
    szTitle = "";
    szMsg = ""; 
    szTitle=@TITLE_MAIN;
    
     
    nModeResult = ExFn_UFSetupTypeMode(NULL, svSetupModeType);   
    g_installmode=svSetupModeType; 
    if (nModeResult = BACK) then
        goto Dlg_SdAskDestPath2;
    else
    if (svSetupModeType==@ID_STRING2002) then    //全产品集中应用模式(远程接入)  
       g_bISinstallRemoteImport=TRUE;                    
    if ((nModeResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2; 
    szTitle = "";
            szMsg = "";
            szFeatures = "AllProduct"; 
            nLevel = 1;  
            nSetupType=COMPLETE;
            if (nSetupType = CUSTOM) then  
                 nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif;  
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif; 
       
       //设置安装类型为全产品模式  
            FeatureSetupTypeSet(MEDIA,"AllProduct");
            FeatureSelectItem (MEDIA, "RAS",TRUE);   
        
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif; 
       
            
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck; 
   //U8V13.0添加金万维远程接入  
   elseif (svSetupModeType==@ID_JWW1002) then    //全产品集中应用模式(金万维远程接入)
       g_bISinstallRemoteImportJWW=TRUE;                    
    if ((nModeResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2; 
    szTitle = "";
            szMsg = "";
            szFeatures = "AllProduct"; 
            nLevel = 1;  
            nSetupType=COMPLETE;
            if (nSetupType = CUSTOM) then  
                 nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif;  
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif; 
       
       //设置安装类型为全产品模式  
            FeatureSetupTypeSet(MEDIA,"AllProduct");
            FeatureSelectItem(MEDIA,"JWW",TRUE);   
        
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif; 
       
            
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck; 
        //u8v12.5版本删除PLM 
        /*
    elseif(svSetupModeType==@ID_STRING2005) then    //全产品集中应用模式(远程接入含PDM) 
       g_bISinstallRemoteImport=TRUE;                    
    if ((nModeResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2; 
    szTitle = "";
            szMsg = "";
            szFeatures = "AllProduct"; 
            nLevel = 1;  
            nSetupType=COMPLETE;
            if (nSetupType = CUSTOM) then  
                 nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif;  
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif; 
       
       //设置安装类型为全产品模式  
            FeatureSetupTypeSet(MEDIA,"AllProduct");
            FeatureSelectItem (MEDIA, "RAS",g_bSetupmodeleSelected);  
            FeatureSelectItem (MEDIA, "PDM",g_bSetupPDMSelected);  
        
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif; 
       
            
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck;        
   */    
    elseif(svSetupModeType==@ID_STRING2001) then //经典应用模式   
       goto Dlg_SetupType2;        
    ////u8v12.5版本删除PLM 
    /*
    elseif(svSetupModeType==@ID_STRING2004) then //经典应用模式(含PDM)
       
       goto Dlg_SetupType2;  
    */      


        elseif(svSetupModeType==@ID_JWW1003) then //客户端集中应用模式(金万维远程接入)
            g_bISinstallRemoteImportJWW=TRUE;      
            nSetupType = CUSTOM; 
    if ((nModeResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2; 
    szTitle = "";
            szMsg = "";
            szFeatures ="Client";
            nLevel = 1;
            if (nSetupType = CUSTOM) then
                 //设置安装类型为客户端模式  
                 FeatureSetupTypeSet(MEDIA,"ClientSetType");
                 FeatureSelectItem(MEDIA,"JWW",TRUE);  
                 nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif;  
            
            if (nModeResult = BACK) then     
               goto Dlg_SetupModeType;
            endif;
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif;  
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif;
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck; 
          
        elseif(svSetupModeType==@ID_STRING2003) then //客户端集中应用模式(远程接入) 
            g_bISinstallRemoteImport=TRUE;      
            nSetupType = CUSTOM; 
    if ((nModeResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2; 
    szTitle = "";
            szMsg = "";
            szFeatures ="Client";
            nLevel = 1;
            if (nSetupType = CUSTOM) then
                 //设置安装类型为客户端模式  
                 FeatureSetupTypeSet(MEDIA,"ClientSetType");
                 FeatureSelectItem (MEDIA, "RAS",TRUE);  
                 nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif;  
            
            if (nModeResult = BACK) then     
               goto Dlg_SetupModeType;
            endif;
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif;  
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif;
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck; 
        endif;
    endif;


 
 
//安装类型的选择,全产品,自定义,客户端的设置    
Dlg_SetupType2:
    szTitle = "";
    szMsg = "";
    nResult = CUSTOM;


    nResult = ExFn_UFSetupType(NULL, svSetupType);
    if(svSetupType=="ClientSetType") then 
         g_setuptype="ClientSetType";
    elseif(svSetupType=="AllProduct") then 
         g_setuptype="AllProduct";
    elseif(svSetupType=="ServerSetType") then 
         g_setuptype="ServerSetType";   
    elseif(svSetupType=="CustomSetType") then 
         g_setuptype="CustomSetType";                  
    endif;
    if (nResult = BACK) then
        goto Dlg_SetupModeType;
    else
    if (IsCustomType(svSetupType)) then
    nSetupType = CUSTOM;
    else
        nSetupType = nResult;
        endif;


    endif;


//智能客户端安装提示
Dlg_SmartClientTip:
    szTitle="";
    szMsg = "";  
    //如果是经典安装模式的客户端安装模式,提示智能客户端.
    if (g_installmode=@ID_STRING2001) then
       if(svSetupType=="ClientSetType") then
          //nResultsmartclient = ExFn_SmartClientDialog(szTitle);
          nResultsmartclient = ExFn_SmartTraditionClientDialog(szTitle);
          if (nResultsmartclient = BACK) then
     goto Dlg_SetupType2;
      endif;
       endif;    
    endif;


Dlg_SdFeatureTree:
    if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
    szTitle = "";
    szMsg = "";
    szFeatures = ExFn_UFGetFeatureStr(svSetupType);
    nLevel = 1;  
    if (nSetupType = CUSTOM) then
        if (szFeatures="Server") then 
          nLevel = 2; 
          nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
          if(g_bSetupPDMSelected=TRUE) then 
             FeatureSelectItem (MEDIA, "PDM", TRUE);
             ExFn_WriteLog("选择PDM","PDM");
          else
             FeatureSelectItem (MEDIA, "PDM", FALSE);
             ExFn_WriteLog("不选择PDM","PDM");
          endif;
        elseif(svSetupType="CustomSetType") then
          nLevel = 2;
          nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
          //如果选择了自定义安装模式,安装模式是PDM安装模式,那么只有选择了  服务器应用服务器基础服务 的时候才安装PDM
          if(g_bSetupPDMSelected=TRUE) then
            if FeatureIsItemSelected(MEDIA,"Server\WebServerAppServer\WebPortal")=1 then 
             FeatureSelectItem (MEDIA, "PDM", TRUE);
             ExFn_WriteLog("选择PDM","PDM");
            else
             FeatureSelectItem (MEDIA, "PDM", FALSE);
             ExFn_WriteLog("不选择PDM","PDM");
            endif; 
          endif;   
                  
        else
           nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
           //如果选择了PDM安装模式 又选择了自定义安装,就不安装PDM模块,因为PDM只能安装到U8的服务端
           if(g_bSetupPDMSelected=TRUE) then
             FeatureSelectItem (MEDIA, "PDM", FALSE);
             ExFn_WriteLog("不选择PDM","PDM");
           endif;
          endif;
        if (nResult = BACK) goto Dlg_SetupType2;
   endif;


   //如果选择了全产品且是 经典加PDM的安装模式...
   if(svSetupType="AllProduct") then 
      if(g_bSetupPDMSelected=TRUE) then 
             FeatureSelectItem (MEDIA, "PDM", TRUE);
             ExFn_WriteLog("选择PDM","PDM");
      else
             FeatureSelectItem (MEDIA, "PDM", FALSE);
             ExFn_WriteLog("不选择PDM","PDM");
      endif;   
    endif;
    
   //如果没有选择Server\WebServerAppServer\WebPortal 基础服务,不安装PDM
   if FeatureIsItemSelected(MEDIA,"Server\WebServerAppServer\WebPortal")!=1 then 
        FeatureSelectItem (MEDIA, "PDM", FALSE);
        ExFn_WriteLog("不选择PDM","PDM");
   endif;
   
   
   if ExFn_FeatureCount() = 0 then
MessageBox(@MSG_ZEROFEATURE,SEVERE);
goto Dlg_SdFeatureTree;
   endif;  
  
//只能在系统默认语言为简体中文时安装数据库服务器  

if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
MessageBox(@ID_STR_INSTALL_DB,SEVERE);
goto Dlg_SetupType2;
endif;
//添加模块依赖处理规则   
//U8客户端内容中选择了"销售管理"时,"PDM接口插件"自动勾选且不可取消(默认安装)
if FeatureIsItemSelected(MEDIA,"ClientGXLProductXSGLManagement") then  
   FeatureSelectItem (MEDIA, "ClientPDMInterfacePlug", TRUE); 
endif; 
// U8服务器内容中选择了"U8应用服务器",则"PDM接口插件"自动勾选且不可取消,强制同时安装PDM接口插件;
if FeatureIsItemSelected(MEDIA,"ServerWebServerAppServer")  then  
   FeatureSelectItem (MEDIA, "ServerPDMInterfacePlug", TRUE); 
endif;  
/* //u8v12.5版本删除PLM 
    //判断是否是老版本的PDM并提示
    CompareIsOlderPDMAndPrompt();
    */




    ///////////////////////////////测试代码/////////////////////////////////
    ////////////////////////////////////////////////////////////////    
              
ExFn_FeatureCheckType();

Dlg_UFEnvCheck:


    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);    
    ExFn_WriteLog("NoEnvCheck  ","SoftWare\Ufsoft\WF\V8.700\Install\NoEnvCheck");  
    if RegDBKeyExist ("SoftWare\Ufsoft\WF\V8.700\Install\NoEnvCheck") == 1 then       
    g_bNoEnvCheck = TRUE;  
    ExFn_WriteLog("不进行环境检测 "," g_bNoEnvCheck = TRUE");
    else
    g_bNoEnvCheck = FALSE;   
    ExFn_WriteLog("进行环境检测"," g_bNoEnvCheck = FALSE");
    endif;
    
if (!g_bNoEnvCheck) then  
 //if(svSetupModeType!=@ID_STRING2001&&svSetupModeType!=@ID_STRING2004)  then  
 //u8v12.5版本删除PLM  
 if(svSetupModeType!=@ID_STRING2001)  then   
   //非经典模式.使用全部检测.检测类型为2
   nResult =ExFn_UFEnvCheck(NULL,2); 
 else  
   //经典模式.使用全部检测.检测类型为1
nResult =ExFn_UFEnvCheck(NULL,1);   
 endif;
else
nResult = 0;
endif; 

if nResult = 2 then
Do(EXIT);
endif;


Dlg_SQLServer:
    nResult = OnSQLServerInitialize(nResult);
    if( nResult = BACK ) then   
        if(svSetupModeType==@ID_STRING2002) then          //全产品集中应用模式(远程接入)
          goto  Dlg_SetupModeType;
        //u8v13.0添加金万维远程接入   
        elseif(svSetupModeType==@ID_JWW1002) then          //全产品集中应用模式(金万维远程接入)
          goto  Dlg_SetupModeType;       
        //u8v12.5版本删除PLM 
        /*
        elseif(svSetupModeType==@ID_STRING2005) then      //全产品集中应用模式(远程接入含PDM)
          goto  Dlg_SetupModeType;   
        */ 
        elseif(svSetupModeType==@ID_JWW1003) then      //客户端集中应用模式(金万维远程接入)
            szTitle = "";
            szMsg = "";
            szFeatures ="Client"; 
            nLevel = 1; 
            nSetupType= CUSTOM; 
            if (nSetupType = CUSTOM) then 
               nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif; 
            if(nModeResult=BACK)  then
               goto  Dlg_SetupModeType;  
            endif; 
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif;  
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif;
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck; 
                     
        elseif(svSetupModeType==@ID_STRING2003) then      //客户端集中应用模式(远程接入)  
            szTitle = "";
            szMsg = "";
            szFeatures ="Client"; 
            nLevel = 1; 
            nSetupType= CUSTOM; 
            if (nSetupType = CUSTOM) then 
               nModeResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
            endif; 
            if(nModeResult=BACK)  then
               goto  Dlg_SetupModeType;  
            endif; 
            if ExFn_FeatureCount() = 0 then
        MessageBox(@MSG_ZEROFEATURE,SEVERE);
        goto Dlg_SetupModeType;
       endif;  
       //只能在系统默认语言为简体中文时安装数据库服务器  
       if SYSINFO.nUserLangID != 2052  && FeatureIsItemSelected(MEDIA,"Server\DataServer") then
        MessageBox(@ID_STR_INSTALL_DB,SEVERE);
       goto Dlg_SetupModeType;
       endif;
       ExFn_FeatureCheckType();
       goto Dlg_UFEnvCheck; 
        else
          goto Dlg_SdFeatureTree;    
         endif;
    endif;


//Dlg_ObjDialogs:
    //nResult = ShowObjWizardPages( nResult );
    //if (nResult = BACK) goto Dlg_SQLServer;




//端口检测 客迈远程接入程序..
Dlg_SdCheckPort:
    szTitle="";
    szMsg = "";  
    //if(svSetupModeType!=@ID_STRING2001&&svSetupModeType!=@ID_STRING2004)  then 
    ////u8v12.5版本删除PLM 
    if(svSetupModeType!=@ID_STRING2001)  then 
 nResult = ExFn_CheckPort(szTitle);  
 if (nResult = BACK) then
goto Dlg_SQLServer;
 endif;
endif;


//开始复制文件..
Dlg_SdStartCopy2:
//-------------------- 
    diWinDisk.szDiskPath = TARGETDISK;
    diWinDisk.nInfoToQuery = DISK_INFO_QUERY_DISK_FREE_SPACE;
    if GetDiskInfo(&diWinDisk) = ISERR_SUCCESS then
         nDiskSpace =  diWinDisk.nFreeSpaceHigh *2*1024 + diWinDisk.nFreeSpaceLow/(1024*1024);
    endif; 
    
    //如果选择了EIS 就设置注册表为应用服务器
    if FeatureIsItemSelected(MEDIA,  "Server\EnterNetServer") then
       if FeatureIsItemSelected(MEDIA,  "Server\WebServerAppServer") then
           ExFn_WriteLog("","选择了EIS 选择了应用服务器"); 
        else  //选择EIS 没有选择应用服务器,设置注册表方便安装MSI包中所有的文件。
          ExFn_SetReg("Client", "客户端");
     ExFn_SetReg("U8AppServer", "U8应用服务器");
     ExFn_SetReg("AppServer", "U8应用服务器");
          ExFn_SetReg("WebServer", "WEB应用服务器");
         endif;
     endif;
    
    //if FeatureGetTotalCost(MEDIA, TARGETDIR,nFeatureSize) = 0 then
    //系统盘占用空间,FeatureGetTotalCost此方法在2008R2以上系统处理时间太长。
    nFeatureSize=1*1024*1024;   //1G
    if TARGETDIR % WINDISK  then
      //根据u8的实际占用空间动态的调整..
      if  SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==2||SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==3  then  //WIN8和WIN8.1 C空间要添加到6G
        nFeatureSize=nFeatureSize/1024+6*1024;   //MB
      else
    nFeatureSize=nFeatureSize/1024+2*1024;   //MB
           endif;    
    else
       nFeatureSize=nFeatureSize/1024;        //MB
    endif;
    //endif;
    
    NumToStr(sFeatureSize,nFeatureSize);
    NumToStr(sDiskSpace,nDiskSpace);
    /*
    //根据u8的实际占用空间动态的调整..
    if SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==2||SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==3  then  //WIN8和WIN8.1 C空间要添加到6G
       nFeatureSize=nFeatureSize+1024*6;
    else
       nFeatureSize=nFeatureSize+1024*2;
    endif;
    */
    sInfo = @ID_STR_LACK_INFO1 + sDiskSpace +"MB " +" "+@ID_STR_LACK_INFO2 + sFeatureSize+"MB "; 
    
//--------------------


    szTitle = "";
    szMsg = "";
    nResult = ExFn_UFStartCopy2(NULL);
    if (nResult = BACK)  then 
      //if(svSetupModeType!=@ID_STRING2001&&svSetupModeType!=@ID_STRING2004)  then 
      //u8v12.5版本删除PLM 
      if(svSetupModeType!=@ID_STRING2001)  then 
         goto Dlg_SdCheckPort;
      else
         //goto Dlg_ObjDialogs;
         goto Dlg_SQLServer;
      endif;    
    endif;


    //////////////////////////////////////////////////////////////////////////////////////////////////////start_setup//////////////////////////////////////////////////////////////////////////////////////////////////////
    ExFn_WriteLog("//////////////////////////////////////////////////////////////////////////////////////////////////////start_setup//////////////////////////////////////////////////////////////////////////////////////////////////////","");
    //////////////////////////////////////////////////////////////////////////////////////////////////////start_setup//////////////////////////////////////////////////////////////////////////////////////////////////////
    ExFn_WriteLog("//////////////////////////////////////////////////////////////////////////////////////////////////////start_setup//////////////////////////////////////////////////////////////////////////////////////////////////////","");
    //磁盘空间大小检测。。5G
    nDiskSpace = GetDiskSpaceEx(WINDISK,GBYTES);
    if  SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==2||SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==3  then  //WIN8和WIN8.1 C空间要添加到6G  
      if nDiskSpace < 6 then    //bytes //判断C盘系统盘寸留空间不小于5G
        SetDialogTitle (DLG_MSG_INFORMATION, @STR_DISKUSAGE);
    MessageBox(@ID_STR_DISK1G_ERR,INFORMATION);
    //goto Dlg_ObjDialogs;
    goto Dlg_SQLServer;
      endif;
    else
       if nDiskSpace < 5 then    //bytes //判断C盘系统盘寸留空间不小于5G
        SetDialogTitle (DLG_MSG_INFORMATION, @STR_DISKUSAGE);
    MessageBox(@ID_STR_DISK1G_ERR,INFORMATION);
    //goto Dlg_ObjDialogs;
    goto Dlg_SQLServer;
       endif;
    endif;


    
    //--------------------  
    diWinDisk.szDiskPath = TARGETDISK;
    diWinDisk.nInfoToQuery = DISK_INFO_QUERY_DISK_FREE_SPACE;
    if GetDiskInfo(&diWinDisk) = ISERR_SUCCESS then
         nDiskSpace =  diWinDisk.nFreeSpaceHigh *2*1024 + diWinDisk.nFreeSpaceLow/(1024*1024);
    endif; 


    ExFn_WriteLog("GETSZIE-----"," 111");
    //if FeatureGetTotalCost(MEDIA, TARGETDIR,nFeatureSize) = 0 then
    //安装盘占用空间
    nFeatureSize=5*1024*1024;   //1G
    if TARGETDIR % WINDISK  then
     //根据u8的实际占用空间动态的调整..
     if  SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==2||SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==3  then  //WIN8和WIN8.1 C空间要添加到6G
       nFeatureSize=nFeatureSize/1024+6*1024;   //MB
     else
    nFeatureSize=nFeatureSize/1024+2*1024;   //MB
     endif;
    else
       nFeatureSize=nFeatureSize/1024;        //MB
    endif;
    //endif;
    
    NumToStr(sFeatureSize,nFeatureSize);
    NumToStr(sDiskSpace,nDiskSpace);
    /*
    //根据u8的实际占用空间动态的调整..
    if  SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==2||SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==3  then  //WIN8和WIN8.1 C空间要添加到6G  
      nFeatureSize=nFeatureSize+6*1024;
    else
      nFeatureSize=nFeatureSize+2*1024;
    endif;
    */
    sInfo = @ID_STR_LACK_INFO1 + sDiskSpace +"MB " +" "+@ID_STR_LACK_INFO2 + sFeatureSize+"MB "; 


    if nDiskSpace < nFeatureSize then 
        SetDialogTitle (DLG_MSG_INFORMATION, @STR_DISKUSAGE);
   MessageBox(@ID_STR_LACK_SYSDISK+" "+sInfo,INFORMATION);
   //goto Dlg_ObjDialogs;
   goto Dlg_SQLServer;
   endif;
   
   SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
   ExFn_WriteLog("GETSZIE-----"," 2222");
    //---------------------
    
    if (nResult = BACK)  then 
     //goto Dlg_ObjDialogs;
     goto Dlg_SQLServer;
    endif;


    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
    
    ExFn_WriteLog("Dlg_SdStartCopy2"," end");
    return 0;
end;  




//安装路径只能由字母、数字和下划线组成
function BOOL ExFn_CheckDirName(path)
int i

声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像