InstallShield打包源码公布

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+"\n";
     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+"\n"+"\n";
     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+"\n"+"\n";
    endif;
    
    //检查CPU及内存是否达到推荐配置要求, 不是卸载或者修改的时候提示。
    if !MAINTENANCE then   
        UseDLL(ENVCHECK_DLL);  
        isadapt= GetCPUClockPerMillisecond()&&GetMemory();
        if !isadapt then
         messageboxshowstr=messageboxshowstr+@ID_Cupmerroryadapt+"\n"; 
         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,"Client\GXLProduct\XSGLManagement") then  
   FeatureSelectItem (MEDIA, "Client\PDMInterfacePlug", TRUE); 
endif; 
// U8服务器内容中选择了"U8应用服务器",则"PDM接口插件"自动勾选且不可取消,强制同时安装PDM接口插件;
if FeatureIsItemSelected(MEDIA,"Server\WebServerAppServer")  then  
   FeatureSelectItem (MEDIA, "Server\PDMInterfacePlug", 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 " +"\n"+@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 " +"\n"+@ID_STR_LACK_INFO2 + sFeatureSize+"MB "; 


    if nDiskSpace < nFeatureSize then 
        SetDialogTitle (DLG_MSG_INFORMATION, @STR_DISKUSAGE);
   MessageBox(@ID_STR_LACK_SYSDISK+"\n"+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 iVal, iLength;
number nLetter;
begin
    iVal = 0;
  iLength = StrLength (path);

     while (iVal <= iLength)
   nLetter = path[iVal];
   //if (nLetter<0) || (nLetter>128) then
   if   !(
    ((nLetter<=90)  && (nLetter>=65))  ||      //A--Z
      ((nLetter<=122) && (nLetter>=97))  ||//a--z 
      ((nLetter<=57)  && (nLetter>=48))  ||//0--9
        nLetter == 58||          //冒号:
        nLetter == 92||          //斜杠\
        nLetter == 95  || //下划线_ 
        nLetter == 0   //|| //字符串结束符
        //nLetter == 32//空格
         )
      then
    return FALSE;
     endif;      
   iVal++;
  endwhile;
    return TRUE;    
end;


//去掉安装路径中的前端空格字符,比如"c:\ apple"-->"c:\apple"
function void ExFn_RemoveFrontBlanks(path)
string sDiskName,sFullSubPath,sCheckedSubPath;
int iLength,iVal;
number nLetter;
begin 


     StrSub(sDiskName,path,0,3);
     iLength = StrLength (path)-3;  
     StrSub(sFullSubPath,path,3,iLength);
     
     iVal = 0;
     while (iVal <= iLength)
   nLetter = sFullSubPath[iVal];   
   if(nLetter!=32) then     
goto outWhile;  //此脚本没有break关键字!
endif;
iVal++;
endwhile;


outWhile:
    StrSub(sCheckedSubPath,sFullSubPath,iVal,iLength-iVal);
    path = sDiskName + sCheckedSubPath;


end;


function OnFirstUIAfter()
    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
    NUMBER bvOpt1, bvOpt2;
NUMBER bShowUpdateServiceDlg;
string dependedMsiStr;
LIST msiList;
STRING msiStr;
NUMBER nResult;
string svResult;
begin
// MessageBox("OnFirstUIAfter",INFORMATION);
    ExFn_WriteLog("","OnFirstUIAfter Enter");
    
    //2015-4-9解决安装到此就不在执行
    //ShowObjWizardPages(NEXT);


    szTitle = "";
    szMsg1 = "";
    szMsg2 = "";
    szOpt1 = "";
    szOpt2 = "";
bvOpt1   = FALSE;
    bvOpt2   = FALSE;


bShowUpdateServiceDlg = FALSE;




if !MAINTENANCE then
    endif;


g_bNeedReboot = TRUE;
if(g_bDebug) then
g_bNeedReboot = FALSE; //Added for debug
endif;
if g_bNeedReboot then
       if SdFinishReboot("","",SYS_BOOTMACHINE,"",0)=WILL_REBOOT then
       ;
       else
           SprintfBox(MB_ICONEXCLAMATION|MB_DEFBUTTON2, @ID_SecuritytIPMessageBox, @ID_SecurityYouHuTong);
       endif;
else
SdFinish(szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
endif;


    ExFn_WriteLog("","OnFirstUIAfter Leave");
end;
 
/*
function OnMaintUIBefore()
    number nResult, nType, nMediaFlags;
    string szTitle, szMsg, szIgnore;
    string  szWarning;
    BOOL    bHasServerInstalld;
    string  sSetupType;
begin
    ExFn_WriteLog("","OnMaintUIBefore Enter");
nType = MODIFY;
    OnSQLServerInitializeMaint();
    bHasServerInstalld = ExFn_HasServerInstall();


Dlg_Start:


Disable( BACKBUTTON );
if bHasServerInstalld then
ExFn_WriteLog("","bHasServerInstalld == TRUE");
nType = ExFn_UFWelcomeMain(NULL,nType);
else
ExFn_WriteLog("","bHasServerInstalld == FALSE");
nType = SdWelcomeMaint( szTitle, szMsg, nType );
endif;


g_nSetupType = nType;
NumToStr(sSetupType,g_nSetupType);
ExFn_WriteLog("g_nSetupType is: ",sSetupType);
Enable( BACKBUTTON );
nResult = NEXT;


    if ( nType = REMOVEALL ) then
if FeatureIsItemSelected(MEDIA,"Server\\DataServer") then
szWarning = SdLoadString( IFX_MAINTUI_MSG )+"\n\n提示:删除的产品中包含数据服务器,建议您在删除之前对账套进行备份";
else
szWarning = SdLoadString( IFX_MAINTUI_MSG );
endif;
nResult = MessageBox( szWarning, MB_YESNO );
if (nResult != IDYES ) then
            if( REMOVEONLY ) then
                abort;
            else
   goto Dlg_Start;
            endif;
endif;
endif;


Dlg_SdFeatureTree:
if ( nType = MODIFY ) then
szTitle = "";
szMsg = SdLoadString( SD_STR_COMPONENT_MAINT_MSG );
nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, "Client", -1 );
if ( nResult = BACK ) goto Dlg_Start;
    endif;


Dlg_ObjDialogs:
    nResult = ShowObjWizardPages( nResult );
    if ( ( nResult = BACK ) && ( nType != MODIFY ) ) goto Dlg_Start;
    if ( ( nResult = BACK ) && ( nType = MODIFY ) ) goto Dlg_SdFeatureTree;


switch(nType)
        case REMOVEALL:
MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );
if( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) then
FeatureRemoveAllInMediaAndLog();
else
FeatureRemoveAllInMedia();
endif;
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );
        case REPAIR:
            if( ADDREMOVE ) then
                FeatureUpdate( "" );
            else
              FeatureReinstall();
            endif;
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REPAIR ) );
        case MODIFY:
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_MODIFY ) );
    endswitch;
end;
*/


function OnMaintUIBefore()
    number nResult, nType, nMediaFlags;
    string szTitle, szMsg, szIgnore;
    string  szWarning;
    BOOL    bHasServerInstalld;
    string  sSetupType;
number  nvFileHandle;
int excuteprompt;
begin
    ExFn_WriteLog("","OnMaintUIBefore Enter");
nType = MODIFY;
    OnSQLServerInitializeMaint();
    bHasServerInstalld = ExFn_HasServerInstall();


Dlg_Start:


Disable( BACKBUTTON );

ExFn_CheckForbidProc();
excuteprompt=0;
nType = SdWelcomeMaint( szTitle, szMsg, nType );
    nType=REMOVEALL;
//添加注册表确定显示修改安装模式.
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);    
    ExFn_WriteLog("MODIFY  ","SoftWare\\Ufsoft\\WF\\V8.700\\Install\\MODIFY");  
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\MODIFY") == 1 then       
    nType = MODIFY ;
    ExFn_WriteLog("添加成功修改安装模式 "," nType = MODIFY ");
    endif;
//

g_nSetupType = nType;

NumToStr(sSetupType,g_nSetupType);
ExFn_WriteLog("g_nSetupType is: ",sSetupType);
Enable( BACKBUTTON );
nResult = NEXT;
    
    if ( nType = REMOVEALL ) then
        /*
        //数据库服务器,需要备份帐套
if FeatureIsItemSelected(MEDIA,"Server\\DataServer") then
szWarning =  @IDS_MAINTUI_MSG_NOTIFY_BACKUP+SdLoadString( IFX_MAINTUI_MSG ) ;
else
szWarning = SdLoadString( IFX_MAINTUI_MSG );
excuteprompt=excuteprompt+1;
endif;
nResult = MessageBox( szWarning, MB_YESNO );
if (nResult != IDYES ) then
            if( REMOVEONLY ) then
                abort;
            else
   goto Dlg_Start;
            endif;
endif;


//本机是加密服务器,如果本机重新安装U8,需要重新导入加密证书或重新在线注册加密,否则加密将无法正常使用
if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer") then
szWarning =  @IDS_MAINTUI_MSG_NOTIFY_LicenseBack+SdLoadString( IFX_MAINTUI_MSG ) ;
else
szWarning = SdLoadString( IFX_MAINTUI_MSG );
excuteprompt=excuteprompt+1;
endif;
if excuteprompt!=2 then 
nResult = MessageBox( szWarning, MB_YESNO);
if (nResult != IDYES ) then
            if( REMOVEONLY ) then
                abort;
            else
   goto Dlg_Start;
            endif;
 endif;
endif;
*/
endif;


Dlg_SdFeatureTree:
if ( nType = MODIFY ) then
szTitle = "";
szMsg = SdLoadString( SD_STR_COMPONENT_MAINT_MSG ); 
if bHasServerInstalld then
ExFn_WriteLog("","bHasServerInstalld == TRUE");
nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, "", -1 );
else
ExFn_WriteLog("","bHasServerInstalld == FALSE");
nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, "Client", -1 );
endif;


if ( nResult = BACK ) goto Dlg_Start;
    endif;


Dlg_ObjDialogs:
    nResult = ShowObjWizardPages( nResult );
    if ( ( nResult = BACK ) && ( nType != MODIFY ) ) goto Dlg_Start;
    if ( ( nResult = BACK ) && ( nType = MODIFY ) ) goto Dlg_SdFeatureTree;


switch(nType)
        case REMOVEALL:
MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );
if( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) then
FeatureRemoveAllInMediaAndLog();
else
FeatureRemoveAllInMedia();
endif;
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );
        case REPAIR:
            if( ADDREMOVE ) then
                FeatureUpdate( "" );
            else
              FeatureReinstall();
            endif;
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REPAIR ) );
        case MODIFY:
DeleteFile(TARGETDIR^"Installer\\MsiSet.log");
CreateFile(nvFileHandle, TARGETDIR^"Installer", "MsiSet.log");
//UseDLL(MSIFUNCTION_DLL);
ExFn_MsiCount();
CopyFile(TARGETDIR^"Installer\\MsiSet.log",TARGETDIR^"Installer\\MsiSet_Backup.log");
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_MODIFY ) );
ExFn_WriteLog("","create backup msiSet.log");
    endswitch;
end;




function OnMaintUIAfter()
    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
    NUMBER bvOpt1, bvOpt2;
begin
// if g_nSetupType == MODIFY then
// ExFn_DoAfterModify();
// elseif g_nSetupType == REPAIR then
// ExFn_DoAfterRepair();
// endif;


    ShowObjWizardPages(NEXT);


    if( REMOVEALLMODE ) then
        szTitle = @MAIN_REMOVE_TITLE;//SdLoadString(IFX_SDFINISH_REMOVE_TITLE);
        szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);
//szMsg2 = "注意:在U8的使用过程中会产生一些日志文件,删除产品后这些文件仍将残留在安装目录下,如果需要您可以在重启之后手工清除";
    szMsg2=@STR_CLEAN_LOG;
    else
        szTitle = @MAIN_REMOVE_TITLE;//SdLoadString(IFX_SDFINISH_MAINT_TITLE);
        szMsg1  = @MAINTENCE_SDFINISH_REMOVE_MSG1;//SdLoadString(IFX_SDFINISH_MAINT_MSG1);
szMsg2 = "";
    endif;


    szOpt1 = "";
    szOpt2 = "";
bvOpt1   = FALSE;
    bvOpt2   = FALSE;


    g_bNeedReboot = TRUE;
    if(g_bDebug) then
    g_bNeedReboot = FALSE; //Added for debug 
    endif;
    if g_bNeedReboot then   
       if (g_bISinstallRemoteImport==TRUE) then  
         szMsg1=@ID_STRINGszMsg1RemoteImport;
         SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
       else
    SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 ); 
       endif;
    else
        SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
    endif;
end;


function ExFn_UFWelcome(hMSI)
    STRING  szDialogName, szDLLName, szDialog,regadoreader,sKeyValue,sKeyValueTemp,svValue;
    NUMBER  nDialog, nResult, nCmdValue;
    BOOL    bDone,isreadregadoreader;
    HWND    hInstance, hwndParent; 
    NUMBER  nvFileHandle;   
    NUMBER  nExitCode;
    NUMBER nvSize,nvType;
begin
    szDialogName = "UFWelcome";
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;
    isreadregadoreader=FALSE;
    nResult  = DefineDialog (szDialogName, hInstance, szDLLName,
                            RES_WELCOME_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL,
DLG_MSG_STANDARD|DLG_CENTERED);


    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.",
SEVERE);
        bDone = TRUE;
        abort;
    endif;


   bDone = FALSE;


   repeat


        nCmdValue = WaitOnDialog(szDialogName);


        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT: ;
            case RES_PBUT_CANCEL:
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
                bDone = TRUE;
            case RES_PBUT_BACK:
            nResult = RES_PBUT_BACK;
                bDone = TRUE;
            case 1201:
                 regadoreader="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\AcroRd32.exe";
                 isreadregadoreader=FALSE;
                 if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
                 endif;
                 nvType = REGDB_STRING;
                 if RegDBGetKeyValueEx(regadoreader,"Path",nvType,sKeyValue,nvSize) = 0 then  
                   StrToLower(sKeyValueTemp, sKeyValue); 
                   StrRemoveLastSlash(sKeyValueTemp);
                   if(ExistsDir(sKeyValueTemp)=EXISTS) then
                     if (FindFile (sKeyValueTemp, "AcroRd32.exe", svValue) = 0) then 
                       //UseDLL(ENVCHECK_DLL);
                         //RunNoBlock("CMD /C taskkill /F /IM AcroRd32.exe");
                //RunNoBlock("\""+sKeyValueTemp^"AcroRd32.exe"+"\""+" "+"\""+SRCDIR^"U8+V12.5_Setup.pdf"+"\"");
               //OpenADOReader("\""+SRCDIR^"U8+V12.5_Setup.pdf"+"\"");
              //UnUseDLL(ENVCHECK_DLL);
                       //ExFn_Run("\""+sKeyValueTemp^"AcroRd32.exe"+"\""+" "+"\""+SRCDIR^"U8+V12.5_Setup.pdf"+"\""); 
                       //LaunchAppAndWait(sKeyValueTemp^"AcroRd32.exe",SRCDIR^"U8+V12.5_Setup.pdf",LAAW_OPTION_MAXIMIZED); 
                       //ExFn_WriteLog(sKeyValueTemp^"AcroRd32.exe",SRCDIR^"U8+V12.5_Setup.pdf");
                       //isreadregadoreader=TRUE;
                     endif;
                   endif;
                 endif;
                 
                 //if(isreadregadoreader=FALSE) then 
                 //如果是WIN10直接的打开目录
                  UseDLL(shell32);
                    //nExitCode = Shell32.ShellExecuteA(NULL, "open", SRCDIR^"U8+V12.5_Setup.pdf", 0, 0, SW_SHOWMAXIMIZED);
                    nExitCode = Shell32.ShellExecuteA(NULL, 'open', 'explorer.exe', SRCDIR^"U8+V15.0_Setup.pdf", 0, SW_SHOWNORMAL);
                    //nExitCode = Shell32.ShellExecuteA(NULL, "open", SRCDIR^"U8+V12.5_Setup.pdf", "nil", "nil", SW_SHOWMAXIMIZED);
                  UnUseDLL(shell32);
                  if nExitCode < 32 then
                  MessageBox(@STR_NOHELPFILE, SEVERE);
                  endif;
                 //endif;
                nResult = UF_README_RESULT;
                bDone = FALSE;
        endswitch;
    until bDone;
    EndDialog (szDialogName);
    ReleaseDialog (szDialogName);
return nResult;
end;


function IsCustomType(typeStr)
begin
    // /*|| typeStr == "标准" || typeStr == "全产品"*/
if( typeStr == "CustomSetType" || typeStr == "ServerSetType" ||typeStr == "ClientSetType") then
return TRUE;
else
return FALSE;
endif;
end;


function string ExFn_UFGetFeatureStr(typeStr)
begin
if typeStr == "标准" then
return "";
endif;
if typeStr == "CustomSetType" then
return "";
endif;
if typeStr == "ClientSetType" then
return "Client";
endif;
if typeStr == "ServerSetType" then
return "Server";
endif;
if typeStr == "AllProduct" then
return "";
endif;
end;




function ExFn_UFDetector(hMSI)
    STRING  szDialogName, szDLLName, szDialog;
    NUMBER  nDialog, nResult, nCmdValue;
    BOOL    bDone;
    HWND    hInstance, hwndParent;
begin
    szDialogName = "UFDetector";
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;
    nResult  = DefineDialog (szDialogName, hInstance, szDLLName,
                            RES_DETECTOR_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL,
DLG_MSG_STANDARD|DLG_CENTERED);


    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.",
SEVERE);
        bDone = TRUE;
        abort;
    endif;


   bDone = FALSE;


   repeat


        nCmdValue = WaitOnDialog(szDialogName);


        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT: ;
            case RES_PBUT_CANCEL:
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
                bDone = TRUE;
            case RES_PBUT_BACK:
            nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;


    until bDone;


    EndDialog (szDialogName);
    ReleaseDialog (szDialogName);
return nResult;
end;


///环境监测...
function ExFn_UFEnvCheck(hMSI,uchtypemodule)
    STRING  szDialogName, szDLLName, szDialog,szCheckType,szCheckTypeModule;
    NUMBER  nDialog, nResult, nCmdValue;
    BOOL    bDone;
    HWND    hInstance, hwndParent,nHwnd,hwndprogress;
    LIST    listBackgroundColors;
    NUMBER  dlgResult;   
    STRING szKey;
    STRING szIsServerIOS,szdlgResult;
begin
    szDialogName = "UFEnvCheck";
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;
    dlgResult = 0;
    nResult  = DefineDialog (szDialogName, hInstance, szDLLName,
                            RES_ENVCHK_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL,
DLG_MSG_STANDARD|DLG_CENTERED);


    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.",
SEVERE);
        bDone = TRUE;
        abort;
    endif;


   bDone = FALSE;


   repeat


        nCmdValue = WaitOnDialog(szDialogName);


        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT: ;
            case RES_PBUT_CANCEL:
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
           
               //设置进度条。
               nHwnd = CmdGetHwndDlg(szDialogName);
               hwndprogress=GetDlgItem(nHwnd,1202);
               CtrlSetText(szDialogName,1202,@envchecktip);
                   
              
               
              //删除注册表  
              if FeatureIsItemSelected(MEDIA,"RAS")=1 then   
            RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);  
            szKey="SOFTWARE\\comexerassys\\MiniRas";
            if (RegDBDeleteKey (szKey)<0) then        
               ExFn_WriteLog("删除注册表失败:","SOFTWARE\\comexerassys\\MiniRas");
            endif;  
            ExFn_Run("\""+SUPPORTDIR^"Wow64Disable.exe"+"\""+" "+"\""+"reg delete HKLM\\SOFTWARE\\comexerassys\\MiniRas  /f"+"\""); 
            //LaunchAppAndWait(SUPPORTDIR^"Wow64Disable.exe","\""+"reg delete HKLM\SOFTWARE\comexerassys  /f"+"\"",WAIT|LAAW_OPTION_HIDDEN);
               endif;
           
            NumToStr( szCheckType, m_CheckType ); 
NumToStr( szCheckTypeModule, uchtypemodule );
if(g_bIsServerIOS=TRUE) then
  szIsServerIOS="TRUE";
else
  szIsServerIOS="FALSE";
endif;
ExFn_WriteLog("m_CheckType::uchtypemodule::TARGETDIR::SUPPORTDIR::SRCDIR::g_strselectfeatureinflectenv::g_bIsServerIOS",szCheckType+"::"+szCheckTypeModule+"::"+TARGETDIR+"::"+SUPPORTDIR+"::"+SRCDIR+"::"+g_strselectfeatureinflectenv+"::"+szIsServerIOS);
         
       //获取选择的影响到环境检测的判断的构件的选择.
       g_strselectfeatureinflectenv=StrGetSelectFetureInfluceEnv();

ExFn_WriteLog("环境检测调用Modal: m_CheckType::uchtypemodule::TARGETDIR::SUPPORTDIR::SRCDIR::g_strselectfeatureinflectenv::g_bIsServerIOS",szCheckType+"::"+szCheckTypeModule+"::"+TARGETDIR+"::"+SUPPORTDIR+"::"+SRCDIR+"::"+g_strselectfeatureinflectenv+"::"+szIsServerIOS);

try
 UseDLL(SUPPORTDIR^"EnvCheckDLL.dll");  
                    dlgResult = Modal(m_CheckType,uchtypemodule,TARGETDIR,SUPPORTDIR,SRCDIR,g_strselectfeatureinflectenv,g_bIsServerIOS);  
 UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");  
                catch
                  ExFn_WriteLog("Modal()","MODAL EXCEPTION"); 
                endcatch;
NumToStr( szdlgResult, dlgResult ); 
ExFn_WriteLog("Modal执行后返回值:::::::::::::",szdlgResult);
NumToStr( szCheckType, m_CheckType ); 
NumToStr( szCheckTypeModule, uchtypemodule ); 
//ExFn_WriteLog("环境检测调用Modal:","Modal(m_CheckType,uchtypemodule,TARGETDIR,SUPPORTDIR,SRCDIR,g_strselectfeatureinflectenv,g_bIsServerIOS)");

if dlgResult = 2 then
nResult = RES_PBUT_BACK;
Do(EXIT);
endif;
                bDone = TRUE;
            case RES_PBUT_BACK:
            nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;


    until bDone;


    EndDialog (szDialogName);
    ReleaseDialog (szDialogName);
return nResult;


end;




function BOOL ExFn_MsiInstalled(szKey)
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    if (RegDBKeyExist ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + szKey) < 0) then
    return FALSE;
    else
    return TRUE;
    endif;
end;




function ExFn_FeatureCheckType()
begin
m_CheckType = 0;
    
    if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer") then
    ExFn_WriteLog("ExFn_FeatureCheckType", "Server\\WebServerAppServer 被选 ,所以自动选 应用服务器");  
   FeatureSelectItem (MEDIA, "Server\\U8AppServer", TRUE);   
else 
FeatureSelectItem (MEDIA, "Server\\U8AppServer", FALSE);
endif;

if FeatureIsItemSelected(MEDIA,  "Client") then
m_CheckType |= CHECK_FOR_CLIENT;
endif;


if FeatureIsItemSelected(MEDIA,  "Server\\U8AppServer") then
m_CheckType |= CHECK_FOR_APPSERVER;
endif;

g_isonlyeisselect=FALSE;
    if FeatureIsItemSelected(MEDIA,  "Server\\EnterNetServer") then
       if FeatureIsItemSelected(MEDIA,  "Server\\WebServerAppServer") then
          m_CheckType |= CHECK_FOR_EnterNetServer;
       else
          g_isonlyeisselect=TRUE;
 m_CheckType |= CHECK_FOR_EnterNetServer;
 m_CheckType |= CHECK_FOR_APPSERVER;
endif;
endif;



if FeatureIsItemSelected(MEDIA,  "Server\\DataServer") then
m_CheckType |= CHECK_FOR_DATASERVER;
endif;


if FeatureIsItemSelected(MEDIA,  "Server\\WebServerAppServer") then
m_CheckType |= CHECK_FOR_WEBSERVER;
endif;


if FeatureIsItemSelected(MEDIA,  "Server\\FileManageServer") then
m_CheckType |= CHECK_FOR_FILESERVER;
endif;


if FeatureIsItemSelected(MEDIA,  "Server\\LicenseServer") then
m_CheckType |= CHECK_FOR_LICENSESERVER;
endif;
    
    
if FeatureIsItemSelected(MEDIA,  "Server\\EnterNetServer") then
m_CheckType |= CHECK_FOR_EnterNetServer;
endif;
    
end;


function void ExFn_PreSetRegs()
begin
if  m_CheckType & CHECK_FOR_CLIENT then
ExFn_SetReg("Client", "客户端");
else
ExFn_DelReg("Client");
endif;


if  m_CheckType & CHECK_FOR_APPSERVER then
ExFn_SetReg("AppServer", "U8应用服务器");
ExFn_SetReg("U8AppServer", "U8应用服务器");
ExFn_SetReg("Client", "U8应用服务器");
else
ExFn_DelReg("AppServer");
ExFn_DelReg("U8AppServer");
// ExFn_DelReg("Client");
endif;


if  m_CheckType & CHECK_FOR_DATASERVER then
ExFn_SetReg("DBServer", "数据服务器");
ExFn_SetReg("Client", "数据服务器");
else
ExFn_DelReg("DBServer");
endif;


if  m_CheckType & CHECK_FOR_WEBSERVER then
ExFn_SetReg("WebServer", "WEB应用服务器");
else
ExFn_DelReg("WebServer");
endif;


if  m_CheckType & CHECK_FOR_LICENSESERVER then
ExFn_SetReg("LicenseServer", "加密服务器");
else
ExFn_DelReg("LicenseServer");
endif;

if  m_CheckType & CHECK_FOR_EnterNetServer then
ExFn_SetReg("U8MServer", "U8MServer");
else
ExFn_DelReg("U8MServer");
endif;


end;


function ExFn_CreateWeb(webName, webPath)
NUMBER iRet;
STRING path;
begin 
    
  if ExistsDir(TARGETDIR^webPath) == 0 then
  if iRet == 0 then 
 
            iRet=UseDLL(SETUPKIT_DLL);
  if AdsiIsExist(webName) then
  AdsiDeleteWeb(webName);
endif;
  path = TARGETDIR^webPath;
  //LongPathToQuote(path, TRUE);
  //设置进度条显示状态
  SetStatusWindow(96, @ID_CreateService+" "+webName); 
  iRet=AdsiCreateWeb(webName, path, "", "", FALSE);
     UnUseDLL(SETUPKIT_DLL);
     
    if !iRet then
  ExFn_WriteLog("创建虚拟目录" + webName + "失败!", "");
endif;
  else
    MessageBox(SETUPKIT_DLL + "加载失败!", WARNING);
  endif;
else
ExFn_WriteLog(TARGETDIR^webPath, "does not exist!");
  endif;   
 
end;


function ExFn_SetReg(szSubKey,szCaption)
STRING szKey;
NUMBER nType, nSize;
begin
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\"+szSubKey;
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szSubKey + "创建失败", SEVERE);
    endif;
    if (RegDBSetKeyValueEx (szKey, "", REGDB_STRING, szCaption,-1) < 0) then
endif;
end;


function ExFn_SetRegByVaule(szSubKey,szCaption,szvalue)
STRING szKey;
NUMBER nType, nSize;
begin
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SoftWare\\Ufsoft\\WF\\V8.700\\Install\\"+szSubKey;
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szSubKey + "创建失败", SEVERE);
    endif;
    if (RegDBSetKeyValueEx (szKey, szvalue, REGDB_STRING, szCaption,-1) < 0) then
endif;
end;






function ExFn_AddAllWebs()
    string svResult;
    NUMBER iRet;
    string szKey;
    string szName;
    NUMBER nvType;
    string svValue;
    NUMBER nvSize;
    NUMBER iR;
    string szError;   
    STRING svPath; 
    string sCommand; 
    string svPathpath,svfileexist,szdllpath;
    object setiis6DLLproject,setiis7DLLproject;
    int isiis6existu8sl;
    int isiis7existu8sl;
    INT isiis7existu8TI,isiis6existu8TI;
begin
ExFn_WriteLog("","ExFn_AddAllWebs Enter");

//设置IIS运行环境
ExFn_SetIISEnvirment();


if m_CheckType & CHECK_FOR_APPSERVER then  
   ExFn_WriteLog("Start Create IIS Web ","CHECK_FOR_APPSERVER");
ExFn_CreateWeb("U8NE","U8NE");
ExFn_CreateWeb("U8CO","U8CO");
ExFn_CreateWeb("U8FORE","U8FORE");
ExFn_CreateWeb("U8EAI","EAI\\ASP");
ExFn_CreateWeb("U8Application","AppServer");
//ExFn_CreateWeb("U8ApplicationEx","U8Framework");    U8V11.0版本 劲涛、郑芸确认可以删除 
//ExFn_CreateWeb("U8SCMApplication","AppServer");     U8V11.0版本 劲涛、郑芸确认可以删除 
//ExFn_CreateWeb("U8KeyManage","KeyManage");       U8V11.0版本 劲涛、郑芸确认可以删除 
ExFn_CreateWeb("U8BM","GDP\\U8BM");
ExFn_CreateWeb("HBBB","GDP\\HBBB");
ExFn_CreateWeb("UAP","UAP");
ExFn_CreateWeb("U8AuditWebSite","U8AuditWebSite");
ExFn_CreateWeb("U8PFWeb","PFWeb"); //Add only for U8100   
ExFn_CreateWeb("U8SL","U8SL"); //Add only for U8100 
ExFn_CreateWeb("U8KCSN","U8KCSN"); //条码管理无线版 
ExFn_CreateWeb("U8FASN","GDZC"); //固定资产管理
svPathpath=TARGETDIR+"\\HY\\client\\HY_QP_ER_PDM\\Website";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8ER","HY\\client\\HY_QP_ER_PDM\\Website");
endif;

//U8V12.0 添加 For CRM
svPathpath=TARGETDIR+"\\turbocrm70\\storage";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("FileTransfer","turbocrm70\\storage");
endif;

//U8V12.1 添加 For HR 微信企业号
svPathpath=TARGETDIR+"\\WXQYH";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("WXQYH","WXQYH");
endif;

//U8V12.5 添加 For CW 微信企业号
svPathpath=TARGETDIR+"\\U8CWWebService";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8CWWebService","U8CWWebService");
endif;


   //U8V12.5 添加 EIS 移动应用
svPathpath=TARGETDIR+"\\EIS\\Web";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("EIS","EIS\\Web");
endif;
//U8V12.5 添加  3rdPrograms 供给智能安装使用。。
svPathpath=TARGETDIR+"\\3rdPrograms";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("3rdPrograms","3rdPrograms");
endif;

//南京添加虚拟目录
svPathpath=TARGETDIR+"\\AppServer\\Bin";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8CJTM","AppServer\\Bin");
endif;

svPathpath=TARGETDIR+"\\FileManager\\UFWebUploadServices";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("UFWebUploadServices ","FileManager\\UFWebUploadServices");
  ExFn_CreateWeb("UFWebUploadServices","FileManager\\UFWebUploadServices");
    endif;


   svPathpath=TARGETDIR+"\\FileManager\\UFFileManagerServices";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("UFFileManagerServices ","FileManager\\UFFileManagerServices");
  ExFn_CreateWeb("UFFileManagerServices","FileManager\\UFFileManagerServices");
   endif;
 
        //U8V13.0 TI 发票管理
        svPathpath=TARGETDIR+"\\TIService";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("TIService ","TIService");
  ExFn_CreateWeb("TIService","TIService");
   endif;
   
   
   svPathpath=TARGETDIR+"\\AppServer\\Bin\\OCAPI";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("webapi ","AppServer\\Bin\\OCAPI");
  ExFn_CreateWeb("webapi","AppServer\\Bin\\OCAPI");
   endif;
   
     
     //添加通配符应用程序映射
UseDLL(ENVCHECK_DLL);
//chglist.vbs" W3SVC/1/root/EIS/ScriptMaps "" "*,C:\WINDOWS\MicroSoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0" /INSERT /COMMIT
RunNoBlock("CMD /C Cscript "+"\""+SUPPORTDIR^"chglist.vbs"+"\""+" W3SVC/1/root/EIS/ScriptMaps "+"\""+"\""+" \""+"*,"+m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727\\aspnet_isapi.dll"+",0"+"\""+" /INSERT /COMMIT"); 
UnUseDLL(ENVCHECK_DLL);


if (FindFile(SUPPORTDIR,"AppPoolSetting.exe", svfileexist) = 0) then 
 ExFn_Run(SUPPORTDIR^"AppPoolSetting.exe");
endif;
   ExFn_WriteLog("END Create IIS Web ","CHECK_FOR_APPSERVER");
elseif m_CheckType & CHECK_FOR_WEBSERVER then
   ExFn_WriteLog("Start Create IIS Web ","CHECK_FOR_WEBSERVER");
        ExFn_CreateWeb("U8NE","U8NE");
ExFn_CreateWeb("U8CO","U8CO");
ExFn_CreateWeb("U8FORE","U8FORE");
ExFn_CreateWeb("U8BM","GDP\\U8BM");
ExFn_CreateWeb("HBBB","GDP\\HBBB");
ExFn_CreateWeb("UAP","UAP");
ExFn_CreateWeb("U8AuditWebSite","U8AuditWebSite");
ExFn_CreateWeb("U8PFWeb","PFWeb"); //Add only for U8100   
ExFn_CreateWeb("U8SL","U8SL"); //Add only for U8100 
ExFn_CreateWeb("U8KCSN","U8KCSN"); //条码管理无线版
ExFn_CreateWeb("U8FASN","GDZC"); //固定资产管理
svPathpath=TARGETDIR+"\\HY\\client\\HY_QP_ER_PDM\\Website";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8ER","HY\\client\\HY_QP_ER_PDM\\Website");
endif;

//U8V12.0 添加 For CRM
svPathpath=TARGETDIR+"\\turbocrm70\\storage";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("FileTransfer","turbocrm70\\storage");
endif;

   //U8V12.1 添加 For HR 微信企业号
svPathpath=TARGETDIR+"\\WXQYH";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("WXQYH","WXQYH");
endif;

//U8V12.5 添加 For CW 微信企业号
svPathpath=TARGETDIR+"\\U8CWWebService";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8CWWebService","U8CWWebService");
endif;

        //U8V12.5 添加 移动应用EIS
svPathpath=TARGETDIR+"\\EIS\\WEB";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("EIS","EIS\\WEB");
endif;

svPathpath=TARGETDIR+"\\3rdPrograms";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("3rdPrograms","3rdPrograms");
endif;

   //南京添加虚拟目录
svPathpath=TARGETDIR+"\\AppServer\\Bin";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8CJTM","AppServer\\Bin");
endif;


svPathpath=TARGETDIR+"\\FileManager\\UFWebUploadServices";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("UFWebUploadServices ","FileManager\\UFWebUploadServices");
  ExFn_CreateWeb("UFWebUploadServices","FileManager\\UFWebUploadServices");
    endif;


   svPathpath=TARGETDIR+"\\FileManager\\UFFileManagerServices";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("UFFileManagerServices ","FileManager\\UFFileManagerServices");
  ExFn_CreateWeb("UFFileManagerServices","FileManager\\UFFileManagerServices");
   endif;
   
   //U8V13.0 TI 发票管理
        svPathpath=TARGETDIR+"\\TIService";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("TIService ","TIService");
  ExFn_CreateWeb("TIService","TIService");
   endif;
   
   svPathpath=TARGETDIR+"\\AppServer\\Bin\\OCAPI";
   if (ExistsDir (svPathpath) = EXISTS) then
      ExFn_WriteLog("webapi ","AppServer\\Bin\\OCAPI");
  ExFn_CreateWeb("webapi","AppServer\\Bin\\OCAPI");
   endif;
   
     //添加通配符应用程序映射
UseDLL(ENVCHECK_DLL);
//chglist.vbs" W3SVC/1/root/EIS/ScriptMaps "" "*,C:\WINDOWS\MicroSoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0" /INSERT /COMMIT
RunNoBlock("CMD /C Cscript "+"\""+SUPPORTDIR^"chglist.vbs"+"\""+" W3SVC/1/root/EIS/ScriptMaps "+"\""+"\""+" \""+"*,"+m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727\\aspnet_isapi.dll"+",0"+"\""+" /INSERT /COMMIT"); 
UnUseDLL(ENVCHECK_DLL);

if (FindFile(SUPPORTDIR,"AppPoolSetting.exe", svfileexist) = 0) then 
 ExFn_Run(SUPPORTDIR^"AppPoolSetting.exe");
endif;  
ExFn_WriteLog("END Create IIS Web ","CHECK_FOR_WEBSERVER");
elseif m_CheckType & CHECK_FOR_EnterNetServer then
   //U8V12.5 添加 移动应用EIS
svPathpath=TARGETDIR+"\\EIS\\WEB";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("EIS","EIS\\WEB");
endif;
svPathpath=TARGETDIR+"\\3rdPrograms";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("3rdPrograms","3rdPrograms");
endif;

//U8V12.5 添加 For CW 微信企业号
svPathpath=TARGETDIR+"\\U8CWWebService";
if (ExistsDir (svPathpath) = EXISTS) then
 ExFn_CreateWeb("U8CWWebService","U8CWWebService");
endif;

     //添加通配符应用程序映射
UseDLL(ENVCHECK_DLL);
//chglist.vbs" W3SVC/1/root/EIS/ScriptMaps "" "*,C:\WINDOWS\MicroSoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0" /INSERT /COMMIT
RunNoBlock("CMD /C Cscript "+"\""+SUPPORTDIR^"chglist.vbs"+"\""+" W3SVC/1/root/EIS/ScriptMaps "+"\""+"\""+" \""+"*,"+m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727\\aspnet_isapi.dll"+",0"+"\""+" /INSERT /COMMIT"); 
UnUseDLL(ENVCHECK_DLL);
endif;
  
  UseDLL(SETUPKIT_DLL);
//Add mine type .xap, .xamp only for u8100
iRet = AdsiIsExist("U8PFWeb"); 
//U8PFweb is exist
if(iRet) then  
   ExFn_WriteLog("AdsiSetMIMEType "," U8PFWeb ");
AdsiSetMIMEType("U8PFWeb",".xap","application/x-silverlight-app");
AdsiSetMIMEType("U8PFWeb",".xaml","application/xaml+xml");
AdsiSetMIMEType("U8PFWeb",".dmg","application/octet-stream");
endif;  
 
iRet = AdsiIsExist("U8SL"); 
//U8SL is exist
if(iRet) then    
   ExFn_WriteLog("AdsiSetMIMEType "," U8SL ");
AdsiSetMIMEType("U8SL",".xap","application/x-silverlight-app");
AdsiSetMIMEType("U8SL",".xaml","application/xaml+xml");
AdsiSetMIMEType("U8SL",".dmg","application/octet-stream");
sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/1/root/u8sl/DefaultDoc default.htm,default.asp,default.aspx,index.htm,index.html,index.asp";   
    ExFn_WriteLog("添加默认启动首页",sCommand);
    ExFn_Run(sCommand);
endif;  

//WXQYH is exist
iRet = AdsiIsExist("WXQYH"); 
//U8SL is exist
if(iRet) then    
sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/1/root/u8sl/DefaultDoc login.aspx,default.htm,default.asp,default.aspx,index.htm,index.html,index.asp";   
    ExFn_WriteLog("添加默认启动首页",sCommand);
    ExFn_Run(sCommand);
endif;  

UnUseDLL(SETUPKIT_DLL); 

if m_CheckType & CHECK_FOR_WEBSERVER  then
// ExFn_CreateWeb("U8GDP","GDP\\Web");       U8V11.0版本U8GDP(管理驾驶仓):与伟星、姚健确认应该由心BA替代 (BI安装盘会创建一个虚拟目录 BA)
//刘顺昌要求,当装web服务器的时候,给创建以下帐户
//ExFn_Run("cmd.exe /c \"net user UF_OLAP_USER U1f2S3o4F5t /add  /ACTIVE:YES /EXPIRES:NEVER \" ");
iRet = UseDLL (SETUPKIT_DLL);
if(!iRet) then
if(AdsiIsExist("U8Portal")) then
  AdsiDeleteWeb("U8Portal");
endif;
AdsiCreateWeb("U8Portal", TARGETDIR + "\\U8Portal", "", "", FALSE);
AdsiSetMIMEType("U8Portal",".hdr","InstallShiled List File");
iR=AdsiCreateSubApp("U8BM","DataExchangeService",TARGETDIR^"GDP\\U8BM\\DataExchangeService");
  endif;
UnUseDLL(SETUPKIT_DLL);
endif;   

svPathpath=TARGETDIR+"\\FileManager\\UFWebUploadServices";
if (ExistsDir (svPathpath) = EXISTS) then
    ExFn_WriteLog("UFWebUploadServices ","FileManager\\UFWebUploadServices");
ExFn_CreateWeb("UFWebUploadServices","FileManager\\UFWebUploadServices");
endif;


svPathpath=TARGETDIR+"\\FileManager\\UFFileManagerServices";
if (ExistsDir (svPathpath) = EXISTS) then
    ExFn_WriteLog("UFFileManagerServices ","FileManager\\UFFileManagerServices");
ExFn_CreateWeb("UFFileManagerServices","FileManager\\UFFileManagerServices");
endif;
/*
if m_CheckType & CHECK_FOR_FILESERVER then
ExFn_CreateWeb("UFWebUploadServices","FileManager\\UFWebUploadServices");
ExFn_CreateWeb("UFFileManagerServices","FileManager\\UFFileManagerServices");
endif;
*/

    
    //创建,更改应用程序池
ExFn_UpdateApplicationPools();


    //设置IIS 64位下兼容32位程序
    ExFn_SetEnable32BitAppOnWin64();
    
     
    ExFn_WriteLog("SetIISDLLProperty","修改U8SL的应用程序池结束!");
     
    //U8V13.0添加 设置TISERVICE的默认程序池的属性和相关设置
    SetTiServicePoolProperty();
    SetWebApiServicePoolProperty();   
    
    ExFn_RevertApppoolToNet20();
    //如果只选择EIS 删除其它虚拟目录
    if(g_isonlyeisselect==TRUE) then
       ExFn_DeleteWebsOnlyRetainEis();
    endif;
ExFn_WriteLog("","ExFn_AddAllWebs Leave");
end;




function ExFn_Run(cmdStr)
begin
UseDLL(ENVCHECK_DLL);
Run(cmdStr);
UnUseDLL(ENVCHECK_DLL);
 end;  
   
//此方法会解决 在对话框中调用WaitForSingleObject等待线程退出导致程序阻塞、如果在界面中移动鼠标。 
function ExFn_RunNoBlock(cmdStr)
begin
UseDLL(ENVCHECK_DLL);
RunNoBlock(cmdStr);
UnUseDLL(ENVCHECK_DLL);
 end;


function ExFn_CmdRun(appName, paras)
string svPath;
string svFileName;
string svValue;
string cmdStr;
begin
if ( ParsePath(svPath,appName,PATH) = 0) && (ParsePath(svFileName,appName,FILENAME) = 0) then
if (FindFile(svPath, svFileName, svValue) = 0) then
   LongPathToQuote(appName, TRUE);
   cmdStr = appName + " " + paras;
ExFn_Run(cmdStr);
endif;
endif;
end;


function ExFn_RegGuid()
STRING svGUID;
STRING szKey;
begin
svGUID = "";
UseDLL(ENVCHECK_DLL);
    CreateGUID(svGUID);
UnUseDLL(ENVCHECK_DLL);
  if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
szKey="SoftWare\\Ufsoft\\WF\\V8.700\\GUID";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
    MessageBox (szKey + @STR_036, SEVERE);
    endif;
    if (RegDBSetKeyValueEx (szKey, "", REGDB_STRING, svGUID,-1) < 0) then
endif;
end;


function ExFn_WriteLog(comment, detail)
begin
UseDLL(ENVCHECK_DLL);
 WriteLog(comment, detail);
UnUseDLL(ENVCHECK_DLL);
end;




function void ExFn_CheckForbidProc()
begin
UseDLL(ENVCHECK_DLL);

if ExistForbidProc() == FALSE  then
    MessageBox(@STR_EXIST_FORBIDPROCS,SEVERE);
    abort;
endif;

UnUseDLL(ENVCHECK_DLL);
end;


function ExFn_InitAllInstalled()
begin
    g_bCnSelected = FALSE; 
    //默认RAS不被选择
    g_bSetupmodeleSelected= FALSE;
    //默认PDM不被选择
    g_bSetupPDMSelected= FALSE;
    g_bTwSelected = TRUE;
    g_bEnSelected = TRUE;
    g_bNeedReboot = FALSE;
    g_bDependenceInstall = FALSE;   
    g_bIsRollBack = FALSE;
    g_bIsLoadMSUI = FALSE;
    g_bIsLoadMSIFuction = FALSE;
    g_bIsShowNoBar = TRUE;
end;




function void ExFn_ClearLogs()
begin
UseDLL(ENVCHECK_DLL);
WriteLog("","ClearLogs");
ClearLogs(TARGETDIR);
UnUseDLL(ENVCHECK_DLL);
end;


function void ExFn_ClearAllFiles()
begin
UseDLL(ENVCHECK_DLL);
WriteLog("","ExFn_ClearAllFiles");
ClearAllFiles(TARGETDIR);
UnUseDLL(ENVCHECK_DLL);
end;


#define RES_INSTALL_LOG_CHECK 1201


function ExFn_UFStartCopy2(hMSI)
    STRING  szDialogName, szDLLName, szDialog;
    NUMBER  nDialog, nResult, nCmdValue;
    BOOL    bDone;
    HWND    hInstance, hwndParent; 
    _DISK_INFO diWinDisk;
    NUMBER  nDiskSpace,nFeatureSize;                     
    string sFeatureSize,sDiskSpace,sInfo;
begin
    szDialogName = "UFStartCopy2";
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;
    nResult  = DefineDialog (szDialogName, hInstance, szDLLName,
                            RES_STARTCOPY2_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL,
DLG_MSG_STANDARD|DLG_CENTERED);


    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.",
SEVERE);
        bDone = TRUE;
        abort;
    endif;


   bDone = FALSE;  
   
   //----------------
   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; 


    
    //FeatureGetTotalCost(MEDIA, TARGETDIR,nFeatureSize);
    //系统盘占用空间,FeatureGetTotalCost此方法在2008R2以上系统处理时间太长。
    nFeatureSize=5*1024*1024;   //1G
    nFeatureSize=nFeatureSize/1024;
    //根据u8的实际占用空间动态的调整..
    nFeatureSize=nFeatureSize+2048;
    NumToStr(sFeatureSize,nFeatureSize);
    NumToStr(sDiskSpace,nDiskSpace); 
    sInfo = @STR_INSTALLPATH +TARGETDIR+"\n";
    sInfo = sInfo + @ID_STR_LACK_INFO1 + sDiskSpace +"MB " +"\n"+@ID_STR_LACK_INFO2 + sFeatureSize+"MB "; 
    if TARGETDIR % WINDISK  then
    sInfo = sInfo + "\n\n"+@STR_SYSDIRINSTALL; 
    nFeatureSize = nFeatureSize +3072;
    NumToStr(sFeatureSize,nFeatureSize);
    sInfo = sInfo+sFeatureSize +"MB";
    endif;
 
    
   //--------------------


   repeat


        nCmdValue = WaitOnDialog(szDialogName);


        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT:
            nResult = CtrlSetState(szDialogName, RES_INSTALL_LOG_CHECK, BUTTON_UNCHECKED);
            case RES_PBUT_CANCEL:
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
                bDone = TRUE;
            case RES_PBUT_BACK:
            nResult = RES_PBUT_BACK;
                bDone = TRUE; 
             case 1203: 
                 SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);  
                 MessageBox (sInfo,INFORMATION);
        endswitch;


    until bDone;


    if CtrlGetState(szDialogName, RES_INSTALL_LOG_CHECK) = BUTTON_CHECKED then
g_bInstallLog = TRUE;
else
g_bInstallLog = FALSE;
    endif;


    EndDialog (szDialogName);
    ReleaseDialog (szDialogName);
return nResult;


end;
/*
function NUMBER ExFn_UFWelcomeMain(hMSI, ntype)
    STRING  szDialogName, szDLLName, szDialog;
    NUMBER  nDialog, nResult, nCmdValue;
    BOOL    bDone;
    HWND    hInstance, hwndParent;
begin
    szDialogName = "UFWelcomeMain";
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;
    nResult  = DefineDialog (szDialogName, hInstance, szDLLName,
                            RES_WELCOMEMAIN_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL,
DLG_MSG_STANDARD|DLG_CENTERED);


    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.",
SEVERE);
        bDone = TRUE;
        abort;
    endif;


   bDone = FALSE;


   nResult = 302;


   repeat


        nCmdValue = WaitOnDialog(szDialogName);


        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT:
            CtrlSetState(szDialogName, 302, BUTTON_CHECKED); 
            case RES_PBUT_CANCEL:
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
                bDone = TRUE;
            case RES_PBUT_BACK:
            nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;


    until bDone;


    if nResult != RES_PBUT_BACK then
   if CtrlGetState(szDialogName, 302) = BUTTON_CHECKED then
nResult = 302;
endif;
    if CtrlGetState(szDialogName, 1202) = BUTTON_CHECKED then
nResult = 303;
  endif;
    endif;


    EndDialog (szDialogName);
    ReleaseDialog (szDialogName);
return nResult;


end;
*/




function OnSelfRegistrationError()
NUMBER ncnt, nResult, i, nCount;
STRING svNum, szFiles, szError, svResult;  
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2; 


begin
    ExFn_WriteLog("OnSelfRegistrationError start!","");
    nCount = FileRegistrar.Errors.Count;
    if(nCount>=1) then 
for i = 1 to nCount
ExFn_WriteLog(FileRegistrar.Errors(i).File,"In OnSelfRegistrationError");
endfor;
    endif;
  if SYSINFO.nISOSL == ISOSL_WINVISTA then 
  ExFn_WriteLog("In SYSINFO.nISOSL","");
  //return ERR_IGNORE;
  endif;
  if REMOVEALLMODE then//卸载不考虑出错
    // return ERR_IGNORE;
  endif;
    ExFn_WriteLog("OnSelfRegistrationError()","");   
    
    //弹出提示重起界面.....  
    szTitle = "";
    szMsg1 = "";
    szMsg2 = "";
    szOpt1 = "";
    szOpt2 = "";
bvOpt1   = FALSE;
    bvOpt2   = FALSE;    
    
    g_bNeedReboot = TRUE;
    if(g_bDebug) then
g_bNeedReboot = FALSE; //Added for debug
endif;  
/*
    if g_bNeedReboot then
SdFinishReboot("","",SYS_BOOTMACHINE,"",0);
else
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
endif;   

    ExFn_WriteLog("OnEnd Level Setup complete !","");  
    */
end;


function OnEnd()
//string sSetupType;  
begin    
ExFn_WriteLog("OnEnd Enter!","");
UnUseDLL(MSIUI_DLL);
    //UnUseDLL(MSIFUNCTION_DLL);
    
    if(!MAINTENANCE) then
     DeleteAddShortCut();
     //u8v12.5版本删除PLM
     //AddPDMShortCut();
    endif;
ExFn_WriteLog("OnEnd Level Setup OVER !",""); 
/*
//临时文件在 C:\WINDOWS\Installer
if(!MAINTENANCE) then
   UseDLL(ENVCHECK_DLL); 
   RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\Installer\\*.msi"+"\"");  
   RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\Installer\\*.msp"+"\""); 
 UnUseDLL(ENVCHECK_DLL); 
endif;
*/
end;


function BOOL ExFn_IsEmptyDir(dir)
BOOL nResult;
begin
UseDLL(ENVCHECK_DLL);
nResult = IsEmptyDir(dir);
if nResult == FALSE then
WriteLog(dir, "is not a empty dir!");
else
WriteLog(dir, "is a empty dir!");
endif;
UnUseDLL(ENVCHECK_DLL);
return nResult;
end;




function OnMoving()
string sRegKey,sKeyValue,svfileexist;
number nvType,nvSize;
begin
    //MessageBox("OnMoving",INFORMATION);
ExFn_WriteLog("OnMoveing Enter!","");
//设置服务超时时间
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
sRegKey =  "SYSTEM\\CurrentControlSet\\Control"; 
nvType = REGDB_NUMBER;
if RegDBGetKeyValueEx(sRegKey,"ServicesPipeTimeout",nvType,sKeyValue,nvSize) = 0 then 
   RegDBSetKeyValueEx (sRegKey, "ServicesPipeTimeout", REGDB_NUMBER, "300000",-1);
else 
RegDBCreateKeyEx(sRegKey,"ServicesPipeTimeout");
RegDBSetKeyValueEx (sRegKey, "ServicesPipeTimeout", REGDB_NUMBER, "300000",-1);
endif;
ExFn_WriteLog("write ServicesPipeTimeout registry","");
//------------- 
    ExFn_WriteLog("OnMoving ","start");
UseDLL(MSIUI_DLL);
//UseDLL(MSIFUNCTION_DLL);
g_bIsLoadMSUI = TRUE;
g_bIsLoadMSIFuction = TRUE;
if (!MAINTENANCE) then 
ExFn_DoBeforeInstall();
else
ExFn_FeatureUninstallCost();
switch(g_nSetupType)
        case REMOVEALL: 
            UnintallPatchMsis();
            //解决 :描述:DLL 函数调用失败: ISRT._DotNetCoCreateObject
            //直接的调用EXE来执行卸载程序。
            if (FindFile(SUPPORTDIR,"RunUnInstallMsi.exe", svfileexist) = 0) then 
       ExFn_Run(SUPPORTDIR^"RunUnInstallMsi.exe"+"\""+SUPPORTDIR+"\"");
       endif;
        ExFn_DoBeforeRemoveAll();
        case REPAIR:
        ExFn_DoBeforeRepair();
        case MODIFY:
        ExFn_DoBeforeModify();
   endswitch;
    endif;
ExFn_WriteLog("OnMoveing Leave!","");
end;




function OnMoved()
NUMBER iReturn;
string sReturn,regkeygrantpri;
BOOL issetupreg;
begin         
ExFn_WriteLog("OnMoved Enter!","");    
//在迁移完数据后执行相关操作
ExFn_OnMovedExcuted();
if (!MAINTENANCE) then
ExFn_DoAfterInstall(); 
//SetOSWin2008Win7InstallMsiProblem(); 
regkeygrantpri="HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData";
//GrantprivilegeToRegister(regkeygrantpri);
ExcuteNetShImproveEfficiency();

//设置进度条显示状态
   StatusUpdate(ON, 100);
   SetStatusWindow(100, @ID_CopyFileComplete);

else
switch(g_nSetupType)
        case REMOVEALL:
        ExFn_DoAfterRemoveAll();
        case REPAIR:
        ExFn_DoAfterRepair();
        case MODIFY:
        ExFn_DoAfterModify();
   endswitch;
    endif;
HideDlg();
//----设置安装状态注册表(回滚的时候不设置此值) 
if g_bIsRollBack != TRUE  then
ExFn_WriteLog("set u8setup registy","SOFTWARE\\Microsoft\\Windows\\u8setup = 2");
issetupreg=WriteU8SetupReg(2);
if(issetupreg = FALSE) then
ExFn_WriteLog("Write registy error","2");
endif;
endif;

ExFn_WriteLog("OnMoved Leave!","");
end;     


function void ExFn_ClearU8Reg()
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);    
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{D7712341-C48F-1979-0609-B461A3712151}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{7998801B-FB44-4D11-8BA7-8616089111F6}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{AC2C5FB1-A354-44D1-8A5B-9974457A3B86}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{A84D5358-62E8-4BE0-BB81-9805ED4AC259}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{9026D6CF-B212-4B8C-BA9A-89AF89EDB567}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{17CD9938-1F6E-4FF6-A76A-94E36FC6227D}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{0751C3CE-1E84-467D-A813-7E1DDD324257}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{D7B0234F-310C-4726-85B9-61031C4C73A4}");
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{AC576ECD-146A-41D6-A064-D8E99C812AF2}");
//u8的安装盘安装后的注册表位置,重要。 
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{9FA58927-FE90-4B3A-9967-6CDF0A9CB890}"); //u8v11.0
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{419C8B7E-26A8-47DD-A08C-BB7E0CAD9713}"); //v11.1 
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{6086EE4B-36BC-4EA6-B41B-F5BB7A155195}"); //v12.0 
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{0C73BC19-015A-4077-AE93-962DD7E76119}"); //v12.1
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{AC6650CD-67D9-4EEF-B6FA-CF51505194D2}"); //v12.5
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{B86C31C8-FE88-4CC3-90DB-F6F49AEFEE79}"); //v13.0
RegDBDeleteKey(UNINSTALL_KEY_NAME+"{23F29D8B-3AD3-4722-A91A-EF2925D94306}"); //v15.0
//RegDBDeleteKey(UNINSTALL_KEY_NAME+"{0AEA76D5-7E9C-4228-ADAB-C39EB822FD12}"); //v15.1
if(IsSpecialRas())||FeatureIsItemSelected(MEDIA,"RAS")=1 then 
     RegDBDeleteKey(UNINSTALL_KEY_NAME+"{EC065B27-13AF-406B-B740-93A460DC6531}"); //科迈产品
endif;
RegDBDeleteKey("SOFTWARE\\Ufsoft");
RegDBDeleteKey("SOFTWARE\\UFMOM");
RegDBDeleteKey("SOFTWARE\\用友软件"); 
RegDBDeleteKey("SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_USE_WINDOWEDSELECTCONTROL");
end;


//点击安装取消的时候程序退出的时候执行 强制退出.
function OnAbort()
NUMBER   nMsiCount;
begin
ExFn_WriteLog("start","OnAbort");   
g_bIsRollBack = TRUE;

if(!g_bIsLoadMSIFuction) then
//UseDLL(MSIFUNCTION_DLL);
g_bIsLoadMSIFuction = TRUE;
endif;

nMsiCount =  ExFn_GetAllInstalledMsiCount();
nMsiCount +=  ExFn_GetAllDenpendenceMsiCount();  
if(!g_bIsLoadMSUI) then
UseDLL(MSIUI_DLL);
g_bIsLoadMSUI = TRUE;
endif;

SetMsiCount(nMsiCount,g_bIsRollBack);
//设置进度条显示状态 一但撤销,进度条从最大值开发往回撤销安装,此处设置进度条为最大状态.

g_statusprocesscurentvalue=98;
StatusUpdate( ON, g_statusprocesscurentvalue);
SetStatusWindow(g_statusprocesscurentvalue, @ID_setuprollbacklable);
ExFn_WriteLog("end ","OnAbort"); 
// UnUseDLL(MSIUI_DLL);
// UnUseDLL(MSIFUNCTION_DLL);
end;   




//---------------------------------------------------------------------------
// OnSetUpdateMode
//
// OnSetUpdateMode is called directly by the framework to set the UPDATEMODE
// InstallShield system variable appropriately to control which UI events
// are called by OnShowUI.
//
// Note: This event is called for all setups.
//---------------------------------------------------------------------------
function OnSetUpdateMode()
number nIgnore, nMediaFlags, nInstalledVersion, nUpdateVersion, nResult;
string szVersion, szIgnore, szMsg;
begin   
    
UPDATEMODE = FALSE; // Non-update mode by default.


// Added 11.5 - Don't set UPDATEMODE when running from Add/Remove
if( ADDREMOVE ) then
return ISERR_SUCCESS;
endif;


// Added 11.5 - Don't set UPDATEMODE when REMOVEONLY is specified
if( REMOVEONLY ) then
return ISERR_SUCCESS;
endif;


// Get the media flags.
MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );


// TODO: If you are updating an application that was installed by a previous
// version of InstallShield, IFX_INSTALLED_VERSION will be empty, and
// VERSION_COMPARE_RESULT_NOT_INSTALLED will be returned by
// VerProductCompareVersions. Change the value of IFX_INSTALLED_VERSION (and
// IFX_INSTALLED_DISPLAY_VERSION) here based on application specific version
// information determined by the setup. Only do this if IFX_INSTALLED_VERSION
// is empty.
//if ( !StrLengthChars( IFX_INSTALLED_VERSION ) && MAINTENANCE ) then
// IFX_INSTALLED_VERSION = "X.XX.XXX";
// IFX_INSTALLED_DISPLAY_VERSION = IFX_INSTALLED_VERSION;
//endif;


// Verify that the installed version is valid.
if( !StrLengthChars( IFX_INSTALLED_VERSION ) && MAINTENANCE ) then
// If this error occurs, IFX_INSTALLED_VERSION needs to be set manually.
szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_NO_INSTALLED_VERSION );
MessageBox( szMsg, SEVERE );
abort;
endif;


// Verify that the product version is valid.
if( !StrLengthChars( IFX_PRODUCT_VERSION ) ) then
// If this error occures, IFX_PRODUCT_VERSION was not initialized correctly.
szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_NO_PRODUCT_VERSION );
MessageBox( szMsg, SEVERE );
abort;
endif;


// Do the version comparison.
nResult = VerProductCompareVersions();


// Make sure that valid data was returned by VerProductCompareVersions
if( nResult < ISERR_SUCCESS ) then
szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_VERSION_COMPARE_FAILURE );
MessageBox( szMsg, SEVERE );
abort;
endif;


// Set update mode if this is a differential media or the product is already installed and the versions do not match.
UPDATEMODE = ( nMediaFlags & MEDIA_FLAG_FORMAT_DIFFERENTIAL || ( MAINTENANCE && ( nResult != VERSION_COMPARE_RESULT_SAME ) ) );


end;
//---------------------------------------------------------------------------
// OnCheckMediaPassword
//
// Displays a password dialog if the media is password protected.
//
// Note: This event is called for all setups.
//---------------------------------------------------------------------------
function OnCheckMediaPassword()
string szResult, szMsg;
BOOL bValidated;
begin


// Check whether the setup author selected this option.
if( !SHOW_PASSWORD_DIALOG ) then;
return ISERR_SUCCESS;
endif;


// Check whether the password has been specified previously.
LogReadCustomString( MEDIA_PASSWORD_KEY, szResult );
if( FeatureValidate( MEDIA, "", szResult ) == 0 ) then
return ISERR_SUCCESS;
endif;


// "Back" button should be disabled.
Disable( BACKBUTTON );


// Attempt to validate the media.
bValidated = FALSE;


// Loop until the password is validated.
while( !bValidated )


// Prompt for password.
if( EnterPassword( "", "", szResult ) < ISERR_SUCCESS ) then
abort; // Failed to display password dialog
endif;


// Attempt to validate the media.
if( FeatureValidate( MEDIA, "", szResult ) == 0 ) then

// Store the media password for maintenance mode.
LogWriteCustomString( MEDIA_PASSWORD_KEY, szResult );


bValidated = TRUE;
else
szMsg = SdLoadString( IDS_IFX_ERROR_INVALID_MEDIA_PASSWORD );
MessageBox( szMsg, INFORMATION );
endif;


endwhile;


// Enable "Back" button.
Enable( BACKBUTTON );


end;
//---------------------------------------------------------------------------
// OnUpdateUIAfter
//
// Update Mode UI Sequence - After Move Data
//
// The OnUpdateUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in update mode. By default
// this event displays UI that informs the end user that the maintenance setup
// has been completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnUpdateUIAfter()
    string szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
    BOOL bOpt1, bOpt2;
begin


    ShowObjWizardPages(NEXT);
    
szTitle = SdLoadString(IDS_IFX_SDFINISH_UPDATE_TITLE);    
    szMsg1  = SdLoadString(IDS_IFX_SDFINISH_UPDATE_MSG1);
szMsg2 = "";    
    szOpt1 = "";
    szOpt2 = "";
bOpt1   = FALSE;
    bOpt2   = FALSE;    
    
    if ( BATCH_INSTALL ) then
    SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
    else    
        SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bOpt1 , bOpt2 );
    endif;
end;
//---------------------------------------------------------------------------
// OnUninstall
//
// The OnUninstall event is called when the setup is run with the -uninst
// switch, in this case this is the only event that will be called.
//---------------------------------------------------------------------------
function OnUninstall()
string szIgnore, szMsg;
number nResult;
BOOL bOpt1, bOpt2;
begin
     
    ExFn_WriteLog("OnUninstall  ","START!"); 
    // Hide the initial progress dialog.
    Disable( DIALOGCACHE );


    // Added in InstallShield 15 - Show an appropriate error message if
    // -uninst is specified and the product is not installed.
    if( !MAINTENANCE ) then
szMsg = SdLoadString( IDS_IFX_ERROR_PRODUCT_NOT_INSTALLED_UNINST );
    SdSubstituteProductInfo( szMsg );
MessageBox( szMsg, SEVERE );
abort;
    endif;

// Show Uninstall Confirmation Dialog
if( MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO ) != IDYES ) then
        abort;
    endif;


    // Remove all features.
FeatureRemoveAllInMediaAndLog();


    // Added in 11.0, disable the cancel button during uninstall.
    if( REMOVEALLMODE ) then
        Disable( CANCELBUTTON );
    endif;
    
// Added in 11.0 - Set appropriate StatusEx static text.
// Moved in 12.1 - Set before calling Enable( STATUSEX ) to ensure proper product name updating.
    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );


    // Show Status
SetStatusWindow( 0, "" );
Enable(STATUSEX);
StatusUpdate( ON, 100 );




    // Uninstall
nResult = FeatureTransferData( MEDIA );


    // Handle move data error and abort if error occured.
if( nResult < ISERR_SUCCESS ) then
//OnComponentError();
//abort;
endif;


    // Disable Status
Disable( STATUSEX );


    // Show final dialog.
    if ( BATCH_INSTALL ) then
        SdFinishReboot( SdLoadString(IFX_SDFINISH_REMOVE_TITLE), SdLoadString(IFX_SDFINISH_REMOVE_MSG2), SYS_BOOTMACHINE, "", 0 );
    else    
        SdFinish( SdLoadString(IFX_SDFINISH_REMOVE_TITLE), SdLoadString(IFX_SDFINISH_REMOVE_MSG1), "", "" , "", bOpt1 , bOpt2 );
    endif;
    ExFn_WriteLog("OnUninstall  ","END!"); 
end;
//---------------------------------------------------------------------------
// OnIISCheckRequirements
//
// The OnIISCheckRequirements event is called by Preprogram to make sure
// that the requirements for IIS runtime are met
//---------------------------------------------------------------------------
function OnIISCheckRequirements()
begin
// obsolete function...moved to after the U.I. to determine user feature selection
// remove comments below to check for IIS at the very beginning of the install, similar to legacy behavior
//OnIISInitialize();


// Pass in a component name in your project that contains IIS configuration
//IISRTCheckForContinue("VirtualDirComponent", FALSE);
end;
//---------------------------------------------------------------------------
// OnShowUI
//
// This function drives the UI sequence and file transfer of the setup.
// 
// The OnShowUI event is called directly by the framework to initiate
// the UI sequence and file transfer of the setup. By default this event
// displays UI that informs the end user that the maintenance setup has been
// completed successfully.
// 
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnShowUI()
BOOL bMaintenanceMode, bUpdateMode;
string szIgnore, szTitle;
begin

// Enable dialog caching
Enable( DIALOGCACHE );

// Determine what events to show.
bUpdateMode = FALSE;
bMaintenanceMode = FALSE;

// Remove this to disabled update mode.
if( UPDATEMODE ) then
bUpdateMode = TRUE;
endif;


// Remove this to disable maintenance mode.
if ( MAINTENANCE ) then
bMaintenanceMode = TRUE;
endif;


// Show appropriate UI


// TODO: Enable if you want to enable background etc.
//if ( LoadStringFromStringTable( "TITLE_MAIN", szTitle ) < ISERR_SUCCESS ) then // Load the title string.
// szTitle = IFX_SETUP_TITLE;
//endif;
//SetTitle( szTitle, 24, WHITE );
//Enable( FULLWINDOWMODE );  
//Enable( BACKGROUND );
//SetColor( BACKGROUND, RGB( 0, 128, 128 ) );
       
if( bUpdateMode ) then
OnUpdateUIBefore();
else
if ( bMaintenanceMode ) then
OnMaintUIBefore();
else
OnFirstUIBefore();
endif;
endif;


// Move Data
OnMoveData();

if( bUpdateMode ) then
OnUpdateUIAfter();
else
if ( bMaintenanceMode ) then
OnMaintUIAfter();
else
OnFirstUIAfter();
endif;
endif;


// Disable dialog caching
Disable(DIALOGCACHE);


end;


//安装复制文件界面,显示进度条等..


//---------------------------------------------------------------------------
// OnMoveData
//
// The OnMoveData event is called by OnShowUI to initiate the file
// transfer of the setup.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMoveData()
number nResult, nMediaFlags;
begin


// Don't install the DISK1COMPONENT if MAINT_OPTION_NONE was specified.
if( MAINT_OPTION = MAINT_OPTION_NONE ) then
FeatureSelectItem( MEDIA, DISK1COMPONENT, FALSE );
endif;


    // Updated in 11.5, disable the cancel button during file transfer unless
// this is non-maintenance mode or repair mode.
    if( MAINTENANCE && ( !REINSTALLMODE || UPDATEMODE ) ) then
        Disable( CANCELBUTTON );
    endif;


    // Show Status
// Note: Start status window at 1 in case CreateInstallationInfo call
// is lengthy.
SetStatusWindow( 1, @ID_isnowcopyfile);
Enable( STATUSEX );
StatusUpdate( ON, 95);
if(MAINTENANCE) then
  g_bprogressnumber=1;
endif;

// Create the uninstall infomation (after displaying the progress dialog)
// Don't create uninstall information if MAINT_OPTION_NONE was specified.
if( MAINT_OPTION != MAINT_OPTION_NONE ) then
CreateInstallationInfo();
endif;


// Move Data
nResult = FeatureTransferData( MEDIA );

    // Moved in 11.0, Check for failure before creating uninstall key.
    // Handle move data error and abort if error occured.
if( nResult < ISERR_SUCCESS ) then
OnComponentError();
abort;
endif;    


// Create uninstall key, if DISK1COMPONENT was installed.
if( IFX_DISK1INSTALLED ) then


// Store text-subs for maintenance mode later, only do this when
// disk 1 is installed. Note that any text-subs that are updated after
        // this call will not be remembered during maintenance mode.
FeatureSaveTarget("");


// Write uninstall information.
MaintenanceStart();


// Customize Uninstall Information
OnCustomizeUninstInfo();


endif;


    // Disable Status
Disable( STATUSEX );


end;


//---------------------------------------------------------------------------
// OnInstallingFile
//
// The OnInstallingFile event is called when a file is about to be installed
// as a result of FeatureTransferData or FeatureMoveData.
//
// szFile will contain the full path of file about to be installed.
//---------------------------------------------------------------------------
function OnInstallingFile(szFile)
begin
     ExFn_WriteLog("OninstallingFile: ", szFile); 
end;




//---------------------------------------------------------------------------
// OnUninstallingFile
//
// The OnUninstallingFile event is called when a file is about to be
// uninstalled as a result of FeatureTransferData or FeatureMoveData.
//
// szFile will contain the full path of file about to be uninstalled.
//---------------------------------------------------------------------------
function OnUninstallingFile(szFile)
begin
   ExFn_WriteLog("OnUninstallingFile: ", szFile); 
end;




//---------------------------------------------------------------------------
// OnCanceling
//
// The OnCanceling event is sent when the installation is cancelled, 
// usually as result of end user clicking Cancel button of a dialog or
// pressing Esc key. Calling Do(EXIT) will also trigger this event.
//---------------------------------------------------------------------------
function OnCanceling()
    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
    NUMBER bvOpt1, bvOpt2;
begin
    if (IDYES = SprintfBox(MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2, SdLoadString(SD_STR_ONCANCELING_TITLE), SdLoadString(SD_STR_ONCANCELING_CONFIRM_MSG))) then
        //Close the current dialog.
        EndCurrentDialog();
        //Display Finish dialog.
        szTitle = "";    
        szMsg1 = SdLoadString( SD_STR_ONCANCELING_FINISH_MSG1 );
        szMsg2 = SdLoadString( SD_STR_ONCANCELING_FINISH_MSG2 );    
        szOpt1 = "";
        szOpt2 = "";
        bvOpt1   = FALSE;
        bvOpt2   = FALSE;
        SdFinish ( szTitle, szMsg1, szMsg2 , szOpt1, szOpt2, bvOpt1, bvOpt2 );                       
        
        abort;
    endif;
end;






//---------------------------------------------------------------------------
// OnRebooted
//
// The OnRebooted event is called when the setup is run automatically after
// rebooting the system. This is the only event that will be called in this
// case.
//---------------------------------------------------------------------------
function OnRebooted()
begin




end;




//---------------------------------------------------------------------------
// OnUninstalledFile
//
// The UninstalledFile event is called after a file is uninstalled 
// as a result of ComponentTransferData or ComponentMoveData.
//
// szFile will contain the full path of file that was just installed.
//---------------------------------------------------------------------------
function OnUninstalledFile(szFile)
begin
    ExFn_WriteLog("OnUninstalledFile: ", szFile); 
end;




//---------------------------------------------------------------------------
// OnFilterComponents
//
// The OnFilterComponents event is called by the framework to filter out
// components in each feature by language and platform, override this
// event to perform custom filtering.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFilterComponents()
begin
    // Filter file groups by current platform.
    FeatureFilterOS(MEDIA, ISOS_ST_ALL, ISOSL_ALL, TRUE);
    FeatureFilterOS(MEDIA, SYSINFO.nSuites, SYSINFO.nISOSL, FALSE);
 
    // Filter file groups by current language.
    FeatureFilterLanguage(MEDIA, ISLANG_ALL, TRUE);
    FeatureFilterLanguage(MEDIA, STANDARD_SELECTED_LANGUAGE, FALSE);
end;




#include "clearreg.rul"
#include "clearexistmsi.rul"
#include "msiexist.rul"
#include "install.rul"
#include "msicount.rul"
#include "featureevents.rul"
#include "featureselectenvirenment.rul"
#include "services.rul"
#include "setuptype.rul"
#include "FeatureCost.rul"
#include "uninstallcost.rul"
#include "FeatureCount.rul"
#include "Dependence.rul"
#include "acl.rul"
#include "msiguid.rul"
#include "backup.rul" 
#include "MovedConfig.rul"    
#include "RunCommad.rul"  
#include "RunCommad2.rul"
#include "runcommad3.rul"
#include "runcommad4.rul"
#include "runcommad5.rul"
#include "SetupBeforeCpy.rul"
#include "CheckPort.rul"
#include "SdLicenseSelf.rul"
#include "SmartClientTip.rul"
#include "SmartClientTraditionSmartClientTip.rul"



featureevents.rul内容

// 客户端 is installing.
export prototype CLIENT_Installing();
function CLIENT_Installing()
begin
ExFn_SetReg("Client", "客户端"); 
    ExFn_SetReg("RA", "分析报表");   
    ExFn_SetReg("GC", "集团管控");   
    ExFn_SetUAPRegByVaule("IntelligentEnabledRefList","Department_AA,Inventory_AA,Vendor_AA,Customer_AA,Warehouse_AA");
    //设置智能安装标示。
    ExFn_SetRegByVaule("SmartGuid","","smartclient");
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
// ExFn_ComponentInstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentInstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;


    //panglh 提出安装档案的时候安装HM,HB
    
    //ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");  
    //ExFn_ComponentInstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}"); 
     
FeatureSpendCost(0,524188000);
end;


// 客户端 is uninstalling.


export prototype CLIENT_UnInstalling();
function CLIENT_UnInstalling()     
string qvPDunistallPath,  svValue;
begin      
    StopPaltframeServices();
    StopServiceU8("U8SCMPool"); 
    //qvPDF卸载
    qvPDunistallPath =TARGETDIR+"\\3rdPrograms\\qvPDF\\UnInstallPrint.exe";
    if (FindFile (TARGETDIR+"\\3rdPrograms\\qvPDF", "UnInstallPrint.exe", svValue) = 0) then 
      ExFn_WriteLog("Uninstall UnInstallPrint.exe : ", TARGETDIR^"3rdPrograms\\qvPDF\\UnInstallPrint.exe"); 
      LaunchAppAndWait(qvPDunistallPath," ", LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN); 
    endif; 
    
    SetUpRollback(10);
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
// ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;
 
//ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
//ExFn_ComponentUninstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
end;


// 客户端 is installed.


export prototype CLIENT_Installed();
function CLIENT_Installed()
string svResult;
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");  
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");  
    
    //if ( SYSINFO.bIsWow64 != 0 ) then
    //  ExFn_AddConfigFile("U8ERP-PUBLIC-OPENAPIX64.xml");
    //  ExFn_AddInstalledMsi("U8ERP-PUBLIC-OPENAPIX64.msi");
    //else
      ExFn_AddConfigFile("U8ERP-PUBLIC-openapix86.xml");
      ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
    //endif;

 //ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
      //ExFn_AddInstalledMsi("U8ERP-COMMON-HM.msi");
      
 //ExFn_AddConfigFile("U8ERP-HR-HM.xml");
      //ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");

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


//复制设置环境变量的setx.exe 发现有的机器没有此文件
Disable(LOGGING);
   if (FindFile(WINSYSDIR,"setx.exe", svResult) < 0) then 
          XCopyFile (SUPPORTDIR+"\\setx.exe", WINSYSDIR, COMP_NORMAL); 
        endif;
    Enable(LOGGING); 
end;


// 客户端 is uninstalled.


export prototype CLIENT_UnInstalled();
function CLIENT_UnInstalled()
begin
ExFn_DelReg("Client");
    ExFn_DelReg("RA");
    ExFn_DelReg("GC");   
ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON.msi");  
ExFn_AbsoluteDeleteMsi("{B2D6C198-095C-4A26-9840-98836AF70F23}");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");  
ExFn_AbsoluteDeleteMsi("{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");


//卸载openapi

//if ( SYSINFO.bIsWow64 != 0 ) then 
//   ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
    //    ExFn_AbsoluteDeleteMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
        ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
        ExFn_AbsoluteDeleteMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;


//ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
        //ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");
        //ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");
        
   //ExFn_RemoveConfigFile("U8ERP-HR-HM.xml");
       // ExFn_RemoveInstalledMsi("U8ERP-HR-HM.msi");
        //ExFn_AbsoluteDeleteMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
       

    DeletaPaltframeServices();  
    
end;






// 客户端\UAP is installing.


export prototype UAPClient_Installing();
function UAPClient_Installing()
begin
ExFn_SetReg("UA", "UAP");


ExFn_ComponentInstall("U8ERP-PUBLIC-UAP.msi","{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
FeatureSpendCost(0,12234752);
end;


// 客户端\UAP is uninstalling.


export prototype UAPClient_UnInstalling();
function UAPClient_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-UAP.msi","{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
//控制进度条,已经取消 FeatureSpendUninstallCost(2987,FEATURE_OPCOST_UNINSTALL_FILE);

end;


// 客户端\UAP is installed.


export prototype UAPClient_Installed();
function UAPClient_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-UAP.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-UAP.msi");
end;


// 客户端\UAP is uninstalled.


export prototype UAPClient_UnInstalled();
function UAPClient_UnInstalled()
begin
ExFn_DelReg("UA");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-UAP.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-UAP.msi");   
ExFn_AbsoluteDeleteMsi("{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");



end;


// 客户端\人力资源 is installing.


export prototype HRCOMMON_Installing();
function HRCOMMON_Installing()
begin
ExFn_SetReg("HB", "基础设置");
ExFn_SetReg("LW", "法律合规");
ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
end;


// 客户端\人力资源 is uninstalling.


export prototype HRCOMMON_UnInstalling();
function HRCOMMON_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
end;


// 客户端\人力资源 is installed.


export prototype HRCOMMON_Installed();
function HRCOMMON_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
end;


// 客户端\人力资源 is uninstalled.


export prototype HRCOMMON_UnInstalled();
function HRCOMMON_UnInstalled()
begin
ExFn_DelReg("HB");


ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");
ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");



end;


// 客户端\人力资源\人事合同 is installing.


export prototype RSHT_Installing();
function RSHT_Installing()
begin
ExFn_SetReg("HT", "人事合同");


ExFn_ComponentInstall("U8ERP-HR-HT.msi","{7303FF34-69E0-473E-817B-C27728E77073}");


FeatureSpendCost(0,4694016);
end;


// 客户端\人力资源\人事合同 is uninstalling.


export prototype RSHT_UnInstalling();
function RSHT_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-HT.msi","{7303FF34-69E0-473E-817B-C27728E77073}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1146,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\人事合同 is installed.


export prototype RSHT_Installed();
function RSHT_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-HT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HT.msi");
end;


// 客户端\人力资源\人事合同 is uninstalled.


export prototype RSHT_UnInstalled();
function RSHT_UnInstalled()
begin
ExFn_DelReg("HT");


ExFn_RemoveConfigFile("U8ERP-HR-HT.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-HT.msi");  
ExFn_AbsoluteDeleteMsi("{7303FF34-69E0-473E-817B-C27728E77073}");



end;


// 客户端\人力资源\人事管理 is installing.


export prototype RLZYHM_Installing();
function RLZYHM_Installing()
begin
ExFn_SetReg("HM", "人事信息管理");


ExFn_ComponentInstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");


FeatureSpendCost(0,5464064);
end;


// 客户端\人力资源\人事管理 is uninstalling.


export prototype RLZYHM_UnInstalling();
function RLZYHM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1334,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\人事管理 is installed.


export prototype RLZYHM_Installed();
function RLZYHM_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-HM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");
end;


// 客户端\人力资源\人事管理 is uninstalled.


export prototype RLZYHM_UnInstalled();
function RLZYHM_UnInstalled()
begin
ExFn_DelReg("HM");


ExFn_RemoveConfigFile("U8ERP-HR-HM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-HM.msi"); 
ExFn_AbsoluteDeleteMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");



end;


// 客户端\人力资源\培训管理 is installing.


export prototype PXGL_Installing();
function PXGL_Installing()
begin
ExFn_SetReg("TR", "培训管理");


ExFn_ComponentInstall("U8ERP-HR-TR.msi","{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");


FeatureSpendCost(0,6815744);
end;


// 客户端\人力资源\培训管理 is uninstalling.


export prototype PXGL_UnInstalling();
function PXGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-TR.msi","{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1664,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\培训管理 is installed.


export prototype PXGL_Installed();
function PXGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-TR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TR.msi");
end;


// 客户端\人力资源\培训管理 is uninstalled.


export prototype PXGL_UnInstalled();
function PXGL_UnInstalled()
begin
ExFn_DelReg("TR");


ExFn_RemoveConfigFile("U8ERP-HR-TR.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-TR.msi");  
ExFn_AbsoluteDeleteMsi("{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");

end;


// 客户端\人力资源\宿舍管理 is installing.


export prototype HRDM_Installing();
function HRDM_Installing()
begin  
/*
ExFn_SetReg("DM", "宿舍管理");


ExFn_ComponentInstall("U8ERP-HR-DM.msi","{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}");


FeatureSpendCost(0,3293184);   
*/
end;


// 客户端\人力资源\宿舍管理 is uninstalling.


export prototype HRDM_UnInstalling();
function HRDM_UnInstalling()
begin   
/*
ExFn_ComponentUninstall("U8ERP-HR-DM.msi","{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}");


//控制进度条,已经取消 FeatureSpendUninstallCost(804,FEATURE_OPCOST_UNINSTALL_FILE); 
*/
end;


// 客户端\人力资源\宿舍管理 is installed.


export prototype HRDM_Installed();
function HRDM_Installed()
begin   
/*
ExFn_AddConfigFile("U8ERP-HR-DM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-DM.msi");
*/
end;


// 客户端\人力资源\宿舍管理 is uninstalled.


export prototype HRDM_UnInstalled();
function HRDM_UnInstalled()
begin    
/*
ExFn_DelReg("DM");


ExFn_RemoveConfigFile("U8ERP-HR-DM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-DM.msi");
*/
end;


// 客户端\人力资源\招聘管理 is installing.


export prototype RLZYRT_Installing();
function RLZYRT_Installing()
begin
ExFn_SetReg("RT", "招聘管理");


ExFn_ComponentInstall("U8ERP-HR-RT.msi","{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");


FeatureSpendCost(0,8065024);
end;


// 客户端\人力资源\招聘管理 is uninstalling.


export prototype RLZYRT_UnInstalling();
function RLZYRT_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-RT.msi","{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1969,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\招聘管理 is installed.


export prototype RLZYRT_Installed();
function RLZYRT_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-RT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-RT.msi");
end;


// 客户端\人力资源\招聘管理 is uninstalled.


export prototype RLZYRT_UnInstalled();
function RLZYRT_UnInstalled()
begin
ExFn_DelReg("RT");


ExFn_RemoveConfigFile("U8ERP-HR-RT.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-RT.msi");  
ExFn_AbsoluteDeleteMsi("{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");



end;


// 客户端\人力资源\福利管理 is installing.


export prototype BXFL_Installing();
function BXFL_Installing()
begin
ExFn_SetReg("WM", "保险福利");


ExFn_ComponentInstall("U8ERP-HR-WM.msi","{582E19C0-23C4-44A7-8772-F0C613297C16}");


FeatureSpendCost(0,4403200);
end;


// 客户端\人力资源\福利管理 is uninstalling.


export prototype BXFL_UnInstalling();
function BXFL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-WM.msi","{582E19C0-23C4-44A7-8772-F0C613297C16}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1075,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\福利管理 is installed.


export prototype BXFL_Installed();
function BXFL_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-WM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WM.msi");
end;


// 客户端\人力资源\福利管理 is uninstalled.


export prototype BXFL_UnInstalled();
function BXFL_UnInstalled()
begin
ExFn_DelReg("WM");


ExFn_RemoveConfigFile("U8ERP-HR-WM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-WM.msi"); 
    ExFn_AbsoluteDeleteMsi("{582E19C0-23C4-44A7-8772-F0C613297C16}");
    


end;


// 客户端\人力资源\绩效管理 is installing.


export prototype HRPFClient_Installing();
function HRPFClient_Installing()
begin
ExFn_SetReg("PF", "绩效管理");


ExFn_ComponentInstall("U8ERP-HR-PF.msi","{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");


FeatureSpendCost(0,7626752);
end;


// 客户端\人力资源\绩效管理 is uninstalling.


export prototype HRPFClient_UnInstalling();
function HRPFClient_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-PF.msi","{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1862,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\绩效管理 is installed.


export prototype HRPFClient_Installed();
function HRPFClient_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-PF.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PF.msi");
end;


// 客户端\人力资源\绩效管理 is uninstalled.


export prototype HRPFClient_UnInstalled();
function HRPFClient_UnInstalled()
begin
ExFn_DelReg("PF");


ExFn_RemoveConfigFile("U8ERP-HR-PF.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-PF.msi");  
ExFn_AbsoluteDeleteMsi("{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");



end;


// 客户端\人力资源\考勤管理 is installing.


export prototype RLZYTM_Installing();
function RLZYTM_Installing()
begin
ExFn_SetReg("TM", "考勤管理");


ExFn_ComponentInstall("U8ERP-HR-TM.msi","{F29D733D-C755-4F8D-85B1-1A8478D69A97}");


FeatureSpendCost(0,9945088);
end;


// 客户端\人力资源\考勤管理 is uninstalling.


export prototype RLZYTM_UnInstalling();
function RLZYTM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-TM.msi","{F29D733D-C755-4F8D-85B1-1A8478D69A97}");


//控制进度条,已经取消 FeatureSpendUninstallCost(2428,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\考勤管理 is installed.


export prototype RLZYTM_Installed();
function RLZYTM_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-TM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TM.msi");
end;


// 客户端\人力资源\考勤管理 is uninstalled.


export prototype RLZYTM_UnInstalled();
function RLZYTM_UnInstalled()
begin
ExFn_DelReg("TM");


ExFn_RemoveConfigFile("U8ERP-HR-TM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-TM.msi");  
ExFn_AbsoluteDeleteMsi("{F29D733D-C755-4F8D-85B1-1A8478D69A97}");



end;


// 客户端\人力资源\薪资管理 is installing.


export prototype HRXZClient_Installing();
function HRXZClient_Installing()
begin
ExFn_SetReg("WA", "薪资管理");


ExFn_ComponentInstall("U8ERP-HR-WA.msi","{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");


FeatureSpendCost(0,25817024);
end;


// 客户端\人力资源\薪资管理 is uninstalling.


export prototype HRXZClient_UnInstalling();
function HRXZClient_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-WA.msi","{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");


//控制进度条,已经取消 FeatureSpendUninstallCost(6302,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\薪资管理 is installed.


export prototype HRXZClient_Installed();
function HRXZClient_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-WA.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WA.msi");
end;


// 客户端\人力资源\薪资管理 is uninstalled.


export prototype HRXZClient_UnInstalled();
function HRXZClient_UnInstalled()
begin
ExFn_DelReg("WA");


ExFn_RemoveConfigFile("U8ERP-HR-WA.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-WA.msi"); 
ExFn_AbsoluteDeleteMsi("{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");



end;


// 客户端\人力资源\计件工资 is installing.


export prototype GZ_Installing();
function GZ_Installing()
begin
ExFn_SetReg("PR", "工资系统");


ExFn_ComponentInstall("U8ERP-HR-PR.msi","{096E3A78-5313-4FC5-8B3C-63E8EA599362}");


FeatureSpendCost(0,5627904);
end;


// 客户端\人力资源\计件工资 is uninstalling.


export prototype GZ_UnInstalling();
function GZ_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-PR.msi","{096E3A78-5313-4FC5-8B3C-63E8EA599362}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1374,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\人力资源\计件工资 is installed.


export prototype GZ_Installed();
function GZ_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-PR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PR.msi");
end;


// 客户端\人力资源\计件工资 is uninstalled.


export prototype GZ_UnInstalled();
function GZ_UnInstalled()
begin
ExFn_DelReg("PR");


ExFn_RemoveConfigFile("U8ERP-HR-PR.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-PR.msi");
ExFn_AbsoluteDeleteMsi("{096E3A78-5313-4FC5-8B3C-63E8EA599362}");



end;


// 客户端\企业应用集成 is installing.


export prototype EAI_Installing();
function EAI_Installing()
begin
ExFn_SetReg("EA", "EAI");


ExFn_ComponentInstall("U8ERP-PUBLIC-EAI.msi","{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
end;


// 客户端\企业应用集成 is uninstalling.


export prototype EAI_UnInstalling();
function EAI_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-EAI.msi","{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
end;


// 客户端\企业应用集成 is installed.


export prototype EAI_Installed();
function EAI_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-EAI.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-EAI.msi");
end;


// 客户端\企业应用集成 is uninstalled.


export prototype EAI_UnInstalled();
function EAI_UnInstalled()
begin
ExFn_DelReg("EA");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-EAI.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-EAI.msi"); 
ExFn_AbsoluteDeleteMsi("{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");



end;




// 客户端\内控审计 is installing.


export prototype AU_Installing();
function AU_Installing()
begin
ExFn_SetReg("AU", "内控审计");


ExFn_ComponentInstall("U8ERP-PUBLIC-AU.msi","{7F1089E1-2A10-4BC5-BD07-53432671B339}");
end;


// 客户端\内控审计 is uninstalling.


export prototype AU_UnInstalling();
function AU_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-AU.msi","{7F1089E1-2A10-4BC5-BD07-53432671B339}");
end;


// 客户端\内控审计 is installed.


export prototype AU_Installed();
function AU_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-AU.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-AU.msi");
end;


// 客户端\内控审计 is uninstalled.


export prototype AU_UnInstalled();
function AU_UnInstalled()
begin
ExFn_DelReg("AU");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-AU.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-AU.msi");  
ExFn_AbsoluteDeleteMsi("{7F1089E1-2A10-4BC5-BD07-53432671B339}");



end;




// 客户端\企业门户 is installing.


export prototype PORTAL_Installing();
function PORTAL_Installing()
begin
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
    ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");
    
    //安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
//ExFn_ComponentInstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentInstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

//panglh 提出安装档案的时候安装HM,HB
//ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");  
    //ExFn_ComponentInstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");  
    
FeatureSpendCost(0,500156416);
end;


// 客户端\企业门户 is uninstalling.


export prototype PORTAL_UnInstalling();
function PORTAL_UnInstalling()
begin   
                                               
    StopPaltframeServices();                                           
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");
//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
//ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
 
 
//ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
//ExFn_ComponentUninstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
//endif;
//控制进度条,已经取消 FeatureSpendUninstallCost(122108,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\企业门户 is installed.


export prototype PORTAL_Installed();
function PORTAL_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");
//安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
    //    ExFn_AddConfigFile("U8ERP-PUBLIC-openapix64.xml");
     //   ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
//else
        ExFn_AddConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
//endif;

      //ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
      //ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
      
 //ExFn_AddConfigFile("U8ERP-HR-HM.xml");
     // ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");

end;


// 客户端\企业门户 is uninstalled.


export prototype PORTAL_UnInstalled();
function PORTAL_UnInstalled()
begin
ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON.msi");  
ExFn_AbsoluteDeleteMsi("{B2D6C198-095C-4A26-9840-98836AF70F23}");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");  
ExFn_AbsoluteDeleteMsi("{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
     //   ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
    //    ExFn_AbsoluteDeleteMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}"); 
//else
        ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
        ExFn_AbsoluteDeleteMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;


//ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
       // ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");
        //ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");
        
       
  // ExFn_RemoveConfigFile("U8ERP-HR-HM.xml");
        //ExFn_RemoveInstalledMsi("U8ERP-HR-HM.msi");
        //ExFn_AbsoluteDeleteMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");

DeletaPaltframeServices();



end;


// 客户端\供应链 is installing.


export prototype SCM_Installing();
function SCM_Installing()
begin
ExFn_ComponentInstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
由于U8M依赖 U8ERP-SCM-KC.msi (条码管理需要添加此包的安装) 
ExFn_ComponentInstall("U8ERP-SCM-KC.msi","{C33E6A1C-4317-4921-B3DC-092ACDB31484}");

end;


// 客户端\供应链 is uninstalling.


export prototype SCM_UnInstalling();
function SCM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
由于U8M依赖 U8ERP-SCM-KC.msi (条码管理需要添加此包的安装) 
ExFn_ComponentUninstall("U8ERP-SCM-KC.msi","{C33E6A1C-4317-4921-B3DC-092ACDB31484}");
end;


// 客户端\供应链 is installed.


export prototype SCM_Installed();
function SCM_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");   
ExFn_AddConfigFile("U8ERP-SCM-KC.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-KC.msi");
end;


// 客户端\供应链 is uninstalled.


export prototype SCM_UnInstalled();
function SCM_UnInstalled()
begin
ExFn_RemoveConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-COMMON.msi");  
ExFn_RemoveConfigFile("U8ERP-SCM-KC.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-KC.msi"); 
 
ExFn_AbsoluteDeleteMsi("{28AFDE6B-54E6-4D5D-8407-26126267722A}"); 
ExFn_AbsoluteDeleteMsi("{C33E6A1C-4317-4921-B3DC-092ACDB31484}");

end;


// 客户端\供应链\GSP质量管理 is installing.


export prototype GSP_Installing();
function GSP_Installing()
begin
ExFn_SetReg("GS", "GSP");


ExFn_ComponentInstall("U8ERP-SCM-GS.msi","{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");


FeatureSpendCost(0,3817472);
end;


// 客户端\供应链\GSP质量管理 is uninstalling.


export prototype GSP_UnInstalling();
function GSP_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-GS.msi","{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");


//控制进度条,已经取消 FeatureSpendUninstallCost(932,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\GSP质量管理 is installed.


export prototype GSP_Installed();
function GSP_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-GS.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-GS.msi");
end;


// 客户端\供应链\GSP质量管理 is uninstalled.


export prototype GSP_UnInstalled();
function GSP_UnInstalled()
begin
ExFn_DelReg("GS");


ExFn_RemoveConfigFile("U8ERP-SCM-GS.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-GS.msi");  
ExFn_AbsoluteDeleteMsi("{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");



end;


// 客户端\供应链\出口管理 is installing.


export prototype CKGLClient_Installing();
function CKGLClient_Installing()
begin
ExFn_SetReg("EX", "出口管理");


ExFn_ComponentInstall("U8ERP-SCM-EX.msi","{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");


FeatureSpendCost(0,17760256);
end;


// 客户端\供应链\出口管理 is uninstalling.


export prototype CKGLClient_UnInstalling();
function CKGLClient_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-EX.msi","{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");


//控制进度条,已经取消 FeatureSpendUninstallCost(4336,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\出口管理 is installed.


export prototype CKGLClient_Installed();
function CKGLClient_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-EX.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EX.msi");
end;


// 客户端\供应链\出口管理 is uninstalled.


export prototype CKGLClient_UnInstalled();
function CKGLClient_UnInstalled()
begin
ExFn_DelReg("EX");


ExFn_RemoveConfigFile("U8ERP-SCM-EX.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EX.msi");
ExFn_AbsoluteDeleteMsi("{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");



end;


// 客户端\供应链\合同管理 is installing.


export prototype HTGL_Installing();
function HTGL_Installing()
begin
ExFn_SetReg("CM", "合同管理");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-CM.msi","{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");


FeatureSpendCost(0,8859648);
end;


// 客户端\供应链\合同管理 is uninstalling.


export prototype HTGL_UnInstalling();
function HTGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-CM.msi","{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");


//控制进度条,已经取消 FeatureSpendUninstallCost(2163,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\合同管理 is installed.


export prototype HTGL_Installed();
function HTGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-CM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CM.msi");
end;


// 客户端\供应链\合同管理 is uninstalled.


export prototype HTGL_UnInstalled();
function HTGL_UnInstalled()
begin
ExFn_DelReg("CM");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CM.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CM.msi"); 
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");



end;


// 客户端\供应链\售前管理 is installing.


export prototype SQ_Installing();
function SQ_Installing()
begin
ExFn_SetReg("PA", "售前管理");


ExFn_ComponentInstall("U8ERP-SCM-PA.msi","{2FF13841-EB92-4A67-849A-872FC4847F4A}");


FeatureSpendCost(0,4182016);
end;


// 客户端\供应链\售前管理 is uninstalling.


export prototype SQ_UnInstalling();
function SQ_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-PA.msi","{2FF13841-EB92-4A67-849A-872FC4847F4A}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1021,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\售前管理 is installed.


export prototype SQ_Installed();
function SQ_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-PA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PA.msi");
end;


// 客户端\供应链\售前管理 is uninstalled.


export prototype SQ_UnInstalled();
function SQ_UnInstalled()
begin
ExFn_DelReg("PA");


ExFn_RemoveConfigFile("U8ERP-SCM-PA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-PA.msi");
ExFn_AbsoluteDeleteMsi("{2FF13841-EB92-4A67-849A-872FC4847F4A}");



end;


// 客户端\供应链\委外管理 is installing.


export prototype WWGL_Installing();
function WWGL_Installing()
begin
ExFn_SetReg("OM", "委外管理");


ExFn_ComponentInstall("U8ERP-SCM-OM.msi","{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
    ExFn_ComponentInstall("U8ERP-SCM-EZ.msi","{125966e5-636a-4a6e-9524-bef9b75b58f6}");
FeatureSpendCost(0,7933952);
end;


// 客户端\供应链\委外管理 is uninstalling.


export prototype WWGL_UnInstalling();
function WWGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-OM.msi","{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
    ExFn_ComponentUninstall("U8ERP-SCM-EZ.msi","{125966e5-636a-4a6e-9524-bef9b75b58f6}");
//控制进度条,已经取消 FeatureSpendUninstallCost(1937,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\委外管理 is installed.


export prototype WWGL_Installed();
function WWGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-OM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-OM.msi"); 
ExFn_AddConfigFile("U8ERP-SCM-EZ.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EZ.msi");
end;


// 客户端\供应链\委外管理 is uninstalled.


export prototype WWGL_UnInstalled();
function WWGL_UnInstalled()
begin
ExFn_DelReg("OM");


ExFn_RemoveConfigFile("U8ERP-SCM-OM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-OM.msi"); 
ExFn_RemoveConfigFile("U8ERP-SCM-EZ.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EZ.msi");  
ExFn_AbsoluteDeleteMsi("{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
ExFn_AbsoluteDeleteMsi("{125966e5-636a-4a6e-9524-bef9b75b58f6}");



end;


// 客户端\供应链\存货核算 is installing.


export prototype CHHS_Installing();
function CHHS_Installing()
begin
ExFn_SetReg("IA", "存货核算");


ExFn_ComponentInstall("U8ERP-SCM-IA.msi","{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");


FeatureSpendCost(0,35201024);
end;


// 客户端\供应链\存货核算 is uninstalling.


export prototype CHHS_UnInstalling();
function CHHS_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-IA.msi","{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");


//控制进度条,已经取消 FeatureSpendUninstallCost(8594,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\存货核算 is installed.


export prototype CHHS_Installed();
function CHHS_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-IA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IA.msi");
end;


// 客户端\供应链\存货核算 is uninstalled.


export prototype CHHS_UnInstalled();
function CHHS_UnInstalled()
begin
ExFn_DelReg("IA");


ExFn_RemoveConfigFile("U8ERP-SCM-IA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-IA.msi"); 
ExFn_AbsoluteDeleteMsi("{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");



end;


// 客户端\供应链\库存管理 is installing.


export prototype KCGL_Installing();
function KCGL_Installing()
begin
ExFn_SetReg("ST", "库存管理");


ExFn_ComponentInstall("U8ERP-SCM-ST.msi","{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
    
    ExFn_ComponentInstall("U8ERP-SCM-JA.msi","{a5ab8f2c-a705-4d26-86a8-a7498a8737de}");
        
FeatureSpendCost(0,27086848);
end;


// 客户端\供应链\库存管理 is uninstalling.


export prototype KCGL_UnInstalling();
function KCGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-ST.msi","{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
    ExFn_ComponentUninstall("U8ERP-SCM-JA.msi","{a5ab8f2c-a705-4d26-86a8-a7498a8737de}");
//控制进度条,已经取消 FeatureSpendUninstallCost(6613,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\库存管理 is installed.


export prototype KCGL_Installed();
function KCGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-ST.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-ST.msi");    
ExFn_AddConfigFile("U8ERP-SCM-JA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-JA.msi"); 
end;


// 客户端\供应链\库存管理 is uninstalled.


export prototype KCGL_UnInstalled();
function KCGL_UnInstalled()
begin
ExFn_DelReg("ST");


ExFn_RemoveConfigFile("U8ERP-SCM-ST.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-ST.msi");    
ExFn_RemoveConfigFile("U8ERP-SCM-JA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-JA.msi");   
ExFn_AbsoluteDeleteMsi("{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
ExFn_AbsoluteDeleteMsi("{a5ab8f2c-a705-4d26-86a8-a7498a8737de}");



end;


// 客户端\供应链\质量管理 is installing.


export prototype QM_Installing();
function QM_Installing()
begin
ExFn_SetReg("QM", "质量管理");


ExFn_ComponentInstall("U8ERP-SCM-QM.msi","{63C31F73-6488-4784-99F2-C9FE2E77222E}");


FeatureSpendCost(0,20156416);
end;


// 客户端\供应链\质量管理 is uninstalling.


export prototype QM_UnInstalling();
function QM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-QM.msi","{63C31F73-6488-4784-99F2-C9FE2E77222E}");


//控制进度条,已经取消 FeatureSpendUninstallCost(4921,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\质量管理 is installed.


export prototype QM_Installed();
function QM_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-QM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-QM.msi");
end;


// 客户端\供应链\质量管理 is uninstalled.


export prototype QM_UnInstalled();
function QM_UnInstalled()
begin
ExFn_DelReg("QM");


ExFn_RemoveConfigFile("U8ERP-SCM-QM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-QM.msi"); 
ExFn_AbsoluteDeleteMsi("{63C31F73-6488-4784-99F2-C9FE2E77222E}");


end;


// 客户端\供应链\进口管理 is installing.


export prototype JKGLClient_Installing();
function JKGLClient_Installing()
begin
ExFn_SetReg("IM", "进口管理");


ExFn_ComponentInstall("U8ERP-SCM-IM.msi","{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");


FeatureSpendCost(0,5931008);
end;


// 客户端\供应链\进口管理 is uninstalling.


export prototype JKGLClient_UnInstalling();
function JKGLClient_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-IM.msi","{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");


//控制进度条,已经取消 FeatureSpendUninstallCost(1448,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\进口管理 is installed.


export prototype JKGLClient_Installed();
function JKGLClient_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-IM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IM.msi");
end;


// 客户端\供应链\进口管理 is uninstalled.


export prototype JKGLClient_UnInstalled();
function JKGLClient_UnInstalled()
begin
ExFn_DelReg("IM");


ExFn_RemoveConfigFile("U8ERP-SCM-IM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-IM.msi");  
ExFn_AbsoluteDeleteMsi("{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");




end;


// 客户端\供应链\采购管理 is installing.


export prototype CGGL_Installing();
function CGGL_Installing()
begin
ExFn_SetReg("PU", "采购管理");           


ExFn_ComponentInstall("U8ERP-SCM-PU.msi","{B7AE865A-791B-4C8A-B813-06BC6E79B116}");

    ExFn_ComponentInstall("U8ERP-SCM-HU.msi","{a3be837c-b5f3-44db-8c3a-afb0433d997f}");
    ExFn_ComponentInstall("U8ERP-SCM-EZ.msi","{125966e5-636a-4a6e-9524-bef9b75b58f6}");
FeatureSpendCost(0,18288640);
end;


// 客户端\供应链\采购管理 is uninstalling.


export prototype CGGL_UnInstalling();
function CGGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-PU.msi","{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
    ExFn_ComponentUninstall("U8ERP-SCM-HU.msi","{a3be837c-b5f3-44db-8c3a-afb0433d997f}");
    ExFn_ComponentUninstall("U8ERP-SCM-EZ.msi","{125966e5-636a-4a6e-9524-bef9b75b58f6}");
    //控制进度条,已经取消 FeatureSpendUninstallCost(4465,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\采购管理 is installed.


export prototype CGGL_Installed();
function CGGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-PU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PU.msi");    
 
ExFn_AddConfigFile("U8ERP-SCM-HU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-HU.msi");
    ExFn_AddConfigFile("U8ERP-SCM-EZ.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EZ.msi"); 


end;


// 客户端\供应链\采购管理 is uninstalled.


export prototype CGGL_UnInstalled();
function CGGL_UnInstalled()
begin
ExFn_DelReg("PU");


ExFn_RemoveConfigFile("U8ERP-SCM-PU.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-PU.msi"); 

ExFn_RemoveConfigFile("U8ERP-SCM-HU.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-HU.msi"); 
ExFn_RemoveConfigFile("U8ERP-SCM-EZ.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EZ.msi");  

ExFn_AbsoluteDeleteMsi("{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
ExFn_AbsoluteDeleteMsi("{a3be837c-b5f3-44db-8c3a-afb0433d997f}");
ExFn_AbsoluteDeleteMsi("{125966e5-636a-4a6e-9524-bef9b75b58f6}");




end;


// 客户端\供应链\销售管理 is installing.


export prototype XSGL_Installing();
function XSGL_Installing()
begin
ExFn_SetReg("SA", "销售管理"); 
//CS 服务管理(与以前的冲突,经确认,以前的废弃不用了)
//ExFn_SetReg("CS", "客户关系管理");


ExFn_ComponentInstall("U8ERP-CRM-CS.msi","{7DED3042-9870-4504-95CB-7E1396A12DD5}");
ExFn_ComponentInstall("U8ERP-SCM-SA.msi","{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");


FeatureSpendCost(0,14942208);
end;


// 客户端\供应链\销售管理 is uninstalling.


export prototype XSGL_UnInstalling();
function XSGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-SA.msi","{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");
ExFn_ComponentUninstall("U8ERP-CRM-CS.msi","{7DED3042-9870-4504-95CB-7E1396A12DD5}");


//控制进度条,已经取消 FeatureSpendUninstallCost(3648,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\销售管理 is installed.


export prototype XSGL_Installed();
function XSGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-SA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SA.msi");
ExFn_AddConfigFile("U8ERP-CRM-CS.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-CS.msi");
end;


// 客户端\供应链\销售管理 is uninstalled.


export prototype XSGL_UnInstalled();
function XSGL_UnInstalled()
begin
ExFn_DelReg("SA");
//ExFn_DelReg("CS");


ExFn_RemoveConfigFile("U8ERP-CRM-CS.xml");
ExFn_RemoveInstalledMsi("U8ERP-CRM-CS.msi");


ExFn_RemoveConfigFile("U8ERP-SCM-SA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-SA.msi");  

ExFn_AbsoluteDeleteMsi("{7DED3042-9870-4504-95CB-7E1396A12DD5}");
ExFn_AbsoluteDeleteMsi("{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");




end;


// 客户端\决策管理\财务分析 is installing.


export prototype ZJPG_Installing();
function ZJPG_Installing()
begin     
   
   /* U8V12.0 需求取消
ExFn_SetReg("SG", "财务分析");


ExFn_ComponentInstall("U8ERP-BPM-SG.msi","{17A6ADEB-7CAC-440A-AC71-122D66E10132}");


FeatureSpendCost(0,19296256);      
*/
end;


// 客户端\决策管理\财务分析 is uninstalling.


export prototype ZJPG_UnInstalling();
function ZJPG_UnInstalling()
begin      
    /* U8V12.0 需求取消
ExFn_ComponentUninstall("U8ERP-BPM-SG.msi","{17A6ADEB-7CAC-440A-AC71-122D66E10132}");


//控制进度条,已经取消 FeatureSpendUninstallCost(4711,FEATURE_OPCOST_UNINSTALL_FILE);    
    */
end;


// 客户端\决策管理\财务分析 is installed.


export prototype ZJPG_Installed();
function ZJPG_Installed()
begin  
    /* U8V12.0 需求取消
ExFn_AddConfigFile("U8ERP-BPM-SG.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-SG.msi");  
    */
end;


// 客户端\决策管理\财务分析 is uninstalled.


export prototype ZJPG_UnInstalled();
function ZJPG_UnInstalled()
begin
    /* U8V12.0 需求取消
ExFn_DelReg("SG");


ExFn_RemoveConfigFile("U8ERP-BPM-SG.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-SG.msi"); 
ExFn_AbsoluteDeleteMsi("{17A6ADEB-7CAC-440A-AC71-122D66E10132}"); 
*/





end;




// 客户端\供应链\售后服务 is installing.


export prototype SR_Installing();
function SR_Installing()
begin
ExFn_SetReg("SR", "售后服务");


ExFn_ComponentInstall("U8ERP-CRM-SR.msi","{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");


FeatureSpendCost(0,1646592);
end;


//客户端\供应链\售后服务 is uninstalling.


export prototype SR_UnInstalling();
function SR_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CRM-SR.msi","{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");


//控制进度条,已经取消 FeatureSpendUninstallCost(402,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\供应链\售后服务 is installed.


export prototype SR_Installed();
function SR_Installed()
begin
ExFn_AddConfigFile("U8ERP-CRM-SR.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-SR.msi");
end;


// 客户端\供应链\售后服务 is uninstalled.


export prototype SR_UnInstalled();
function SR_UnInstalled()
begin
ExFn_DelReg("SR");


ExFn_RemoveConfigFile("U8ERP-CRM-SR.xml");
ExFn_RemoveInstalledMsi("U8ERP-CRM-SR.msi");   
ExFn_AbsoluteDeleteMsi("{B7F76D73-44F5-4A16-8490-4D0F56E397BD}"); 




end;


// 客户端\生产制造\工序委外 is installing.


export prototype HY_Installing();
function HY_Installing()
begin
ExFn_SetReg("HY", "工序委外");


ExFn_ComponentInstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_ComponentInstall("U8ERP-SCM-HY.msi","{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");
end;


// 客户端\生产制造\工序委外 is uninstalling.


export prototype HY_UnInstalling();
function HY_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_ComponentUninstall("U8ERP-SCM-HY.msi","{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");
end;


// 客户端\生产制造\工序委外 is installed.


export prototype HY_Installed();
function HY_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-SCM-HY.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-HY.msi");
end;


// 客户端\生产制造\工序委外 is uninstalled.


export prototype HY_UnInstalled();
function HY_UnInstalled()
begin
ExFn_DelReg("HY");


ExFn_RemoveConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-HY.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-HY.msi"); 

ExFn_AbsoluteDeleteMsi("{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_AbsoluteDeleteMsi("{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");




end;


// 客户端\生产制造\生产制造 is installing.


export prototype U8MClient_Installing();
function U8MClient_Installing()
begin
ExFn_SetReg("MQ", "需求规划");
ExFn_SetReg("MP", "主生产计划");
ExFn_SetReg("MO", "生产订单");
ExFn_SetReg("FC", "车间管理");
ExFn_SetReg("EC", "工程变更");
ExFn_SetReg("CP", "产能管理");
ExFn_SetReg("BO", "物料清单");


ExFn_ComponentInstall("U8ERP-U8M-COMMON.msi","{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
ExFn_ComponentInstall("U8ERP-U8M-PFFC.msi","{0101FF2B-33BE-451A-A7D1-7754DF2D4457}"); 
//ExFn_ComponentInstall("U8ERP-U8M-PFBMCX.msi","{036aeaaa-e767-4592-bcd1-52d9c47b4324}");
//ExFn_ComponentInstall("U8ERP-U8M-PFCJPG.msi","{FAA2082D-06E5-4CC2-9BD1-75D34CC1A52B}");
    ExFn_ComponentInstall("U8ERP-SCM-EZ.msi","{125966e5-636a-4a6e-9524-bef9b75b58f6}");  
    //由于U8M依赖 U8ERP-SCM-KC.msi (条码管理需要添加此包的安装)
    ExFn_ComponentInstall("U8ERP-SCM-KC.msi","{C33E6A1C-4317-4921-B3DC-092ACDB31484}");
    // no modify cost
FeatureSpendCost(0,30515200);
end;


// 客户端\生产制造\生产制造 is uninstalling.


export prototype U8MClient_UnInstalling();
function U8MClient_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-U8M-COMMON.msi","{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
ExFn_ComponentUninstall("U8ERP-U8M-PFFC.msi","{0101FF2B-33BE-451A-A7D1-7754DF2D4457}");
//ExFn_ComponentUninstall("U8ERP-U8M-PFBMCX.msi","{036aeaaa-e767-4592-bcd1-52d9c47b4324}");  
//ExFn_ComponentUninstall("U8ERP-U8M-PFCJPG.msi","{FAA2082D-06E5-4CC2-9BD1-75D34CC1A52B}");
ExFn_ComponentUninstall("U8ERP-SCM-EZ.msi","{125966e5-636a-4a6e-9524-bef9b75b58f6}");  
//由于U8M依赖 U8ERP-SCM-KC.msi (条码管理需要添加此包的安装)
    ExFn_ComponentUninstall("U8ERP-SCM-KC.msi","{C33E6A1C-4317-4921-B3DC-092ACDB31484}");
//控制进度条,已经取消 FeatureSpendUninstallCost(7450,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\生产制造\生产制造 is installed.


export prototype U8MClient_Installed();
function U8MClient_Installed()
begin
ExFn_AddConfigFile("U8ERP-U8M-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-PFFC.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-PFFC.msi");  
//ExFn_AddConfigFile("U8ERP-U8M-PFBMCX.xml");
//ExFn_AddInstalledMsi("U8ERP-U8M-PFBMCX.msi");   
//ExFn_AddConfigFile("U8ERP-U8M-PFCJPG.xml");
//ExFn_AddInstalledMsi("U8ERP-U8M-PFCJPG.msi"); 
ExFn_AddConfigFile("U8ERP-SCM-EZ.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EZ.msi");  
//由于U8M依赖 U8ERP-SCM-KC.msi (条码管理需要添加此包的安装)
ExFn_AddConfigFile("U8ERP-SCM-KC.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-KC.msi");  
end;


// 客户端\生产制造\生产制造 is uninstalled.


export prototype U8MClient_UnInstalled();
function U8MClient_UnInstalled()
begin
ExFn_DelReg("MQ");
ExFn_DelReg("MP");
ExFn_DelReg("MO");
ExFn_DelReg("FC");
ExFn_DelReg("EC");
ExFn_DelReg("CP");
ExFn_DelReg("BO");


ExFn_RemoveConfigFile("U8ERP-U8M-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-U8M-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-U8M-PFFC.xml");
ExFn_RemoveInstalledMsi("U8ERP-U8M-PFFC.msi");  
//ExFn_RemoveConfigFile("U8ERP-U8M-PFBMCX.xml");
//ExFn_RemoveInstalledMsi("U8ERP-U8M-PFBMCX.msi"); 
//ExFn_RemoveConfigFile("U8ERP-U8M-PFCJPG.xml");
//ExFn_RemoveInstalledMsi("U8ERP-U8M-PFCJPG.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-EZ.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EZ.msi");  
//由于U8M依赖 U8ERP-SCM-KC.msi (条码管理需要添加此包的安装)
ExFn_RemoveConfigFile("U8ERP-SCM-KC.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-KC.msi");  

ExFn_AbsoluteDeleteMsi("{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
ExFn_AbsoluteDeleteMsi("{0101FF2B-33BE-451A-A7D1-7754DF2D4457}");
//ExFn_AbsoluteDeleteMsi("{036aeaaa-e767-4592-bcd1-52d9c47b4324}");
//ExFn_AbsoluteDeleteMsi("{FAA2082D-06E5-4CC2-9BD1-75D34CC1A52B}");
ExFn_AbsoluteDeleteMsi("{125966e5-636a-4a6e-9524-bef9b75b58f6}");
ExFn_AbsoluteDeleteMsi("{C33E6A1C-4317-4921-B3DC-092ACDB31484}");




end;


// 客户端\生产制造\设备管理 is installing.


export prototype EQ_Installing();
function EQ_Installing()
begin
ExFn_SetReg("EQ", "设备管理");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-U8M-EQ.msi","{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");


FeatureSpendCost(0,25817024);
end;


// 客户端\生产制造\设备管理 is uninstalling.


export prototype EQ_UnInstalling();
function EQ_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-U8M-EQ.msi","{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");


//控制进度条,已经取消 FeatureSpendUninstallCost(6302,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\生产制造\设备管理 is installed.


export prototype EQ_Installed();
function EQ_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-EQ.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-EQ.msi");
end;


// 客户端\生产制造\设备管理 is uninstalled.


export prototype EQ_UnInstalled();
function EQ_UnInstalled()
begin
ExFn_DelReg("EQ");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-U8M-EQ.xml");
ExFn_RemoveInstalledMsi("U8ERP-U8M-EQ.msi");  

ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");




end;


// 客户端\管理会计\成本管理 is installing.


export prototype CB_Installing();
function CB_Installing()
begin
ExFn_SetReg("CA", "成本管理");
ExFn_SetReg("ED", "标准成本");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-CA.msi","{21B42064-DDA6-4231-A31E-5E3732D1744D}");
ExFn_ComponentInstall("U8ERP-CW-CASC.msi","{582E19C0-23C4-44A7-8772-F0C623297C16}");


FeatureSpendCost(0,15896576);
end;


// 客户端\管理会计\成本管理 is uninstalling.


export prototype CB_UnInstalling();
function CB_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-CA.msi","{21B42064-DDA6-4231-A31E-5E3732D1744D}");
    ExFn_ComponentUninstall("U8ERP-CW-CASC.msi","{582E19C0-23C4-44A7-8772-F0C623297C16}");
//控制进度条,已经取消 FeatureSpendUninstallCost(3881,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\管理会计\成本管理 is installed.


export prototype CB_Installed();
function CB_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-CA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CA.msi");
ExFn_AddConfigFile("U8ERP-CW-CASC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CASC.msi");
end;


// 客户端\管理会计\成本管理 is uninstalled.


export prototype CB_UnInstalled();
function CB_UnInstalled()
begin
ExFn_DelReg("CA");
ExFn_DelReg("ED");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CA.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CA.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CASC.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CASC.msi");   
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{21B42064-DDA6-4231-A31E-5E3732D1744D}");
ExFn_AbsoluteDeleteMsi("{582E19C0-23C4-44A7-8772-F0C623297C16}");




end;


// 客户端\管理会计\资金管理 is installing.


export prototype ZJGL_Installing();
function ZJGL_Installing()
begin
ExFn_SetReg("FM", "资金管理");
  ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-FM.msi","{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");


FeatureSpendCost(0,11530240);
end;


// 客户端\管理会计\资金管理 is uninstalling.


export prototype ZJGL_UnInstalling();
function ZJGL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-FM.msi","{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");


//控制进度条,已经取消 FeatureSpendUninstallCost(2815,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\管理会计\资金管理 is installed.


export prototype ZJGL_Installed();
function ZJGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-FM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FM.msi");
end;


// 客户端\管理会计\资金管理 is uninstalled.


export prototype ZJGL_UnInstalled();
function ZJGL_UnInstalled()
begin
ExFn_DelReg("FM");
    ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-FM.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FM.msi"); 
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");




end;


// 客户端\管理会计\项目管理 is installing.


export prototype PM_Installing();
function PM_Installing()
begin
ExFn_SetReg("PM", "项目管理");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-PM.msi","{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");


FeatureSpendCost(0,12251136);
end;


// 客户端\管理会计\项目管理 is uninstalling.


export prototype PM_UnInstalling();
function PM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-PM.msi","{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");


//控制进度条,已经取消 FeatureSpendUninstallCost(2991,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\管理会计\项目管理 is installed.


export prototype PM_Installed();
function PM_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-PM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PM.msi");
end;


// 客户端\管理会计\项目管理 is uninstalled.


export prototype PM_UnInstalled();
function PM_UnInstalled()
begin
ExFn_DelReg("PM");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-PM.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-PM.msi");  

ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");




end;


// 客户端\财务会计 is installing.


export prototype Accountant_Installing();
function Accountant_Installing()
begin
ExFn_SetReg("CW", "财务会计");
ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
end;


// 客户端\财务会计 is uninstalling.


export prototype Accountant_UnInstalling();
function Accountant_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
end;


// 客户端\财务会计 is installed.


export prototype Accountant_Installed();
function Accountant_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
end;


// 客户端\财务会计 is uninstalled.


export prototype Accountant_UnInstalled();
function Accountant_UnInstalled()
begin
ExFn_DelReg("CW");
ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");  
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");




end;


// 客户端\财务会计\UFO报表 is installing.


export prototype UFO_Installing();
function UFO_Installing()
begin
ExFn_SetReg("MR", "UFO");


ExFn_ComponentInstall("U8ERP-CW-MR.msi","{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");


FeatureSpendCost(0,63860736);
end;


// 客户端\财务会计\UFO报表 is uninstalling.


export prototype UFO_UnInstalling();
function UFO_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-MR.msi","{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");


//控制进度条,已经取消 FeatureSpendUninstallCost(15591,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\财务会计\UFO报表 is installed.


export prototype UFO_Installed();
function UFO_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-MR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-MR.msi");
end;


// 客户端\财务会计\UFO报表 is uninstalled.


export prototype UFO_UnInstalled();
function UFO_UnInstalled()
begin
ExFn_DelReg("MR");


ExFn_RemoveConfigFile("U8ERP-CW-MR.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-MR.msi"); 
ExFn_AbsoluteDeleteMsi("{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");




end;






// 客户端\财务会计\出纳管理 is installing.


export prototype SC_Installing();
function SC_Installing()
begin
ExFn_SetReg("SC", "出纳管理");


ExFn_ComponentInstall("U8ERP-CW-SC.msi","{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");
end;


// 客户端\财务会计\出纳管理 is uninstalling.


export prototype SC_UnInstalling();
function SC_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-SC.msi","{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");
end;


// 客户端\财务会计\出纳管理 is installed.


export prototype SC_Installed();
function SC_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-SC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-SC.msi");
end;


// 客户端\财务会计\出纳管理 is uninstalled.


export prototype SC_UnInstalled();
function SC_UnInstalled()
begin
ExFn_DelReg("SC");


ExFn_RemoveConfigFile("U8ERP-CW-SC.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-SC.msi");    
ExFn_AbsoluteDeleteMsi("{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");




end;




//费用管理
// 客户端\财务会计\费用管理 is installing.


export prototype FB_Installing();
function FB_Installing()
begin
ExFn_SetReg("FB", "费用管理");


ExFn_ComponentInstall("U8ERP-CW-FB.msi","{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
end;


// 客户端\财务会计\费用管理 is uninstalling.


export prototype FB_UnInstalling();
function FB_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-FB.msi","{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
end;


// 客户端\财务会计\费用管理 is installed.


export prototype FB_Installed();
function FB_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-FB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FB.msi");
end;


// 客户端\财务会计\费用管理 is uninstalled.


export prototype FB_UnInstalled();
function FB_UnInstalled()
begin
ExFn_DelReg("FB");


ExFn_RemoveConfigFile("U8ERP-CW-FB.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FB.msi");    
ExFn_AbsoluteDeleteMsi("{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
end;








//发票管理  U8V13.0 lixm要求添加
// 客户端\财务会计\发票管理 is installing.


export prototype TI_Installing();
function TI_Installing()
begin
ExFn_SetReg("TI", "发票管理");


end;


// 客户端\财务会计\发票管理 is uninstalling.


export prototype TI_UnInstalling();
function TI_UnInstalling()
begin

end;


// 客户端\财务会计\发票管理 is installed.


export prototype TI_Installed();
function TI_Installed()
begin

end;


// 客户端\财务会计\发票管理 is uninstalled.


export prototype TI_UnInstalled();
function TI_UnInstalled()
begin
ExFn_DelReg("TI");


end;






//利润考核 U8V13.0 lixm要求添加
// 客户端\财务会计\利润考核 is installing.


export prototype PE_Installing();
function PE_Installing()
begin
ExFn_SetReg("PE", "利润考核");


end;


// 客户端\财务会计\利润考核 is uninstalling.


export prototype PE_UnInstalling();
function PE_UnInstalling()
begin

end;


// 客户端\财务会计\利润考核 is installed.


export prototype PE_Installed();
function PE_Installed()
begin

end;


// 客户端\财务会计\利润考核 is uninstalled.


export prototype PE_UnInstalled();
function PE_UnInstalled()
begin
ExFn_DelReg("PE");


end;










// 客户端\财务会计\固定资产 is installing.


export prototype GDZC_Installing();
function GDZC_Installing()
begin
ExFn_SetReg("FA", "固定资产系统");


ExFn_ComponentInstall("U8ERP-CW-FA.msi","{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");


FeatureSpendCost(0,9506816);
end;


// 客户端\财务会计\固定资产 is uninstalling.


export prototype GDZC_UnInstalling();
function GDZC_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-FA.msi","{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");


//控制进度条,已经取消 FeatureSpendUninstallCost(2321,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\财务会计\固定资产 is installed.


export prototype GDZC_Installed();
function GDZC_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-FA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FA.msi");
end;


// 客户端\财务会计\固定资产 is uninstalled.


export prototype GDZC_UnInstalled();
function GDZC_UnInstalled()
begin
ExFn_DelReg("FA");


ExFn_RemoveConfigFile("U8ERP-CW-FA.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FA.msi"); 
ExFn_AbsoluteDeleteMsi("{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");




end;


// 客户端\财务会计\应付款管理 is installing.


export prototype YFK_Installing();
function YFK_Installing()
begin
ExFn_SetReg("AP", "应付款管理");


ExFn_ComponentInstall("U8ERP-CW-AP.msi","{D1B612FA-71C3-4707-9E4B-D387306CB195}");
end;


// 客户端\财务会计\应付款管理 is uninstalling.


export prototype YFK_UnInstalling();
function YFK_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-AP.msi","{D1B612FA-71C3-4707-9E4B-D387306CB195}");
end;


// 客户端\财务会计\应付款管理 is installed.


export prototype YFK_Installed();
function YFK_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-AP.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AP.msi");
end;


// 客户端\财务会计\应付款管理 is uninstalled.


export prototype YFK_UnInstalled();
function YFK_UnInstalled()
begin
ExFn_DelReg("AP");


ExFn_RemoveConfigFile("U8ERP-CW-AP.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-AP.msi");
ExFn_AbsoluteDeleteMsi("{D1B612FA-71C3-4707-9E4B-D387306CB195}");




end;


// 客户端\财务会计\应收款管理 is installing.


export prototype YSK_Installing();
function YSK_Installing()
begin
ExFn_SetReg("AR", "应收款管理");


ExFn_ComponentInstall("U8ERP-CW-AR.msi","{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");


FeatureSpendCost(0,29724672);
end;


// 客户端\财务会计\应收款管理 is uninstalling.


export prototype YSK_UnInstalling();
function YSK_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-AR.msi","{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");


//控制进度条,已经取消 FeatureSpendUninstallCost(7257,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\财务会计\应收款管理 is installed.


export prototype YSK_Installed();
function YSK_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-AR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AR.msi");
end;


// 客户端\财务会计\应收款管理 is uninstalled.


export prototype YSK_UnInstalled();
function YSK_UnInstalled()
begin
ExFn_DelReg("AR");


ExFn_RemoveConfigFile("U8ERP-CW-AR.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-AR.msi");  
ExFn_AbsoluteDeleteMsi("{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");




end;


// 客户端\财务会计\总账 is installing.


export prototype ZW_Installing();
function ZW_Installing()
begin
ExFn_SetReg("GL", "总账系统");


ExFn_ComponentInstall("U8ERP-CW-GL.msi","{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");


FeatureSpendCost(0,93495296);
end;


// 客户端\财务会计\总账 is uninstalling.


export prototype ZW_UnInstalling();
function ZW_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-GL.msi","{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");


//控制进度条,已经取消 FeatureSpendUninstallCost(22826,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\财务会计\总账 is installed.


export prototype ZW_Installed();
function ZW_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-GL.xml");
ExFn_AddInstalledMsi("U8ERP-CW-GL.msi");
end;


// 客户端\财务会计\总账 is uninstalled.


export prototype ZW_UnInstalled();
function ZW_UnInstalled()
begin
ExFn_DelReg("GL");


ExFn_RemoveConfigFile("U8ERP-CW-GL.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-GL.msi"); 
ExFn_AbsoluteDeleteMsi("{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");




end;




/* U8V12.0 需求取消
// 客户端\财务会计\现金流量表 is installing.


export prototype XJLL_Installing();
function XJLL_Installing()
begin
ExFn_SetReg("FT", "现金流量");
ExFn_ComponentInstall("U8ERP-CW-FT.msi","{56106E75-31E9-4C12-BA0E-6C791FF65418}");
FeatureSpendCost(0,25866240);
end;


// 客户端\财务会计\现金流量表 is uninstalling.


export prototype XJLL_UnInstalling();
function XJLL_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-FT.msi","{56106E75-31E9-4C12-BA0E-6C791FF65418}");


//控制进度条,已经取消 FeatureSpendUninstallCost(6315,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\财务会计\现金流量表 is installed.


export prototype XJLL_Installed();
function XJLL_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-FT.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FT.msi");
end;


// 客户端\财务会计\现金流量表 is uninstalled.


export prototype XJLL_UnInstalled();
function XJLL_UnInstalled()
begin
ExFn_DelReg("FT");


ExFn_RemoveConfigFile("U8ERP-CW-FT.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FT.msi");   
ExFn_AbsoluteDeleteMsi("{56106E75-31E9-4C12-BA0E-6C791FF65418}");
end;
*/






// 客户端\财务会计\网上银行 is installing.


export prototype NB_Installing();
function NB_Installing()
begin
ExFn_SetReg("NB", "网上银行");
ExFn_ComponentInstall("U8ERP-CW-NB.msi","{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
FeatureSpendCost(0,10182656);


ExFn_SetReg("NE", "网上报销");
ExFn_ComponentInstall("U8ERP-CW-NE.msi","{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
FeatureSpendCost(0,20332544);

//U8V13.0添加客户端安装预算的产品 zhangzhy添加
ExFn_SetReg("BM", "预算管理");
ExFn_ComponentInstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentInstall("U8ERP-BPM-BM.msi","{87D8570F-5D85-430A-97F5-1721592B14D5}");
FeatureSpendCost(0,25784320);
end;


// 客户端\财务会计\网上银行 is uninstalling.


export prototype NB_UnInstalling();
function NB_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-NB.msi","{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
ExFn_ComponentUninstall("U8ERP-CW-NE.msi","{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
//控制进度条,已经取消 FeatureSpendUninstallCost(2486,FEATURE_OPCOST_UNINSTALL_FILE);

//U8V13.0添加客户端安装预算的产品
ExFn_ComponentUninstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentUninstall("U8ERP-BPM-BM.msi","{87D8570F-5D85-430A-97F5-1721592B14D5}");
end;


// 客户端\财务会计\网上银行 is installed.


export prototype NB_Installed();
function NB_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-NB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NB.msi");

ExFn_AddConfigFile("U8ERP-CW-NE.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NE.msi");

//U8V13.0添加客户端安装预算的产品
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-BM.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-BM.msi");
end;


// 客户端\财务会计\网上银行 is uninstalled.


export prototype NB_UnInstalled();
function NB_UnInstalled()
begin
ExFn_DelReg("NB");
    ExFn_DelReg("NE");


ExFn_RemoveConfigFile("U8ERP-CW-NB.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-NB.msi");   
ExFn_AbsoluteDeleteMsi("{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");

    ExFn_RemoveConfigFile("U8ERP-CW-NE.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-NE.msi"); 
    ExFn_AbsoluteDeleteMsi("{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
    
    
    //U8V13.0添加客户端安装预算的产品
    ExFn_DelReg("BM");
ExFn_RemoveConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-BM.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-BM.msi"); 
ExFn_AbsoluteDeleteMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_AbsoluteDeleteMsi("{87D8570F-5D85-430A-97F5-1721592B14D5}");

end;


// 客户端\集团应用\结算中心 is installing.


export prototype Balance_Installing();
function Balance_Installing()
begin
ExFn_SetReg("FD", "结算中心");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-BPM-FD.msi","{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");


FeatureSpendCost(0,20946944);
end;


// 客户端\集团应用\结算中心 is uninstalling.


export prototype Balance_UnInstalling();
function Balance_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-BPM-FD.msi","{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");


//控制进度条,已经取消 FeatureSpendUninstallCost(5114,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\集团应用\结算中心 is installed.


export prototype Balance_Installed();
function Balance_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-FD.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-FD.msi");
end;


// 客户端\集团应用\结算中心 is uninstalled.


export prototype Balance_UnInstalled();
function Balance_UnInstalled()
begin
ExFn_DelReg("FD");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-FD.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-FD.msi");  
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");




end;


// 客户端\集团应用\行业(集团)报表 is installing.


export prototype YCBB_Installing();
function YCBB_Installing()
begin   
    
//U8V12.0 需求取消 ExFn_SetReg("RC", "行业报表");
    //U8V12.0 需求取消 ExFn_SetReg("RR", "行业报表");
ExFn_ComponentInstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
//U8V12.0 需求取消 ExFn_ComponentInstall("U8ERP-BPM-RC.msi","{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");

end;


// 客户端\集团应用\行业(集团)报表 is uninstalling.


export prototype YCBB_UnInstalling();
function YCBB_UnInstalling()
begin  


ExFn_ComponentUninstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
//U8V12.0 需求取消 ExFn_ComponentUninstall("U8ERP-BPM-RC.msi","{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");


end;


// 客户端\集团应用\行业(集团)报表 is installed.


export prototype YCBB_Installed();
function YCBB_Installed()
begin  


ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
//U8V12.0 需求取消 ExFn_AddConfigFile("U8ERP-BPM-RC.xml");
//U8V12.0 需求取消 ExFn_AddInstalledMsi("U8ERP-BPM-RC.msi");  


end;


// 客户端\集团应用\行业(集团)报表 is uninstalled.


export prototype YCBB_UnInstalled();
function YCBB_UnInstalled()
begin   
    
//U8V12.0 需求取消 ExFn_DelReg("RC");
    //U8V12.0 需求取消 ExFn_DelReg("RR");
ExFn_RemoveConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-COMMON.msi");
//U8V12.0 需求取消 ExFn_RemoveConfigFile("U8ERP-BPM-RC.xml");
//U8V12.0 需求取消 ExFn_RemoveInstalledMsi("U8ERP-BPM-RC.msi"); 
ExFn_AbsoluteDeleteMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
//U8V12.0 需求取消 ExFn_AbsoluteDeleteMsi("{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");





end;


// 客户端\集团应用\集团财务 is installing.


export prototype JTCW_Installing();
function JTCW_Installing()
begin
ExFn_SetReg("GF", "集团财务");


ExFn_ComponentInstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentInstall("U8ERP-BPM-GF.msi","{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");


FeatureSpendCost(0,17813504);
end;


// 客户端\集团应用\集团财务 is uninstalling.


export prototype JTCW_UnInstalling();
function JTCW_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentUninstall("U8ERP-BPM-GF.msi","{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");


//控制进度条,已经取消 FeatureSpendUninstallCost(4349,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 客户端\集团应用\集团财务 is installed.


export prototype JTCW_Installed();
function JTCW_Installed()
begin
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-GF.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-GF.msi");
end;


// 客户端\集团应用\集团财务 is uninstalled.


export prototype JTCW_UnInstalled();
function JTCW_UnInstalled()
begin
ExFn_DelReg("GF");


ExFn_RemoveConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-GF.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-GF.msi");   
ExFn_AbsoluteDeleteMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_AbsoluteDeleteMsi("{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");




end;


// 服务器\数据服务 is installing.


export prototype XTGL_Installing();
function XTGL_Installing()
begin
ExFn_SetReg("DBServer", "数据服务器");
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");
//安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
//ExFn_ComponentInstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentInstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;


    //panglh 提出安装档案的时候安装HM,HB
    //ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");  
    //ExFn_ComponentInstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");  

ExFn_ComponentInstall("U8ERP-PUBLIC-DB.msi","{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}");
    ExFn_ComponentInstall("U8ERP-PUBLIC-DB2.msi","{E9A2049E-FACF-4709-B81F-DCA7FD0B621E}");
    ExFn_ComponentInstall("U8ERP-CRM-CS.msi","{7DED3042-9870-4504-95CB-7E1396A12DD5}");
FeatureSpendCost(0,430699392);
end;


// 服务器\数据服务 is uninstalling.


export prototype XTGL_UnInstalling();
function XTGL_UnInstalling()
begin 
    StopPaltframeServices();
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
// ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

//ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
//ExFn_ComponentUninstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");

ExFn_ComponentUninstall("U8ERP-PUBLIC-DB.msi","{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}");
    ExFn_ComponentUninstall("U8ERP-PUBLIC-DB2.msi","{E9A2049E-FACF-4709-B81F-DCA7FD0B621E}");
    ExFn_ComponentUninstall("U8ERP-CRM-CS.msi","{7DED3042-9870-4504-95CB-7E1396A12DD5}");
//控制进度条,已经取消 FeatureSpendUninstallCost(105151,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\数据服务 is installed.


export prototype XTGL_Installed();
function XTGL_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");
//安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
    //    ExFn_AddConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
//else
        ExFn_AddConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix86.msi"); 
//endif;

      //ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
      //ExFn_AddInstalledMsi("U8ERP-COMMON-HM.msi");
 //ExFn_AddConfigFile("U8ERP-HR-HM.xml");
      //ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");

ExFn_AddConfigFile("U8ERP-PUBLIC-DB.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-DB.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-DB2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-DB2.msi"); 
ExFn_AddConfigFile("U8ERP-CRM-CS.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-CS.msi");
end;


// 服务器\数据服务 is uninstalled.


export prototype XTGL_UnInstalled();
function XTGL_UnInstalled()
begin
ExFn_DelReg("DBServer");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
    //    ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
     //   ExFn_AbsoluteDeleteMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
        ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
        ExFn_AbsoluteDeleteMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

ExFn_RemoveConfigFile("U8ERP-PUBLIC-DB.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-DB.msi");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-DB2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-DB2.msi");
ExFn_RemoveConfigFile("U8ERP-CRM-CS.xml");
ExFn_RemoveInstalledMsi("U8ERP-CRM-CS.msi");   
ExFn_AbsoluteDeleteMsi("{B2D6C198-095C-4A26-9840-98836AF70F23}");
  
    ExFn_AbsoluteDeleteMsi("{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

ExFn_AbsoluteDeleteMsi("{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}");
ExFn_AbsoluteDeleteMsi("{E9A2049E-FACF-4709-B81F-DCA7FD0B621E}");
ExFn_AbsoluteDeleteMsi("{7DED3042-9870-4504-95CB-7E1396A12DD5}");


    //ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
    //ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");
    //ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");
        
//ExFn_RemoveConfigFile("U8ERP-HR-HM.xml");
    //ExFn_RemoveInstalledMsi("U8ERP-HR-HM.msi");
    //ExFn_AbsoluteDeleteMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");


DeletaPaltframeServices();




end;


// 服务器\WEB应用服务器 is installing.


export prototype WEBServer_Installing();
function WEBServer_Installing()
begin
ExFn_SetReg("WebServer", "WEB应用服务器");
ExFn_SetReg("U8AuditWebSite", "审批流Web");


ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
// ExFn_ComponentInstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentInstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

//panglh 提出安装档案的时候安装HM,HB
//ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}"); 
    //ExFn_ComponentInstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");   
end;


// 服务器\WEB应用服务器 is uninstalling.


export prototype WEBServer_UnInstalling();
function WEBServer_UnInstalling()
begin 
    StopPaltframeServices();
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");
//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
// ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

 
//ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
//ExFn_ComponentUninstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
end;


// 服务器\WEB应用服务器 is installed.


export prototype WEBServer_Installed();
function WEBServer_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");

//安装openapi
//if (SYSINFO.bIsWow64 != 0 ) then
   //     ExFn_AddConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
//else
        ExFn_AddConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
//endif;


 //ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
     // ExFn_AddInstalledMsi("U8ERP-COMMON-HM.msi");
     
 //ExFn_AddConfigFile("U8ERP-HR-HM.xml");
      //ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");
end;


// 服务器\WEB应用服务器 is uninstalled.


export prototype WEBServer_UnInstalled();
function WEBServer_UnInstalled()
begin
ExFn_DelReg("WebServer");
ExFn_DelReg("U8AuditWebSite");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON.msi");  
ExFn_AbsoluteDeleteMsi("{B2D6C198-095C-4A26-9840-98836AF70F23}");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");  
ExFn_AbsoluteDeleteMsi("{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
    //    ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
    //    ExFn_AbsoluteDeleteMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
        ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
        ExFn_AbsoluteDeleteMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;


//ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
        //ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");
        //ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");
        

   //ExFn_RemoveConfigFile("U8ERP-HR-HM.xml");
        //ExFn_RemoveInstalledMsi("U8ERP-HR-HM.msi");
        //ExFn_AbsoluteDeleteMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
       
DeletaPaltframeServices();   





end;




// 服务器\WEB应用服务器\WEB应用 is installing.


export prototype WEB_Installing();
function WEB_Installing()
begin
ExFn_ComponentInstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_ComponentInstall("U8ERP-SCM-SO.msi","{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
ExFn_ComponentInstall("U8ERP-CW-CO.msi","{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");


FeatureSpendCost(0,45912064);
end;


// 服务器\WEB应用服务器\WEB应用 is uninstalling.


export prototype WEB_UnInstalling();
function WEB_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_ComponentUninstall("U8ERP-SCM-SO.msi","{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
ExFn_ComponentUninstall("U8ERP-CW-CO.msi","{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");


//控制进度条,已经取消 FeatureSpendUninstallCost(11209,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\WEB应用 is installed.


export prototype WEB_Installed();
function WEB_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-SCM-SO.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SO.msi");
ExFn_AddConfigFile("U8ERP-CW-CO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CO.msi");
end;


// 服务器\WEB应用服务器\WEB应用 is uninstalled.


export prototype WEB_UnInstalled();
function WEB_UnInstalled()
begin
ExFn_RemoveConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-SO.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-SO.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CO.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CO.msi");  
ExFn_AbsoluteDeleteMsi("{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_AbsoluteDeleteMsi("{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
ExFn_AbsoluteDeleteMsi("{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");




end;


// 服务器\WEB应用服务器\Web门户 is installing.


export prototype U8WebPortal_Installing();
function U8WebPortal_Installing()
begin
ExFn_ComponentInstall("U8ERP-OA-PORTAL.msi","{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}");


FeatureSpendCost(0,130453504);
end;


// 服务器\WEB应用服务器\Web门户 is uninstalling.


export prototype U8WebPortal_UnInstalling();
function U8WebPortal_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-OA-PORTAL.msi","{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}");


//控制进度条,已经取消 FeatureSpendUninstallCost(31849,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\Web门户 is installed.


export prototype U8WebPortal_Installed();
function U8WebPortal_Installed()
begin
ExFn_AddConfigFile("U8ERP-OA-PORTAL.xml");
ExFn_AddInstalledMsi("U8ERP-OA-PORTAL.msi");
end;


// 服务器\WEB应用服务器\Web门户 is uninstalled.


export prototype U8WebPortal_UnInstalled();
function U8WebPortal_UnInstalled()
begin
ExFn_RemoveConfigFile("U8ERP-OA-PORTAL.xml");
ExFn_RemoveInstalledMsi("U8ERP-OA-PORTAL.msi"); 
ExFn_AbsoluteDeleteMsi("{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}");




end;


// 服务器\WEB应用服务器\人力资源 is installing.


export prototype HR_Installing();
function HR_Installing()
begin
ExFn_SetReg("HB", "人力资源");


ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
end;


// 服务器\WEB应用服务器\人力资源 is uninstalling.


export prototype HR_UnInstalling();
function HR_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
end;


// 服务器\WEB应用服务器\人力资源 is installed.


export prototype HR_Installed();
function HR_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
end;


// 服务器\WEB应用服务器\人力资源 is uninstalled.


export prototype HR_UnInstalled();
function HR_UnInstalled()
begin
ExFn_DelReg("HB");


ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");  
ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");




end;


// 服务器\WEB应用服务器\人力资源\员工自助 is installing.


export prototype MQ_Installing();
function MQ_Installing()
begin
ExFn_SetReg("SS", "员工自助");


ExFn_ComponentInstall("U8ERP-HR-SS.msi","{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
end;


// 服务器\WEB应用服务器\人力资源\员工自助 is uninstalling.


export prototype MQ_UnInstalling();
function MQ_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-SS.msi","{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
end;


// 服务器\WEB应用服务器\人力资源\员工自助 is installed.


export prototype MQ_Installed();
function MQ_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-SS.xml");
ExFn_AddInstalledMsi("U8ERP-HR-SS.msi");
end;


// 服务器\WEB应用服务器\人力资源\员工自助 is uninstalled.


export prototype MQ_UnInstalled();
function MQ_UnInstalled()
begin
ExFn_DelReg("SS");


ExFn_RemoveConfigFile("U8ERP-HR-SS.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-SS.msi");
ExFn_AbsoluteDeleteMsi("{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");




end;


// 服务器\WEB应用服务器\人力资源\经理自助 is installing.


export prototype MC_Installing();
function MC_Installing()
begin
ExFn_SetReg("MC", "经理自助");


ExFn_ComponentInstall("U8ERP-HR-MC.msi","{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
end;


// 服务器\WEB应用服务器\人力资源\经理自助 is uninstalling.


export prototype MC_UnInstalling();
function MC_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-MC.msi","{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
end;


// 服务器\WEB应用服务器\人力资源\经理自助 is installed.


export prototype MC_Installed();
function MC_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-MC.xml");
ExFn_AddInstalledMsi("U8ERP-HR-MC.msi");
end;


// 服务器\WEB应用服务器\人力资源\经理自助 is uninstalled.


export prototype MC_UnInstalled();
function MC_UnInstalled()
begin
ExFn_DelReg("MC");


ExFn_RemoveConfigFile("U8ERP-HR-MC.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-MC.msi");  
ExFn_AbsoluteDeleteMsi("{865041D6-C60F-46A3-948F-B6AFEEB1D347}");




end;


// 服务器\WEB应用服务器\人力资源\绩效管理 is installing.


export prototype HRPFServer_Installing();
function HRPFServer_Installing()
begin
ExFn_SetReg("PF", "绩效管理");


ExFn_ComponentInstall("U8ERP-HR-PF.msi","{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
end;


// 服务器\WEB应用服务器\人力资源\绩效管理 is uninstalling.


export prototype HRPFServer_UnInstalling();
function HRPFServer_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-HR-PF.msi","{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
end;


// 服务器\WEB应用服务器\人力资源\绩效管理 is installed.


export prototype HRPFServer_Installed();
function HRPFServer_Installed()
begin
ExFn_AddConfigFile("U8ERP-HR-PF.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PF.msi");
end;


// 服务器\WEB应用服务器\人力资源\绩效管理 is uninstalled.


export prototype HRPFServer_UnInstalled();
function HRPFServer_UnInstalled()
begin
ExFn_DelReg("PF");


ExFn_RemoveConfigFile("U8ERP-HR-PF.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-PF.msi");  
ExFn_AbsoluteDeleteMsi("{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");




end;


// 服务器\WEB应用服务器\合并报表 is installing.


export prototype HBBB_Installing();
function HBBB_Installing()
begin
ExFn_SetReg("HBBBZ", "合并报表(子)");
ExFn_SetReg("CR", "合并报表");


ExFn_ComponentInstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentInstall("U8ERP-BPM-CR.msi","{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");


FeatureSpendCost(0,72675328);
end;


// 服务器\WEB应用服务器\合并报表 is uninstalling.


export prototype HBBB_UnInstalling();
function HBBB_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentUninstall("U8ERP-BPM-CR.msi","{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");


//控制进度条,已经取消 FeatureSpendUninstallCost(17743,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\合并报表 is installed.


export prototype HBBB_Installed();
function HBBB_Installed()
begin
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-CR.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-CR.msi");
end;


// 服务器\WEB应用服务器\合并报表 is uninstalled.


export prototype HBBB_UnInstalled();
function HBBB_UnInstalled()
begin
ExFn_DelReg("HBBBZ");


ExFn_RemoveConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-CR.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-CR.msi");    
ExFn_AbsoluteDeleteMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_AbsoluteDeleteMsi("{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");




end;




/*
// 服务器\WEB应用服务器\报账中心 is installing.


export prototype FORE_Installing();
function FORE_Installing()
begin
ExFn_SetReg("WH", "报账中心");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-WH.msi","{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}");


FeatureSpendCost(0,12967936);
end;


// 服务器\WEB应用服务器\报账中心 is uninstalling.


export prototype FORE_UnInstalling();
function FORE_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-WH.msi","{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}");


//控制进度条,已经取消 FeatureSpendUninstallCost(3166,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\报账中心 is installed.


export prototype FORE_Installed();
function FORE_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-WH.xml");
ExFn_AddInstalledMsi("U8ERP-CW-WH.msi");
end;


// 服务器\WEB应用服务器\报账中心 is uninstalled.


export prototype FORE_UnInstalled();
function FORE_UnInstalled()
begin
ExFn_DelReg("WH");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-WH.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-WH.msi");
end; 
*/


// 服务器\WEB应用服务器\网上报销 is installing.


export prototype U8NE_Installing();
function U8NE_Installing()
begin
ExFn_SetReg("NE", "网上报销");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-NE.msi","{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");


FeatureSpendCost(0,20332544);
end;


// 服务器\WEB应用服务器\网上报销 is uninstalling.


export prototype U8NE_UnInstalling();
function U8NE_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-NE.msi","{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");


//控制进度条,已经取消 FeatureSpendUninstallCost(4964,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\网上报销 is installed.


export prototype U8NE_Installed();
function U8NE_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-NE.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NE.msi");
end;


// 服务器\WEB应用服务器\网上报销 is uninstalled.


export prototype U8NE_UnInstalled();
function U8NE_UnInstalled()
begin
ExFn_DelReg("NE");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-NE.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-NE.msi");  
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
end;


// 服务器\WEB应用服务器\财务管理 is installing.


export prototype FINANCE_Installing();
function FINANCE_Installing()
begin
ExFn_SetReg("WEB", "财务WEB");


ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-CW-PO.msi","{224DF229-95E5-4927-9DBE-D48320D1F05E}");


FeatureSpendCost(0,43732992);
end;


// 服务器\WEB应用服务器\财务管理 is uninstalling.


export prototype FINANCE_UnInstalling();
function FINANCE_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-CW-PO.msi","{224DF229-95E5-4927-9DBE-D48320D1F05E}");


//控制进度条,已经取消 FeatureSpendUninstallCost(10677,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\财务管理 is installed.


export prototype FINANCE_Installed();
function FINANCE_Installed()
begin
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-PO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PO.msi");
end;


// 服务器\WEB应用服务器\财务管理 is uninstalled.


export prototype FINANCE_UnInstalled();
function FINANCE_UnInstalled()
begin
ExFn_DelReg("WEB");


ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-PO.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-PO.msi");
ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_AbsoluteDeleteMsi("{224DF229-95E5-4927-9DBE-D48320D1F05E}");




end;
 
///U8ERP-TruboCrm-U8安装


// 服务器\WEB应用服务器\客户关系管理 is installing.


export prototype CustomRelationManagement_Installing();
function CustomRelationManagement_Installing()
begin
    ExFn_SetReg("TurboCrm", "用友TurboCrm");
    ExFn_SetReg("CS", "服务管理");
    ExFn_SetReg("MK", "营销管理"); 
    ExFn_SetReg("CC", "系统设置"); 
    ExFn_ComponentInstall("U8ERP-TruboCrm-U8.msi","{EF92679D-5761-4F0F-BD64-7EE96749B3D9}");
FeatureSpendCost(0,89436);
end;


// 服务器\WEB应用服务器\客户关系管理 is uninstalling.


export prototype CustomRelationManagement_UnInstalling();
function CustomRelationManagement_UnInstalling()
string svValue;
begin  
    //停止Apache和TurboCRM服务   
    StopServiceU8("TurboCRM70"); 
StopServiceU8("Apache4TurboCRM70");  
UseDLL(ENVCHECK_DLL);   
    if (FindFile (TARGETDIR+"\\turbocrm70\\memcached", "memcached.exe", svValue) = 0) then 
      Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d stop");
      Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d uninstall");
    endif;    
    UnUseDLL(ENVCHECK_DLL);
StopServiceU8("memcached Server");
StopServiceU8("XYNTService");   
    ExFn_ComponentUninstall("U8ERP-TruboCrm-U8.msi","{EF92679D-5761-4F0F-BD64-7EE96749B3D9}");
//控制进度条,已经取消 FeatureSpendUninstallCost(89436,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\客户关系管理 is installed.


export prototype CustomRelationManagement_Installed();
function CustomRelationManagement_Installed()
begin
ExFn_AddConfigFile("U8ERP-TruboCrm-U8.xml");
ExFn_AddInstalledMsi("U8ERP-TruboCrm-U8.msi");
end;


// 服务器\WEB应用服务器\客户关系管理 is uninstalled.


export prototype CustomRelationManagement_UnInstalled();
function CustomRelationManagement_UnInstalled()
begin
ExFn_DelReg("TurboCrm");
ExFn_DelReg("CS");
ExFn_DelReg("CC");
ExFn_DelReg("MK");
ExFn_RemoveConfigFile("U8ERP-TruboCrm-U8.xml");
ExFn_RemoveInstalledMsi("U8ERP-TruboCrm-U8.msi"); 
ExFn_AbsoluteDeleteMsi("{EF92679D-5761-4F0F-BD64-7EE96749B3D9}");
//删除服务。
DeleteServiceU8("TurboCRM70");
DeleteServiceU8("Apache4TurboCRM70");
DeleteServiceU8("XYNTService");  
DeleteServiceU8("memcached Server");




end;


//U8ERP-TruboCrm-U8安装结束


// 服务器\WEB应用服务器\预算管理 is installing.


export prototype BM_Installing();
function BM_Installing()
begin
ExFn_SetReg("BM", "预算管理");


ExFn_ComponentInstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentInstall("U8ERP-BPM-BM.msi","{87D8570F-5D85-430A-97F5-1721592B14D5}");


FeatureSpendCost(0,25784320);
end;


// 服务器\WEB应用服务器\预算管理 is uninstalling.


export prototype BM_UnInstalling();
function BM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentUninstall("U8ERP-BPM-BM.msi","{87D8570F-5D85-430A-97F5-1721592B14D5}");


//控制进度条,已经取消 FeatureSpendUninstallCost(6295,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\WEB应用服务器\预算管理 is installed.


export prototype BM_Installed();
function BM_Installed()
begin
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-BM.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-BM.msi");
end;


// 服务器\WEB应用服务器\预算管理 is uninstalled.


export prototype BM_UnInstalled();
function BM_UnInstalled()
begin
ExFn_DelReg("BM");


ExFn_RemoveConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-BM.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-BM.msi"); 
ExFn_AbsoluteDeleteMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_AbsoluteDeleteMsi("{87D8570F-5D85-430A-97F5-1721592B14D5}");




end;


// 服务器\加密服务器 is installing.


export prototype LicenseServer_Installing();
function LicenseServer_Installing()
begin
ExFn_SetReg("LicenseServer", "加密服务器");
    ExFn_Set870DownReg("ServerReg","YonyouYhtSrv","https://apcenter.yonyoucloud.com");
ExFn_ComponentInstall("U8ERP-PUBLIC-LS.msi","{402D419C-1AC3-42CA-8484-311C0BBBF7CC}");


    //添加PDM的加密服务
    /* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then 
       ExFn_ComponentInstall("U8ERP-PDM-License.msi","{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}");        
    endif; 
    */


FeatureSpendCost(0,8784320);
end;


// 服务器\加密服务器 is uninstalling.


export prototype LicenseServer_UnInstalling();
function LicenseServer_UnInstalling()
begin  
    //停止 UFNet服务 ServerNT.exe
    StopServiceU8("UFNet");
ExFn_ComponentUninstall("U8ERP-PUBLIC-LS.msi","{402D419C-1AC3-42CA-8484-311C0BBBF7CC}");


    //添加PDM的加密服务
    /* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then
      StopServiceU8("UFAllNet");
       ExFn_ComponentUninstall("U8ERP-PDM-License.msi","{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}");        
    endif;  
    */
    
//控制进度条,已经取消 FeatureSpendUninstallCost(2144,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\加密服务器 is installed.


export prototype LicenseServer_Installed();
function LicenseServer_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-LS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-LS.msi");

//添加PDM的加密服务
/* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then
       ExFn_AddConfigFile("U8ERP-PDM-License.xml");
  ExFn_AddInstalledMsi("U8ERP-PDM-License.msi");
    endif;  
    */
end;


// 服务器\加密服务器 is uninstalled.


export prototype LicenseServer_UnInstalled();
function LicenseServer_UnInstalled()
begin
ExFn_DelReg("LicenseServer");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-LS.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-LS.msi"); 
ExFn_AbsoluteDeleteMsi("{402D419C-1AC3-42CA-8484-311C0BBBF7CC}");
//删除服务UFNet  ServerNT.exe
DeleteServiceU8("UFNet");

//添加PDM的加密服务
/* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then
       ExFn_RemoveConfigFile("U8ERP-PDM-License.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PDM-License.msi");
  ExFn_AbsoluteDeleteMsi("{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}");
  //删除服务UFAllNet PDM加密
 // DeleteServiceU8("UFAllNet");
    endif; 
    */


end;


// 服务器\应用服务器 is installing.


export prototype U8AppServer_Installing();
function U8AppServer_Installing()
STRING szCaption,szKey;
begin
ExFn_SetReg("U8AppServer", "U8应用服务器");
ExFn_SetReg("AppServer", "U8应用服务器");
ExFn_SetReg("U8MServer", "U8MServer");
ExFn_SetReg("CRMServer", "CRMServer");
ExFn_SetReg("WF", "WorkFlow"); 
//为了单独安装UTU的时候不安装UTU的公共插件。 
    ExFn_SetReg("UTUCommon", "优途公共部件");   
    ExFn_SetReg("ER", "PDM接口插件");
    
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentInstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//安装openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
// ExFn_ComponentInstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentInstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

ExFn_ComponentInstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentInstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentInstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
ExFn_ComponentInstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_ComponentInstall("U8ERP-U8M-COMMON.msi","{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
ExFn_ComponentInstall("U8ERP-U8M-PFFC.msi","{0101FF2B-33BE-451A-A7D1-7754DF2D4457}");
ExFn_ComponentInstall("U8ERP-BPM-BM.msi","{87D8570F-5D85-430A-97F5-1721592B14D5}");
ExFn_ComponentInstall("U8ERP-BPM-CR.msi","{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");
ExFn_ComponentInstall("U8ERP-BPM-FD.msi","{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");
ExFn_ComponentInstall("U8ERP-BPM-GF.msi","{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");
//U8V12.0需求取消  ExFn_ComponentInstall("U8ERP-BPM-RC.msi","{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");
//U8V12.0需求取消  ExFn_ComponentInstall("U8ERP-BPM-SG.msi","{17A6ADEB-7CAC-440A-AC71-122D66E10132}");
ExFn_ComponentInstall("U8ERP-CRM-CS.msi","{7DED3042-9870-4504-95CB-7E1396A12DD5}");
ExFn_ComponentInstall("U8ERP-CRM-SR.msi","{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");
ExFn_ComponentInstall("U8ERP-CW-AP.msi","{D1B612FA-71C3-4707-9E4B-D387306CB195}");
ExFn_ComponentInstall("U8ERP-CW-AR.msi","{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");
ExFn_ComponentInstall("U8ERP-CW-CA.msi","{21B42064-DDA6-4231-A31E-5E3732D1744D}");
ExFn_ComponentInstall("U8ERP-CW-CASC.msi","{582E19C0-23C4-44A7-8772-F0C623297C16}");
ExFn_ComponentInstall("U8ERP-CW-CM.msi","{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");
ExFn_ComponentInstall("U8ERP-CW-CO.msi","{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");
ExFn_ComponentInstall("U8ERP-CW-FA.msi","{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");
ExFn_ComponentInstall("U8ERP-CW-FM.msi","{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");
//U8V12.0需求取消  ExFn_ComponentInstall("U8ERP-CW-FT.msi","{56106E75-31E9-4C12-BA0E-6C791FF65418}");
ExFn_ComponentInstall("U8ERP-CW-GL.msi","{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");
//U8V12.0需求 添加FB 费用管理
ExFn_ComponentInstall("U8ERP-CW-FB.msi","{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
ExFn_ComponentInstall("U8ERP-CW-MR.msi","{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");
ExFn_ComponentInstall("U8ERP-CW-NB.msi","{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
ExFn_ComponentInstall("U8ERP-CW-NE.msi","{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
ExFn_ComponentInstall("U8ERP-CW-PM.msi","{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");
ExFn_ComponentInstall("U8ERP-CW-PO.msi","{224DF229-95E5-4927-9DBE-D48320D1F05E}");
ExFn_ComponentInstall("U8ERP-CW-SC.msi","{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");
//ExFn_ComponentInstall("U8ERP-CW-WH.msi","{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}");
//ExFn_ComponentInstall("U8ERP-HR-DM.msi","{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}");
ExFn_ComponentInstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
ExFn_ComponentInstall("U8ERP-HR-HT.msi","{7303FF34-69E0-473E-817B-C27728E77073}");
ExFn_ComponentInstall("U8ERP-HR-MC.msi","{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
ExFn_ComponentInstall("U8ERP-HR-PF.msi","{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
ExFn_ComponentInstall("U8ERP-HR-PR.msi","{096E3A78-5313-4FC5-8B3C-63E8EA599362}");
ExFn_ComponentInstall("U8ERP-HR-RT.msi","{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");
ExFn_ComponentInstall("U8ERP-HR-SS.msi","{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
ExFn_ComponentInstall("U8ERP-HR-TM.msi","{F29D733D-C755-4F8D-85B1-1A8478D69A97}");
ExFn_ComponentInstall("U8ERP-HR-TR.msi","{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");
ExFn_ComponentInstall("U8ERP-HR-WA.msi","{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");
ExFn_ComponentInstall("U8ERP-HR-WM.msi","{582E19C0-23C4-44A7-8772-F0C613297C16}");
ExFn_ComponentInstall("U8ERP-PUBLIC-EAI.msi","{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
ExFn_ComponentInstall("U8ERP-PUBLIC-UAP.msi","{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
ExFn_ComponentInstall("U8ERP-SCM-EX.msi","{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");
//ExFn_ComponentInstall("U8ERP-SCM-GS.msi","{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");
ExFn_ComponentInstall("U8ERP-SCM-IA.msi","{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");
ExFn_ComponentInstall("U8ERP-SCM-IM.msi","{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");
ExFn_ComponentInstall("U8ERP-SCM-OM.msi","{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
ExFn_ComponentInstall("U8ERP-SCM-PA.msi","{2FF13841-EB92-4A67-849A-872FC4847F4A}");
ExFn_ComponentInstall("U8ERP-SCM-PU.msi","{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
ExFn_ComponentInstall("U8ERP-SCM-QM.msi","{63C31F73-6488-4784-99F2-C9FE2E77222E}");
ExFn_ComponentInstall("U8ERP-SCM-SA.msi","{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");
ExFn_ComponentInstall("U8ERP-SCM-SO.msi","{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
ExFn_ComponentInstall("U8ERP-SCM-ST.msi","{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
ExFn_ComponentInstall("U8ERP-SCM-HY.msi","{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");
ExFn_ComponentInstall("U8ERP-SCM-HU.msi","{a3be837c-b5f3-44db-8c3a-afb0433d997f}");
ExFn_ComponentInstall("U8ERP-SCM-KC.msi","{c33e6a1c-4317-4921-b3dc-092acdb31484}");
ExFn_ComponentInstall("U8ERP-SCM-EB.msi","{6F15ABFD-F426-43DE-A049-E5FEFC0F91A3}");
//会员管理 GXL
ExFn_ComponentInstall("U8ERP-SCM-VM.msi","{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}");
ExFn_ComponentInstall("U8ERP-U8M-EQ.msi","{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");
ExFn_ComponentInstall("U8ERP-PUBLIC-AU.msi","{7F1089E1-2A10-4BC5-BD07-53432671B339}");
ExFn_ComponentInstall("U8ERP-ECE-UTU.msi","{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}");
//如果ISD自己的包安装了ISD 会写入注册表这个键值。 
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
 ExFn_ComponentInstall("U8ERP-GreenService-ISD.msi","{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}"); 
endif;
ExFn_ComponentInstall("U8ERP-SCM-U8KCSN.msi","{6F26CF69-5612-4276-82B6-09DC5B9F12D0}");   

//U8V13.0去除科迈安装
/*
    if FeatureIsItemSelected(MEDIA,"RAS")=1 then 
        AddRasRegister();
        ExFn_ComponentInstall("U8ERP-PUBLIC-RAS.msi","{1D0AB63F-23CA-4D78-8475-58A78C5D6533}");  
    endif;  
    */
    
    //金万维
    if FeatureIsItemSelected(MEDIA,"JWW")=1 then 
        ExFn_ComponentInstall("U8ERP-PUBLIC-JWW.msi","{1BD21323-FF20-430E-99A9-1294C95F592A}");  
    endif;  
    
    //PDM安装...
    /* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"PDM")=1 then  
       AddPDMRegister();
       ExFn_ComponentInstall("U8ERP-PDM-Server.msi","{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}");
       ExFn_ComponentInstall("U8ERP-PDM-Server2.msi","{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");
  ExFn_ComponentInstall("U8ERP-PDM-FileServer.msi","{D94F0B75-A7B7-404A-8DB2-1C16B997C642}");
  ExFn_ComponentInstall("U8ERP-PDM-ServerForClient.msi","{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}");
    endif;  
    */
    //添加PDM的加密服务
    /* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then 
       ExFn_ComponentInstall("U8ERP-PDM-License.msi","{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}");        
    endif; 
    */
   //PDM接口插件
   ExFn_ComponentInstall("U8ERP-SCM-PDM.msi","{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");    
   
   FeatureSpendCost(0,128215120);
end;


// 服务器\应用服务器 is uninstalling.


export prototype U8AppServer_UnInstalling();
function U8AppServer_UnInstalling()
string u8isdguid,szKey;
begin
    StopPaltframeServices();
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON.msi","{B2D6C198-095C-4A26-9840-98836AF70F23}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-COMMON2.msi","{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
//ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix64.msi","{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
ExFn_ComponentUninstall("U8ERP-PUBLIC-openapix86.msi","{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

ExFn_ComponentUninstall("U8ERP-BPM-COMMON.msi","{F554F819-FDE7-406E-9095-A78CAABA22A6}");
ExFn_ComponentUninstall("U8ERP-CW-COMMON.msi","{29935392-23EB-4FC7-AC8A-308D7101B133}");
ExFn_ComponentUninstall("U8ERP-HR-COMMON.msi","{D057B835-1AB0-4439-945D-F3064030B8F3}");
ExFn_ComponentUninstall("U8ERP-SCM-COMMON.msi","{28AFDE6B-54E6-4D5D-8407-26126267722A}");
ExFn_ComponentUninstall("U8ERP-U8M-COMMON.msi","{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
ExFn_ComponentUninstall("U8ERP-U8M-PFFC.msi","{0101FF2B-33BE-451A-A7D1-7754DF2D4457}");
ExFn_ComponentUninstall("U8ERP-BPM-BM.msi","{87D8570F-5D85-430A-97F5-1721592B14D5}");
ExFn_ComponentUninstall("U8ERP-BPM-CR.msi","{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");
ExFn_ComponentUninstall("U8ERP-BPM-FD.msi","{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");
ExFn_ComponentUninstall("U8ERP-BPM-GF.msi","{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");
//U8V12.0需求取消  ExFn_ComponentUninstall("U8ERP-BPM-RC.msi","{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");
//U8V12.0需求取消  ExFn_ComponentUninstall("U8ERP-BPM-SG.msi","{17A6ADEB-7CAC-440A-AC71-122D66E10132}");
ExFn_ComponentUninstall("U8ERP-CRM-CS.msi","{7DED3042-9870-4504-95CB-7E1396A12DD5}");
ExFn_ComponentUninstall("U8ERP-CRM-SR.msi","{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");
ExFn_ComponentUninstall("U8ERP-CW-AP.msi","{D1B612FA-71C3-4707-9E4B-D387306CB195}");
ExFn_ComponentUninstall("U8ERP-CW-AR.msi","{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");
ExFn_ComponentUninstall("U8ERP-CW-CA.msi","{21B42064-DDA6-4231-A31E-5E3732D1744D}");
ExFn_ComponentUninstall("U8ERP-CW-CASC.msi","{582E19C0-23C4-44A7-8772-F0C623297C16}");
ExFn_ComponentUninstall("U8ERP-CW-CM.msi","{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");
ExFn_ComponentUninstall("U8ERP-CW-CO.msi","{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");
ExFn_ComponentUninstall("U8ERP-CW-FA.msi","{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");
ExFn_ComponentUninstall("U8ERP-CW-FM.msi","{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");
//U8V12.0需求取消  ExFn_ComponentUninstall("U8ERP-CW-FT.msi","{56106E75-31E9-4C12-BA0E-6C791FF65418}");
ExFn_ComponentUninstall("U8ERP-CW-GL.msi","{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");
//U8V12.0需求 添加FB 费用管理
ExFn_ComponentUninstall("U8ERP-CW-FB.msi","{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
ExFn_ComponentUninstall("U8ERP-CW-MR.msi","{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");
ExFn_ComponentUninstall("U8ERP-CW-NB.msi","{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
ExFn_ComponentUninstall("U8ERP-CW-NE.msi","{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
ExFn_ComponentUninstall("U8ERP-CW-PM.msi","{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");
ExFn_ComponentUninstall("U8ERP-CW-PO.msi","{224DF229-95E5-4927-9DBE-D48320D1F05E}");
ExFn_ComponentUninstall("U8ERP-CW-SC.msi","{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");
//ExFn_ComponentUninstall("U8ERP-CW-WH.msi","{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}");
//ExFn_ComponentUninstall("U8ERP-HR-DM.msi","{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}");
ExFn_ComponentUninstall("U8ERP-HR-HM.msi","{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
ExFn_ComponentUninstall("U8ERP-HR-HT.msi","{7303FF34-69E0-473E-817B-C27728E77073}");
ExFn_ComponentUninstall("U8ERP-HR-MC.msi","{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
ExFn_ComponentUninstall("U8ERP-HR-PF.msi","{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
ExFn_ComponentUninstall("U8ERP-HR-PR.msi","{096E3A78-5313-4FC5-8B3C-63E8EA599362}");
ExFn_ComponentUninstall("U8ERP-HR-RT.msi","{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");
ExFn_ComponentUninstall("U8ERP-HR-SS.msi","{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
ExFn_ComponentUninstall("U8ERP-HR-TM.msi","{F29D733D-C755-4F8D-85B1-1A8478D69A97}");
ExFn_ComponentUninstall("U8ERP-HR-TR.msi","{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");
ExFn_ComponentUninstall("U8ERP-HR-WA.msi","{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");
ExFn_ComponentUninstall("U8ERP-HR-WM.msi","{582E19C0-23C4-44A7-8772-F0C613297C16}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-EAI.msi","{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-UAP.msi","{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
ExFn_ComponentUninstall("U8ERP-SCM-EX.msi","{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");
//ExFn_ComponentUninstall("U8ERP-SCM-GS.msi","{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");
ExFn_ComponentUninstall("U8ERP-SCM-IA.msi","{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");
ExFn_ComponentUninstall("U8ERP-SCM-IM.msi","{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");
ExFn_ComponentUninstall("U8ERP-SCM-OM.msi","{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
ExFn_ComponentUninstall("U8ERP-SCM-PA.msi","{2FF13841-EB92-4A67-849A-872FC4847F4A}");
ExFn_ComponentUninstall("U8ERP-SCM-PU.msi","{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
ExFn_ComponentUninstall("U8ERP-SCM-QM.msi","{63C31F73-6488-4784-99F2-C9FE2E77222E}");
ExFn_ComponentUninstall("U8ERP-SCM-SA.msi","{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");
ExFn_ComponentUninstall("U8ERP-SCM-SO.msi","{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
ExFn_ComponentUninstall("U8ERP-SCM-ST.msi","{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
ExFn_ComponentUninstall("U8ERP-SCM-HY.msi","{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}"); 
ExFn_ComponentUninstall("U8ERP-SCM-HU.msi","{a3be837c-b5f3-44db-8c3a-afb0433d997f}");
ExFn_ComponentUninstall("U8ERP-SCM-KC.msi","{c33e6a1c-4317-4921-b3dc-092acdb31484}");
ExFn_ComponentUninstall("U8ERP-SCM-EB.msi","{6F15ABFD-F426-43DE-A049-E5FEFC0F91A3}");

// 会员管理
ExFn_ComponentUninstall("U8ERP-SCM-VM.msi","{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}");

ExFn_ComponentUninstall("U8ERP-U8M-EQ.msi","{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");
ExFn_ComponentUninstall("U8ERP-PUBLIC-AU.msi","{7F1089E1-2A10-4BC5-BD07-53432671B339}");
ExFn_ComponentUninstall("U8ERP-ECE-UTU.msi","{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}"); 
//如果ISD自己的包安装了ISD 会写入注册表这个键值。 
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
 ExFn_ComponentUninstall("U8ERP-GreenService-ISD.msi","{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}"); 
//endif;


//卸载单独安装的ISD包
UseDLL(ENVCHECK_DLL);
          u8isdguid="{1AB35E03-F52A-4EBA-8002-F4FC3FE2788C}";
  RunNoBlock(WINSYSDIR^"msiexec.exe /x "+u8isdguid +" /quiet /qn"); 
UnUseDLL(ENVCHECK_DLL);
//删除注册表
    szKey="SoftWare\\ISD";
    if(RegDBDeleteKey(szKey)<0) then
    endif;



    ExFn_ComponentUninstall("U8ERP-SCM-U8KCSN.msi","{6F26CF69-5612-4276-82B6-09DC5B9F12D0}");  
    
    //U8V13.0去除科迈安装
    /*
    if FeatureIsItemSelected(MEDIA,"RAS")=1 then  
       ExFn_ComponentUninstall("U8ERP-PUBLIC-RAS.msi","{1D0AB63F-23CA-4D78-8475-58A78C5D6533}");  
    endif; 
    */
    
   //金万维
   if FeatureIsItemSelected(MEDIA,"JWW")=1 then  
       ExFn_ComponentUninstall("U8ERP-PUBLIC-JWW.msi","{1BD21323-FF20-430E-99A9-1294C95F592A}");  
    endif;
    
   /* //u8v12.5版本删除PLM 
   if FeatureIsItemSelected(MEDIA,"PDM")=1 then  
  ExFn_ComponentUninstall("U8ERP-PDM-Server.msi","{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}");
  ExFn_ComponentUninstall("U8ERP-PDM-Server2.msi","{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");
  ExFn_ComponentUninstall("U8ERP-PDM-FileServer.msi","{D94F0B75-A7B7-404A-8DB2-1C16B997C642}");
  ExFn_ComponentUninstall("U8ERP-PDM-ServerForClient.msi","{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}");        
    endif; 
    */
    //添加PDM的加密服务
    /* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then
       ExFn_ComponentUninstall("U8ERP-PDM-License.msi","{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}");        
    endif;  
    */
     
   //PDM接口插件
   ExFn_ComponentUninstall("U8ERP-SCM-PDM.msi","{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");
   
   //控制进度条,已经取消 FeatureSpendUninstallCost(31502,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\应用服务器 is installed.


export prototype U8AppServer_Installed();
function U8AppServer_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");


ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");

//安装openapi
//if (SYSINFO.bIsWow64 != 0 ) then
     //   ExFn_AddConfigFile("U8ERP-PUBLIC-openapix64.xml");
     //   ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix64.msi");
//else
        ExFn_AddConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_AddInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
//endif;

ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-PFFC.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-PFFC.msi");
ExFn_AddConfigFile("U8ERP-BPM-BM.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-BM.msi");
ExFn_AddConfigFile("U8ERP-BPM-CR.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-CR.msi");
ExFn_AddConfigFile("U8ERP-BPM-FD.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-FD.msi");
ExFn_AddConfigFile("U8ERP-BPM-GF.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-GF.msi");
/* U8V12.0需求取消 
ExFn_AddConfigFile("U8ERP-BPM-RC.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-RC.msi");
*/
/* U8V12.0需求取消  
ExFn_AddConfigFile("U8ERP-BPM-SG.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-SG.msi");
*/
ExFn_AddConfigFile("U8ERP-CRM-CS.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-CS.msi");
ExFn_AddConfigFile("U8ERP-CRM-SR.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-SR.msi");
ExFn_AddConfigFile("U8ERP-CW-AP.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AP.msi");
ExFn_AddConfigFile("U8ERP-CW-AR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AR.msi");
ExFn_AddConfigFile("U8ERP-CW-CA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CA.msi");
ExFn_AddConfigFile("U8ERP-CW-CASC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CASC.msi");
ExFn_AddConfigFile("U8ERP-CW-CM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CM.msi");
ExFn_AddConfigFile("U8ERP-CW-CO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CO.msi");
ExFn_AddConfigFile("U8ERP-CW-FA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FA.msi");
ExFn_AddConfigFile("U8ERP-CW-FM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FM.msi");
/* U8V12.0需求取消..
ExFn_AddConfigFile("U8ERP-CW-FT.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FT.msi");
*/
ExFn_AddConfigFile("U8ERP-CW-GL.xml");
ExFn_AddInstalledMsi("U8ERP-CW-GL.msi");
    //U8V12.0需求 添加FB 费用管理
ExFn_AddConfigFile("U8ERP-CW-FB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FB.msi");

ExFn_AddConfigFile("U8ERP-CW-MR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-MR.msi");
ExFn_AddConfigFile("U8ERP-CW-NB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NB.msi");
ExFn_AddConfigFile("U8ERP-CW-NE.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NE.msi");
ExFn_AddConfigFile("U8ERP-CW-PM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PM.msi");
ExFn_AddConfigFile("U8ERP-CW-PO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PO.msi");
ExFn_AddConfigFile("U8ERP-CW-SC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-SC.msi");
// ExFn_AddConfigFile("U8ERP-CW-WH.xml");
// ExFn_AddInstalledMsi("U8ERP-CW-WH.msi");
// ExFn_AddConfigFile("U8ERP-HR-DM.xml");
// ExFn_AddInstalledMsi("U8ERP-HR-DM.msi");
ExFn_AddConfigFile("U8ERP-HR-HM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");
ExFn_AddConfigFile("U8ERP-HR-HT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HT.msi");
ExFn_AddConfigFile("U8ERP-HR-MC.xml");
ExFn_AddInstalledMsi("U8ERP-HR-MC.msi");
ExFn_AddConfigFile("U8ERP-HR-PF.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PF.msi");
ExFn_AddConfigFile("U8ERP-HR-PR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PR.msi");
ExFn_AddConfigFile("U8ERP-HR-RT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-RT.msi");
ExFn_AddConfigFile("U8ERP-HR-SS.xml");
ExFn_AddInstalledMsi("U8ERP-HR-SS.msi");
ExFn_AddConfigFile("U8ERP-HR-TM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TM.msi");
ExFn_AddConfigFile("U8ERP-HR-TR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TR.msi");
ExFn_AddConfigFile("U8ERP-HR-WA.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WA.msi");
ExFn_AddConfigFile("U8ERP-HR-WM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WM.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-EAI.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-EAI.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-UAP.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-UAP.msi");
ExFn_AddConfigFile("U8ERP-SCM-EX.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EX.msi");
//ExFn_AddConfigFile("U8ERP-SCM-GS.xml");
//ExFn_AddInstalledMsi("U8ERP-SCM-GS.msi");
ExFn_AddConfigFile("U8ERP-SCM-IA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IA.msi");
ExFn_AddConfigFile("U8ERP-SCM-IM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IM.msi");
ExFn_AddConfigFile("U8ERP-SCM-OM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-OM.msi");
ExFn_AddConfigFile("U8ERP-SCM-PA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PA.msi");
ExFn_AddConfigFile("U8ERP-SCM-PU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PU.msi");
ExFn_AddConfigFile("U8ERP-SCM-QM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-QM.msi");
ExFn_AddConfigFile("U8ERP-SCM-SA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SA.msi");
ExFn_AddConfigFile("U8ERP-SCM-SO.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SO.msi");
ExFn_AddConfigFile("U8ERP-SCM-ST.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-ST.msi");
ExFn_AddConfigFile("U8ERP-SCM-HY.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-HY.msi");
ExFn_AddConfigFile("U8ERP-SCM-HU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-HU.msi");  
ExFn_AddConfigFile("U8ERP-SCM-KC.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-KC.msi");  
ExFn_AddConfigFile("U8ERP-SCM-EB.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EB.msi"); 
 
ExFn_AddConfigFile("U8ERP-SCM-VM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-VM.msi");
 
ExFn_AddConfigFile("U8ERP-U8M-EQ.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-EQ.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-AU.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-AU.msi");  
ExFn_AddConfigFile("U8ERP-ECE-UTU.xml");
ExFn_AddInstalledMsi("U8ERP-ECE-UTU.msi"); 

//如果ISD自己的包安装了ISD 会写入注册表这个键值。 
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then  
 ExFn_AddConfigFile("U8ERP-GreenService-ISD.xml"); 
 ExFn_AddInstalledMsi("U8ERP-GreenService-ISD.msi");  
endif;
 
ExFn_AddConfigFile("U8ERP-SCM-U8KCSN.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-U8KCSN.msi");   

//U8V13.0去除科迈安装
/*
   if FeatureIsItemSelected(MEDIA,"RAS")=1 then   
       ExFn_AddConfigFile("U8ERP-PUBLIC-RAS.xml");
  ExFn_AddInstalledMsi("U8ERP-PUBLIC-RAS.msi");  
   endif;
   */
   //金万维
   if FeatureIsItemSelected(MEDIA,"JWW")=1 then   
       ExFn_AddConfigFile("U8ERP-PUBLIC-JWW.xml");
  ExFn_AddInstalledMsi("U8ERP-PUBLIC-JWW.msi");  
    endif;
   
    
   /* //u8v12.5版本删除PLM 
   if FeatureIsItemSelected(MEDIA,"PDM")=1 then   
       ExFn_AddConfigFile("U8ERP-PDM-Server.xml");
  ExFn_AddInstalledMsi("U8ERP-PDM-Server.msi"); 
       ExFn_AddConfigFile("U8ERP-PDM-Server2.xml");
  ExFn_AddInstalledMsi("U8ERP-PDM-Server2.msi"); 
  ExFn_AddConfigFile("U8ERP-PDM-FileServer.xml");
  ExFn_AddInstalledMsi("U8ERP-PDM-FileServer.msi"); 
  ExFn_AddConfigFile("U8ERP-PDM-ServerForClient.xml");
  ExFn_AddInstalledMsi("U8ERP-PDM-ServerForClient.msi"); 
  AddPDMRegister();
  SetPDMJavaHomeEnvPath();
   endif;   
   */
   //添加PDM的加密服务
   /* //u8v12.5版本删除PLM 
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then
       ExFn_AddConfigFile("U8ERP-PDM-License.xml");
  ExFn_AddInstalledMsi("U8ERP-PDM-License.msi");
    endif;     
    */
    
   //PDM接口插件
   ExFn_AddConfigFile("U8ERP-SCM-PDM.xml");
   ExFn_AddInstalledMsi("U8ERP-SCM-PDM.msi");  
end;


// 服务器\应用服务器 is uninstalled.


export prototype U8AppServer_UnInstalled();
function U8AppServer_UnInstalled()
begin
ExFn_DelReg("U8AppServer");
ExFn_DelReg("AppServer");
ExFn_DelReg("U8MServer");
ExFn_DelReg("CRMServer");
ExFn_DelReg("WF"); 
    ExFn_DelReg("UTUCommon");
    ExFn_DelReg("ER");
    
    
ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON.msi");

ExFn_RemoveConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");

//卸载openapi
//if ( SYSINFO.bIsWow64 != 0 ) then
    //    ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix64.xml");
    //    ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix64.msi"); 
     //   ExFn_AbsoluteDeleteMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//else
        ExFn_RemoveConfigFile("U8ERP-PUBLIC-openapix86.xml");
        ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-openapix86.msi");
        ExFn_AbsoluteDeleteMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
//endif;

ExFn_RemoveConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-CW-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-HR-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-U8M-COMMON.xml");
ExFn_RemoveInstalledMsi("U8ERP-U8M-COMMON.msi");
ExFn_RemoveConfigFile("U8ERP-U8M-PFFC.xml");
ExFn_RemoveInstalledMsi("U8ERP-U8M-PFFC.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-BM.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-BM.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-CR.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-CR.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-FD.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-FD.msi");
ExFn_RemoveConfigFile("U8ERP-BPM-GF.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-GF.msi");
/* U8V12.0需求取消 
ExFn_RemoveConfigFile("U8ERP-BPM-RC.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-RC.msi");
*/
/* U8V12.0需求取消  
ExFn_RemoveConfigFile("U8ERP-BPM-SG.xml");
ExFn_RemoveInstalledMsi("U8ERP-BPM-SG.msi");
*/
ExFn_RemoveConfigFile("U8ERP-CRM-CS.xml");
ExFn_RemoveInstalledMsi("U8ERP-CRM-CS.msi");
ExFn_RemoveConfigFile("U8ERP-CRM-SR.xml");
ExFn_RemoveInstalledMsi("U8ERP-CRM-SR.msi");
ExFn_RemoveConfigFile("U8ERP-CW-AP.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-AP.msi");
ExFn_RemoveConfigFile("U8ERP-CW-AR.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-AR.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CA.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CA.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CASC.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CASC.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CM.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CM.msi");
ExFn_RemoveConfigFile("U8ERP-CW-CO.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-CO.msi");
ExFn_RemoveConfigFile("U8ERP-CW-FA.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FA.msi");
ExFn_RemoveConfigFile("U8ERP-CW-FM.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FM.msi");
/* U8V12.0 需求取消
ExFn_RemoveConfigFile("U8ERP-CW-FT.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FT.msi");
*/
ExFn_RemoveConfigFile("U8ERP-CW-GL.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-GL.msi");
    //U8V12.0需求 添加FB 费用管理
ExFn_RemoveConfigFile("U8ERP-CW-FB.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-FB.msi");

ExFn_RemoveConfigFile("U8ERP-CW-MR.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-MR.msi");
ExFn_RemoveConfigFile("U8ERP-CW-NB.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-NB.msi");
ExFn_RemoveConfigFile("U8ERP-CW-NE.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-NE.msi");
ExFn_RemoveConfigFile("U8ERP-CW-PM.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-PM.msi");
ExFn_RemoveConfigFile("U8ERP-CW-PO.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-PO.msi");
ExFn_RemoveConfigFile("U8ERP-CW-SC.xml");
ExFn_RemoveInstalledMsi("U8ERP-CW-SC.msi");
// ExFn_RemoveConfigFile("U8ERP-CW-WH.xml");
// ExFn_RemoveInstalledMsi("U8ERP-CW-WH.msi");
// ExFn_RemoveConfigFile("U8ERP-HR-DM.xml");
// ExFn_RemoveInstalledMsi("U8ERP-HR-DM.msi");
ExFn_RemoveConfigFile("U8ERP-HR-HM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-HM.msi");
ExFn_RemoveConfigFile("U8ERP-HR-HT.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-HT.msi");
ExFn_RemoveConfigFile("U8ERP-HR-MC.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-MC.msi");
ExFn_RemoveConfigFile("U8ERP-HR-PF.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-PF.msi");
ExFn_RemoveConfigFile("U8ERP-HR-PR.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-PR.msi");
ExFn_RemoveConfigFile("U8ERP-HR-RT.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-RT.msi");
ExFn_RemoveConfigFile("U8ERP-HR-SS.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-SS.msi");
ExFn_RemoveConfigFile("U8ERP-HR-TM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-TM.msi");
ExFn_RemoveConfigFile("U8ERP-HR-TR.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-TR.msi");
ExFn_RemoveConfigFile("U8ERP-HR-WA.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-WA.msi");
ExFn_RemoveConfigFile("U8ERP-HR-WM.xml");
ExFn_RemoveInstalledMsi("U8ERP-HR-WM.msi");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-EAI.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-EAI.msi");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-UAP.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-UAP.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-EX.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EX.msi");
//ExFn_RemoveConfigFile("U8ERP-SCM-GS.xml");
//ExFn_RemoveInstalledMsi("U8ERP-SCM-GS.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-IA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-IA.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-IM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-IM.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-OM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-OM.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-PA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-PA.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-PU.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-PU.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-QM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-QM.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-SA.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-SA.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-SO.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-SO.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-ST.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-ST.msi");
ExFn_RemoveConfigFile("U8ERP-SCM-HY.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-HY.msi"); 
    ExFn_RemoveConfigFile("U8ERP-SCM-HU.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-HU.msi");   
ExFn_RemoveConfigFile("U8ERP-SCM-KC.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-KC.msi");  
ExFn_RemoveConfigFile("U8ERP-SCM-EB.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EB.msi");


ExFn_RemoveConfigFile("U8ERP-SCM-VM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-VM.msi");

ExFn_RemoveConfigFile("U8ERP-U8M-EQ.xml");
ExFn_RemoveInstalledMsi("U8ERP-U8M-EQ.msi"); 
ExFn_RemoveConfigFile("U8ERP-PUBLIC-AU.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-AU.msi");  
ExFn_RemoveConfigFile("U8ERP-ECE-UTU.xml");
ExFn_RemoveInstalledMsi("U8ERP-ECE-UTU.msi"); 

//如果ISD自己的包安装了ISD 会写入注册表这个键值。 
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
 ExFn_RemoveConfigFile("U8ERP-GreenService-ISD.xml");
 ExFn_RemoveInstalledMsi("U8ERP-GreenService-ISD.msi");
//endif;
 
ExFn_RemoveConfigFile("U8ERP-SCM-U8KCSN.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-U8KCSN.msi");

//U8V13.0去除科迈安装
/*
if FeatureIsItemSelected(MEDIA,"RAS")=1 then   
       ExFn_RemoveConfigFile("U8ERP-PUBLIC-RAS.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-RAS.msi");  
  RasDelRASRegister();
    endif;
    */
    
     //金万维
    if FeatureIsItemSelected(MEDIA,"JWW")=1 then   
       ExFn_RemoveConfigFile("U8ERP-PUBLIC-JWW.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-JWW.msi");  
    endif;
    
   /* //u8v12.5版本删除PLM 
   if FeatureIsItemSelected(MEDIA,"PDM")=1 then   
       ExFn_DelReg("PDMProductU8Setup");
       ExFn_RemoveConfigFile("U8ERP-PDM-Server.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PDM-Server.msi");  
       ExFn_RemoveConfigFile("U8ERP-PDM-Server2.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PDM-Server2.msi"); 
  ExFn_RemoveConfigFile("U8ERP-PDM-ServerForClient.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PDM-ServerForClient.msi"); 
  ExFn_RemoveConfigFile("U8ERP-PDM-FileServer.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PDM-FileServer.msi");
  PDMDelPDMRegister(); 
    endif;


     //添加PDM的加密服务
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&g_bSetupPDMSelected=TRUE then
       ExFn_RemoveConfigFile("U8ERP-PDM-License.xml");
  ExFn_RemoveInstalledMsi("U8ERP-PDM-License.msi");
    endif;  
*/
// PDM接口插件
ExFn_RemoveConfigFile("U8ERP-SCM-PDM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-PDM.msi");
   
//彻底删除应用程序安装的MSI包的信息  
ExFn_AbsoluteDeleteAppserverMsi();   

DeletaPaltframeServices(); 
end;


// 服务器文件服务器 is installing.


export prototype FileServer_Installing();
function FileServer_Installing()
begin
ExFn_SetReg("FS", "文件服务器");


ExFn_ComponentInstall("U8ERP-PUBLIC-FS.msi","{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}");


FeatureSpendCost(0,8784320);
end;


// 服务器\文件服务器 is uninstalling.


export prototype FileServer_UnInstalling();
function FileServer_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-FS.msi","{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}");


//控制进度条,已经取消 FeatureSpendUninstallCost(2144,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 服务器\文件服务器 is installed.


export prototype FileServer_Installed();
function FileServer_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-FS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-FS.msi");
end;


// 服务器\文件服务器 is uninstalled.


export prototype FileServer_UnInstalled();
function FileServer_UnInstalled()
begin
ExFn_DelReg("FS");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-FS.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-FS.msi"); 
ExFn_AbsoluteDeleteMsi("{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}");
end;


// 资源\简体中文 is installing.


export prototype CN_Installing();
function CN_Installing()
begin
ExFn_SetReg("zh-cn", "简体中文");


ExFn_ComponentInstall("U8ERP-PUBLIC-CN.msi","{D979201A-A74E-4705-A3A6-45D5B7F096CA}");


FeatureSpendCost(0,53764096);
end;


// 资源\简体中文 is uninstalling.


export prototype CN_UnInstalling();
function CN_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-CN.msi","{D979201A-A74E-4705-A3A6-45D5B7F096CA}");


//控制进度条,已经取消 FeatureSpendUninstallCost(13126,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 资源\简体中文 is installed.


export prototype CN_Installed();
function CN_Installed()
string svma,svnaname;
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-CN.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-CN.msi");
//添加CHY需要生成的TLB 文件.  
svma= TARGETDIR^"U8AuditWebSite\\Bin"; 
svnaname= "UFIDA.U8.MA.Cache.dll";
ExFn_RegasmTlb(svma,svnaname);
svnaname="UFIDA.U8.MA.EditSession.dll"; 
ExFn_RegasmTlb(svma,svnaname); 
svnaname= "UFIDA.U8.MA.SchemaResolve.dll";
ExFn_RegasmTlb(svma,svnaname);

//注册net4.0TLB
ExFn_Regasm40Tlb(TARGETDIR^"ZW\\bin","U8ArchiveManagementService.dll");
end;


// 资源\简体中文 is uninstalled.


export prototype CN_UnInstalled();
function CN_UnInstalled()
begin
ExFn_DelReg("zh-cn");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-CN.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-CN.msi");  
ExFn_AbsoluteDeleteMsi("{D979201A-A74E-4705-A3A6-45D5B7F096CA}");

end;


// 资源\繁体中文 is installing.


export prototype TW_Installing();
function TW_Installing()
begin
ExFn_SetReg("zh-tw", "繁体中文");


ExFn_ComponentInstall("U8ERP-PUBLIC-TW.msi","{B3470B1E-54CC-4DAB-AD77-881A1617037E}");


FeatureSpendCost(0,53796864);
end;


// 资源\繁体中文 is uninstalling.


export prototype TW_UnInstalling();
function TW_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-TW.msi","{B3470B1E-54CC-4DAB-AD77-881A1617037E}");


//控制进度条,已经取消 FeatureSpendUninstallCost(13134,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 资源\繁体中文 is installed.


export prototype TW_Installed();
function TW_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-TW.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-TW.msi"); 

end;


// 资源\繁体中文 is uninstalled.


export prototype TW_UnInstalled();
function TW_UnInstalled()
begin
ExFn_DelReg("zh-tw");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-TW.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-TW.msi");   
ExFn_AbsoluteDeleteMsi("{B3470B1E-54CC-4DAB-AD77-881A1617037E}");



end;


// 资源\英文 is installing.


export prototype US_Installing();
function US_Installing()
begin
ExFn_SetReg("en-us", "英文");


ExFn_ComponentInstall("U8ERP-PUBLIC-US.msi","{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}");


FeatureSpendCost(0,55668736);
end;


// 资源\英文 is uninstalling.


export prototype US_UnInstalling();
function US_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-US.msi","{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}");


//控制进度条,已经取消 FeatureSpendUninstallCost(13591,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 资源\英文 is installed.


export prototype US_Installed();
function US_Installed()
begin   
ExFn_AddConfigFile("U8ERP-PUBLIC-US.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-US.msi"); 

  
end;


// 资源\英文 is uninstalled.


export prototype US_UnInstalled();
function US_UnInstalled()
begin
ExFn_DelReg("en-us");


ExFn_RemoveConfigFile("U8ERP-PUBLIC-US.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-US.msi");  
ExFn_AbsoluteDeleteMsi("{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}");
end;


// 资源\通用 is installing.


export prototype RESCommon_Installing();
function RESCommon_Installing()
begin
ExFn_ComponentInstall("U8ERP-PUBLIC-RES.msi","{0EE3EEAC-D612-4B72-8795-CAE90510878A}");


FeatureSpendCost(0,21286912);
end;


// 资源\通用 is uninstalling.


export prototype RESCommon_UnInstalling();
function RESCommon_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-RES.msi","{0EE3EEAC-D612-4B72-8795-CAE90510878A}");


//控制进度条,已经取消 FeatureSpendUninstallCost(5197,FEATURE_OPCOST_UNINSTALL_FILE);
end;


// 资源\通用 is installed.


export prototype RESCommon_Installed();
function RESCommon_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-RES.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-RES.msi");  
    if(!MAINTENANCE) then
     DeleteAddShortCut();
     // u8v12.5版本删除PLM
     //AddPDMShortCut();
    endif;    
end;


// 资源\通用 is uninstalled.


export prototype RESCommon_UnInstalled();
function RESCommon_UnInstalled()
begin
ExFn_RemoveConfigFile("U8ERP-PUBLIC-RES.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-RES.msi");   
ExFn_AbsoluteDeleteMsi("{0EE3EEAC-D612-4B72-8795-CAE90510878A}");




end;
           


// 实施工具 is installing.


export prototype QSSS_Installing();
function QSSS_Installing()
begin   
    ExFn_SetReg("QI", "实施工具");
ExFn_ComponentInstall("U8ERP-PUBLIC-QSSS.msi","{782E19C0-23C4-44A7-8772-F0C613297C17}");
end;


// 实施工具 is uninstalling.


export prototype QSSS_UnInstalling();
function QSSS_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-PUBLIC-QSSS.msi","{782E19C0-23C4-44A7-8772-F0C613297C17}");
end;


// 实施工具 is installed.


export prototype QSSS_Installed();
function QSSS_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-QSSS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-QSSS.msi");   
//AddOfficeSetupQSSSRegister();
end;


// 实施工具 is uninstalled.


export prototype QSSS_UnInstalled();
function QSSS_UnInstalled()
begin   
    ExFn_DelReg("QI");
    ExFn_OfficeSetupQSSSRegister();
ExFn_RemoveConfigFile("U8ERP-PUBLIC-QSSS.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-QSSS.msi");  
ExFn_AbsoluteDeleteMsi("{782E19C0-23C4-44A7-8772-F0C613297C17}");


end;         




// MERP is installing.


export prototype MERP_Installing();
function MERP_Installing()
begin
    ExFn_SetReg("HW", "移动应用");
ExFn_ComponentInstall("U8ERP-MA-MobileApp.msi","{61af2c59-2d09-47c9-81e4-5e59b9dcdea4}");
end;


// MERP is uninstalling.


export prototype MERP_UnInstalling();
function MERP_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-MA-MobileApp.msi","{61af2c59-2d09-47c9-81e4-5e59b9dcdea4}");


end;


// MERP is installed.


export prototype MERP_Installed();
function MERP_Installed()
begin
ExFn_AddConfigFile("U8ERP-MA-MobileApp.xml");
ExFn_AddInstalledMsi("U8ERP-MA-MobileApp.msi");
end;


// MERP is uninstalled.


export prototype MERP_UnInstalled();
function MERP_UnInstalled()
begin
    //卸载的时候恢复PDM7.6的JDK的环境变量设置..
    //UninstallReSetJavaHomeEnvPath();
    ExFn_DelReg("HW");
ExFn_RemoveConfigFile("U8ERP-MA-MobileApp.xml");
ExFn_RemoveInstalledMsi("U8ERP-MA-MobileApp.msi");
ExFn_AbsoluteDeleteMsi("{61af2c59-2d09-47c9-81e4-5e59b9dcdea4}");
end;


//优途


// 优途 UTU is installing.


export prototype UTU_Installing();
function UTU_Installing()
begin
       ExFn_SetReg("UTU", "优途");  
       ExFn_SetReg("UTUClient", "优途客户端");
  ExFn_ComponentInstall("U8ERP-ECE-UTU.msi","{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}");
end;


// 优途 UTU is uninstalling.


export prototype UTU_UnInstalling();
function UTU_UnInstalling()  
string killprocessname;
begin  
       //停止UTUService
       StopServiceU8("UTUService");
       killprocessname="UFIDA.U8.ECE.UTU.exe";  
       ExFn_TaskKillProcess(killprocessname);
  ExFn_ComponentUninstall("U8ERP-ECE-UTU.msi","{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}");
end;


// 优途 UTU is installed.


export prototype UTU_Installed();
function UTU_Installed()
begin 
 ExFn_AddConfigFile("U8ERP-ECE-UTU.xml");
 ExFn_AddInstalledMsi("U8ERP-ECE-UTU.msi");      
end;


//优途 UTU is uninstalled.


export prototype UTU_UnInstalled();
function UTU_UnInstalled()
begin   


       ExFn_DelReg("UTU"); 
       ExFn_DelReg("UTUClient");
  ExFn_RemoveConfigFile("U8ERP-ECE-UTU.xml");
  ExFn_RemoveInstalledMsi("U8ERP-ECE-UTU.msi");  
  ExFn_AbsoluteDeleteMsi("{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}");
  //删除服务
       DeleteServiceU8("UTUService"); 


end;    




//绿色服务桌面


// 绿色服务桌面 ISD is installing.


export prototype ISD_Installing();
function ISD_Installing()
begin
       //如果ISD自己的包安装了ISD 会写入注册表这个键值。 
  RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then 
    ExFn_SetReg("ISD", "绿色服务桌面");  
         ExFn_SetReg("ISDProductU8Setup", "U8安装的绿色服务桌面");
    ExFn_ComponentInstall("U8ERP-GreenService-ISD.msi","{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}");
  endif;   
end;


// 绿色服务桌面 ISD is uninstalling.


export prototype ISD_UnInstalling();
function ISD_UnInstalling()  
string killprocessname,u8isdguid,szKey;
begin  
       killprocessname="UUDesktop.exe";  
       ExFn_TaskKillProcess(killprocessname);
          
       //如果ISD自己的包安装了ISD 会写入注册表这个键值。 
  RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  //if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
    ExFn_ComponentUninstall("U8ERP-GreenService-ISD.msi","{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}");
  //endif;
  
  //卸载单独安装的ISD包
  UseDLL(ENVCHECK_DLL);
          u8isdguid="{1AB35E03-F52A-4EBA-8002-F4FC3FE2788C}";
  RunNoBlock(WINSYSDIR^"msiexec.exe /x "+u8isdguid +" /quiet /qn"); 
UnUseDLL(ENVCHECK_DLL);
//删除注册表
        szKey="SoftWare\\ISD";
        if(RegDBDeleteKey(szKey)<0) then
        endif;
end;


// 优途 UTU is installed.


export prototype ISD_Installed();
function ISD_Installed()
begin   


       //如果ISD自己的包安装了ISD 会写入注册表这个键值。 
 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
 if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
   ExFn_AddConfigFile("U8ERP-GreenService-ISD.xml");
   ExFn_AddInstalledMsi("U8ERP-GreenService-ISD.msi"); 
 endif;
end;


//优途 UTU is uninstalled.


export prototype ISD_UnInstalled();
function ISD_UnInstalled()
begin      
      //如果ISD自己的包安装了ISD 会写入注册表这个键值。 
  RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  //if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then   
     ExFn_DelReg("ISD"); 
          ExFn_DelReg("ISDProductU8Setup"); 
     ExFn_RemoveConfigFile("U8ERP-GreenService-ISD.xml");
     ExFn_RemoveInstalledMsi("U8ERP-GreenService-ISD.msi"); 
     ExFn_AbsoluteDeleteMsi("{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}"); 
   //endif;
   //isd修改为覆盖安装,所以卸载后还要删除ISD独立安装的GUID  
   RegDBDeleteKey(UNINSTALL_KEY_NAME+"{1AB35E03-F52A-4EBA-8002-F4FC3FE2788C}"); 
   ExFn_AbsoluteDeleteMsi("{1AB35E03-F52A-4EBA-8002-F4FC3FE2788C}"); 
   
end;  


 


//条码管理 KC    用友U8供应链开发部提供


// 条码管理  KC is installing.


export prototype KC_Installing();
function KC_Installing()
begin
    ExFn_SetReg("KC", "条码管理");
ExFn_ComponentInstall("U8ERP-SCM-KC.msi","{c33e6a1c-4317-4921-b3dc-092acdb31484}");
end;


// 条码管理   KC is uninstalling.


export prototype KC_UnInstalling();
function KC_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-KC.msi","{c33e6a1c-4317-4921-b3dc-092acdb31484}");
end;


// 条码管理   KC is installed.


export prototype KC_Installed();
function KC_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-KC.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-KC.msi");
end;


//条码管理   KC is uninstalled.     


export prototype KC_UnInstalled();
function KC_UnInstalled()
begin
    ExFn_DelReg("KC");
ExFn_RemoveConfigFile("U8ERP-SCM-KC.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-KC.msi");  
ExFn_AbsoluteDeleteMsi("{c33e6a1c-4317-4921-b3dc-092acdb31484}");
end;


//START 电子商务模块 GXL      用友U8供应链开发部提供


// 电子商务  EB is installing.


export prototype EB_Installing();
function EB_Installing()
begin
    ExFn_SetReg("EB", "电商订单中心");
ExFn_ComponentInstall("U8ERP-SCM-EB.msi","{6f15abfd-f426-43de-a049-e5fefc0f91a3}");
end;


// 电子商务   EB is uninstalling.


export prototype EB_UnInstalling();
function EB_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-EB.msi","{6f15abfd-f426-43de-a049-e5fefc0f91a3}");
end;


// 电子商务   EB is installed.


export prototype EB_Installed();
function EB_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-EB.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EB.msi");
end;


//电子商务   EB is uninstalled.     


export prototype EB_UnInstalled();
function EB_UnInstalled()
begin
    ExFn_DelReg("EB");
ExFn_RemoveConfigFile("U8ERP-SCM-EB.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-EB.msi");  
ExFn_AbsoluteDeleteMsi("{6f15abfd-f426-43de-a049-e5fefc0f91a3}");
end;


//END 电子商务模块 GXL








//START 会员管理 GXL      用友U8供应链开发部提供


// 会员管理  VM is installing.


export prototype VM_Installing();
function VM_Installing()
begin
    ExFn_SetReg("VM", "会员管理");
ExFn_ComponentInstall("U8ERP-SCM-VM.msi","{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}");
end;


// 会员管理   VM is uninstalling.


export prototype VM_UnInstalling();
function VM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-VM.msi","{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}");
end;


// 会员管理   VM is installed.


export prototype VM_Installed();
function VM_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-VM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-VM.msi");
end;


//会员管理   VM is uninstalled.     


export prototype VM_UnInstalled();
function VM_UnInstalled()
begin
    ExFn_DelReg("VM");
ExFn_RemoveConfigFile("U8ERP-SCM-VM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-VM.msi");  
ExFn_AbsoluteDeleteMsi("{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}");
end;


//END 会员管理模块 GXL






//安全库存模型 BW 用友BI开发部提供


// 安全库存模型 BW is installing.


export prototype BW_Installing();
function BW_Installing()
begin 
    /* U8V12.5版本去除
    ExFn_SetReg("BW", "安全库存模型");
ExFn_ComponentInstall("U8ERP-BI-BW.msi","{D33F1EBC-627D-4EA7-BB0A-95F38967188B}");
*/
end;


// 安全库存模型 BW  is uninstalling.


export prototype BW_UnInstalling();
function BW_UnInstalling()
begin
    /* U8V12.5版本去除
ExFn_ComponentUninstall("U8ERP-BI-BW.msi","{D33F1EBC-627D-4EA7-BB0A-95F38967188B}");
*/
end;


// 安全库存模型 BW  is installed.


export prototype BW_Installed();
function BW_Installed()
begin
    /* U8V12.5版本去除
ExFn_AddConfigFile("U8ERP-BI-BW.xml");
ExFn_AddInstalledMsi("U8ERP-BI-BW.msi");
*/
end;


//安全库存模型 BW  is uninstalled.


export prototype BW_UnInstalled();
function BW_UnInstalled()
begin
    /* U8V12.5版本去除
    ExFn_DelReg("BW");
ExFn_RemoveConfigFile("U8ERP-BI-BW.xml");
ExFn_RemoveInstalledMsi("U8ERP-BI-BW.msi");    
ExFn_AbsoluteDeleteMsi("{D33F1EBC-627D-4EA7-BB0A-95F38967188B}");
*/
end;  




// 移动应用添加


// 移动应用添加   EIS
export prototype EIS_Installing();
function EIS_Installing()
begin
    ExFn_SetReg("EIS", "移动应用服务");
ExFn_ComponentInstall("U8ERP-PUBLIC-EIS.msi","{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}");
end;


// 移动应用添加 EIS  is uninstalling.


export prototype EIS_UnInstalling();
function EIS_UnInstalling()
begin
    StopServiceU8("U8EISService");  
ExFn_ComponentUninstall("U8ERP-PUBLIC-EIS.msi","{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}");
end;


// 移动应用添加 EIS is installed.


export prototype EIS_Installed();
function EIS_Installed()
begin
ExFn_AddConfigFile("U8ERP-PUBLIC-EIS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-EIS.msi");
//SetJavaHomeEnvPath();
//SetMaServerJavaHomeEnvPath();
end;


//移动应用添加 EIS  is uninstalled.


export prototype EIS_UnInstalled();
function EIS_UnInstalled()
begin
    ExFn_DelReg("EIS");
ExFn_RemoveConfigFile("U8ERP-PUBLIC-EIS.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-EIS.msi");    
ExFn_AbsoluteDeleteMsi("{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}");
DeleteServiceU8("U8EISService");



end;       


//  移动应用添加   






//行业部门需要添加
// PDM接口插件   PDM
export prototype PDM_Installing();
function PDM_Installing()
begin
    ExFn_SetReg("ER", "PDM接口插件");
ExFn_ComponentInstall("U8ERP-SCM-PDM.msi","{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");
end;


// PDM接口插件 PDM  is uninstalling.


export prototype PDM_UnInstalling();
function PDM_UnInstalling()
begin
ExFn_ComponentUninstall("U8ERP-SCM-PDM.msi","{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");
end;


// PDM接口插件 PDM  is installed.


export prototype PDM_Installed();
function PDM_Installed()
begin
ExFn_AddConfigFile("U8ERP-SCM-PDM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PDM.msi");
end;


//PDM接口插件 PDM  is uninstalled.


export prototype PDM_UnInstalled();
function PDM_UnInstalled()
begin
    ExFn_DelReg("ER");
ExFn_RemoveConfigFile("U8ERP-SCM-PDM.xml");
ExFn_RemoveInstalledMsi("U8ERP-SCM-PDM.msi");    
ExFn_AbsoluteDeleteMsi("{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");

end;       


// PDM接口插件








//++++++++++++++++++++++++++++++++++++++++++++++++++PDMALLPRODUCT+++++++++++++++++++++++


//pdm全部产品需要添加
// pdm全部产品   PDMALLPRODUCT
export prototype PDMALLPRODUCT_Installing();
function PDMALLPRODUCT_Installing()
STRING szKey,szCaption;
begin
/*  //u8v12.5版本删除PLM 
  if FeatureIsItemSelected(MEDIA,"PDM")=1 then  
AddPDMRegister();
ExFn_ComponentInstall("U8ERP-PDM-Server.msi","{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}");
ExFn_ComponentInstall("U8ERP-PDM-Server2.msi","{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");
ExFn_ComponentInstall("U8ERP-PDM-FileServer.msi","{D94F0B75-A7B7-404A-8DB2-1C16B997C642}");
ExFn_ComponentInstall("U8ERP-PDM-ServerForClient.msi","{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}");
  endif;
 */
end;


// pdm全部产品 PDMALLPRODUCT  is uninstalling.


export prototype PDMALLPRODUCT_UnInstalling();
function PDMALLPRODUCT_UnInstalling()
begin


    //StopServiceU8("UFALLNet");
    //StopServiceU8("yonyouftpserver");
    /* //u8v12.5版本删除PLM 
ExFn_ComponentUninstall("U8ERP-PDM-Server.msi","{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}");
ExFn_ComponentUninstall("U8ERP-PDM-Server2.msi","{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");
ExFn_ComponentUninstall("U8ERP-PDM-FileServer.msi","{D94F0B75-A7B7-404A-8DB2-1C16B997C642}");
ExFn_ComponentUninstall("U8ERP-PDM-ServerForClient.msi","{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}");
*/

  
end;


// pdm全部产品 PDMALLPRODUCT  is installed.


export prototype PDMALLPRODUCT_Installed();
function PDMALLPRODUCT_Installed()
begin
/*  //u8v12.5版本删除PLM 
  if FeatureIsItemSelected(MEDIA,"PDM")=1 then 
ExFn_AddConfigFile("U8ERP-PDM-Server.xml");
ExFn_AddInstalledMsi("U8ERP-PDM-Server.msi");
ExFn_AddConfigFile("U8ERP-PDM-Server2.xml");
ExFn_AddInstalledMsi("U8ERP-PDM-Server2.msi");
ExFn_AddConfigFile("U8ERP-PDM-FileServer.xml");
ExFn_AddInstalledMsi("U8ERP-PDM-FileServer.msi");
    ExFn_AddConfigFile("U8ERP-PDM-ServerForClient.xml");
ExFn_AddInstalledMsi("U8ERP-PDM-ServerForClient.msi");
SetPDMJavaHomeEnvPath();
  endif;
  */
end;


//pdm全部产品 PDMALLPRODUCT  is uninstalled.


export prototype PDMALLPRODUCT_UnInstalled();
function PDMALLPRODUCT_UnInstalled()
begin
/*  //u8v12.5版本删除PLM 
    ExFn_DelReg("PDMProductU8Setup");
    PDMDelPDMRegister();
ExFn_RemoveConfigFile("U8ERP-PDM-Server.xml");
ExFn_RemoveInstalledMsi("U8ERP-PDM-Server.msi");  
 
ExFn_RemoveConfigFile("U8ERP-PDM-Server2.xml");
ExFn_RemoveInstalledMsi("U8ERP-PDM-Server2.msi");  

    ExFn_RemoveConfigFile("U8ERP-PDM-FileServer.xml");
ExFn_RemoveInstalledMsi("U8ERP-PDM-FileServer.msi");    


ExFn_RemoveConfigFile("U8ERP-PDM-ServerForClient.xml");
ExFn_RemoveInstalledMsi("U8ERP-PDM-ServerForClient.msi");    
    
    ExFn_AbsoluteDeleteMsi("{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}");
    ExFn_AbsoluteDeleteMsi("{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");
ExFn_AbsoluteDeleteMsi("{D94F0B75-A7B7-404A-8DB2-1C16B997C642}");
ExFn_AbsoluteDeleteMsi("{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}");

    //DeleteServiceU8("UFALLNet");
    //DeleteServiceU8("yonyouftpserver"); 
*/
end;       


// pdm全部产品




//++++++++++++++++++++++++++++++++++++++++++++++++==+PDMALLPRODUCT++++++++++++++++++++++


//=================================================================================
// 科迈远程接入 RSA is installing.


export prototype RAS_Installing();
function RAS_Installing()
begin  
    //U8V13.0去除科迈安装
    /*
    if FeatureIsItemSelected(MEDIA,"RAS")=1 then  
     AddRasRegister();
     ExFn_SetReg("RAS", "远程接入");
ExFn_ComponentInstall("U8ERP-PUBLIC-RAS.msi","{1D0AB63F-23CA-4D78-8475-58A78C5D6533}"); 
endif;
*/
end;


// 科迈远程接入 RAS  is uninstalling.


export prototype RAS_UnInstalling();
function RAS_UnInstalling()
string svValue;
begin   
   //U8V13.0去除科迈安装
   /*
   //调用科迈自己的卸载,卸载注册表和服务.
   if (FindFile (TARGETDIR^"RasMini", "SetupHelper.exe", svValue) = 0) then
           UseDLL(ENVCHECK_DLL);
   RunWithDirectory(TARGETDIR^"RasMini\\SetupHelper.exe -u",TARGETDIR^"RasMini");
  UnUseDLL(ENVCHECK_DLL);
   endif; 
   //停止远程接入的服务模块
   StopServiceU8("Ras Database Service"); 
   StopServiceU8("RasBasicManage"); 
   StopServiceU8("RasMonitor"); 
   StopServiceU8("RasWebService");
   ExFn_ComponentUninstall("U8ERP-PUBLIC-RAS.msi","{1D0AB63F-23CA-4D78-8475-58A78C5D6533}");
   */
end;


// 科迈远程接入 RAS  is installed.


export prototype RAS_Installed();
function RAS_Installed()
begin 
  //U8V13.0去除科迈安装
  /*
  if FeatureIsItemSelected(MEDIA,"RAS")=1 then 
ExFn_AddConfigFile("U8ERP-PUBLIC-RAS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-RAS.msi");   
  endif;
  */
end;


//科迈远程接入 RAS  is uninstalled.


export prototype RAS_UnInstalled();
function RAS_UnInstalled()
string givedir;
begin 
   //U8V13.0去除科迈安装
   /* 
   if FeatureIsItemSelected(MEDIA,"RAS")=1 then
    ExFn_DelReg("RAS");  
    RasDelRASRegister();
ExFn_RemoveConfigFile("U8ERP-PUBLIC-RAS.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-RAS.msi");    
ExFn_AbsoluteDeleteMsi("{1D0AB63F-23CA-4D78-8475-58A78C5D6533}");   
DeleteServiceU8("Ras Database Service"); 
    DeleteServiceU8("RasBasicManage"); 
    DeleteServiceU8("RasMonitor"); 
    DeleteServiceU8("RasWebService");
   endif;
   
   UseDLL(ENVCHECK_DLL); 
     RunNoBlock("CMD /C taskkill /F /IM RasClntMgr.exe");
   UnUseDLL(ENVCHECK_DLL);
   if(IsSpecialRas())||FeatureIsItemSelected(MEDIA,"RAS")=1 then
    givedir=TARGETDIR^"RasMini";
         ExFn_DELETEDirAndFiles(givedir);
   endif;  
   */
end; 


//======================================================================================






//=================================================================================
// 金万维远程接入 JWW is installing.


export prototype JWW_Installing();
function JWW_Installing()
begin   
     ExFn_SetReg("JWW", "金万维远程接入");
ExFn_ComponentInstall("U8ERP-PUBLIC-JWW.msi","{1BD21323-FF20-430E-99A9-1294C95F592A}"); 
end;


//金万维远程接入 JWW  is uninstalling.


export prototype JWW_UnInstalling();
function JWW_UnInstalling()
string svValue,killprocessname;
begin 
   StopServiceU8("GNWebService"); 
   StopServiceU8("yonyouU8WebService"); 
   StopServiceU8("GNESLServiceHelper"); 
   killprocessname="php-cgi.exe";  
   ExFn_TaskKillProcess(killprocessname);
   ExFn_ComponentUninstall("U8ERP-PUBLIC-JWW.msi","{1BD21323-FF20-430E-99A9-1294C95F592A}"); 
end;


// 金万维远程接入 JWW  is installed.


export prototype JWW_Installed();
function JWW_Installed()
BOOL m_iswebcanuser,m_israsportuser;
string szwebport,szrasport;
begin 
    ExFn_WriteLog("JWW_Installed","START");
    
ExFn_AddConfigFile("U8ERP-PUBLIC-JWW.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-JWW.msi");
    
    
//执行金万维其它的设置命令
    
    
//添加金万维的服务
CreateServiceJWW();

//添加金万维注册表远程接入 
AddJinWanWeiRegister();
    //添加金万维服务第二部分
    AddSecondJinWanWeiRegister();
    //添加金万维服务第三部分    
    AddThirdJinWanWeiRegister();
    //复制金万维驱动文件
    CopyJinWanWeiDriversFiles();
    //导入注册表ODBCFix1.reg 和 ODBCFix2.reg
    ImportRegisterfileJWW();
    
    
    
    //添加金万维对应的快截方式.
    //AddJWWShortCut();
    
    //云盘安装执行
    //JWWAutoCheckDiskMap();
    JWWSetSpecifyURLTrustful();
    
    
    //虚拟打印机安装
    //JWWInstallPrinter();
    //JWWSetDefPrinter();
    
    /*
    //设置端口
    m_iswebcanuser=JWWIsWebPortCanUseCheck(g_KMWebport);
    NumToStr(szwebport,g_KMWebport);
    ExFn_WriteLog("JWWIsWebPortCanUseCheck Port::",szwebport);
    if(m_iswebcanuser==FALSE) then
      ExFn_WriteLog("JWWIsWebPortCanUseCheck","FALSE");
    endif;
    m_israsportuser=JWWIsRDPPortCanUseCheck(g_JWWRemotePort);
    NumToStr(szrasport,g_JWWRemotePort);
    ExFn_WriteLog("JWWIsRDPPortCanUseCheck Port::",szrasport);
    if(m_iswebcanuser==FALSE) then
      ExFn_WriteLog("JWWIsRDPPortCanUseCheck","FALSE");
    endif;
    */
    
    
    //设置金万维注册表
    //GWWGNCopyRegDealWith();
    //根据金万维操作系统设置相关设置
    //SetJWWWindowsSettingByWindowsVersion();
    ExcuteGNESLSetupSetWebPortRdpPort();
    
    
    //添加ADO注册
    //JWWCmdCommandExcute();
    ExFn_WriteLog("JWW_Installed","END");
    
end;


//金万维远程接入 JWW  is uninstalled.


export prototype JWW_UnInstalled();
function JWW_UnInstalled()
string givedir,szKey,killprocessname;
begin  
    ExFn_WriteLog("","JWW_UnInstalled");
    //if FeatureIsItemSelected(MEDIA,"JWW")=1 then
    ExFn_WriteLog("","JWW_UnInstalledSelectJww");
     
ExFn_RemoveConfigFile("U8ERP-PUBLIC-JWW.xml");
ExFn_RemoveInstalledMsi("U8ERP-PUBLIC-JWW.msi");    
ExFn_AbsoluteDeleteMsi("{1BD21323-FF20-430E-99A9-1294C95F592A}");

//卸载U8后执行卸载金万维相关设置
UninstallJWWAfterRemove();
    
end; 


//======================================================================================


acl.rul内容 (权限赋值)

//===========================================================================
//
//  File Name:    acl.rul
//   
// Author:  lilf
//
//  Description: 权限赋值
//
//  Comments:     
//
//===========================================================================


function EnableDirectoryACL(path)  
string  svDir ;
begin             
Run("cacls.exe \"" + path +"\" /E /T /G EveryOne:F");     
end;


function NUMBER ExFn_SetRegPrivilege(regPath,objectType,objectName,operatorMode)
NUMBER nReturn; 
STRING sReturn;
begin   
    UseDLL(ENVCHECK_DLL);
    WriteLog("In","ExFn_SetRegPrivilege");
    
    nReturn = setRegPrivilege(regPath,objectType,objectName,operatorMode);
if nReturn!=0 then
NumToStr(sReturn,nReturn);
WriteLog("Error set RegPrivilege,return value is",sReturn);
endif;
WriteLog("Out","ExFn_SetRegPrivilege");   
UnUseDLL(ENVCHECK_DLL);
return nReturn;
end;
 
function void ExFn_EnableAllDir()
begin
UseDLL(ENVCHECK_DLL);
EnableDirectoryACL(TARGETDIR+"\\AppServer");
EnableDirectoryACL(TARGETDIR+"\\PortalConfig");
EnableDirectoryACL(TARGETDIR+"\\MessageCenter");
EnableDirectoryACL(TARGETDIR+"\\FileManager");
EnableDirectoryACL(TARGETDIR+"\\U8Framework");
EnableDirectoryACL(TARGETDIR+"\\KeyManage");
//add by zjt
EnableDirectoryACL(TARGETDIR+"\\Cache");
EnableDirectoryACL(TARGETDIR+"\\Logs");
EnableDirectoryACL(TARGETDIR+"\\UTU");
EnableDirectoryACL(TARGETDIR+"\\ISD");
//end
EnableDirectoryACL(TARGETDIR+"\\UFMOM\\Logs");
EnableDirectoryACL(TARGETDIR^"UFCOMSQL"); 
EnableDirectoryACL(TARGETDIR^"Portal");
EnableDirectoryACL(TARGETDIR^"U8Portal\\DesktopModules\\HR\\common");    
EnableDirectoryACL(TARGETDIR^"U8Portal\\logs");
EnableDirectoryACL(TARGETDIR^"Resources");
EnableDirectoryACL(m_WinDir+"\\SYSTEM32\\UFCOMSQL");  
EnableDirectoryACL(m_WinDir+"\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files");
EnableDirectoryACL(m_WinDir+"\\Microsoft.NET\\Framework\\v2.0.50727");
EnableDirectoryACL(TARGETDIR^"EAI\\Logs");
EnableDirectoryACL(TARGETDIR^"EAI\\Config");
EnableDirectoryACL(TARGETDIR^"EAI\\QuartzScheduler\\QuartzScheduledTasks.xml");
EnableDirectoryACL(TARGETDIR^"UFMOM\\Logs");
EnableDirectoryACL(TARGETDIR^"UFMOM\\UFMOMCF");
EnableDirectoryACL(TARGETDIR^"Workflow");
EnableDirectoryACL(TARGETDIR^"GDZC");
EnableDirectoryACL(TARGETDIR^"ZW");    
EnableDirectoryACL(TARGETDIR^"UFO");
EnableDirectoryACL(TARGETDIR^"QuickImport");  
EnableDirectoryACL(TARGETDIR^"DBArchiver"); 
EnableDirectoryACL(TARGETDIR^"Deploy\\Data"); 
EnableDirectoryACL(TARGETDIR^"GDP\\U8BM"); 
if (ExistsDir (TARGETDIR^"RasMini") = EXISTS) then 
 EnableDirectoryACL(TARGETDIR^"RasMini");   
    endif;
EnableDirectoryACL(TARGETDIR^"U8SL\\resources\\themes\\images\\default\\Logo");
EnableDirectoryACL(m_WinDir+"\\UfMailBox");
EnableDirectoryACL(m_WinDir+"\\temp"); 
EnableDirectoryACL(m_WinDir+"\\system32\\msword9.ocx");
    
    if (ExistsDir (TARGETDIR^"ImplementNavigation\\icons") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"ImplementNavigation\\icons");
    endif;
    if (ExistsDir (TARGETDIR^"ImplementNavigation\\icons") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"ImplementNavigation\\icons");
    endif;
    
    if (ExistsDir (TARGETDIR^"U8SLDL") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"U8SLDL");
    endif;
    
    if (ExistsDir (TARGETDIR^"U8SL") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"U8SL");
    endif;


    if (ExistsDir (TARGETDIR^"3rdPrograms") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"3rdPrograms");
    endif;    
    
    if (ExistsDir (TARGETDIR^"BusinessNavigation\\icons") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"BusinessNavigation\\icons");
    endif;
    
if ExistsDir(m_WinDir+"\\Microsoft.NET\\Framework\\v1.1.4322")==0 then
EnableDirectoryACL(m_WinDir+"\\Microsoft.NET\\Framework\\v1.1.4322");
endif;


    if (ExistsDir (TARGETDIR^"VoucherDiagram") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"VoucherDiagram");
    endif;

if (ExistsDir (TARGETDIR^"HY\\client\\HY_QP_ER_PDM") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"HY\\client\\HY_QP_ER_PDM");
    endif;
    
    if (ExistsDir (TARGETDIR^"turbocrm70\\storage") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"turbocrm70\\storage");
    endif;
    
    if (ExistsDir (TARGETDIR^"WXQYH") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"WXQYH");
    endif;
    
    if (ExistsDir (TARGETDIR^"EIS") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"EIS");
    endif;


    if (ExistsDir (TARGETDIR^"SmartClient") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR^"SmartClient");
    endif;
    
    if (ExistsDir (m_WinDir+"\\system32\\config\\systemprofile\\Desktop") = EXISTS) then 
       EnableDirectoryACL(m_WinDir+"\\system32\\config\\systemprofile\\Desktop");
    endif;
    
    if (ExistsDir (TARGETDIR+"\\TIService") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR+"\\TIService");
    endif;
    
    if (ExistsDir (TARGETDIR+"\\AppServer\\bin\\OCAPI") = EXISTS) then 
       EnableDirectoryACL(TARGETDIR+"\\AppServer\\bin\\OCAPI");
    endif;
        
   
    //设置temp权限
    EnableDirectoryACL("%temp%");
    
UnUseDLL(ENVCHECK_DLL);


ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\Ufsoft","GROUP","Users","Allow");
end;




backup.rul源码

export prototype Backup_Installing();
function Backup_Installing()
begin
ExFn_WriteLog("","Backup_Installing");   
ExFn_InstallAllBackupMSi();
end;
 
export prototype Backup_Installed();
function Backup_Installed()
begin
ExFn_WriteLog("","Backup_Installed");
end;


export prototype Backup_UnInstalling();
function Backup_UnInstalling()
begin
ExFn_WriteLog("","Backup_UnInstalling"); 
    ExFn_RemoveAllBackupMSi();  
end;
 
export prototype Backup_UnInstalled();
function Backup_UnInstalled()
begin
ExFn_WriteLog("","Backup_UnInstalled");
end;


function void ExFn_InstallAllBackupMSi()
STRING msi(BACKUP_MSICOUNT);
STRING guid(BACKUP_MSICOUNT);
NUMBER i;
STRING svResult;
begin
msi(0) = "U8ERP-User-Define1";
msi(1) = "U8ERP-User-Define2";
msi(2) = "U8ERP-User-Define3";
msi(3) = "U8ERP-User-Define4";
msi(4) = "U8ERP-User-Define5";

msi(5) = "U8ERP-User-Define6";
msi(6) = "U8ERP-User-Define7";
msi(7) = "U8ERP-User-Define8";
msi(8) = "U8ERP-User-Define9";
msi(9) = "U8ERP-User-Define10";  

msi(10) = "U8ERP-User-Define11";
msi(11) = "U8ERP-User-Define12";
msi(12) = "U8ERP-User-Define13";
msi(13) = "U8ERP-User-Define14";
msi(14) = "U8ERP-User-Define15";  

msi(15) = "U8ERP-User-Define16";
msi(16) = "U8ERP-User-Define17";
msi(17) = "U8ERP-User-Define18";
msi(18) = "U8ERP-User-Define19";
msi(19) = "U8ERP-User-Define20";

guid(0) = "{a0000000-0000-0000-0000-000000000001}";
guid(1) = "{a0000000-0000-0000-0000-000000000002}";
guid(2) = "{a0000000-0000-0000-0000-000000000003}";
guid(3) = "{a0000000-0000-0000-0000-000000000004}";
guid(4) = "{a0000000-0000-0000-0000-000000000005}";

guid(5) = "{a0000000-0000-0000-0000-000000000006}";
guid(6) = "{a0000000-0000-0000-0000-000000000007}";
guid(7) = "{a0000000-0000-0000-0000-000000000008}";
guid(8) = "{a0000000-0000-0000-0000-000000000009}";
guid(9) = "{a0000000-0000-0000-0000-00000000000a}";

guid(10) = "{a0000000-0000-0000-0000-00000000000b}";
guid(11) = "{a0000000-0000-0000-0000-00000000000c}";
guid(12) = "{a0000000-0000-0000-0000-00000000000d}";
guid(13) = "{a0000000-0000-0000-0000-00000000000e}";
guid(14) = "{a0000000-0000-0000-0000-00000000000f}";      

guid(15) = "{a0000000-0000-0000-0000-000000000010}";
guid(16) = "{a0000000-0000-0000-0000-000000000011}";
guid(17) = "{a0000000-0000-0000-0000-000000000012}";
guid(18) = "{a0000000-0000-0000-0000-000000000013}";
guid(19) = "{a0000000-0000-0000-0000-000000000014}";

//不显示安装包数
g_bIsShowNoBar = TRUE;
for i=0 to BACKUP_MSICOUNT-1
   if (FindFile(SRCDIR^"MSI\\", msi(i)+".msi", svResult) = 0) then 
    //ExFn_FeatureInstall(svResult);   
    //为了安装SP1补丁时候不执行 DBEnginSys.exe 添加注册表。 
    ExFn_SetReg("ISSP1MODULE", msi(i)+".msi");
    ExFn_SetReg("NoRunDBEnginSys", "DBEnginSys.exe");
    ExFn_ComponentInstall(svResult,guid(i));
    ExFn_DelReg("NoRunDBEnginSys"); 
    ExFn_SetReg(msi(i), "备用");
   endif;
    endfor;
    g_bIsShowNoBar = TRUE;
      
    
end; 




function void ExFn_RemoveAllBackupMSi()
STRING msi(BACKUP_MSICOUNT);
STRING guid(BACKUP_MSICOUNT);
NUMBER i;
begin   
 
    msi(0) = "U8ERP-User-Define1";
msi(1) = "U8ERP-User-Define2";
msi(2) = "U8ERP-User-Define3";
msi(3) = "U8ERP-User-Define4";
msi(4) = "U8ERP-User-Define5";

msi(5) = "U8ERP-User-Define6";
msi(6) = "U8ERP-User-Define7";
msi(7) = "U8ERP-User-Define8";
msi(8) = "U8ERP-User-Define9";
msi(9) = "U8ERP-User-Define10";  

msi(10) = "U8ERP-User-Define11";
msi(11) = "U8ERP-User-Define12";
msi(12) = "U8ERP-User-Define13";
msi(13) = "U8ERP-User-Define14";
msi(14) = "U8ERP-User-Define15";  

msi(15) = "U8ERP-User-Define16";
msi(16) = "U8ERP-User-Define17";
msi(17) = "U8ERP-User-Define18";
msi(18) = "U8ERP-User-Define19";
msi(19) = "U8ERP-User-Define20";

guid(0) = "{a0000000-0000-0000-0000-000000000001}";
guid(1) = "{a0000000-0000-0000-0000-000000000002}";
guid(2) = "{a0000000-0000-0000-0000-000000000003}";
guid(3) = "{a0000000-0000-0000-0000-000000000004}";
guid(4) = "{a0000000-0000-0000-0000-000000000005}";

guid(5) = "{a0000000-0000-0000-0000-000000000006}";
guid(6) = "{a0000000-0000-0000-0000-000000000007}";
guid(7) = "{a0000000-0000-0000-0000-000000000008}";
guid(8) = "{a0000000-0000-0000-0000-000000000009}";
guid(9) = "{a0000000-0000-0000-0000-00000000000a}";

guid(10) = "{a0000000-0000-0000-0000-00000000000b}";
guid(11) = "{a0000000-0000-0000-0000-00000000000c}";
guid(12) = "{a0000000-0000-0000-0000-00000000000d}";
guid(13) = "{a0000000-0000-0000-0000-00000000000e}";
guid(14) = "{a0000000-0000-0000-0000-00000000000f}";      

guid(15) = "{a0000000-0000-0000-0000-000000000010}";
guid(16) = "{a0000000-0000-0000-0000-000000000011}";
guid(17) = "{a0000000-0000-0000-0000-000000000012}";
guid(18) = "{a0000000-0000-0000-0000-000000000013}";
guid(19) = "{a0000000-0000-0000-0000-000000000014}";



RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
ExFn_DelReg("ISSP1MODULE");
//不显示安装包数
g_bIsShowNoBar = TRUE;
for i=0 to BACKUP_MSICOUNT-1
   if RegDBKeyExist("SOFTWARE\\Ufsoft\\WF\\V8.700\\Install\\Installed\\" +msi(i))  = 1 then 
       ExFn_WriteLog("ExFn_RemoveAllBackupMSi :"," exist!");
    ExFn_FeatureUninstall(msi(i)+".msi",guid(i));
   endif;
    endfor;
    g_bIsShowNoBar = TRUE;
    
    
end;


                                  


CheckPort.rul 源码

//===========================================================================
//
//  File Name:    CheckPort.rul
//   
// Author:  lilf
//
//  Description:  显示端口检测对话框
//
//  Comments:     用于指定相应的Web端口和数据服务端口
//
//===========================================================================




function NUMBER ExFn_CheckPort(szTitle) 
    STRING  szDialogName, szWebPort,szDataPort,szWebPortIsOK,szDataPortIsOK,info; 
    string szgetrasport;
    NUMBER  nResult, nCmdValue,nSize,nWebPort,nDataPort,nDataPort2; 
    BOOL    bDone,isWebPortcanuse,isDataPortcanuse; 
    NUMBER szgetfreeeDataPort,nJWWRemotePort; 
    string szpromptport;
    HWND nHwnd;
begin 
    //获取默认的终端服务端口
    //szgetrasport=GetRASServicePort();
    szgetrasport="5366";
    StrToNum(nJWWRemotePort,szgetrasport);
    g_JWWRemotePort=nJWWRemotePort;
    //如果是第一次打开,先检查端口的可用性  
    isDataPortcanuse=FALSE;
    isWebPortcanuse=FALSE;
    szWebPort="81";  
    szDataPort="3309";
    g_KMWebport=81;  
    g_KMDataport=3309;  
    szTitle=@TITLE_MAIN;
    //如果是第一次打开,先检查端口的可用性
    if (gb_FirstShowChkPort = TRUE) then
    gb_FirstShowChkPort = FALSE;
    CtrlSetText(szDialogName,RES_TEXT_WEBPORT,szWebPort);    
CtrlSetText(szDialogName,RES_TEXT_DATAPORT,szgetrasport); 
StrToNum(nDataPort,szDataPort);
//不允许设置为3389端口 和远程接入端口出现冲突
/*
if nDataPort==3389 then
   MessageBox (@ID_RASPortConflict, SEVERE);
  gb_ShowCheckPort = FALSE;
    return NEXT;
endif;
*/
szgetfreeeDataPort=ExFn_IsDataPortCanUseCheck(nJWWRemotePort);
if(szgetfreeeDataPort==nJWWRemotePort)  then 
  isDataPortcanuse=TRUE;   
  g_KMDataport= nDataPort;
endif; 

StrToNum(nWebPort,szWebPort); 
isWebPortcanuse=ExFn_IsWebPortCanUseCheck(nWebPort); 
if(isWebPortcanuse) then
  isWebPortcanuse=TRUE; 
  g_KMWebport=nWebPort;
endif;  

   if (isWebPortcanuse && isDataPortcanuse) then 
    gb_ShowCheckPort = FALSE;
    return NEXT;
   endif;
endif;

szDialogName = "CheckPort"; 
    
    nResult = EzDefineDialog (szDialogName, "", "", RES_DLG_ID_CHKPORT);
    if (nResult < 0) then 
        MessageBox ("An error occurred while defining the dialog CheckPort.", SEVERE); 
        bDone = TRUE; 
        abort; 
    endif; 


   bDone = FALSE; 
   repeat 
        DoStart:
        nCmdValue = WaitOnDialog(szDialogName); 
        switch (nCmdValue) 
            case DLG_CLOSE: 
                Do (EXIT); 
            case IDCANCEL: 
                Do (EXIT);                 
            case DLG_ERR: 
                MessageBox ("Unable to display dialog. Setup canceled.", SEVERE); 
                abort; 
            case DLG_INIT:  
                SetDialogTitle (RES_DLG_ID_CHKPORT,@TITLE_MAIN);
   if (isWebPortcanuse == FALSE) then 
    LoadStringFromStringTable("CHECK_PORT_WEB_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_WEBPORT,info);
   else   
    LoadStringFromStringTable("CHECK_PORT_WEB_VALID", info );
    CtrlSetText(szDialogName,RES_LBL_WEBPORT,info);
   endif;
   if (isDataPortcanuse = FALSE) then   
     if(szgetrasport="3389") then
    LoadStringFromStringTable("CHECK_PORT_DATA_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info);
     else
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,@CHECK_PORT_DATA_First); 
     endif;
   else 
    LoadStringFromStringTable("CHECK_PORT_DATA_VALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info);
   endif;
   CtrlSetText(szDialogName,RES_TEXT_WEBPORT,szWebPort);    
   CtrlSetText(szDialogName,RES_TEXT_DATAPORT,szgetrasport);  
   nHwnd = CmdGetHwndDlg(szDialogName);    
                SdSetDlgTitle(szDialogName,nHwnd,szTitle);
            case RES_PBUT_CANCEL: 
                Do (EXIT); 
            case RES_PBUT_NEXT:
            CtrlGetText(szDialogName,RES_TEXT_WEBPORT,szWebPort);
            if (StrToNum(nWebPort,szWebPort) < 0) then   
            LoadStringFromStringTable("CHECK_PORT_WEB_REENTER", info );
            MessageBox (info, SEVERE);
            goto DoStart;            
            endif;
            CtrlGetText(szDialogName,RES_TEXT_DATAPORT,szDataPort);
            if (StrToNum(nDataPort,szDataPort) < 0) then 
             LoadStringFromStringTable("CHECK_PORT_DATA_REENTER", info );
             MessageBox (info, SEVERE);
             goto DoStart;   
                else
                   //不允许设置为3389端口 和远程接入端口出现冲突
                   /*
          if nDataPort==3389 then
                  MessageBox (@ID_RASPortConflict, SEVERE);
                  goto DoStart;  
                   endif;
                   */
            endif;  
           
            if (nDataPort = nWebPort) then     
            LoadStringFromStringTable("CHECK_PORT_REPEAT", info );
            MessageBox (info, SEVERE);
            goto DoStart;  
            endif;       

CtrlGetText(szDialogName,RES_TEXT_WEBPORT,szWebPort);      
       
       StrToNum(nDataPort,szDataPort);   
       if (StrToNum(nWebPort,szWebPort)=0) then
         isWebPortcanuse=ExFn_IsWebPortCanUseCheck(nWebPort); 
         if(isWebPortcanuse) then
           isWebPortcanuse=TRUE;
           g_KMWebport= nWebPort;
         endif;
       else
         isWebPortcanuse=FALSE;
       endif;
       //取终端服务端口,即是输入的服务端口.   
       CtrlGetText(szDialogName,RES_TEXT_DATAPORT,szgetrasport); 
       if (StrToNum(nJWWRemotePort,szgetrasport)=0) then
           nDataPort2=ExFn_IsDataPortCanUseCheck(nJWWRemotePort);
           if(nJWWRemotePort==nDataPort2)  then 
              isDataPortcanuse=TRUE; 
              g_KMDataport=nDataPort; 
           else
              isDataPortcanuse=TRUE;
             g_KMDataport=nDataPort2;  
           endif; 
       else
        isDataPortcanuse=FALSE;
       endif;
   
   if (isWebPortcanuse == FALSE) then   
    LoadStringFromStringTable("CHECK_PORT_WEB_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_WEBPORT,info);   
    LoadStringFromStringTable("CHECK_PORT_WEB_REENTER", info );
    MessageBox (info, SEVERE);
                else       
                LoadStringFromStringTable("CHECK_PORT_WEB_VALID", info );
                CtrlSetText(szDialogName,RES_LBL_WEBPORT,info);   
   endif;
   
   if (isDataPortcanuse == FALSE) then      
       LoadStringFromStringTable("CHECK_PORT_DATA_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info); 
    LoadStringFromStringTable("CHECK_PORT_DATA_REENTER", info );
    MessageBox (info, SEVERE);
   else    
    LoadStringFromStringTable("CHECK_PORT_DATA_VALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info);
   endif; 
   
            if(isDataPortcanuse && isWebPortcanuse) then //端口满足要求
               添加远程接入科迈的注册表...在防火墙例外加入端口为安装端口
               AddFireWarePortRasRegister(szgetrasport);
    if (nCmdValue = RES_PBUT_NEXT) then
    bDone = TRUE;
    endif;
   endif;
   
case RES_PBUT_CHECKPORT:
   CtrlGetText(szDialogName,RES_TEXT_WEBPORT,szWebPort);
            if (StrToNum(nWebPort,szWebPort) < 0) then   
            LoadStringFromStringTable("CHECK_PORT_WEB_REENTER", info );
            MessageBox (info, SEVERE);
            goto DoStart;            
            endif;
            CtrlGetText(szDialogName,RES_TEXT_DATAPORT,szDataPort);
            if (StrToNum(nDataPort,szDataPort) < 0) then 
            LoadStringFromStringTable("CHECK_PORT_DATA_REENTER", info );
            MessageBox (info, SEVERE);
            goto DoStart; 
                else
              //不允许设置为3389端口 和远程接入端口出现冲突
              /*
          if nDataPort==3389 then
                  MessageBox (@ID_RASPortConflict, SEVERE);
                  goto DoStart;  
                   endif;
                   */                    
            endif;  
           
            if (nDataPort = nWebPort) then     
            LoadStringFromStringTable("CHECK_PORT_REPEAT", info );
            MessageBox (info, SEVERE);
            goto DoStart;
            endif; 
           
            CtrlGetText(szDialogName,RES_TEXT_WEBPORT,szWebPort);    
       //CtrlGetText(szDialogName,RES_TEXT_DATAPORT,szDataPort); 
       StrToNum(nDataPort,szDataPort);   
       
       if (StrToNum(nWebPort,szWebPort)=0) then
          isWebPortcanuse=ExFn_IsWebPortCanUseCheck(nWebPort); 
          if(isWebPortcanuse) then
             isWebPortcanuse=TRUE; 
             g_KMWebport=nWebPort;
          endif;
       else
         isWebPortcanuse=FALSE;
       endif; 
       
       //取终端服务端口,即是输入的服务端口.   
       CtrlGetText(szDialogName,RES_TEXT_DATAPORT,szgetrasport); 
       if (StrToNum(nJWWRemotePort,szgetrasport)=0) then
          nDataPort2=ExFn_IsDataPortCanUseCheck(nJWWRemotePort);
          if(nJWWRemotePort==nDataPort2)  then 
            isDataPortcanuse=TRUE;
            g_KMDataport=nDataPort; 
          else
            isDataPortcanuse=TRUE;
            g_KMDataport=nDataPort2;  
          endif; 
       else
         isDataPortcanuse=FALSE;
       endif;
       

           
            if (isWebPortcanuse==FALSE) then   
    LoadStringFromStringTable("CHECK_PORT_WEB_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_WEBPORT,info);   
    LoadStringFromStringTable("CHECK_PORT_WEB_REENTER", info );
    MessageBox (info, SEVERE);
                else       
                LoadStringFromStringTable("CHECK_PORT_WEB_VALID", info );
                CtrlSetText(szDialogName,RES_LBL_WEBPORT,info);   
   endif;
   
   if (isDataPortcanuse == FALSE) then      
       LoadStringFromStringTable("CHECK_PORT_DATA_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info); 
    LoadStringFromStringTable("CHECK_PORT_DATA_REENTER", info );
    MessageBox (info, SEVERE);
   else    
    LoadStringFromStringTable("CHECK_PORT_DATA_VALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info);
   endif; 
           
            //如果终端服务端口是3389.给出提示..
            CtrlGetText(szDialogName,RES_TEXT_DATAPORT,szgetrasport);
            if(szgetrasport="3389") then
              LoadStringFromStringTable("CHECK_PORT_DATA_INVALID", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info);
            endif;
           
            if(isDataPortcanuse && isWebPortcanuse) then //端口满足要求
               LoadStringFromStringTable("CHECK_PORT_DATA_VALID_DATA", info );
    CtrlSetText(szDialogName,RES_LBL_DATAPORT,info);
    if (nCmdValue = RES_PBUT_NEXT) then
    bDone = TRUE;
    endif;
   endif;
           
            case RES_PBUT_BACK: 
                bDone = TRUE; 
        endswitch; 
    until bDone; 
    EndDialog (szDialogName); 
    ReleaseDialog (szDialogName);    
    if (nCmdValue = RES_PBUT_NEXT) then
    return NEXT;
    else
    return BACK;
    endif;
end;  



clearexistmsi.rul 源码



function void ExFn_ClearAllExistMsi()
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{03FC4463-C12B-40B8-A4D0-FB1654987C14}") = 1 then 
ExFn_ClearExistMsi("{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{096E3A78-5313-4FC5-8B3C-63E8EA599362}") = 1 then 
ExFn_ClearExistMsi("{096E3A78-5313-4FC5-8B3C-63E8EA599362}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}") = 1 then 
ExFn_ClearExistMsi("{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}") = 1 then 
ExFn_ClearExistMsi("{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}") = 1 then 
ExFn_ClearExistMsi("{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0EE3EEAC-D612-4B72-8795-CAE90510878A}") = 1 then 
ExFn_ClearExistMsi("{0EE3EEAC-D612-4B72-8795-CAE90510878A}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0FAC7C1F-FAF9-4EA6-8CC6-87F1DC30E72F}") = 1 then 
ExFn_ClearExistMsi("{0FAC7C1F-FAF9-4EA6-8CC6-87F1DC30E72F}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}") = 1 then 
ExFn_ClearExistMsi("{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{17A6ADEB-7CAC-440A-AC71-122D66E10132}") = 1 then 
ExFn_ClearExistMsi("{17A6ADEB-7CAC-440A-AC71-122D66E10132}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{2166C7C8-B032-4A45-8C47-88ED6270BC5F}") = 1 then 
ExFn_ClearExistMsi("{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{21B42064-DDA6-4231-A31E-5E3732D1744D}") = 1 then 
ExFn_ClearExistMsi("{21B42064-DDA6-4231-A31E-5E3732D1744D}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{224DF229-95E5-4927-9DBE-D48320D1F05E}") = 1 then 
ExFn_ClearExistMsi("{224DF229-95E5-4927-9DBE-D48320D1F05E}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{28AFDE6B-54E6-4D5D-8407-26126267722A}") = 1 then 
ExFn_ClearExistMsi("{28AFDE6B-54E6-4D5D-8407-26126267722A}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{28B6C62A-D9DD-4352-80D2-C258F86F85F3}") = 1 then 
ExFn_ClearExistMsi("{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{29935392-23EB-4FC7-AC8A-308D7101B133}") = 1 then 
ExFn_ClearExistMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}") = 1 then 
ExFn_ClearExistMsi("{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");
endif;
    //U8V12.0需求 添加FB 费用管理
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}") = 1 then 
ExFn_ClearExistMsi("{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
endif;

if RegDBKeyExist(UNINSTALL_KEY_NAME + "{2FF13841-EB92-4A67-849A-872FC4847F4A}") = 1 then 
ExFn_ClearExistMsi("{2FF13841-EB92-4A67-849A-872FC4847F4A}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}") = 1 then 
ExFn_ClearExistMsi("{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{402D419C-1AC3-42CA-8484-311C0BBBF7CC}") = 1 then 
ExFn_ClearExistMsi("{402D419C-1AC3-42CA-8484-311C0BBBF7CC}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}") = 1 then 
ExFn_ClearExistMsi("{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}") = 1 then 
ExFn_ClearExistMsi("{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}") = 1 then 
ExFn_ClearExistMsi("{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}") = 1 then 
ExFn_ClearExistMsi("{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}") = 1 then 
ExFn_ClearExistMsi("{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}") = 1 then 
ExFn_ClearExistMsi("{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}") = 1 then 
ExFn_ClearExistMsi("{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}") = 1 then 
ExFn_ClearExistMsi("{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{56106E75-31E9-4C12-BA0E-6C791FF65418}") = 1 then 
ExFn_ClearExistMsi("{56106E75-31E9-4C12-BA0E-6C791FF65418}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{582E19C0-23C4-44A7-8772-F0C613297C16}") = 1 then 
ExFn_ClearExistMsi("{582E19C0-23C4-44A7-8772-F0C613297C16}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}") = 1 then 
ExFn_ClearExistMsi("{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{63C31F73-6488-4784-99F2-C9FE2E77222E}") = 1 then 
ExFn_ClearExistMsi("{63C31F73-6488-4784-99F2-C9FE2E77222E}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}") = 1 then 
ExFn_ClearExistMsi("{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6BF16486-4C92-4E21-8103-67FCA1CB12A6}") = 1 then 
ExFn_ClearExistMsi("{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}") = 1 then 
ExFn_ClearExistMsi("{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{7303FF34-69E0-473E-817B-C27728E77073}") = 1 then 
ExFn_ClearExistMsi("{7303FF34-69E0-473E-817B-C27728E77073}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{7DED3042-9870-4504-95CB-7E1396A12DD5}") = 1 then 
ExFn_ClearExistMsi("{7DED3042-9870-4504-95CB-7E1396A12DD5}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}") = 1 then 
ExFn_ClearExistMsi("{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}") = 1 then 
ExFn_ClearExistMsi("{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{865041D6-C60F-46A3-948F-B6AFEEB1D347}") = 1 then 
ExFn_ClearExistMsi("{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{87D8570F-5D85-430A-97F5-1721592B14D5}") = 1 then 
ExFn_ClearExistMsi("{87D8570F-5D85-430A-97F5-1721592B14D5}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}") = 1 then 
ExFn_ClearExistMsi("{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}") = 1 then 
ExFn_ClearExistMsi("{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}") = 1 then 
ExFn_ClearExistMsi("{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}") = 1 then 
ExFn_ClearExistMsi("{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A33E5DFC-4075-454B-807D-10A63EE5E0A7}") = 1 then 
ExFn_ClearExistMsi("{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A9304A69-3AB7-4FC1-9C37-6D797E94213E}") = 1 then 
ExFn_ClearExistMsi("{A9304A69-3AB7-4FC1-9C37-6D797E94213E}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}") = 1 then 
ExFn_ClearExistMsi("{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B2D6C198-095C-4A26-9840-98836AF70F23}") = 1 then 
ExFn_ClearExistMsi("{B2D6C198-095C-4A26-9840-98836AF70F23}");
endif;


if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E10149AC-BE82-4760-8BD9-301C6B11B0F2}") = 1 then 
ExFn_ClearExistMsi("{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");
endif;

if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B3470B1E-54CC-4DAB-AD77-881A1617037E}") = 1 then 
ExFn_ClearExistMsi("{B3470B1E-54CC-4DAB-AD77-881A1617037E}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B7AE865A-791B-4C8A-B813-06BC6E79B116}") = 1 then 
ExFn_ClearExistMsi("{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B7F76D73-44F5-4A16-8490-4D0F56E397BD}") = 1 then 
ExFn_ClearExistMsi("{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}") = 1 then 
ExFn_ClearExistMsi("{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}") = 1 then 
ExFn_ClearExistMsi("{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}") = 1 then 
ExFn_ClearExistMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}") = 1 then 
ExFn_ClearExistMsi("{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D057B835-1AB0-4439-945D-F3064030B8F3}") = 1 then 
ExFn_ClearExistMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D1B612FA-71C3-4707-9E4B-D387306CB195}") = 1 then 
ExFn_ClearExistMsi("{D1B612FA-71C3-4707-9E4B-D387306CB195}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D979201A-A74E-4705-A3A6-45D5B7F096CA}") = 1 then 
ExFn_ClearExistMsi("{D979201A-A74E-4705-A3A6-45D5B7F096CA}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{DA024A96-5C95-4E9B-87FE-EC2906717AAC}") = 1 then 
ExFn_ClearExistMsi("{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E1CDD5B7-8952-490D-80D6-0880AA011CE5}") = 1 then 
ExFn_ClearExistMsi("{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}") = 1 then 
ExFn_ClearExistMsi("{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}") = 1 then 
ExFn_ClearExistMsi("{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F147E096-2126-41C8-BDA5-E2ED297F2DC3}") = 1 then 
ExFn_ClearExistMsi("{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F29D733D-C755-4F8D-85B1-1A8478D69A97}") = 1 then 
ExFn_ClearExistMsi("{F29D733D-C755-4F8D-85B1-1A8478D69A97}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F554F819-FDE7-406E-9095-A78CAABA22A6}") = 1 then 
ExFn_ClearExistMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}") = 1 then 
ExFn_ClearExistMsi("{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}") = 1 then 
ExFn_ClearExistMsi("{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");
endif;
//U8ERP-SCM-EB.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6F15ABFD-F426-43DE-A049-E5FEFC0F91A3}") = 1 then 
ExFn_ClearExistMsi("{6F15ABFD-F426-43DE-A049-E5FEFC0F91A3}");
endif; 
//U8ERP-SCM-VM.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}") = 1 then 
ExFn_ClearExistMsi("{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}");
endif; 

//U8ERP-SCM-PDM.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{fdbbedb7-683f-46a0-94bb-c90e8c13b659}") = 1 then 
ExFn_ClearExistMsi("{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");
endif;

    //U8ERP-PUBLIC-RAS.msi  U8V13.0去除科迈安装
    /*
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{1D0AB63F-23CA-4D78-8475-58A78C5D6533}") = 1 then 
ExFn_ClearExistMsi("{1D0AB63F-23CA-4D78-8475-58A78C5D6533}");
endif;
*/
//U8ERP-PUBLIC-JWW.msi   金万维
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{1BD21323-FF20-430E-99A9-1294C95F592A}") = 1 then 
ExFn_ClearExistMsi("{1BD21323-FF20-430E-99A9-1294C95F592A}");
endif;

/*  //u8v12.5版本删除PLM 
    //U8ERP-PDM-ServerForClient.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}") = 1 then 
ExFn_ClearExistMsi("{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}");
endif;

//U8ERP-PDM-Server.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}") = 1 then 
ExFn_ClearExistMsi("{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}");
endif;

//U8ERP-PDM-Server2.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}") = 1 then 
ExFn_ClearExistMsi("{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");
endif;

//U8ERP-PDM-FileServer.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D94F0B75-A7B7-404A-8DB2-1C16B997C642}") = 1 then 
ExFn_ClearExistMsi("{D94F0B75-A7B7-404A-8DB2-1C16B997C642}");
endif;

    //U8ERP-PDM-License.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}") = 1 then 
ExFn_ClearExistMsi("{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}");
endif;
*/
    //U8ERP-PUBLIC-EIS.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}") = 1 then 
ExFn_ClearExistMsi("{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}");
endif;

//U8ERP-PUBLIC-openapix64.msi   
//if RegDBKeyExist(UNINSTALL_KEY_NAME + "{1c23de0c-5ff3-4f22-8044-ff314a490ed3}") = 1 then 
//ExFn_ClearExistMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//endif;

    //U8ERP-PUBLIC-openapix86.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}") = 1 then 
ExFn_ClearExistMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");
endif;
end;



clearreg.rul源码

function void ExFn_ClearAllMsiReg()
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{096E3A78-5313-4FC5-8B3C-63E8EA599362}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{0EE3EEAC-D612-4B72-8795-CAE90510878A}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{0FAC7C1F-FAF9-4EA6-8CC6-87F1DC30E72F}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{17A6ADEB-7CAC-440A-AC71-122D66E10132}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{21B42064-DDA6-4231-A31E-5E3732D1744D}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{224DF229-95E5-4927-9DBE-D48320D1F05E}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{28AFDE6B-54E6-4D5D-8407-26126267722A}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{29935392-23EB-4FC7-AC8A-308D7101B133}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");
    //U8V12.0需求 添加FB 费用管理
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{2FF13841-EB92-4A67-849A-872FC4847F4A}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{402D419C-1AC3-42CA-8484-311C0BBBF7CC}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{56106E75-31E9-4C12-BA0E-6C791FF65418}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{582E19C0-23C4-44A7-8772-F0C613297C16}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{63C31F73-6488-4784-99F2-C9FE2E77222E}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{7303FF34-69E0-473E-817B-C27728E77073}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{7DED3042-9870-4504-95CB-7E1396A12DD5}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
//删除 U8ERP-CW-WH.msi  模块
//RegDBDeleteKey(UNINSTALL_KEY_NAME + "{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{87D8570F-5D85-430A-97F5-1721592B14D5}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{A9304A69-3AB7-4FC1-9C37-6D797E94213E}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{B2D6C198-095C-4A26-9840-98836AF70F23}");

//删除 U8ERP-PUBLIC-openapix64.msi  模块
//RegDBDeleteKey(UNINSTALL_KEY_NAME + "{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
//删除 U8ERP-PUBLIC-openapix86.msi  模块
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");

//删除 U8ERP-PUBLIC-COMMON2.msi  模块
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");

RegDBDeleteKey(UNINSTALL_KEY_NAME + "{B3470B1E-54CC-4DAB-AD77-881A1617037E}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{D057B835-1AB0-4439-945D-F3064030B8F3}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{D1B612FA-71C3-4707-9E4B-D387306CB195}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{D979201A-A74E-4705-A3A6-45D5B7F096CA}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{F29D733D-C755-4F8D-85B1-1A8478D69A97}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{F554F819-FDE7-406E-9095-A78CAABA22A6}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{E9A2049E-FACF-4709-B81F-DCA7FD0B621E}"); 
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{782E19C0-23C4-44A7-8772-F0C613297C17}");   
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{036aeaaa-e767-4592-bcd1-52d9c47b4324}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{a3be837c-b5f3-44db-8c3a-afb0433d997f }");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{125966e5-636a-4a6e-9524-bef9b75b58f6}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{a5ab8f2c-a705-4d26-86a8-a7498a8737de}");  
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{61af2c59-2d09-47c9-81e4-5e59b9dcdea4}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{c33e6a1c-4317-4921-b3dc-092acdb31484}");    //U8ERP-SCM-KC.msi
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}");
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{61af2c59-2d09-47c9-81e4-5e59b9dcdea4}");
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{CBD50EDA-F170-4024-B7D0-B03E4345F5D5}"); 
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{EF92679D-5761-4F0F-BD64-7EE96749B3D9}");       
    //U8ERP-SCM-U8KCSN.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{6F26CF69-5612-4276-82B6-09DC5B9F12D0}"); 
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}");   //U8ERP-GreenService-ISD.msi
    //U8ERP-SCM-EB.msi  
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{6f15abfd-f426-43de-a049-e5fefc0f91a3}"); 
    
    //U8ERP-SCM-VM.msi  
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}"); 
      
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{fdbbedb7-683f-46a0-94bb-c90e8c13b659}");  //U8ERP-SCM-PDM.msi
    //U8ERP-PUBLIC-RAS.msi U8V13.0去除科迈安装
    /*
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{1D0AB63F-23CA-4D78-8475-58A78C5D6533}"); 
    */
    
    //U8ERP-PUBLIC-JWW.msi 金万维
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{1BD21323-FF20-430E-99A9-1294C95F592A}"); 
    /*  //u8v12.5版本删除PLM 
    //U8ERP-PDM-Server.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}"); 
    //U8ERP-PDM-Server2.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}");     
    //U8ERP-PDM-FileServer.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{D94F0B75-A7B7-404A-8DB2-1C16B997C642}"); 
    //U8ERP-PDM-ServerForClient.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}"); 
    //U8ERP-PDM-License.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}"); 
    */
    //U8ERP-PUBLIC-EIS.msi
    RegDBDeleteKey(UNINSTALL_KEY_NAME + "{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}");       
end;


dependence.rul

dependence.rul源码

function void ExFn_RemoveAllDependenceMSi()
string dependedMsiStr;
LIST msiList;
STRING msiStr;       
NUMBER nResult;
STRING guidStr;  
STRING svResult;  
begin
dependedMsiStr = "";     
ExFn_WriteLog("","ExFn_RemoveAllDependenceMSi");  
ExFn_GetAllDenpendenceMsi(dependedMsiStr);           
msiList = ListCreate(STRINGLIST);

StrGetTokens(msiList, dependedMsiStr, ",");  

if (msiList = LIST_NULL) then
MessageBox("不能创建列表", SEVERE);
abort;
endif;  


nResult = ListGetFirstString (msiList, msiStr);


g_bDependenceInstall = TRUE;
while (nResult != END_OF_LIST)
guidStr = ExFn_GetMsiGuid(msiStr);  
if ExFn_MsiInstalled(guidStr) then
ExFn_FeatureUninstall(msiStr, guidStr);
endif;
svResult = msiStr;
StrReplace ( svResult, ".msi", ".config", 0); 
DeleteFile(TARGETDIR^"Installer\\"+svResult);
ExFn_WriteLog("Delete config file: ", TARGETDIR^"Installer\\"+svResult); 

        nResult = ListGetNextString (msiList, msiStr);
    endwhile;   
g_bDependenceInstall = FALSE;

    ListDestroy(msiList);

end;                                       


function void ExFn_InstallAllDependenceMSi()
string dependedMsiStr;
LIST msiList;
string msiStr;  
NUMBER nResult;
STRING guidStr;
begin  
dependedMsiStr = "";     
    
   
ExFn_WriteConfigFile(dependedMsiStr);           


msiList = ListCreate(STRINGLIST);
StrGetTokens(msiList, dependedMsiStr, ",");  

if (msiList = LIST_NULL) then
MessageBox("不能创建列表", SEVERE);
abort;
endif;  


nResult = ListGetFirstString (msiList, msiStr);


g_bDependenceInstall = TRUE;
while (nResult != END_OF_LIST)
guidStr = ExFn_GetMsiGuid(msiStr);
ExFn_ComponentInstall(msiStr, guidStr);  
        nResult = ListGetNextString (msiList, msiStr);
    endwhile;
g_bDependenceInstall = FALSE;
    
    ListDestroy(msiList);


end;


export prototype ENV_Installing();
function ENV_Installing()
begin     
ExFn_WriteLog("","ENV_Installing");  
end;


export prototype ENV_Installed();
function ENV_Installed()
begin
ExFn_WriteLog("","ENV_Installed"); 
end;


export prototype ENV_UnInstalling();
function ENV_UnInstalling()
begin
ExFn_WriteLog("","ENV_UnInstalling");  
//bitao:卸载时同时把这两个包也卸了  
//卸载时卸载 u8erp-webclient.msi   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AF4430-4258-439C-8E1D-7525E7A3988B}") = 1 then 
ExFn_ComponentUninstall("u8erp-webclient.msi","{78AF4430-4258-439C-8E1D-7525E7A3988B}");
endif;
//卸载时卸载 U8ERP-PortalClient.msi  
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AD4430-4259-438B-8E2D-7535E7A3988B}") = 1 then 
ExFn_ComponentUninstall("U8ERP-PortalClient.msi","{78AD4430-4259-438B-8E2D-7535E7A3988B}"); 
endif; 
//卸载时卸载 U8ERP-SmartClient.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{81973461-2B34-448C-9F70-FB4C1C1E2602}") = 1 then 
ExFn_ComponentUninstall("U8ERP-SmartClient.msi","{81973461-2B34-448C-9F70-FB4C1C1E2602}");
endif;      
//卸载时卸载 U8ERP-CRWebClient.msi  
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{66F46BEA-8854-4050-9057-E3BDBC3C0687}") = 1 then 
ExFn_ComponentUninstall("U8ERP-CRWebClient.msi","{66F46BEA-8854-4050-9057-E3BDBC3C0687}");
endif;    
//卸载时卸载 U8ERP-HRWebClient.msi  
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{BA130354-4F21-4FE6-951A-4FCEFD4702C2}") = 1 then 
ExFn_ComponentUninstall("U8ERP-HRWebClient.msi","{BA130354-4F21-4FE6-951A-4FCEFD4702C2}");
endif;   
//卸载时同时卸载  yonyou up U8+V13.0.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{293C702A-6D44-45BA-B5BA-A0494D9CFC40}") = 1 then 
  ExFn_ComponentUninstall("yonyou up U8+V13.0.msi","{293C702A-6D44-45BA-B5BA-A0494D9CFC40}");
endif;  
//卸载时同时卸载  yonyou up U8+V13.1.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A40FC4E9-2308-4DFD-8F87-AD341253F36A}") = 1 then 
  ExFn_ComponentUninstall("yonyou U8+V13.1.msi","{A40FC4E9-2308-4DFD-8F87-AD341253F36A}");
endif; 
//卸载时同时卸载  yonyou up U8+V15.0.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{27109C4F-436C-41E7-BAA9-FBA6931FC38D}") = 1 then 
  ExFn_ComponentUninstall("yonyou U8+V15.0.msi","{27109C4F-436C-41E7-BAA9-FBA6931FC38D}");
endif; 
end;
 
export prototype ENV_UnInstalled();
function ENV_UnInstalled()
INT iCount;
begin 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AF4430-4258-439C-8E1D-7525E7A3988B}") = 1 then 
ExFn_RemoveInstalledMsi("U8ERP-WebClient.msi");  
    ExFn_AbsoluteDeleteMsi("{78AF4430-4258-439C-8E1D-7525E7A3988B}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AD4430-4259-438B-8E2D-7535E7A3988B}") = 1 then 
ExFn_RemoveInstalledMsi("U8ERP-PortalClient.msi");  
   ExFn_AbsoluteDeleteMsi("{78AD4430-4259-438B-8E2D-7535E7A3988B}");  
endif; 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{81973461-2B34-448C-9F70-FB4C1C1E2602}") = 1 then 
ExFn_RemoveInstalledMsi("U8ERP-SmartClient.msi");  
   ExFn_AbsoluteDeleteMsi("{81973461-2B34-448C-9F70-FB4C1C1E2602}"); 
endif; 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{66F46BEA-8854-4050-9057-E3BDBC3C0687}") = 1 then 
ExFn_RemoveInstalledMsi("U8ERP-CRWebClient.msi");  
    ExFn_AbsoluteDeleteMsi("{66F46BEA-8854-4050-9057-E3BDBC3C0687}");
endif; 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{BA130354-4F21-4FE6-951A-4FCEFD4702C2}") = 1 then 
ExFn_RemoveInstalledMsi("U8ERP-HRWebClient.msi");  
    ExFn_AbsoluteDeleteMsi("{BA130354-4F21-4FE6-951A-4FCEFD4702C2}");
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{293C702A-6D44-45BA-B5BA-A0494D9CFC40}") = 1 then 
    ExFn_RemoveInstalledMsi("yonyou up U8+V13.0.msi");  
    ExFn_AbsoluteDeleteMsi("{293C702A-6D44-45BA-B5BA-A0494D9CFC40}");
endif;                  
if g_bIsRollBack == TRUE then   
HideDlg();
//UnUseDLL(MSIUI_DLL);
endif;
    
    
    //设置进度条的回滚状态
    if g_bIsRollBack==TRUE then  
      if(g_statusprocesscurentvalue>0) then
        for iCount = 0 to g_statusprocesscurentvalue step 1
           Delay(1);
           g_statusprocesscurentvalue=g_statusprocesscurentvalue-1;
           SetStatusWindow(g_statusprocesscurentvalue, @ID_setuprollbacklable);
        endfor;
      endif;
    endif;
    
    
ExFn_WriteLog("","ENV_UnInstalled");    
end;




export prototype Dependence_Installing();
function Dependence_Installing()
begin
ExFn_WriteLog("","Dependence_Installing");   
ExFn_InstallAllDependenceMSi(); 
// HideDlg();
end;
 
export prototype Dependence_Installed();
function Dependence_Installed()
begin
ExFn_WriteLog("","Dependence_Installed");
end;
 
export prototype Dependence_UnInstalling();
function Dependence_UnInstalling()
begin
ExFn_WriteLog("","Dependence_UnInstalling"); 
//    ExFn_UnInstallU8Service();  
    ExFn_RemoveAllDependenceMSi();  
end;
 
export prototype Dependence_UnInstalled();
function Dependence_UnInstalled()
begin
ExFn_WriteLog("","Dependence_UnInstalled");
end;




featurecost.rul 源码

STRING g_LastPath;


function void ExFn_FeatureCost()
begin
if g_LastPath == TARGETDIR then
return;
endif;
if(g_LastPath != "")then
FeatureAddCost(MEDIA, "Dependence", g_LastPath, 0, -157286400);
FeatureAddCost(MEDIA, "Client", g_LastPath, 0, -0);
//FeatureAddCost(MEDIA, "Client\\OA", g_LastPath, 0, -0);
//FeatureAddCost(MEDIA, "Client\\OA\\WorkBench", g_LastPath, 0, -12701696);
FeatureAddCost(MEDIA, "Client\\UAP", g_LastPath, 0, -12234752);    
FeatureAddCost(MEDIA, "Client\\MERP", g_LastPath, 0, -648192);  
FeatureAddCost(MEDIA, "Client\\UTU", g_LastPath, 0, -4535296);  
FeatureAddCost(MEDIA, "Client\\iSD", g_LastPath, 0, -33964503);   
FeatureAddCost(MEDIA, "Client\\PDMInterfacePlug", g_LastPath, 0, -7098368); 
FeatureAddCost(MEDIA, "Client\\SSDHGZT", g_LastPath, 0, -51318784);
FeatureAddCost(MEDIA, "Client\\ModelAnalysis\\SafetyStockModel", g_LastPath, 0, -1705984);
FeatureAddCost(MEDIA, "Client\\HumanResources", g_LastPath, 0, -100774208);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PersonnelContract", g_LastPath, 0, -4694016);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PersonnelManagement", g_LastPath, 0, -5464064);
FeatureAddCost(MEDIA, "Client\\HumanResources\\TrainingManagement", g_LastPath, 0, -6815744);
//FeatureAddCost(MEDIA, "客户端\\人力资源\\宿舍管理", g_LastPath, 0, -3293184);
FeatureAddCost(MEDIA, "Client\\HumanResources\\RecruitmentManagement", g_LastPath, 0, -8065024);
FeatureAddCost(MEDIA, "Client\\HumanResources\\BenefitsManagement", g_LastPath, 0, -4403200);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PerformanceManagement", g_LastPath, 0, -7626752);
FeatureAddCost(MEDIA, "Client\\HumanResources\\AttendanceManagement", g_LastPath, 0, -9945088);
FeatureAddCost(MEDIA, "Client\\HumanResources\\SalaryManagement", g_LastPath, 0, -50975616);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PieceworkWage", g_LastPath, 0, -5627904);
FeatureAddCost(MEDIA, "Client\\EAIntergration", g_LastPath, 0, -50914688);
FeatureAddCost(MEDIA, "Client\\EnterprisePortal", g_LastPath, 0, -1503108206);
FeatureAddCost(MEDIA, "Client\\GXLProduct", g_LastPath, 0, -0);
//FeatureAddCost(MEDIA, "客户端\\GXLProduct\\GSP质量管理", g_LastPath, 0, -3817472);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ExportManagement", g_LastPath, 0, -100710656);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ContractManagement", g_LastPath, 0, -8859648);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\SalesManagement", g_LastPath, 0, -4182016);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\OutsourceManagement", g_LastPath, 0, -7933952);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\InventoryAccounting", g_LastPath, 0, -35201024);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\InventoryManagement", g_LastPath, 0, -100532992);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\QualityManagement", g_LastPath, 0, -20156416);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ImportManagement", g_LastPath, 0, -5931008);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ProcurementManagement", g_LastPath, 0, -18288640);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\XSGLManagement", g_LastPath, 0, -14942208);  
FeatureAddCost(MEDIA, "Client\\GXLProduct\\BarCodeManagement", g_LastPath, 0, -3145216);
FeatureAddCost(MEDIA, "Client\\DecisionManagement", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\DecisionManagement\\FinancialAnalysis", g_LastPath, 0, -19296256);
FeatureAddCost(MEDIA, "Client\\CustomerRelationshipManagement", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\CustomerRelationshipManagement\\CustomerRelationshipManagement", g_LastPath, 0, -16359424);
FeatureAddCost(MEDIA, "Client\\CustomerRelationshipManagement\\服务管理", g_LastPath, 0, -1646592);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct\\ProcessUutsourcing", g_LastPath, 0, -30915840);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct\\MMClient", g_LastPath, 0, -150688448);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct\\EquipmentManagement", g_LastPath, 0, -25817024);
FeatureAddCost(MEDIA, "Client\\ManagementAccount", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\ManagementAccount\\CostManagement", g_LastPath, 0, -15896576);
FeatureAddCost(MEDIA, "Client\\ManagementAccount\\MoneyManagement", g_LastPath, 0, -11530240);
FeatureAddCost(MEDIA, "Client\\ManagementAccount\\ProjectManagement", g_LastPath, 0, -12251136);
FeatureAddCost(MEDIA, "Client\\FinacialAccount", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\UFOReport", g_LastPath, 0, -63860736);
//FeatureAddCost(MEDIA, "客户端\\FinacialAccount\\公司对账", g_LastPath, 0, -1679360);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\CashierManagement", g_LastPath, 0, -100931264);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\FixedAssets", g_LastPath, 0, -9506816);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\PayableManagement", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\ReceivablesManagement", g_LastPath, 0, -29724672);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\GeneralLedger", g_LastPath, 0, -201986304);
//FeatureAddCost(MEDIA, "Client\\FinacialAccount\\现金流量表", g_LastPath, 0, -25866240);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\OnlineBank", g_LastPath, 0, -10182656);
FeatureAddCost(MEDIA, "Client\\GroupApplications", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\GroupApplications\\SettlementCenter", g_LastPath, 0, -20946944);
FeatureAddCost(MEDIA, "Client\\GroupApplications\\HYReport", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Client\\GroupApplications\\GroupFinancial", g_LastPath, 0, -17813504);
FeatureAddCost(MEDIA, "Server", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Server\\DataServer", g_LastPath, 0, -1210588763); 
//bitao:因为选此节点,后台会选 应用服务器
FeatureAddCost(MEDIA, "Server\\WebServerAppServer", g_LastPath, 0, -628213120);
FeatureAddCost(MEDIA, "Server\\SSDHGZT", g_LastPath, 0, -51318784);
//FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\OA服务器", g_LastPath, 0, -36651008);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\WEBApp", g_LastPath, 0, -45912064);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\WebPortal", g_LastPath, 0, -158333700);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\EmployeeSelf", g_LastPath, 0, -25000000);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\ManagerSelf", g_LastPath, 0, -25000000);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\PerformanceManagement", g_LastPath, 0, -25000000);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HHBB", g_LastPath, 0, -207470848);
//FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\报账中心", g_LastPath, 0, -12967936);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\OnlineClaims", g_LastPath, 0, -50332544);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\FinancialManagement", g_LastPath, 0, -43732992);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\BudgetManagement", g_LastPath, 0, -25784320);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\CustomerRelationshipManagement", g_LastPath, 0, -100298029);
FeatureAddCost(MEDIA, "Server\\LicenseServer", g_LastPath, 0, -8784320);
//FeatureAddCost(MEDIA, "Server\\U8AppServer", g_LastPath, 0, -128213120);
FeatureAddCost(MEDIA, "Server\\U8AppServer", g_LastPath, 0, -628213120);
FeatureAddCost(MEDIA, "Server\\FileManageServer", g_LastPath, 0, -8784320);  
FeatureAddCost(MEDIA, "Server\\EIS", g_LastPath, 0,-10039808);
FeatureAddCost(MEDIA, "Server\\PDMInterfacePlug", g_LastPath, 0, -7098368);
FeatureAddCost(MEDIA, "Envirment", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Envirment\\Jet 3.51", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Envirment\\Jet 4.0", g_LastPath, 0, -0);
//FeatureAddCost(MEDIA, "Envirment\\注册", g_LastPath, 0, -0);
//FeatureAddCost(MEDIA, "Envirment\\非注册", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Resource", g_LastPath, 0, -0);
FeatureAddCost(MEDIA, "Resource\\ZH_CN", g_LastPath, 0, -25383680);
FeatureAddCost(MEDIA, "Resource\\ZH_TW", g_LastPath, 0, -25486080);
FeatureAddCost(MEDIA, "Resource\\EN_US", g_LastPath, 0, -25300032);
FeatureAddCost(MEDIA, "Resource\\ResCommon", g_LastPath, 0, -45184064);  
FeatureAddCost(MEDIA, "SSDHGZT", g_LastPath, 0, -51318784);
FeatureAddCost(MEDIA, "PDM", g_LastPath, 0, -2512990094);
endif;


FeatureAddCost(MEDIA, "Dependence", TARGETDIR, 0, 157286400);
FeatureAddCost(MEDIA, "Client", TARGETDIR, 0, 0);
//FeatureAddCost(MEDIA, "Client\\OA", TARGETDIR, 0, 0);
//FeatureAddCost(MEDIA, "Client\\OA\\WorkBench", TARGETDIR, 0, 12701696);
FeatureAddCost(MEDIA, "Client\\UAP", TARGETDIR, 0, 12234752);
FeatureAddCost(MEDIA, "Client\\MERP", TARGETDIR, 0, 648192); 
FeatureAddCost(MEDIA, "Client\\UTU", TARGETDIR, 0, 4535296);  
FeatureAddCost(MEDIA, "Client\\iSD", TARGETDIR, 0, 33964503);
FeatureAddCost(MEDIA, "Client\\PDMInterfacePlug", TARGETDIR, 0,7098368); 
FeatureAddCost(MEDIA, "Client\\SSDHGZT", TARGETDIR, 0, 51318784);
FeatureAddCost(MEDIA, "PDM", TARGETDIR, 0, 2512990094);
FeatureAddCost(MEDIA, "Client\\ModelAnalysis\\SafetyStockModel", g_LastPath, 0, 1705984);
FeatureAddCost(MEDIA, "Client\\HumanResources", TARGETDIR, 0, 100774208);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PersonnelContract", TARGETDIR, 0, 4694016);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PersonnelManagement", TARGETDIR, 0, 5464064);
FeatureAddCost(MEDIA, "Client\\HumanResources\\TrainingManagement", TARGETDIR, 0, 6815744);
//FeatureAddCost(MEDIA, "Client\\HumanResources\\宿舍管理", TARGETDIR, 0, 3293184);
FeatureAddCost(MEDIA, "Client\\HumanResources\\RecruitmentManagement", TARGETDIR, 0, 8065024);
FeatureAddCost(MEDIA, "Client\\HumanResources\\BenefitsManagement", TARGETDIR, 0, 4403200);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PerformanceManagement", TARGETDIR, 0, 7626752);
FeatureAddCost(MEDIA, "Client\\HumanResources\\AttendanceManagement", TARGETDIR, 0, 9945088);
FeatureAddCost(MEDIA, "Client\\HumanResources\\SalaryManagement", TARGETDIR, 0, 50975616);
FeatureAddCost(MEDIA, "Client\\HumanResources\\PieceworkWage", TARGETDIR, 0, 5627904);
FeatureAddCost(MEDIA, "Client\\EAIntergration", TARGETDIR, 0, 50914688);
FeatureAddCost(MEDIA, "Client\\EnterprisePortal", TARGETDIR, 0, 1503108206);
FeatureAddCost(MEDIA, "Client\\GXLProduct", TARGETDIR, 0, 0);
//FeatureAddCost(MEDIA, "Client\\GXLProduct\\GSP质量管理", TARGETDIR, 0, 3817472);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ExportManagement", TARGETDIR, 0, 100710656);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ContractManagement", TARGETDIR, 0, 8859648);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\SalesManagement", TARGETDIR, 0, 4182016);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\OutsourceManagement", TARGETDIR, 0, 7933952);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\InventoryAccounting", TARGETDIR, 0, 35201024);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\InventoryManagement", TARGETDIR, 0, 100532992);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\QualityManagement", TARGETDIR, 0, 20156416);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ImportManagement", TARGETDIR, 0, 5931008);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\ProcurementManagement", TARGETDIR, 0, 18288640);
FeatureAddCost(MEDIA, "Client\\GXLProduct\\XSGLManagement", TARGETDIR, 0, 14942208);   
FeatureAddCost(MEDIA, "Client\\GXLProduct\\BarCodeManagement", g_LastPath, 0, 3145216);
FeatureAddCost(MEDIA, "Client\\DecisionManagement", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\DecisionManagement\\FinancialAnalysis", TARGETDIR, 0, 19296256);
FeatureAddCost(MEDIA, "Client\\CustomerRelationshipManagement", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\CustomerRelationshipManagement\\CustomerRelationshipManagement", TARGETDIR, 0, 16359424);
FeatureAddCost(MEDIA, "Client\\CustomerRelationshipManagement\\服务管理", TARGETDIR, 0, 1646592);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct\\ProcessUutsourcing", TARGETDIR, 0, 30915840);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct\\MMClient", TARGETDIR, 0, 150688448);
FeatureAddCost(MEDIA, "Client\\ManufactureProduct\\EquipmentManagement", TARGETDIR, 0, 25817024);
FeatureAddCost(MEDIA, "Client\\ManagementAccount", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\ManagementAccount\\CostManagement", TARGETDIR, 0, 15896576);
FeatureAddCost(MEDIA, "Client\\ManagementAccount\\MoneyManagement", TARGETDIR, 0, 11530240);
FeatureAddCost(MEDIA, "Client\\ManagementAccount\\ProjectManagement", TARGETDIR, 0, 12251136);
FeatureAddCost(MEDIA, "Client\\FinacialAccount", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\UFOReport", TARGETDIR, 0, 63860736);
//FeatureAddCost(MEDIA, "Client\\FinacialAccount\\公司对账", TARGETDIR, 0, 1679360);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\CashierManagement", TARGETDIR, 0, 100931264);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\FixedAssets", TARGETDIR, 0, 9506816);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\PayableManagement", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\ReceivablesManagement", TARGETDIR, 0, 29724672);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\GeneralLedger", TARGETDIR, 0, 201986304);
//FeatureAddCost(MEDIA, "Client\\FinacialAccount\\现金流量表", TARGETDIR, 0, 25866240);
FeatureAddCost(MEDIA, "Client\\FinacialAccount\\OnlineBank", TARGETDIR, 0, 10182656);
FeatureAddCost(MEDIA, "Client\\GroupApplications", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\GroupApplications\\SettlementCenter", TARGETDIR, 0, 20946944);
FeatureAddCost(MEDIA, "Client\\GroupApplications\\HYReport", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Client\\GroupApplications\\GroupFinancial", TARGETDIR, 0, 17813504);
FeatureAddCost(MEDIA, "Server", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Server\\DataServer", TARGETDIR, 0, 1210588763);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer", TARGETDIR, 0, 628213120);
FeatureAddCost(MEDIA, "Server\\SSDHGZT", TARGETDIR, 0, 51318784);
//FeatureAddCost(MEDIA, "服务器\\WebServerAppServer\\OA服务器", TARGETDIR, 0, 36651008);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\WEBApp", TARGETDIR, 0, 45912064);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\WebPortal", TARGETDIR, 0, 158333700);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\EmployeeSelf", TARGETDIR, 0, 25000000);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\ManagerSelf", TARGETDIR, 0, 25000000);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\PerformanceManagement", TARGETDIR, 0, 25000000);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\HHBB", TARGETDIR, 0, 207470848);
//FeatureAddCost(MEDIA, "服务器\\WebServerAppServer\\报账中心", TARGETDIR, 0, 12967936);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\OnlineClaims", TARGETDIR, 0, 50332544);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\FinancialManagement", TARGETDIR, 0, 43732992);
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\BudgetManagement", TARGETDIR, 0, 25784320);   
FeatureAddCost(MEDIA, "Server\\WebServerAppServer\\CustomerRelationshipManagement", TARGETDIR, 0, 100298029);
FeatureAddCost(MEDIA, "Server\\EIS", TARGETDIR, 0,10039808);
   
FeatureAddCost(MEDIA, "Server\\PDMInterfacePlug", TARGETDIR, 0,7098368);
FeatureAddCost(MEDIA, "SSDHGZT", TARGETDIR, 0, 51318784);
//FeatureAddCost(MEDIA, "Server\\U8AppServer", TARGETDIR, 0, 128213120);
//装应用服务器时,自动安装client的一些东西
FeatureAddCost(MEDIA, "Server\\U8AppServer", TARGETDIR, 0, 628213120);
FeatureAddCost(MEDIA, "Server\\FileManageServer", TARGETDIR, 0, 8784320);
FeatureAddCost(MEDIA, "Envirment", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Envirment\\Jet 3.51", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Envirment\\Jet 4.0", TARGETDIR, 0, 0);
//FeatureAddCost(MEDIA, "Envirment\\注册", TARGETDIR, 0, 0);
//FeatureAddCost(MEDIA, "Envirment\\非注册", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Resource", TARGETDIR, 0, 0);
FeatureAddCost(MEDIA, "Resource\\ZH_CN", TARGETDIR, 0, 25383680);
FeatureAddCost(MEDIA, "Resource\\ZH_TW", TARGETDIR, 0, 25486080);
FeatureAddCost(MEDIA, "Resource\\EN_US", TARGETDIR, 0, 25300032);
FeatureAddCost(MEDIA, "Resource\\ResCommon", TARGETDIR, 0, 45184064);
g_LastPath = TARGETDIR;
end;


featurecount.rul源码

function NUMBER ExFn_FeatureCount()
NUMBER count;
begin
count = 0;
if FeatureIsItemSelected(MEDIA,"Client")=1 then
count = count + 1;
endif;
    /*
if FeatureIsItemSelected(MEDIA,"Client\\OA")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\OA\\WorkBench")=1 then
count = count + 1;
endif;   
*/


if FeatureIsItemSelected(MEDIA,"Client\\UAP")=1 then
count = count + 1;
endif;
               
    if FeatureIsItemSelected(MEDIA,"Client\\MERP")=1 then
count = count + 1;
endif;   
 
if FeatureIsItemSelected(MEDIA,"Client\\UTU")=1 then
count = count + 1;
endif;  
     
    if FeatureIsItemSelected(MEDIA,"Client\\iSD")=1 then
count = count + 1;
endif;  
    //任何一个选择都只增加一个包.
    if FeatureIsItemSelected(MEDIA,"Client\\PDMInterfacePlug")=1 || FeatureIsItemSelected(MEDIA,"Server\\PDMInterfacePlug")=1 then
count = count + 1;
endif;  
    
if FeatureIsItemSelected(MEDIA,"Client\\HumanResources")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PersonnelContract")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PersonnelManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\TrainingManagement")=1 then
count = count + 1;
endif;
    
    /*
if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\宿舍管理")=1 then
count = count + 1;
endif;       
*/


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\RecruitmentManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\BenefitsManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PerformanceManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\AttendanceManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\SalaryManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PieceworkWage")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\EAIntergration")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\EnterprisePortal")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct")=1 then
count = count + 1;
endif;
 
  //bitao:这个己经不用了
 /*
if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\GSP质量管理") then
count = count + 1;
endif;
   */
   
if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ExportManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ContractManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\SalesManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\OutsourceManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\InventoryAccounting")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\InventoryManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\QualityManagement") then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ImportManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ProcurementManagement")=1 then
count = count + 4;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\XSGLManagement")=1 then
count = count + 2;
endif;

if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\AfterSaleService")=1 then
count = count + 1;
endif;
    
    if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\BarCodeManagement")=1 then
count = count + 1;
endif;

/*
if FeatureIsItemSelected(MEDIA,"Client\\DecisionManagement") then
count = count + 1;
endif;
    */
if FeatureIsItemSelected(MEDIA,"Client\\DecisionManagement\\FinancialAnalysis")=1 then
count = count + 1;
endif;




if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct\\ProcessUutsourcing")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct\\MMClient")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct\\EquipmentManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount\\CostManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount\\MoneyManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount\\ProjectManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\UFOReport")=1 then
count = count + 1;
endif;
    /*
if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\公司对账")=1 then
count = count + 1;
endif; 
*/


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\CashierManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\FixedAssets")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\PayableManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\ReceivablesManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\GeneralLedger")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\现金流量表")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\OnlineBank")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications\\SettlementCenter")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications\\HYReport")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications\\GroupFinancial")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\DataServer")=1 then
count = count + 2;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")=1 then
count = count + 2;
endif;
    /*
if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\OA服务器")=1 then
count = count + 1;
endif;
*/


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\WEBApp")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\WebPortal")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources\\EmployeeSelf")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources\\ManagerSelf")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources\\PerformanceManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HHBB")=1 then
count = count + 1;
endif;


    /*
if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\报账中心") then
count = count + 1;
endif;     
*/


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\OnlineClaims")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\FinancialManagement")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\BudgetManagement")=1 then
count = count + 1;
endif;     

    if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\CustomerRelationshipManagement")=1 then
count = count + 1;
endif;  

if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1 then
count = count + 1;
if(g_bSetupPDMSelected=TRUE) then 
 count = count + 1;
endif;
endif;


        
    
if FeatureIsItemSelected(MEDIA,"Server\\U8AppServer")=1 then
count = count + 1;
endif;


if FeatureIsItemSelected(MEDIA,"Server\\FileManageServer")=1 then
count = count + 1;
endif;

    if FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")=1 then
count = count + 1;
endif;    

    if FeatureIsItemSelected(MEDIA,"SSDHGZT")=1 || FeatureIsItemSelected(MEDIA,"Client\\SSDHGZT")=1 || FeatureIsItemSelected(MEDIA,"Server\\SSDHGZT")=1 then
count = count + 1;
endif;  
 
    if FeatureIsItemSelected(MEDIA,"RAS")=1 then
count = count + 1;
endif;   

if FeatureIsItemSelected(MEDIA,"PDM")=1 then
count = count + 3;
endif;  
 
return count;
end;

featureselectenvirenment.rul源码



//获取影响到环境监测的 FeatureIs 被添加后,修改对应的检测逻辑.
function STRING StrGetSelectFetureInfluceEnv()
STRING strselectfeatureinflectenv;
begin
     strselectfeatureinflectenv="";
     if FeatureIsItemSelected(MEDIA,"SSDHGZT")=1 || FeatureIsItemSelected(MEDIA,"Client\\SSDHGZT")=1 || FeatureIsItemSelected(MEDIA,"Server\\SSDHGZT")=1 then
strselectfeatureinflectenv=strselectfeatureinflectenv+"SSDHGZT1"+";";


endif;  
     if FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")=1 then
strselectfeatureinflectenv=strselectfeatureinflectenv+"UDYYFW2"+";";
endif;   


     if FeatureIsItemSelected(MEDIA,"PDM")=1 then
strselectfeatureinflectenv=strselectfeatureinflectenv+"PDM"+";";
endif;  
   
     //没有选择PDM 但选择了PDM的安装模式
     if g_bSetupPDMSelected=TRUE&&FeatureIsItemSelected(MEDIA,"PDM")!=1 then
strselectfeatureinflectenv=strselectfeatureinflectenv+"PDMUpdate"+";";
endif;  
 
     return strselectfeatureinflectenv;
end;


global.h 源码

#define RES_WELCOME_DLG_ID     12006   // ID of dialog box itself 
#define RES_DETECTOR_DLG_ID   13002   
#define RES_ENVCHK_DLG_ID     13003    
#define RES_SETUPTYPE_DLG_ID   12033   
#define RES_STARTCOPY2_DLG_ID 12068        
#define RES_WELCOMEMAIN_DLG_ID 13053  


#define RES_SETUPTYPEMODE_DLG_ID   40001  
#define RES_DLG_ID_CHKPORT          50001  
#define RES_DLG_ID_License          60001
#define RES_DLG_ID_SmartClient      30001
#define RES_DLG_ID_SmartTraditionClient   20001




#define RES_ComboBoxSeletClient_ID   40008
#define RES_PBUT_CHECKPORT 15               //端口检测代码
#define RES_TEXT_WEBPORT 1204 //WEB端口
#define RES_TEXT_DATAPORT 1203 //数据端口
#define RES_LBL_WEBPORT 901 //WEB端口上方显示的文字
#define RES_LBL_DATAPORT 1201 //数据端口上方显示的文字






#define RES_PBUT_Try 1401    //立即尝试?
#define RES_TEXT_U8AppIISPort 1402 //SmartClient iis应用服务器端口
#define RES_TEXT_U8AppAdress 1403 //应用服务器地址


#define RES_PBUT_Print 10               //许可协议打印
#define RES_PBUT_edit_license 1305               //许可协议内容
#define  RES_PBUT_checkbox_license  10311  
#define  RES_PBUT_radiobuttonYes_license  10089
#define  RES_PBUT_radiobuttonNo_license  10090


#define  RES_PBUT_checkbox_smartcleint  10322
#define  RES_PBUT_checkbox_Traditionclient  10333




#define RES_PBUT_NEXT         1   // ID of Next button
#define RES_PBUT_CANCEL       9   // ID of Cancel button
#define RES_PBUT_BACK         12   // ID of Back button     
#define UF_README_RESULT  20           
#define CHECK_FOR_CLIENT      1
#define CHECK_FOR_APPSERVER  2
#define CHECK_FOR_DATASERVER  4
#define CHECK_FOR_WEBSERVER   8
#define CHECK_FOR_FILESERVER  16    
#define CHECK_FOR_LICENSESERVER 32   
#define CHECK_FOR_EnterNetServer  64
#define ENVCHECK_DLL SUPPORTDIR^"EnvCheckDLL.dll"
#define SETUPKIT_DLL SUPPORTDIR^"SetupKit.dll" 
#define SETUPKIT2_DLL SUPPORTDIR^"SetupKit2.dll"   
#define SETUPKIT3_DLL SUPPORTDIR^"SetupKit3.dll" 
#define SetupBeforeCpy_DLL SUPPORTDIR^"SetupBeforeCpy.dll"  
#define MSIUI_DLL    SUPPORTDIR^"MSIUI.DLL"
#define MSIFUNCTION_DLL  SUPPORTDIR^"MSIFunction.DLL"   
#define shell32  SUPPORTDIR^"shell32.dll"   
#define UNINSTALL_KEY_NAME "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
#define BACKUP_MSICOUNT 20


#define INSTALLMODULES "SOFTWARE\\Ufsoft\\WF\\V8.700\\Install\\Installed\\"


//金万维引用相关DLL
#define JWWGNMisc_DLL  TARGETDIR^"u8remote"^"GNMisc.dll"




//prototype NUMBER Shell32.ShellExecuteA(NUMBER,BYVAL STRING, BYVAL STRING, NUMBER, NUMBER,BYVAL INT);


prototype NUMBER Shell32.ShellExecuteA(NUMBER,BYVAL STRING, BYVAL STRING,BYVAL STRING, NUMBER ,BYVAL INT);


//环境检测.. 环境检测判断需要安装的第三方组件..
prototype stdcall INT EnvCheckDLL.Modal(LONG,NUMBER,STRING,STRING,STRING,STRING,BOOL);       
prototype EnvCheckDLL.Cleaning(BYVAL STRING);  
prototype EnvCheckDLL.DeleteTargirFilesInformation( STRING, STRING);   
//删除文件和目录.卸载的时候调用,不弹出窗体..
prototype EnvCheckDLL.DeleteTargirFilesSilentNoForm(BYVAL STRING,BYVAL STRING); 
prototype BOOL EnvCheckDLL.HasUFInstalled();
prototype EnvCheckDLL.UFExistedProduction(BYREF STRING);   
prototype INT EnvCheckDLL.Run(BYVAL STRING); 
prototype INT EnvCheckDLL.RunNoBlock(BYVAL STRING);
prototype void EnvCheckDLL.WriteLog(BYVAL STRING, BYVAL STRING);
prototype void EnvCheckDLL.CreateGUID(BYREF STRING);    
prototype void EnvCheckDLL.ClearLogs(BYVAL STRING);    
prototype INT  EnvCheckDLL.RunWithDirectory(BYVAL STRING, BYVAL STRING);   
prototype INT  EnvCheckDLL.RunWithDirectoryNoBlock(BYVAL STRING, BYVAL STRING);
prototype void EnvCheckDLL.ClearAllFiles(BYVAL STRING);   
prototype BOOL EnvCheckDLL.IsEmptyDir(BYVAL STRING);  
prototype void EnvCheckDLL.ClearU8Services(BYVAL STRING);     
//prototype void EnvCheckDLL.ClearU8GAC();    
//prototype void EnvCheckDLL.ClearU8COMPLus();    
prototype BOOL EnvCheckDLL.U8GACExists();
prototype BOOL EnvCheckDLL.MultiCheckUFInstalled(BYVAL STRING);
prototype BOOL EnvCheckDLL.RemoveU8Silent(BYVAL STRING,BYVAL STRING);
prototype NUMBER EnvCheckDLL.setRegPrivilege(BYVAL STRING,BYVAL STRING,BYVAL STRING,BYVAL STRING);
prototype NUMBER EnvCheckDLL.checkMSDTCservice();
prototype BOOL EnvCheckDLL.ExistForbidProc(); 
prototype BOOL EnvCheckDLL.GetCPUClockPerMillisecond(); 
prototype BOOL EnvCheckDLL.GetMemory();
//调用默然打印机
prototype void EnvCheckDLL.PrintLicense(BYVAL STRING);
prototype void EnvCheckDLL.OpenADOReader(BYVAL STRING);
web服务端口检测
prototype BOOL EnvCheckDLL.SmartClientPortCheck(BYVAL STRING,BYVAL STRING);
prototype  string EnvCheckDLL.GetMyLocalMachineName();
//判断是几核的,返回核数
prototype stdcall int EnvCheckDLL.getProcessNumber();
//返回内存总数。
prototype stdcall  int  EnvCheckDLL.getMemorySize();
//获取磁盘分区并返回所有
prototype  void EnvCheckDLL.GetAllDriveStrings(BYVAL STRING);
//读取ini文件
prototype   string  EnvCheckDLL.GetIniFileStr(BYVAL STRING,BYVAL STRING,BYVAL STRING);
//写ini文件  
prototype   string  EnvCheckDLL.WriteIniFileStr(BYVAL STRING,BYVAL STRING,BYVAL STRING,BYVAL STRING);  






prototype void MSIFunction.AddConfigFile(BYVAL STRING, BYVAL STRING);
prototype void MSIFunction.AddInstalledMsi(BYVAL STRING, BYVAL STRING);
prototype void MSIFunction.WriteConfigFile(BYREF STRING, BYVAL STRING);  
prototype void MSIFunction.GetAllDenpendenceMsi(BYREF STRING, BYVAL STRING);  
prototype void MSIFunction.GetAllInstalledMsi(BYREF STRING, BYVAL STRING);  
prototype void MSIFunction.RemoveInstalledMsi(BYVAL STRING, BYVAL STRING);    
prototype void MSIFunction.RemoveConfigFile(BYVAL STRING, BYVAL STRING);   
prototype NUMBER MSIFunction.GetAllInstalledMsiCount(BYVAL STRING);    
prototype NUMBER MSIFunction.GetAllDenpendenceMsiCount(BYVAL STRING);
prototype void MSIFunction.AddReinstalledFile(BYVAL STRING);
prototype void MSIFunction.WriteCACompareDateFile(BYVAL STRING, BYVAL STRING);
prototype BOOL MSIFunction.IsExistCACompareDateFile(BYVAL STRING, BYVAL STRING);
prototype BOOL MSIFunction.IsReinstalledFile(BYVAL STRING);
prototype BOOL MSIFunction.IsWindows2008();








prototype BOOL SetupKit.AdsiCreateWeb(BYVAL STRING,BYVAL STRING,BYVAL STRING,BYVAL STRING,BYVAL BOOL);
prototype BOOL SetupKit.AdsiIsExist(BYVAL STRING);      
prototype BOOL SetupKit.AdsiDeleteWeb(BYVAL STRING);
prototype BOOL SetupKit.AdsiSetMIMEType(BYVAL STRING,BYVAL STRING,BYVAL STRING);    
prototype BOOL SetupKit.AdsiSetHttpErrorPage(BYVAL STRING,BYVAL INT,BYVAL INT,BYVAL STRING);
prototype BOOL SetupKit.AdsiCreatePortalWeb(BYVAL STRING,BYVAL STRING,BYVAL STRING);
prototype BOOL SetupKit.AdsiCreateSubApp(BYVAL STRING,BYVAL STRING,BYVAL STRING);








prototype NUMBER MSIUI.Install(BYVAL STRING, BYVAL STRING, BYVAL STRING,BYVAL BOOL);  
prototype NUMBER MSIUI.Uninstall(BYVAL STRING, BYVAL STRING, BYVAL STRING, BYVAL STRING,BYVAL BOOL,BYVAL BOOL);
prototype NUMBER MSIUI.Reinstall(BYVAL STRING, BYVAL STRING, BYVAL STRING, BYVAL STRING);
prototype NUMBER MSIUI.HideDlg(); 
prototype void MSIUI.SetMsiCount(NUMBER,BYVAL BOOL);
prototype BOOL MSIUI.WriteU8SetupReg(NUMBER);


 
prototype cdecl  NUMBER SetupBeforeCpy.IsDataPortCanUseCheck(BYVAL INT);
prototype cdecl  BOOL SetupBeforeCpy.IsWebPortCanUseCheck(BYVAL INT);


prototype AddUser.AddUser(BYVAL STRING,BYVAL STRING,BYVAL STRING,BYREF STRING);


//金万维相关函数
prototype cdecl BOOL GNMisc.AutoCheckPort(NUMBER);
prototype cdecl BOOL GNMisc.AutoCheckRDPPort(NUMBER);
prototype cdecl void GNMisc.AutoCheckDiskMap(BYVAL STRING);
prototype cdecl void GNMisc.SetSpecifyURLTrustful();
prototype cdecl void GNMisc.LogOffAllOnlineSession();
prototype cdecl void GNMisc.DeleteAllUsers(BYVAL STRING);
prototype cdecl void GNMisc.SetDefPrinter(BYVAL STRING);
prototype cdecl void GNMisc.GNCopyReg(INT,BYVAL STRING,INT,BYVAL STRING);
prototype STRING GNMisc.GetOSName();








prototype BOOL ExFn_FeatureInstall(STRING);
prototype BOOL ExFn_FeatureUninstall(STRING,STRING); 
prototype BOOL ExFn_FeatureReinstall(STRING,STRING);
prototype ExFn_FeatureCheckType();             
prototype ExFn_CreateWeb(STRING, STRING);   
prototype ExFn_SetReg(STRING, STRING);   
prototype ExFn_DelReg(STRING);  
prototype SetPolicyScope();
prototype ResetPolicyScope(); 
prototype SetStrException(); //放开标点符号  
prototype SetMIMETypeForSpusms(); // 解决补丁更新工具 在Vista以上版本打开服务端的WEB服务出现错误
prototype void ExFn_InstallU8CRMApacheService();
prototype ExFn_AddConfigFile(BYVAL STRING);
prototype ExFn_AddInstalledMsi(BYVAL STRING);   
prototype ExFn_AddAllWebs();  
prototype ExFn_InitAllInstalled();   
prototype ExFn_InstallU8Service();
prototype ExFn_UnInstallU8Service();   
prototype ExFn_RegGuid();  
prototype ExFn_Run(STRING);    
prototype ExFn_RunNoBlock(STRING);
prototype ExFn_CmdRun(STRING, STRING);   
prototype void ExFn_FeatureCost();     
prototype BOOL ExFn_MsiInstalled(STRING);    
prototype ExFn_WriteLog(STRING, STRING);      
prototype NUMBER ExFn_FeatureCount();              
prototype void ExFn_ClearLogs();    
prototype void ExFn_RemoveAllDependenceMSi();   
prototype void ExFn_RemoveAllInstalledMSi();
prototype STRING ExFn_GetMsiGuid(STRING);     
prototype void ExFn_EnableAllDir();
prototype void ExFn_ComponentInstall(STRING, STRING);
prototype void ExFn_ComponentUninstall(STRING, STRING);    
prototype void ExFn_RemoveInstalledMsi(STRING);  
prototype void ExFn_RemoveConfigFile(STRING);     
prototype void ExFn_InstallAllDependenceMSi();     
prototype void ExFn_DoBeforeInstall();
prototype void ExFn_DoAfterInstall();
prototype void ExFn_DoBeforeModify();
prototype void ExFn_DoAfterModify(); 
prototype void ExFn_DoBeforeRepair();
prototype void ExFn_DoAfterRepair();   
prototype void ExFn_DoBeforeRemoveAll();
prototype void ExFn_DoAfterRemoveAll();    
prototype BOOL ExFn_HasServerInstall();  
prototype NUMBER ExFn_MsiCount();              
prototype void ExFn_ClearAllFiles();
prototype BOOL ExFn_IsEmptyDir(BYVAL STRING);
prototype void ExFn_DeleteAllWebs();   
prototype void ExFn_ClearAllMsiReg();   
prototype BOOL ExFn_MsiExist();     
prototype void ExFn_ClearExistMsi(BYVAL STRING);     
prototype void ExFn_ClearAllExistMsi();   
prototype void ExFn_FeatureUninstallCost();  
prototype void ExFn_ClearU8Reg(); 
prototype void ExFn_WriteConfigFile(BYREF STRING);
prototype void ExFn_GetAllDenpendenceMsi(BYREF STRING);
prototype void ExFn_GetAllInstalledMsi(BYREF STRING);
prototype NUMBER ExFn_GetAllInstalledMsiCount();
prototype NUMBER ExFn_GetAllDenpendenceMsiCount();
prototype void ExFn_WriteCACompareDateile(STRING);
prototype BOOL ExFn_IsExistCACompareDateFile(STRING);
prototype void ExFn_InstallAllBackupMSi();
prototype void ExFn_RemoveAllBackupMSi();
prototype BOOL ExFn_IsWindows2008();
prototype NUMBER ExFn_SetRegPrivilege(BYVAL STRING,BYVAL STRING,BYVAL STRING,BYVAL STRING);
prototype void ExFn_RegisterSpecialFiles();
prototype void ExFn_ModifyInstallMsi(); 
prototype BOOL ExFn_CheckDirName(BYVAL STRING);
prototype BOOL ExFn_SetApplicationPool(BYVAL STRING);
prototype void ExFn_RemoveFrontBlanks(byref string);
prototype void ExFn_CheckForbidProc(); 
export prototype EnableDirectoryACL(BYVAL STRING);
//设置Windows Server 2008/Windows 7 不会自动配置WCF在IIS中的映射处理程序.
prototype void ExFn_SetWCFInIISMapping();
//在迁移完数据后执行相关操作.
prototype void ExFn_OnMovedExcuted(); 
//添加U8插件模块
prototype void ExFn_SetModuleAboutPlugIn();
//删除 U8插件模块
prototype void ExFn_DeleteModuleAboutPlugIn();
//设置操作相关安全属性
prototype   SetOsSafeControl(); 
// 解决WIN2008 WIN7反复卸载后安装出现 无法打开项 UNKNOWN\Components 的问题。
prototype   SetOSWin2008Win7InstallMsiProblem();   
//解决登陆门户比较慢的问题 Windows 2008,windows 7,windows vista要执行 netsh interface tcp set global autotuninglevel=disabled
prototype   ExcuteNetShImproveEfficiency(); 
//删除任务管理器中存在的进程
prototype void ExFn_TaskKillProcess(BYREF STRING);
//注册表赋予管理员组的完全控制权限    
prototype  GrantprivilegeToRegister(BYREF STRING);   
// 安装前,确认所有的U8的服务是关闭的,如果不是关闭,关闭U8的所有的服务
prototype StopU8Allservices();
//停止服务   
prototype StopServiceU8(STRING); 
//启动服务
prototype StartServiceU8(STRING); 
//sc delete 删除服务
prototype DeleteServiceU8(STRING); 
//卸载平台包的时候停止平台包中含有的服务
prototype StopPaltframeServices();
 //卸载平台包的时候删除平台包中含有的服务
prototype DeletaPaltframeServices();
//彻底删除MSI包残留的信息  
prototype void ExFn_AbsoluteDeleteMsi(STRING);  
//删除应用服务器所有MSI包的信息 
prototype void   ExFn_AbsoluteDeleteAppserverMsi();    
//设置 IIS 指定应用程序池要使用的帐户标识 。
prototype SetapplicationPoolsidentityType();  
//解决 BM 打开分析表查询,然后打开执行分析表设计后在切换到分析表查询显示错误
prototype Settreeviewhtcfilereplace();  
//有些微软的系统文件卸载MSI包后需要重新的进行注册。
prototype ReverseRegisterSystemfolderFiles(); 
//卸载后删除快捷方式图标。
prototype DeleteFolderShortCutICON();  
 //BS门户站点启用GZip压缩
prototype SetBsPortalStartGZip();  
//停止进程中 taskkill /im msiexec.exe    
prototype StopMsiexecInTaskKill(); 
//卸载所有的补丁。 
prototype UnintallPatchMsis();    


//彻底删除所有64,32位注册表项目
prototype void  ExFn_DelALLU8Registers();
          
//添加删除快捷方式
prototype void  DeleteAddShortCut();


//删除没有删除掉的快捷方式卸载使用
prototype  void DeleteShortCutAfterRemoveall();


//端口检测.
prototype NUMBER ExFn_CheckPort(STRING);


//智能客户端提示界面相关配置。
prototype NUMBER ExFn_SmartClientDialog(STRING);


//智能客户端提示界面相关配置。
prototype NUMBER ExFn_SmartTraditionClientDialog(STRING);


//是否WEB端口可以使用
prototype  BOOL ExFn_IsWebPortCanUseCheck(BYVAL INT);


//是否数据端口可以使用
prototype  NUMBER ExFn_IsDataPortCanUseCheck(BYVAL INT);  


//修改科迈相关配置.
prototype void ExFn_KMRemoteSet(BYREF STRING,NUMBER,NUMBER,BYREF STRING,BYREF STRING,BYREF STRING);


//regasm.exe /tlb 导出TLB 文件并注册.
prototype void  ExFn_RegasmTlb(BYREF STRING,BYREF STRING);  


prototype void  ExFn_Regasm40Tlb( STRING, STRING); 


//删除目录和目录下的文件
prototype void  ExFn_DELETEDirAndFiles(BYREF STRING);


//删除给出的目录;
prototype void  ExFn_ALLDELETEDirAndFiles();


//复制adsutil.vbs IIsExt.vbs 到对应的目录下 在WIN8系统没有此文件.
prototype void  IISsetvbsCopy(BYREF STRING);


//在64位系统中添加64位的注册表信息..
prototype  AddRegisterIn64();  


//卸载是删除添加的脚本命令项目
prototype UnSetupScriptconfig();   


//添加远程接入的注册表项目...              
prototype void AddRasRegister(); 
//删除远程接入的注册表项目...              
prototype void  RasDelRASRegister();   
prototype void   ExFn_DelALLRetainFils(); 


//判断是否是安装过科迈的产品..
prototype BOOL IsSetUpRas();  


//卸载经典模式的时候判断是不是提供给U8的专版本科迈
prototype BOOL IsSpecialRas();


//安装U8经典单独卸载提供给U8的专版科迈(作为U8的一个模块来卸载) 
prototype void UninstallForU8SpecialRas(); 


prototype void SetFTHRegister();    


//复制VS2011运行时       
prototype void CopyVS2011RuntimeDLL();    


设置服务超时时间   2013-08-27 lizheng liyong        
prototype void SetServiceTimeOut();


//回滚的时候设置进度条的递减数值...
prototype void SetUpRollback(INT);


//卸载的时候执行进度条的递增数值...
prototype void SetUpUnistallIncrease(INT);


//安装实施导航,需要进行注册表注册,添加OFFICE插件注册表项目.
prototype void AddOfficeSetupQSSSRegister();


//删除添加的注册表 OFFICE 插件给实施导航使用.
prototype ExFn_OfficeSetupQSSSRegister();


//添加远程接入科迈的注册表...在防火墙例外加入6222端口为安装端口 
prototype AddFireWarePortRasRegister(BYREF STRING);


//获取影响到环境监测的 FeatureIs 被添加后,修改对应的检测逻辑.
prototype STRING StrGetSelectFetureInfluceEnv();


//添加移动应用服务  到系统环境变量中.
prototype void SetJavaHomeEnvPath();


//添加 PDM  JAVA_HOME 到系统环境变量中.
//  Setx /M JAVA_HOME ""
//prototype void SetPDMJavaHomeEnvPath();


//添加PDM注册表项目//
prototype void AddPDMRegister();


//删除PDM的注册表项目...              
//prototype void PDMDelPDMRegister();


//添加PDM对应的多语言快截方式.
//prototype void AddPDMShortCut();


//  Setx /M JAVA_HOME ""
//prototype void SetMaServerJavaHomeEnvPath();


//判断是否是老版本的PDM
prototype INT CompareIsOlderPDMVersion();


//判断是否是老版本的PDM
prototype void CompareIsOlderPDMAndPrompt();


//获取终端服务端口
//prototype STRING GetRASServicePort();


//卸载COM+组件..
prototype void UnistallCOMPlusMsi();


//设置MSDTC 的安全配置 设置 网络DTC访问
prototype void SetDtcSecturity();


//恢复初始时候的端口为3389
prototype void SetRemotePortalToRetain();


//配置Apache 服务给ISD读取加密信息使用..
prototype void ConfigureApacheServiceToIsd();


//卸载的时候恢复PDM7.6的JDK的环境变量设置..
prototype void UninstallReSetJavaHomeEnvPath();


//解决 如果后安装CAD 打开U8的时候,点记都会出现安装CAD 的问题.
prototype void ExFn_RegisterCadBUG();




//修改 Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System 注册表项下面的 EnableLUA 的注册表值,将值从1改为0
//修改UAC的权限,降低下,方便注册表的读写..
prototype void  SetUAC();


//启动错误报告机制
prototype void  SetDontshowUI();


//判断虚拟目录存在,删除虚拟目录.
prototype DeleteVirtual(string);


//添加用友隐私权政策的条款在许可协议中
prototype NUMBER ExFn_SdLicenseSelf();


//删除注册表设置隐私权协议.
prototype ExFn_DelPrivacy();


//解决 Windows 10上打开单据无响应的问题
prototype void ExFn_RegisterMsvbvm60();


//解决WIN10 SENDKEY 卡死问题.
prototype void SetUACBack();


prototype void ExFn_SetUpSoapsdk();


//卸载 soapsdk.msi
prototype void ExFn_UnistallSoapsdk();


//删除web站点进行应用程序池
prototype BOOL ExFn_DELETEApplicationPool(BYVAL STRING);


//删除所有历史遗留应用程序池..
prototype void ExFn_DeleteAllAppPool();


//设置web站点进行应用程序池为U8SLApplicationAppPool
prototype BOOL ExFn_SetApplicationPoolU8SL(BYVAL STRING);
//TI 发票管理
//设置web站点进行应用程序池为U8TIApplicationAppPool
prototype BOOL ExFn_SetApplicationPoolU8TI(BYVAL STRING);




prototype ExFn_SetRegByVaule(STRING, STRING,STRING);




//UAP智能输入功能
prototype ExFn_SetUAPRegByVaule(STRING,STRING);


//添加智能安装服务,对纯客户端的安装模式添加
prototype ExFn_InstallSmartClientService();


//基于以前安装进行的重新启动已挂起
prototype ExFn_SetReStartTip();


//创建服务只有安装客户端的时候进行创建
prototype CreateServiceSmartClientOnlySetUpClient();


 //sc create 创建服务
prototype CreateService(STRING);
prototype CopyServiceFile(STRING);




//iis相关设置
//设置TISERVICE的默认程序池的属性和相关设置
prototype void SetTiServicePoolProperty();
//设置IIS 64位下兼容32位程序
prototype void ExFn_SetEnable32BitAppOnWin64();
//更改应用程序池
prototype void ExFn_UpdateApplicationPools();
//设置IIS运行环境
prototype void ExFn_SetIISEnvirment();
//设置web站点进行应用程序池为ExFn_SetApplicationPoolWebApppool
prototype BOOL ExFn_SetApplicationPoolWebApppool( STRING, STRING);
prototype void ExFn_AttachAppPool( STRING, STRING);
//恢复默认的经典和默认应用程序池的.NET版本为2.0
prototype void ExFn_RevertApppoolToNet20();
prototype void SetWebApiServicePoolProperty();




prototype void ExFn_MsiInstallParam(BYREF STRING,BYREF STRING,STRING); 
prototype void ExFn_MsiUninstallParam(BYREF STRING,BYREF STRING,STRING,STRING);
prototype void ExFn_MsiReinstallParam(BYREF STRING,BYREF STRING,STRING,STRING);
prototype void ExFn_InstallU8SLSVR();
prototype BOOL SetupKit2.InstallU8SLSVR();
prototype void SetupKit2.DisableAutotuning();


//删除对应的快截方式 只安装EIS的时候 移动引用服务器.
prototype void DeleteShortCutByEis();
//删除所有虚拟目录..只保留EIS
prototype void ExFn_DeleteWebsOnlyRetainEis();


//获取机器名称
prototype string GetlocalMachineName();


//判断是否安装过智能客户端,如果安装提示
prototype BOOL CheckIsInstallU8SmartClient();
//U8V15.0 yangli提出修改 64为放SYSTEM32下
prototype void CopySystemWOW64ToSYStem32();
prototype ExFn_Set870DownReg( STRING, STRING, STRING);


 //创建金万维服务
prototype void CreateServiceJWW();
 //添加金万维注册表远程接入           
prototype void AddJinWanWeiRegister();
//删除金万维第一部分注册表
prototype void DeleteJinWanWeiRegister();
//添加金万维服务第二部分
prototype void AddSecondJinWanWeiRegister();
//删除金万维服务第二部分
prototype void DeleteSecondJinWanWeiRegister();
//添加金万维服务第三部分
prototype void AddThirdJinWanWeiRegister();
//复制金万维驱动文件
prototype void CopyJinWanWeiDriversFiles();
//导入注册表ODBCFix1.reg 和 ODBCFix2.reg
prototype void ImportRegisterfileJWW();
//执行金万维其它的设置命令
prototype void JWWCmdCommandExcute();
//判断是否是安装过金万维的产品..
prototype BOOL IsSetUpJww();
//添加金万维对应的快截方式.
prototype void AddJWWShortCut();
//是否WEB端口可以使用
prototype  BOOL JWWIsWebPortCanUseCheck(INT);
//客户输入的RDP端口
prototype  BOOL JWWIsRDPPortCanUseCheck(INT);
prototype  BOOL JWWAutoCheckDiskMap();
prototype  BOOL JWWSetSpecifyURLTrustful();
//卸载执行
prototype  BOOL JWWUninstallLogOffAllOnlineSession();
prototype  BOOL JWWUninstallDeleteAllUsers();
//虚拟打印机安装
//$INSTDIR\GNMisc.dll::SetDefPrinter("GNPrinter");
//prototype  BOOL JWWSetDefPrinter();
prototype  BOOL JWWInstallPrinter();
prototype  void MemcacheRunservice();
//金万维注册表复制处理。
prototype void GWWGNCopyRegDealWith();
//根据操作系统设置相关设置
prototype void SetJWWWindowsSettingByWindowsVersion();
//设置WIN10金万维注册表设置
prototype void SetingJWWWIN10();
//设置金万维注册表设置 "Windows Server 2012 R2" 
prototype void SetingJWWWIN2012R2();
//设置金万维注册表设置 "Windows Server 2008R2" 
prototype void SetingJWWWin2008R2();
//设置金万维注册表设置 "Windows Server 2008" 
prototype void SetingJWWWin2008();
//设置金万维注册表设置 "Windows 2003" 
prototype void SetingJWWWin2003();
//设置金万维注册表设置 WIN7以上
prototype void SetingJWWWin7UP();
//删除端口号
prototype void DeleteJWWWRemotePort();
//设置金万维注册表设置Windows Server 2016
prototype void SetingJWWWIN2016();
//卸载U8后执行卸载金万维相关设置
prototype void UninstallJWWAfterRemove();
prototype void ExcuteGNESLSetupSetWebPortRdpPort();




//获取系统磁盘并判断空间决定是否使用
prototype LIST ExFn_GetSystemDisk();
//判断可以使用的分区,剩余空间在8G以上的磁盘分区
prototype LIST GetCanUseDisk(); 
prototype LIST GetEliminateSystemDisk();




//判断是否是纯客户端
prototype BOOL IsOnlySetUpClient();
//如果是纯客户端删除不应该存在的快捷方式
prototype void DeleteShortCutByOnlyInstallClient();
//如果是非加密服务器删除不应该存在的快捷方式
prototype void DeleteShortCutByOnlyInstallLicenseServer();
//U8V15.0 yangli提出 删除安装到 64为放SYSTEM32下文件
prototype void DeleteSYStem32FilesInstall();
//U8V15.0电商提出删除对应的login文件,由于define2中的removefile  CAREMOVE="NO"导致不能执行删除需要使用命令删除
prototype void DeleteEBLonginFiles();




BOOL g_bIsDeugU8;
BOOL   g_bCnSelected;  
//是否科迈被选择..
BOOL   g_bSetupmodeleSelected;
//是否PDM被选择.
BOOL   g_bSetupPDMSelected;
BOOL   g_bTwSelected;
BOOL   g_bEnSelected;           
BOOL   g_bNeedReboot;   
BOOL   g_bInstallLog;        
NUMBER g_nSetupType;   
BOOL   g_bDependenceInstall;
BOOL   g_bIsRollBack;
BOOL   g_bIsLoadMSUI;
BOOL   g_bIsLoadMSIFuction; 
BOOL   g_bIsShowNoBar; 
BOOL   g_bNoEnvCheck;
BOOL   g_bDebug;
BOOL   g_bNoCleaning;
//是否是只选择EIS,其它没有选择
BOOL g_isonlyeisselect;
NUMBER g_bSystemlangid;  
INT    g_statusprocesscurentvalue;  
//是否安装过远程接入.
BOOL g_bISinstallRemoteImport;






//是否安装过金万维远程接入.
BOOL g_bISinstallRemoteImportJWW;








//卸载进度条显示尺寸
NUMBER g_bprogressnumber;


BOOL gb_FirstShowChkPort;
//读取操作系统如果是Server版本不让安装科迈..
BOOL g_bIsServerIOS;


STRING g_svSetupModeType;
prototype LONG KERNEL.GetExitCodeProcess(LONG, LONG);   
prototype INT Kernel32.GetSystemDirectory(BYREF STRING,BYVAL INT); 


LONG m_CheckType;
STRING m_WinDir;
STRING g_DiskUsage; 


//科迈设置的数据端口和WEB端口..
NUMBER g_KMDataport;
NUMBER g_KMWebport;
NUMBER g_JWWRemotePort;


//获取影响到环境检测的构件..
string g_strselectfeatureinflectenv;
//安装模式....
string g_installmode;
//安装类型
string g_setuptype;



install.rul 源码



function BOOL ExFn_FeatureInstall(msiName)
STRING applicationPath, msiPath;
NUMBER iRetCode; 
STRING cmdStr;      
STRING logFile;
begin   
if msiName != "" then   
ExFn_MsiInstallParam(cmdStr,logFile,msiName);
ExFn_WriteLog("Install "+SRCDIR^"MSI\\"+msiName, cmdStr + " "+ logFile);
if(g_bDebug) then
return TRUE; //Added for debug
endif;
//iRetCode = 0;
if(g_bIsDeugU8!=TRUE) then 
 iRetCode = Install(SRCDIR^"MSI\\"+msiName, cmdStr, logFile,g_bIsShowNoBar);  
endif;
if iRetCode != 0  && iRetCode != 3010 then
if iRetCode == 1619 then
ExFn_WriteLog("Error install",msiPath + " is not exist!");
elseif iRetCode == 1602 then
ExFn_WriteLog("Error install",msiPath + " cancel by user!");
abort;
elseif iRetCode == 1620 then
MessageBox(@IDS_NETWORKERROR,SEVERE);  
abort;
elseif iRetCode == 112 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_STR_LACK_SYSDISK+"ExitCode is %d", iRetCode);
elseif iRetCode == 2203 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_StrVirOccupy+"ExitCode is %d", iRetCode);   
else 
//SprintfBox(INFORMATION, "ExitCode", "ExitCode is %d", iRetCode);
abort;
endif;
endif;  
if iRetCode == 3010 then
g_bNeedReboot = TRUE;
ExFn_WriteLog(msiName, " needs reboot after installed!");
endif;
if iRetCode == 0 || iRetCode == 3010 then
return TRUE;
else
return FALSE;
endif;
endif;   
end;




function BOOL ExFn_FeatureReinstall(msiName,guid)
STRING applicationPath;
NUMBER iRetCode;
string cmdStr;  
string logFile;
BOOL isretainfile;
begin  
    UseDLL(MSIFUNCTION_DLL);
     isretainfile= IsReinstalledFile(msiName); 
    UnUseDLL(MSIFUNCTION_DLL);                   
if isretainfile == TRUE then 
ExFn_WriteLog("Skip reinstall with ", msiName);
return FALSE;
endif;

if msiName != "" then
        ExFn_MsiReinstallParam(cmdStr,logFile,msiName,guid);
ExFn_WriteLog("Reinstall "+msiName+" "+guid, cmdStr + " "+ logFile); 
if(g_bDebug) then
return TRUE; //Added for debug 
endif;
//iRetCode = Reinstall(msiName, guid, cmdStr, logFile);
if(g_bIsDeugU8!=TRUE) then
  iRetCode = Install(SRCDIR^"MSI\\"+msiName, cmdStr, logFile,g_bIsShowNoBar); 
endif;
if iRetCode != 0 && iRetCode != 3010 then
if iRetCode == 1619 || iRetCode == 1605 then
ExFn_WriteLog("Error Reinstall",msiName + " is not exist!");
elseif iRetCode == 1602 then
ExFn_WriteLog("Error Reinstall",msiName + " cancel by user!");
abort;
elseif iRetCode == 112 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_STR_LACK_SYSDISK+"ExitCode is %d", iRetCode);
elseif iRetCode == 2203 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_StrVirOccupy+"ExitCode is %d", iRetCode);
else 
SprintfBox(INFORMATION, "ExitCode", "ExitCode is %d", iRetCode);
abort;
endif;
endif;


if iRetCode == 3010 then
g_bNeedReboot = TRUE;
ExFn_WriteLog(msiName, " needs reboot after uninstalled!");
endif;

if iRetCode == 0 || iRetCode == 3010 then 
 UseDLL(MSIFUNCTION_DLL);
AddReinstalledFile(msiName);
 UnUseDLL(MSIFUNCTION_DLL);
 return TRUE;
else
return FALSE;
endif;
endif;
end; 




function BOOL ExFn_FeatureUninstall(msiName,guid)
STRING applicationPath;
NUMBER iRetCode;
string cmdStr;  
string logFile;
begin                           
if msiName != "" then
ExFn_MsiUninstallParam(cmdStr,logFile,msiName,guid);        
ExFn_WriteLog("UnInstall "+msiName+" "+guid, cmdStr + " "+ logFile);
if(g_bDebug) then
return TRUE; //Added for debug
endif;
if(g_bIsDeugU8!=TRUE) then
  iRetCode = Uninstall(msiName, guid, cmdStr, logFile,g_bIsShowNoBar,g_bIsRollBack);
endif;
if iRetCode != 0 && iRetCode != 3010 then
if iRetCode == 1619  then
ExFn_WriteLog("Error uninstall",msiName + " is not exist!");
elseif iRetCode == 1602 then
ExFn_WriteLog("Error uninstall",msiName + " cancel by user!");
elseif iRetCode == 1605 then
ExFn_WriteLog("Error uninstall",msiName + " may be uninstalled!1605");
if ExFn_MsiInstalled(guid) == TRUE then
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    RegDBDeleteKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + guid);
endif;
elseif iRetCode == 112 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_STR_LACK_SYSDISK+"ExitCode is %d", iRetCode);
elseif iRetCode == 2203 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_StrVirOccupy+"ExitCode is %d", iRetCode);
else 
SprintfBox(INFORMATION, "ExitCode", "ExitCode is %d", iRetCode);
abort;
endif;
endif;


if iRetCode == 3010 then
g_bNeedReboot = TRUE;
ExFn_WriteLog(msiName, " needs reboot after uninstalled!");
endif;

if iRetCode == 0 || iRetCode == 3010 then
return TRUE;
else
return FALSE;
endif;
endif;
end;                        
                        
function void ExFn_ComponentInstall(msiName, guid)
STRING svResult;
string sRegKey,sKeyValue;
number nvType,nvSize;
BOOL isu8setupreg;
begin

//设置安装状态注册表
  ExFn_WriteLog("set u8setup registy","SOFTWARE\\Microsoft\\Windows\\u8setup = 1");
    isu8setupreg=WriteU8SetupReg(1);
  if(isu8setupreg = FALSE) then
  ExFn_WriteLog("Write registy error","1");
  endif;
 

if g_nSetupType == MODIFY then    
ExFn_WriteLog("MODIFY install with ", msiName);
if ExFn_MsiInstalled(guid) == TRUE then   
if (msiName % "COMMON") then
   ExFn_WriteLog("Skip reinstall with ", msiName);
return;
endif;
ExFn_FeatureUninstall(msiName, guid);               
svResult = msiName;
StrReplace ( svResult, ".msi", ".config", 0); 
DeleteFile(TARGETDIR^"Installer\\"+svResult);
ExFn_WriteLog("Delete config file: ", TARGETDIR^"Installer\\"+svResult); 
endif;
ExFn_FeatureInstall(msiName); 
elseif g_nSetupType == REPAIR then
ExFn_FeatureReinstall(msiName,guid);
else
if ExFn_MsiInstalled(guid) == FALSE then
ExFn_FeatureInstall(msiName);    
else
ExFn_WriteLog(msiName+" have already installed", "with "+guid);
endif;
endif;
end;  


function void ExFn_ComponentUninstall(msiName, guid)
begin
if g_nSetupType == MODIFY then  
ExFn_WriteLog("MODIFY uninstall with ", msiName);
if (msiName % "COMMON") then
   ExFn_WriteLog("Skip uninstall with ", msiName);
return;
endif;
endif;

if ExFn_MsiInstalled(guid) == TRUE then
ExFn_FeatureUninstall(msiName, guid);  

   //执行回滚进度条递减操作..
   SetUpRollback(1);
   卸载的时候执行进度条的递增数值...
   SetUpUnistallIncrease(1);
   
else
ExFn_WriteLog(msiName+" havn't installed", "with "+guid);
endif;
end;     


function ExFn_AddConfigFile(xmlName)
begin
    ExFn_WriteLog("ExFn_AddConfigFile",xmlName); 
    UseDLL(MSIFUNCTION_DLL);                    
 AddConfigFile(SRCDIR^"\\MSI\\" + xmlName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);
ExFn_WriteLog("ExFn_AddConfigFile",xmlName); 
end;


function ExFn_AddInstalledMsi(msiName)
begin   
    ExFn_WriteLog("ExFn_AddInstalledMsi-msiName",msiName);            
    ExFn_WriteLog("ExFn_AddInstalledMsi-TARGETDIR",TARGETDIR);
    UseDLL(MSIFUNCTION_DLL);               
 AddInstalledMsi(msiName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);
ExFn_WriteLog("ExFn_AddInstalledMsi","end");   
end;                        
       
//----------------- old ---------------------


function void ExFn_WriteConfigFile(msiName)
begin 
    ExFn_WriteLog("ExFn_WriteConfigFile","start");  
    UseDLL(MSIFUNCTION_DLL);    
      WriteConfigFile(msiName,TARGETDIR);    
    UnUseDLL(MSIFUNCTION_DLL);    
ExFn_WriteLog("WriteConfigFile msiName::TARGETDIR",msiName+"::" +TARGETDIR);  
ExFn_WriteLog("ExFn_WriteConfigFile","end");  
end;  
//


function void ExFn_GetAllDenpendenceMsi(msiName)
begin 
    ExFn_WriteLog("ExFn_GetAllDenpendenceMsi","start"); 
    UseDLL(MSIFUNCTION_DLL);                 
 GetAllDenpendenceMsi(msiName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);    
ExFn_WriteLog("ExFn_GetAllDenpendenceMsi","end"); 
end;


function void ExFn_GetAllInstalledMsi(msiName)
begin 
    ExFn_WriteLog("ExFn_GetAllInstalledMsi","start"); 
    UseDLL(MSIFUNCTION_DLL);               
 GetAllInstalledMsi(msiName,TARGETDIR);
    UnUseDLL(MSIFUNCTION_DLL);    
ExFn_WriteLog("ExFn_GetAllInstalledMsi","end"); 
end;


function NUMBER ExFn_GetAllInstalledMsiCount()  
NUMBER result;
begin
    ExFn_WriteLog("获取所有MSI的个数 ExFn_GetAllInstalledMsiCount ",TARGETDIR);   
    UseDLL(MSIFUNCTION_DLL);                 
      result = GetAllInstalledMsiCount(TARGETDIR);
    UnUseDLL(MSIFUNCTION_DLL); 
    ExFn_WriteLog("ExFn_GetAllInstalledMsiCount","end"); 
return result;
end;       


function NUMBER ExFn_GetAllDenpendenceMsiCount()
NUMBER result;
begin  
    ExFn_WriteLog("ExFn_GetAllDenpendenceMsiCount","start"); 
    UseDLL(MSIFUNCTION_DLL);             
 result = GetAllDenpendenceMsiCount(TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL); 
ExFn_WriteLog("ExFn_GetAllDenpendenceMsiCount","end"); 
return result;
end;


function void ExFn_WriteCACompareDateile(msiName)
begin
    ExFn_WriteLog("ExFn_WriteCACompareDateile","start"); 
    UseDLL(MSIFUNCTION_DLL);                         
 WriteCACompareDateFile(msiName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL); 
ExFn_WriteLog("ExFn_WriteCACompareDateile","end"); 
end;


function BOOL ExFn_IsExistCACompareDateFile(msiName)
begin 
    ExFn_WriteLog("ExFn_IsExistCACompareDateFile","start"); 
      UseDLL(MSIFUNCTION_DLL);                       
   IsExistCACompareDateFile(msiName,TARGETDIR);
 UnUseDLL(MSIFUNCTION_DLL); 
ExFn_WriteLog("ExFn_IsExistCACompareDateFile","end"); 
end;


function BOOL ExFn_IsWindows2008()
BOOL bIsWindows2008;
begin                       
UseDLL(MSIFUNCTION_DLL);
 bIsWindows2008 = IsWindows2008();
UnUseDLL(MSIFUNCTION_DLL);
return bIsWindows2008;

end;
//-----------------


function void ExFn_RemoveInstalledMsi(msiName)
begin  
    ExFn_WriteLog("start","ExFn_RemoveInstalledMsi");
if g_nSetupType == MODIFY then    
   UseDLL(MSIFUNCTION_DLL); 
 RemoveInstalledMsi(msiName,TARGETDIR);  
UnUseDLL(MSIFUNCTION_DLL);               
endif;
ExFn_WriteLog("end","ExFn_RemoveInstalledMsi");
end;


function void ExFn_RemoveConfigFile(xmlName)
begin
    ExFn_WriteLog("start","ExFn_RemoveConfigFile");
if g_nSetupType == MODIFY then   
   UseDLL(MSIFUNCTION_DLL); 
 RemoveConfigFile(SRCDIR^"\\MSI\\" + xmlName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);      
endif;
ExFn_WriteLog("end","ExFn_RemoveConfigFile");
end;


function void ExFn_DoBeforeInstall()    
NUMBER nMsiCount;
STRING msiStr;
begin
    ExFn_WriteLog("start","ExFn_DoBeforeInstall");
//-----判断能否创建installer目录-------
  if (ExistsDir (TARGETDIR^"Installer") != EXISTS) then
  if (CreateDir (TARGETDIR^"Installer") < 0) then 
  MessageBox ("Unable to create directory", SEVERE);
            abort;
        endif;
    endif;
  //------------
//CreateDir(TARGETDIR^"Installer"); 
ExFn_ClearLogs();
    //停止U8的所有的启动服务。
    StopU8Allservices();
  ExFn_RegGuid();
  if g_bInstallLog then
    if RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE) = 0 then
  RegDBCreateKeyEx("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\EnableLogs", "");
   endif;   
  endif;  
  ExFn_PreSetRegs(); 
 
  ExFn_WriteLog("start","ExFn_MsiCount");
  ExFn_MsiCount(); 
  ExFn_WriteLog("end ","ExFn_MsiCount");

//反注册执行时间太长
//ExFn_Run("regsvr32.exe /u " + WINSYSDIR^"mscomctl.ocx" +" /s");
    ExFn_Run("regsvr32.exe " + WINSYSDIR^"mscomctl.ocx" +" /s");


//UseDLL(ENVCHECK_DLL);
  nMsiCount = ExFn_GetAllInstalledMsiCount();
  msiStr = "";
  ExFn_WriteConfigFile(msiStr);
  nMsiCount += ExFn_GetAllDenpendenceMsiCount();
  SetMsiCount(nMsiCount,FALSE);
  ExFn_WriteLog("end","ExFn_DoBeforeInstall");
end;


function void ExFn_RegisterSpecialFiles()
string szKey;
begin
UseDLL(ENVCHECK_DLL);
Run("regsvr32.exe " + WINSYSDIR^"scrrun.dll" +" /s");
Run("regsvr32.exe " + WINSYSDIR^"CellCtrl5.dll" +" /s");
Run("regsvr32.exe " + "\"" + TARGETDIR^"ZPTD\\bin\\"+"WriteXls.ocx" + "\"" +" /s");
Run("regsvr32.exe " + "\"" + TARGETDIR^"ZPTD\\bin\\"+"ReadXls.ocx" + "\"" +" /s");
Run("regsvr32.exe " + "\"" + WINDISK+"\\"+"Program Files\\Common Files\\System\\ado\\"+"msado15.dll" + "\""+" /s");
Run("regsvr32.exe " + "\"" + WINDISK+"\\"+"Program Files\\Common Files\\System\\ado\\"+"msadox.dll" + "\""+" /s");
UnUseDLL(ENVCHECK_DLL);

//wangkai3@ufida.com.cn
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey="SoftWare\\Classes\\CLSID\\{E7A1B208-06E8-45E0-8BCD-FCAB8BA7EE3F}\\InprocServer32";
RegDBSetKeyValueEx(szKey, "ThreadingModel", REGDB_STRING,"Apartment",-1);
end;


function void ExFn_DoAfterInstall()  
string svValue,svValue2;   
string szKey; 
string  szReportPath; 
string svResult; 
string svfileexist;
string svu8path,svkmlocalserverip,svsystemlanuage,svkmversion;
BOOL iseisonly;
begin


if (FindFile(WINSYSDIR, "InstWiz3.exe", svValue) = 0) then
ExFn_Run(WINSYSDIR^"InstWiz3.exe" +  " /nogui");
endif;
Delay(1);


    //复制文件.U8FileServerExtendProc.dll 到64为系统的system32下... 有的环境会丢失..
Disable(LOGGING);
 Disable(WOW64FSREDIRECTION);
   if (FindFile(WINSYSDIR,"U8FileServerExtendProc.dll", svfileexist) < 0&&SYSINFO.bIsWow64 != 0) then 
          XCopyFile (WINSYSDIR+"\\U8FileServerExtendProc.dll",m_WinDir+"\\system32\\", COMP_NORMAL);
        endif;
        CreateDir(m_WinDir+"\\system32\\config\\systemprofile\\Desktop");
       Enable(WOW64FSREDIRECTION);
     Enable(LOGGING); 
     
     
//设置进度条显示状态 创建服务
StatusUpdate( ON, 96);
SetStatusWindow(96, @ID_CreatingVirtualAddService);

if(!g_bDebug) then 
    ExFn_RegisterSpecialFiles();
     endif;
//放开标点符号  
SetStrException();  // ZHAOYIN 要求注册表BadStrException项是当初890补丁同步时给测试加上的,出上市盘不需要保留,请把这个键值去掉
if(!g_bDebug) then
    ExFn_EnableAllDir();  
    endif;
    //资源\英文   下迁移过来
解决 BM 打开分析表查询,然后打开执行分析表设计后在切换到分析表查询显示错误
//提前处理为了最后处理感觉安装完好像安装停止一样。
Settreeviewhtcfilereplace(); 
//复制adsutil.vbs IIsExt.vbs 到对应的目录下 在WIN8系统没有此文件. 
IISsetvbsCopy(m_WinDir);
if(!g_bDebug) then
        ExFn_AddAllWebs();
    endif; 
    SetapplicationPoolsidentityType();   
    //设置Windows Server 2008/Windows 7 不会自动配置WCF在IIS中的映射处理程序
SetMIMETypeForSpusms();

SetBsPortalStartGZip(); 
ReverseRegisterSystemfolderFiles(); 
 
ExFn_FeatureCheckType();  

添加智能安装服务,对纯客户端的安装模式添加

ExFn_InstallSmartClientService();


if m_CheckType & (CHECK_FOR_DATASERVER | CHECK_FOR_APPSERVER | CHECK_FOR_WEBSERVER | CHECK_FOR_LICENSESERVER | CHECK_FOR_FILESERVER | CHECK_FOR_EnterNetServer) then  
 if(!g_bDebug) then
ExFn_InstallU8Service();
 endif;   
endif;  
 
//设置MSDTC 的安全配置 设置 网络DTC访问
SetDtcSecturity();
 
//设置进度条显示状态
StatusUpdate( ON, 97);
SetStatusWindow(97, @ID_SETSystemEnv);
      
     //支持64bit操作系统,zhengyun要求
     if ( SYSINFO.bIsWow64 != 0 ) then
      ExFn_WriteLog("","the operation system is 64bit");
    if (FindFile(TARGETDIR^"UFServerMgr", "UFSoft.U8.Framework.Repair64Processor.UI.exe",svValue) = 0) then
ExFn_Run(TARGETDIR^"UFServerMgr\\UFSoft.U8.Framework.Repair64Processor.UI.exe");
ExFn_WriteLog("","Running the UFSoft.U8.Framework.Repair64Processor.UI.exe");
endif;
endif; 
 
if m_CheckType & (CHECK_FOR_DATASERVER | CHECK_FOR_APPSERVER) then
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;   
/*
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
if (RegDBSetKeyValueEx(szKey, "U8Installer", REGDB_STRING,TARGETDIR^"Installer\\SetupConfigure.exe",-1) = 0) then
  ExFn_WriteLog("SetupConfigure.exe ","RunOnce Success");    
else
   ExFn_WriteLog("SetupConfigure.exe ","RunOnce False"); 
endif; 
*/
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run";
if (RegDBSetKeyValueEx(szKey, "U8Installer", REGDB_STRING,TARGETDIR^"Installer\\SetupConfigure.exe",-1) = 0) then
  ExFn_WriteLog("SetupConfigure.exe ","RunOnce Success");    
else
   ExFn_WriteLog("SetupConfigure.exe ","RunOnce False"); 
endif;
endif; 

/*
//添加OPENAPI启动项目。。
if (FindFile (TARGETDIR+"\\openapi-client\\redis", "redis-server.exe", svValue2) = 0) then 
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run";
if (RegDBSetKeyValueEx(szKey, "redis-server", REGDB_STRING,"\""+TARGETDIR^"openapi-client\\redis\\redis-server.exe"+"\""+" "+"\""+ TARGETDIR^"openapi-client\\config\\redis.windows.conf"+"\"",-1) = 0) then
ExFn_WriteLog("redis-server.exe ","Run Success");    
else
ExFn_WriteLog("redis-server.exe ","Run False"); 
endif;
endif;
*/

   //ExFn_InstallU8SLSVR();
    //恢复系统的安全策略。
ResetPolicyScope();     
    ExFn_WriteLog("","begin DisableAutotuning"); 
UseDLL(SETUPKIT2_DLL);
DisableAutotuning();
UnUseDLL(SETUPKIT2_DLL);  

ExFn_WriteLog("","end DisableAutotuning");
//添加CRM相关的Apache服务  只要不是删除所有都执行.  必须放到最后执行.
ExFn_InstallU8CRMApacheService();
//添加科迈的相关设置。
svu8path="";
//如果是客户端集成应用模式(远程接入) 不设置这个参数应该留空,因为这时候并不知道u8服务器是谁
if(g_svSetupModeType ==@ID_STRING2003) then 
 svkmlocalserverip="";
else
 svkmlocalserverip="127.0.0.1";
    endif;  

//客户端集中应用模式(金万维远程接入) 不设置这个参数应该留空,因为这时候并不知道u8服务器是谁
if(g_svSetupModeType ==@ID_JWW1003) then 
 svkmlocalserverip="";
else
 svkmlocalserverip="127.0.0.1";
    endif;  
    
    
svsystemlanuage="2052";
svkmversion="4.1";
if FeatureIsItemSelected(MEDIA,"RAS")=1 then
ExFn_KMRemoteSet(svu8path,g_KMWebport,g_KMDataport,svkmlocalserverip,svsystemlanuage,svkmversion);
StartServiceU8("RasBasicManage");
StartServiceU8("RasWebService"); 
endif;

if FeatureIsItemSelected(MEDIA,"PDM")=1 then
 StartServiceU8("UFAllNet"); 
endif;

//解决 如果后安装CAD 打开U8的时候,点记都会出现安装CAD 的问题.
    ExFn_RegisterCadBUG();
    
    //解决 Windows 10上打开单据无响应的问题
    ExFn_RegisterMsvbvm60();
    SetUACBack();
    
     
     iseisonly=TRUE;
     //如果只安装EIS服务器删除快捷方式


     //如果只安装EIS服务器删除快捷方式
     if FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")=1 then 
       iseisonly=FALSE; 
        if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")=1 then
          iseisonly=TRUE;
        endif;
        if FeatureIsItemSelected(MEDIA,"Server\\FileManageServer")=1 then
          iseisonly=TRUE;
        endif;  
        if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1 then
          iseisonly=TRUE;
        endif;   
        if FeatureIsItemSelected(MEDIA,"Server\\DataServer")=1 then
          iseisonly=TRUE;
        endif;                    
     endif;
     if iseisonly=FALSE then
         DeleteShortCutByEis();
     endif;
     
     //如果是纯客户端删除不应该存在的快捷方式
     DeleteShortCutByOnlyInstallClient();
     
     //如果是非加密服务器删除不应该存在的快捷方式
     DeleteShortCutByOnlyInstallLicenseServer();
     CopySystemWOW64ToSYStem32();
     DeleteEBLonginFiles();
     
     
     //设置智能安装标示。
     if FeatureIsItemSelected(MEDIA,"Server\\U8AppServer")||FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")||FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")||FeatureIsItemSelected(MEDIA,"Server\\DataServer") then  
      ExFn_SetRegByVaule("SmartGuid","","smartclient");
     endif;
     
     UseDLL(ENVCHECK_DLL); 
        Disable(WOW64FSREDIRECTION);
    RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\system32\\UFAuthSrvMgr.exe"+"\"");  
    RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\system32\\UfAlertSvrMgr.exe"+"\""); 
   Enable(WOW64FSREDIRECTION);
UnUseDLL(ENVCHECK_DLL); 
 
     //添加智能安装服务
     CreateServiceSmartClientOnlySetUpClient();
     
     //U8V15.0 要求添加
     UseDLL(ENVCHECK_DLL); 
        if (FindFile (TARGETDIR+"\\u8webapi", "CreateServicesAndVirtual.exe", svValue) >= 0) then 
    RunNoBlock(TARGETDIR+"\\u8webapi\\CreateServicesAndVirtual.exe");  
   endif;
UnUseDLL(ENVCHECK_DLL); 
 
//设置进度条显示状态
StatusUpdate( ON, 99);
SetStatusWindow(99, @ID_FileCopySetENV);
end;


function void ExFn_DoBeforeModify()
begin                          
  g_bIsShowNoBar = FALSE; 
ExFn_FeatureCheckType();
  ExFn_PreSetRegs();  
  //停止U8的所有的启动服务。
    StopU8Allservices();
ExFn_UnInstallU8Service();
ExFn_RemoveAllDependenceMSi();
end;


function void ExFn_DoAfterModify()
begin     
if g_nSetupType == MODIFY then
CopyFile(TARGETDIR^"Installer\\MsiSet_Backup.log",TARGETDIR^"Installer\\MsiSet.log");
ExFn_ModifyInstallMsi();
ExFn_InstallAllDependenceMSi();
ExFn_InstallU8Service();  
//恢复系统的安全策略。
   ResetPolicyScope();     
   //放开标点符号  
  // SetStrException();
   //添加CRM相关的Apache服务  只要不是删除所有都执行.  必须放到最后执行.
   ExFn_InstallU8CRMApacheService();   
endif;
end;


function void ExFn_ModifyInstallMsi()
string AllMsiStr;
LIST msiList;
STRING msiStr;       
NUMBER nResult;
STRING guidStr;  
STRING svResult;  


begin
ExFn_WriteLog("begin","ExFn_Test");  
ExFn_GetAllInstalledMsi(AllMsiStr);

msiList = ListCreate(STRINGLIST);

StrGetTokens(msiList, AllMsiStr, ",");  

if (msiList = LIST_NULL) then
MessageBox("不能创建列表", SEVERE);
abort;
endif;  

nResult = ListGetFirstString (msiList, msiStr);


msiStr = "u8erp-"+msiStr+".msi";
while (nResult != END_OF_LIST)
guidStr = ExFn_GetMsiGuid(msiStr);  
ExFn_ComponentInstall(msiStr, guidStr);
        nResult = ListGetNextString (msiList, msiStr);
        msiStr = "u8erp-"+msiStr+".msi";
    endwhile;   



    ListDestroy(msiList);
    
ExFn_WriteLog("end","ExFn_Test");  
end;


function void ExFn_DoBeforeRepair()
NUMBER  nMsiCount;
begin  
ExFn_WriteLog("","ExFn_DoBeforeRepair Enter"); 
    //停止U8的所有的启动服务。
    StopU8Allservices();
nMsiCount =  ExFn_GetAllInstalledMsiCount();
nMsiCount +=  ExFn_GetAllDenpendenceMsiCount();    
    
SetMsiCount(nMsiCount,FALSE);

ExFn_UnInstallU8Service();
//ExFn_RemoveAllDependenceMSi();  
//ExFn_RemoveAllInstalledMSi();
ExFn_WriteLog("","ExFn_DoBeforeRepair Leave"); 
end;


function void ExFn_DoAfterRepair()
begin
ExFn_WriteLog("","ExFn_DoAfterRepair Enter"); 
//ExFn_InstallAllDependenceMSi();
ExFn_InstallU8Service(); 
//恢复系统的安全策略。
ResetPolicyScope();     
//放开标点符号  
//SetStrException();
//添加CRM相关的Apache服务  只要不是删除所有都执行.  必须放到最后执行.
ExFn_InstallU8CRMApacheService();    
ExFn_WriteLog("","ExFn_DoAfterRepair Leave"); 
end;   


function void ExFn_DoBeforeRemoveAll()
NUMBER  nMsiCount;
begin
ExFn_WriteLog("","in ExFn_DoBeforeRemoveAll"); 
//启动监控程序去掉卸载的时候弹出窗体。
LaunchAppAndWait(SUPPORTDIR + "\\DeletePromptWindows.exe", "", NOWAIT|LAAW_OPTION_HIDDEN);
    //停止U8的所有的启动服务。
    StopU8Allservices();
ExFn_UnInstallU8Service(); 
//UseDLL(ENVCHECK_DLL);
nMsiCount =  ExFn_GetAllInstalledMsiCount();
nMsiCount +=  ExFn_GetAllDenpendenceMsiCount();


//修复卸载的时候个数不对的问题。例如:U8ERP-PortalClient.msi 由于依赖的卸载安装的时候没有安装,但对U8的产品进行配置的时候会安装,卸载的时候需要清除。
//如果安装了 u8erp-webclient.msi 卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AF4430-4258-439C-8E1D-7525E7A3988B}") = 1 then 
nMsiCount +=1;
endif;
//如果安装了 U8ERP-PortalClient.msi  卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AD4430-4259-438B-8E2D-7535E7A3988B}") = 1 then 
nMsiCount +=1; 
endif; 
//如果安装了 U8ERP-SmartClient.msi   卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{81973461-2B34-448C-9F70-FB4C1C1E2602}") = 1 then 
nMsiCount +=1;
endif;      
//如果安装了 U8ERP-CRWebClient.msi    卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{66F46BEA-8854-4050-9057-E3BDBC3C0687}") = 1 then 
nMsiCount +=1;
endif;    
//如果安装了 U8ERP-HRWebClient.msi   卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{BA130354-4F21-4FE6-951A-4FCEFD4702C2}") = 1 then 
nMsiCount +=1;
endif;   
//如果安装了 yonyou up U8+V13.0.msi      卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{293C702A-6D44-45BA-B5BA-A0494D9CFC40}") = 1 then 
  nMsiCount +=1;
endif; 


SetMsiCount(nMsiCount,FALSE);

end;


function void ExFn_DoAfterRemoveAll()    
string sSetupType;
begin
NumToStr(sSetupType,g_nSetupType);
ExFn_WriteLog("g_nSetupType is: ",sSetupType);

if g_nSetupType == REMOVEALL then
 ExFn_WriteLog("ExFn_DoAfterRemoveAll SUPPORTDIR::TARGETDIR",SUPPORTDIR+"::"+TARGETDIR); 
UseDLL(SUPPORTDIR^"EnvCheckDLL.dll"); 
 //此处可能导致卸载卡死  
 //RemoveU8Silent(SUPPORTDIR,TARGETDIR);
 DeleteTargirFilesSilentNoForm(SUPPORTDIR,TARGETDIR);
UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
RegDBDeleteValue("Software\\Microsoft\\Windows\\CurrentVersion\\Run","U8EAITimer");

卸载 soapsdk.msi
        ExFn_UnistallSoapsdk();

//删除 放开标点符号
ExFn_DelStrException("Portal"); 
//设置删除 U8插件模块
ExFn_DeleteModuleAboutPlugIn();    
//删除注册表。
ExFn_ClearU8Reg();
//有些微软的系统文件卸载MSI包后需要重新的进行注册。不然其它的软件会出现问题。  
ReverseRegisterSystemfolderFiles();  
//删除快捷方式。
DeleteFolderShortCutICON(); 
//删除所有文件 
ExFn_DelALLRetainFils();    
//卸载是删除添加的脚本命令项目
UnSetupScriptconfig();  
//安装U8经典单独 卸载提供给U8的专版科迈(作为U8的一个模块来卸载) 
        UninstallForU8SpecialRas(); 
//删除给出的目录;
ExFn_ALLDELETEDirAndFiles(); 
//SetFTHRegister();  
//设置服务超时时间   
SetServiceTimeOut();
//卸载COM+组件..
UnistallCOMPlusMsi();
//恢复初始时候的端口为3389
SetRemotePortalToRetain();

//删除对应的注册表项目,64 32位下的注册表项目. 
ExFn_DelALLU8Registers(); 

//删除所有历史遗留虚拟目录.
ExFn_DeleteAllWebs();

//删除所有历史遗留应用程序池..
   ExFn_DeleteAllAppPool();
   
删除注册表设置隐私权协议.
ExFn_DelPrivacy();

   //删除筛选器
        ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "delete W3SVC/1/Filters/RemETag "); 
        //删除没有删除掉的快捷方式卸载使用
        DeleteShortCutAfterRemoveall();
       
        //卸载U8后执行卸载金万维相关设置
   UninstallJWWAfterRemove();
   
   DeleteSYStem32FilesInstall();
endif;
end;


  
function void ExFn_RemoveAllInstalledMSi()
string installedMsiStr;
LIST msi_list;
STRING msiStr;       
NUMBER nResult;
STRING guidStr;  
STRING svResult;  
begin
installedMsiStr = "";     
//UseDLL(ENVCHECK_DLL);     
ExFn_WriteLog("","ExFn_RemoveAllInstalledMSi");  
    
ExFn_GetAllInstalledMsi(installedMsiStr);           
//UnUseDLL(ENVCHECK_DLL);
msi_list = ListCreate(STRINGLIST);

StrGetTokens(msi_list, installedMsiStr, ",");  

if (msi_list = LIST_NULL) then
MessageBox("不能创建列表", SEVERE);
abort;
endif;  

nResult = ListGetFirstString (msi_list, msiStr);
    msiStr = "u8erp-"+msiStr+".msi";
while (nResult != END_OF_LIST)
guidStr = ExFn_GetMsiGuid(msiStr);
ExFn_FeatureUninstall(msiStr, guidStr);                     
        nResult = ListGetNextString (msi_list, msiStr);
   msiStr = "u8erp-"+msiStr+".msi";
    endwhile;
    
    ListDestroy(msi_list);
end;                                       


function BOOL ExFn_HasServerInstall()
begin     
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\AppServer") == 1 then
    return TRUE;
    endif;
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\U8AppServer") == 1 then
    return TRUE;
    endif; 
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\DBServer") == 1 then
    return TRUE;
    endif; 
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\WebServer") == 1 then
    return TRUE;
    endif; 
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\LicenseServer") == 1 then
    return TRUE;
    endif; 
    return FALSE;
end;




function void ExFn_ClearExistMsi(msiGuid) 
NUMBER iRetCode;
begin    
UseDLL(ENVCHECK_DLL);
iRetCode = Run("msiexec.exe /quiet /x " + msiGuid +" REBOOT=ReallySuppress");   
if iRetCode != 0  && iRetCode != 3010 then 
Run(SUPPORTDIR^"msizap.exe t " +msiGuid);
endif;
UnUseDLL(ENVCHECK_DLL);
end;
/*        
function void  ExFn_MsiInstallParam(cmdStr,logFile,msiName)
begin
       cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1";
if g_bDependenceInstall then
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1";
elseif g_nSetupType = MODIFY || msiName == "U8ERP-PUBLIC-LS.msi" then
cmdStr = cmdStr + " CADEPEND=1";         
else
cmdStr = cmdStr + " CAPEPEND=0";
endif;


if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+".log";
else
logFile = "";
endif; 
end;    


   
function void  ExFn_MsiUninstallParam(cmdStr,logFile,msiName,guid)
begin
  cmdStr = "REBOOT=ReallySuppress";  
if g_nSetupType == REMOVEALL then
cmdStr = cmdStr + " CAREMOVE=\"ALL\"";    
endif;


if g_bDependenceInstall then
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1";
elseif g_nSetupType = MODIFY || msiName == "U8ERP-PUBLIC-LS.msi" then
cmdStr = cmdStr + " CADEPEND=1";         
else
cmdStr = cmdStr + " CADEPEND=0";
endif;

if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+guid+".log";
else
logFile = "";
endif; 
end;
*/  


 /*
function void  ExFn_MsiInstallParam(cmdStr,logFile,msiName)
begin
       cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 CAREMOVE=\"NO\" ";
if g_bDependenceInstall then 
if  g_nSetupType = MODIFY  then
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName);
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"Y\" ";   
else
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"N\" ";
endif;
elseif g_nSetupType = MODIFY  then  //不单独处理LS包 郑芸 2007.11.29
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName); 
cmdStr = cmdStr + " CADEPEND=0 CACOMPAREDATE=\"Y\" ";         
else
cmdStr = cmdStr + " CAPEPEND=0 CACOMPAREDATE=\"N\" ";
endif;


if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+".log";
else
logFile = "";
endif; 
end;    
     
 */     
 
function void  ExFn_MsiInstallParam(cmdStr,logFile,msiName)
begin
       cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 CAREMOVE=\"NO\" ";
if g_bDependenceInstall then 
if  g_nSetupType = MODIFY  then
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName);
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"Y\" ";   
else
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"Y\" ";
endif;
elseif g_nSetupType = MODIFY  then  
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName); 
cmdStr = cmdStr + " CADEPEND=0 CACOMPAREDATE=\"Y\" ";         
else
cmdStr = cmdStr + " CAPEPEND=0 CACOMPAREDATE=\"N\" ";
endif;


if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+".log";
else
logFile = "";
endif; 
end;


   
       


function void  ExFn_MsiUninstallParam(cmdStr,logFile,msiName,guid)
//STRING strCACOMPAREDATE;
begin
  cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1";  
        /*if ExFn_IsExistCACompareDateFile(msiName) then
strCACOMPAREDATE = " CACOMPAREDATE=\"Y\" ";
else
strCACOMPAREDATE = " CACOMPAREDATE=\"N\" ";
endif; 
*/
 
if g_bDependenceInstall then   
if g_nSetupType == REMOVEALL then 
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"ALL\"  CACOMPAREDATE=\"Y\" ";
elseif g_nSetupType = MODIFY then 
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"NO\" CACOMPAREDATE=\"Y\"";
else 
//不应该有的分支
ExFn_WriteLog("Error install","in ExFn_MsiUninstallParam1");
//安装时出错,程序自动回滚,执行此分支
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"ALL\"  CACOMPAREDATE=\"Y\" ";
endif;
endif;
if g_bDependenceInstall = FALSE then 
if g_nSetupType = REMOVEALL  then
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"ALL\"   CACOMPAREDATE=\"Y\" ";
elseif g_nSetupType = MODIFY /*|| msiName == "U8ERP-PUBLIC-LS.msi"*/ then
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"NO\" CACOMPAREDATE=\"Y\"  ";  
else  
//不应该有的分支
ExFn_WriteLog("Error install","in ExFn_MsiUninstallParam2");
//安装时出错,程序自动回滚,执行此分支
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"ALL\"   CACOMPAREDATE=\"Y\" ";
endif; 
endif;

if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+"_un.log";
else
logFile = "";
endif; 
end;  


function void  ExFn_MsiReinstallParam(cmdStr,logFile,msiName,guid)
begin 
cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 REINSTALL=ALL REINSTALLMODE=emus";  
if g_bDependenceInstall then
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"NO\" CACOMPAREDATE=\"N\"";
else
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"NO\" CACOMPAREDATE=\"N\"  ";  
endif;

if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+"_re.log";
else
logFile = "";
endif;   
end;     


//删除任务管理器中存在的进程  导致无法卸载此进程和此进程引用的文件,杀掉对应的进程。
function void    ExFn_TaskKillProcess(m_processname)   
string exedelete,msicmd,processnameexe;
begin       
      //执行 taskkill /im m_processname
       exedelete="taskkill /im ";
       processnameexe=m_processname;
       msicmd=WINSYSDIR +exedelete+processnameexe; 
       ExFn_Run(msicmd); 
       ExFn_WriteLog("ExFn_TaskKillProcess",msicmd);
end;



function BOOL ExFn_FeatureInstall(msiName)
STRING applicationPath, msiPath;
NUMBER iRetCode; 
STRING cmdStr;      
STRING logFile;
begin   
if msiName != "" then   
ExFn_MsiInstallParam(cmdStr,logFile,msiName);
ExFn_WriteLog("Install "+SRCDIR^"MSI\\"+msiName, cmdStr + " "+ logFile);
if(g_bDebug) then
return TRUE; //Added for debug
endif;
//iRetCode = 0;
if(g_bIsDeugU8!=TRUE) then 
 iRetCode = Install(SRCDIR^"MSI\\"+msiName, cmdStr, logFile,g_bIsShowNoBar);  
endif;
if iRetCode != 0  && iRetCode != 3010 then
if iRetCode == 1619 then
ExFn_WriteLog("Error install",msiPath + " is not exist!");
elseif iRetCode == 1602 then
ExFn_WriteLog("Error install",msiPath + " cancel by user!");
abort;
elseif iRetCode == 1620 then
MessageBox(@IDS_NETWORKERROR,SEVERE);  
abort;
elseif iRetCode == 112 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_STR_LACK_SYSDISK+"ExitCode is %d", iRetCode);
elseif iRetCode == 2203 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_StrVirOccupy+"ExitCode is %d", iRetCode);   
else 
//SprintfBox(INFORMATION, "ExitCode", "ExitCode is %d", iRetCode);
abort;
endif;
endif;  
if iRetCode == 3010 then
g_bNeedReboot = TRUE;
ExFn_WriteLog(msiName, " needs reboot after installed!");
endif;
if iRetCode == 0 || iRetCode == 3010 then
return TRUE;
else
return FALSE;
endif;
endif;   
end;




function BOOL ExFn_FeatureReinstall(msiName,guid)
STRING applicationPath;
NUMBER iRetCode;
string cmdStr;  
string logFile;
BOOL isretainfile;
begin  
    UseDLL(MSIFUNCTION_DLL);
     isretainfile= IsReinstalledFile(msiName); 
    UnUseDLL(MSIFUNCTION_DLL);                   
if isretainfile == TRUE then 
ExFn_WriteLog("Skip reinstall with ", msiName);
return FALSE;
endif;

if msiName != "" then
        ExFn_MsiReinstallParam(cmdStr,logFile,msiName,guid);
ExFn_WriteLog("Reinstall "+msiName+" "+guid, cmdStr + " "+ logFile); 
if(g_bDebug) then
return TRUE; //Added for debug 
endif;
//iRetCode = Reinstall(msiName, guid, cmdStr, logFile);
if(g_bIsDeugU8!=TRUE) then
  iRetCode = Install(SRCDIR^"MSI\\"+msiName, cmdStr, logFile,g_bIsShowNoBar); 
endif;
if iRetCode != 0 && iRetCode != 3010 then
if iRetCode == 1619 || iRetCode == 1605 then
ExFn_WriteLog("Error Reinstall",msiName + " is not exist!");
elseif iRetCode == 1602 then
ExFn_WriteLog("Error Reinstall",msiName + " cancel by user!");
abort;
elseif iRetCode == 112 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_STR_LACK_SYSDISK+"ExitCode is %d", iRetCode);
elseif iRetCode == 2203 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_StrVirOccupy+"ExitCode is %d", iRetCode);
else 
SprintfBox(INFORMATION, "ExitCode", "ExitCode is %d", iRetCode);
abort;
endif;
endif;


if iRetCode == 3010 then
g_bNeedReboot = TRUE;
ExFn_WriteLog(msiName, " needs reboot after uninstalled!");
endif;

if iRetCode == 0 || iRetCode == 3010 then 
 UseDLL(MSIFUNCTION_DLL);
AddReinstalledFile(msiName);
 UnUseDLL(MSIFUNCTION_DLL);
 return TRUE;
else
return FALSE;
endif;
endif;
end; 




function BOOL ExFn_FeatureUninstall(msiName,guid)
STRING applicationPath;
NUMBER iRetCode;
string cmdStr;  
string logFile;
begin                           
if msiName != "" then
ExFn_MsiUninstallParam(cmdStr,logFile,msiName,guid);        
ExFn_WriteLog("UnInstall "+msiName+" "+guid, cmdStr + " "+ logFile);
if(g_bDebug) then
return TRUE; //Added for debug
endif;
if(g_bIsDeugU8!=TRUE) then
  iRetCode = Uninstall(msiName, guid, cmdStr, logFile,g_bIsShowNoBar,g_bIsRollBack);
endif;
if iRetCode != 0 && iRetCode != 3010 then
if iRetCode == 1619  then
ExFn_WriteLog("Error uninstall",msiName + " is not exist!");
elseif iRetCode == 1602 then
ExFn_WriteLog("Error uninstall",msiName + " cancel by user!");
elseif iRetCode == 1605 then
ExFn_WriteLog("Error uninstall",msiName + " may be uninstalled!1605");
if ExFn_MsiInstalled(guid) == TRUE then
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    RegDBDeleteKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + guid);
endif;
elseif iRetCode == 112 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_STR_LACK_SYSDISK+"ExitCode is %d", iRetCode);
elseif iRetCode == 2203 then
   SprintfBox(INFORMATION, @TITLE_CAPTIONBAR, @ID_StrVirOccupy+"ExitCode is %d", iRetCode);
else 
SprintfBox(INFORMATION, "ExitCode", "ExitCode is %d", iRetCode);
abort;
endif;
endif;


if iRetCode == 3010 then
g_bNeedReboot = TRUE;
ExFn_WriteLog(msiName, " needs reboot after uninstalled!");
endif;

if iRetCode == 0 || iRetCode == 3010 then
return TRUE;
else
return FALSE;
endif;
endif;
end;                        
                        
function void ExFn_ComponentInstall(msiName, guid)
STRING svResult;
string sRegKey,sKeyValue;
number nvType,nvSize;
BOOL isu8setupreg;
begin

//设置安装状态注册表
  ExFn_WriteLog("set u8setup registy","SOFTWARE\\Microsoft\\Windows\\u8setup = 1");
    isu8setupreg=WriteU8SetupReg(1);
  if(isu8setupreg = FALSE) then
  ExFn_WriteLog("Write registy error","1");
  endif;
 

if g_nSetupType == MODIFY then    
ExFn_WriteLog("MODIFY install with ", msiName);
if ExFn_MsiInstalled(guid) == TRUE then   
if (msiName % "COMMON") then
   ExFn_WriteLog("Skip reinstall with ", msiName);
return;
endif;
ExFn_FeatureUninstall(msiName, guid);               
svResult = msiName;
StrReplace ( svResult, ".msi", ".config", 0); 
DeleteFile(TARGETDIR^"Installer\\"+svResult);
ExFn_WriteLog("Delete config file: ", TARGETDIR^"Installer\\"+svResult); 
endif;
ExFn_FeatureInstall(msiName); 
elseif g_nSetupType == REPAIR then
ExFn_FeatureReinstall(msiName,guid);
else
if ExFn_MsiInstalled(guid) == FALSE then
ExFn_FeatureInstall(msiName);    
else
ExFn_WriteLog(msiName+" have already installed", "with "+guid);
endif;
endif;
end;  


function void ExFn_ComponentUninstall(msiName, guid)
begin
if g_nSetupType == MODIFY then  
ExFn_WriteLog("MODIFY uninstall with ", msiName);
if (msiName % "COMMON") then
   ExFn_WriteLog("Skip uninstall with ", msiName);
return;
endif;
endif;

if ExFn_MsiInstalled(guid) == TRUE then
ExFn_FeatureUninstall(msiName, guid);  

   //执行回滚进度条递减操作..
   SetUpRollback(1);
   卸载的时候执行进度条的递增数值...
   SetUpUnistallIncrease(1);
   
else
ExFn_WriteLog(msiName+" havn't installed", "with "+guid);
endif;
end;     


function ExFn_AddConfigFile(xmlName)
begin
    ExFn_WriteLog("ExFn_AddConfigFile",xmlName); 
    UseDLL(MSIFUNCTION_DLL);                    
 AddConfigFile(SRCDIR^"\\MSI\\" + xmlName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);
ExFn_WriteLog("ExFn_AddConfigFile",xmlName); 
end;


function ExFn_AddInstalledMsi(msiName)
begin   
    ExFn_WriteLog("ExFn_AddInstalledMsi-msiName",msiName);            
    ExFn_WriteLog("ExFn_AddInstalledMsi-TARGETDIR",TARGETDIR);
    UseDLL(MSIFUNCTION_DLL);               
 AddInstalledMsi(msiName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);
ExFn_WriteLog("ExFn_AddInstalledMsi","end");   
end;                        
       
//----------------- old ---------------------


function void ExFn_WriteConfigFile(msiName)
begin 
    ExFn_WriteLog("ExFn_WriteConfigFile","start");  
    UseDLL(MSIFUNCTION_DLL);    
      WriteConfigFile(msiName,TARGETDIR);    
    UnUseDLL(MSIFUNCTION_DLL);    
ExFn_WriteLog("WriteConfigFile msiName::TARGETDIR",msiName+"::" +TARGETDIR);  
ExFn_WriteLog("ExFn_WriteConfigFile","end");  
end;  
//


function void ExFn_GetAllDenpendenceMsi(msiName)
begin 
    ExFn_WriteLog("ExFn_GetAllDenpendenceMsi","start"); 
    UseDLL(MSIFUNCTION_DLL);                 
 GetAllDenpendenceMsi(msiName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);    
ExFn_WriteLog("ExFn_GetAllDenpendenceMsi","end"); 
end;


function void ExFn_GetAllInstalledMsi(msiName)
begin 
    ExFn_WriteLog("ExFn_GetAllInstalledMsi","start"); 
    UseDLL(MSIFUNCTION_DLL);               
 GetAllInstalledMsi(msiName,TARGETDIR);
    UnUseDLL(MSIFUNCTION_DLL);    
ExFn_WriteLog("ExFn_GetAllInstalledMsi","end"); 
end;


function NUMBER ExFn_GetAllInstalledMsiCount()  
NUMBER result;
begin
    ExFn_WriteLog("获取所有MSI的个数 ExFn_GetAllInstalledMsiCount ",TARGETDIR);   
    UseDLL(MSIFUNCTION_DLL);                 
      result = GetAllInstalledMsiCount(TARGETDIR);
    UnUseDLL(MSIFUNCTION_DLL); 
    ExFn_WriteLog("ExFn_GetAllInstalledMsiCount","end"); 
return result;
end;       


function NUMBER ExFn_GetAllDenpendenceMsiCount()
NUMBER result;
begin  
    ExFn_WriteLog("ExFn_GetAllDenpendenceMsiCount","start"); 
    UseDLL(MSIFUNCTION_DLL);             
 result = GetAllDenpendenceMsiCount(TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL); 
ExFn_WriteLog("ExFn_GetAllDenpendenceMsiCount","end"); 
return result;
end;


function void ExFn_WriteCACompareDateile(msiName)
begin
    ExFn_WriteLog("ExFn_WriteCACompareDateile","start"); 
    UseDLL(MSIFUNCTION_DLL);                         
 WriteCACompareDateFile(msiName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL); 
ExFn_WriteLog("ExFn_WriteCACompareDateile","end"); 
end;


function BOOL ExFn_IsExistCACompareDateFile(msiName)
begin 
    ExFn_WriteLog("ExFn_IsExistCACompareDateFile","start"); 
      UseDLL(MSIFUNCTION_DLL);                       
   IsExistCACompareDateFile(msiName,TARGETDIR);
 UnUseDLL(MSIFUNCTION_DLL); 
ExFn_WriteLog("ExFn_IsExistCACompareDateFile","end"); 
end;


function BOOL ExFn_IsWindows2008()
BOOL bIsWindows2008;
begin                       
UseDLL(MSIFUNCTION_DLL);
 bIsWindows2008 = IsWindows2008();
UnUseDLL(MSIFUNCTION_DLL);
return bIsWindows2008;

end;
//-----------------


function void ExFn_RemoveInstalledMsi(msiName)
begin  
    ExFn_WriteLog("start","ExFn_RemoveInstalledMsi");
if g_nSetupType == MODIFY then    
   UseDLL(MSIFUNCTION_DLL); 
 RemoveInstalledMsi(msiName,TARGETDIR);  
UnUseDLL(MSIFUNCTION_DLL);               
endif;
ExFn_WriteLog("end","ExFn_RemoveInstalledMsi");
end;


function void ExFn_RemoveConfigFile(xmlName)
begin
    ExFn_WriteLog("start","ExFn_RemoveConfigFile");
if g_nSetupType == MODIFY then   
   UseDLL(MSIFUNCTION_DLL); 
 RemoveConfigFile(SRCDIR^"\\MSI\\" + xmlName,TARGETDIR);
UnUseDLL(MSIFUNCTION_DLL);      
endif;
ExFn_WriteLog("end","ExFn_RemoveConfigFile");
end;


function void ExFn_DoBeforeInstall()    
NUMBER nMsiCount;
STRING msiStr;
begin
    ExFn_WriteLog("start","ExFn_DoBeforeInstall");
//-----判断能否创建installer目录-------
  if (ExistsDir (TARGETDIR^"Installer") != EXISTS) then
  if (CreateDir (TARGETDIR^"Installer") < 0) then 
  MessageBox ("Unable to create directory", SEVERE);
            abort;
        endif;
    endif;
  //------------
//CreateDir(TARGETDIR^"Installer"); 
ExFn_ClearLogs();
    //停止U8的所有的启动服务。
    StopU8Allservices();
  ExFn_RegGuid();
  if g_bInstallLog then
    if RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE) = 0 then
  RegDBCreateKeyEx("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\EnableLogs", "");
   endif;   
  endif;  
  ExFn_PreSetRegs(); 
 
  ExFn_WriteLog("start","ExFn_MsiCount");
  ExFn_MsiCount(); 
  ExFn_WriteLog("end ","ExFn_MsiCount");

//反注册执行时间太长
//ExFn_Run("regsvr32.exe /u " + WINSYSDIR^"mscomctl.ocx" +" /s");
    ExFn_Run("regsvr32.exe " + WINSYSDIR^"mscomctl.ocx" +" /s");


//UseDLL(ENVCHECK_DLL);
  nMsiCount = ExFn_GetAllInstalledMsiCount();
  msiStr = "";
  ExFn_WriteConfigFile(msiStr);
  nMsiCount += ExFn_GetAllDenpendenceMsiCount();
  SetMsiCount(nMsiCount,FALSE);
  ExFn_WriteLog("end","ExFn_DoBeforeInstall");
end;


function void ExFn_RegisterSpecialFiles()
string szKey;
begin
UseDLL(ENVCHECK_DLL);
Run("regsvr32.exe " + WINSYSDIR^"scrrun.dll" +" /s");
Run("regsvr32.exe " + WINSYSDIR^"CellCtrl5.dll" +" /s");
Run("regsvr32.exe " + "\"" + TARGETDIR^"ZPTD\\bin\\"+"WriteXls.ocx" + "\"" +" /s");
Run("regsvr32.exe " + "\"" + TARGETDIR^"ZPTD\\bin\\"+"ReadXls.ocx" + "\"" +" /s");
Run("regsvr32.exe " + "\"" + WINDISK+"\\"+"Program Files\\Common Files\\System\\ado\\"+"msado15.dll" + "\""+" /s");
Run("regsvr32.exe " + "\"" + WINDISK+"\\"+"Program Files\\Common Files\\System\\ado\\"+"msadox.dll" + "\""+" /s");
UnUseDLL(ENVCHECK_DLL);

//wangkai3@ufida.com.cn
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey="SoftWare\\Classes\\CLSID\\{E7A1B208-06E8-45E0-8BCD-FCAB8BA7EE3F}\\InprocServer32";
RegDBSetKeyValueEx(szKey, "ThreadingModel", REGDB_STRING,"Apartment",-1);
end;


function void ExFn_DoAfterInstall()  
string svValue,svValue2;   
string szKey; 
string  szReportPath; 
string svResult; 
string svfileexist;
string svu8path,svkmlocalserverip,svsystemlanuage,svkmversion;
BOOL iseisonly;
begin


if (FindFile(WINSYSDIR, "InstWiz3.exe", svValue) = 0) then
ExFn_Run(WINSYSDIR^"InstWiz3.exe" +  " /nogui");
endif;
Delay(1);


    //复制文件.U8FileServerExtendProc.dll 到64为系统的system32下... 有的环境会丢失..
Disable(LOGGING);
 Disable(WOW64FSREDIRECTION);
   if (FindFile(WINSYSDIR,"U8FileServerExtendProc.dll", svfileexist) < 0&&SYSINFO.bIsWow64 != 0) then 
          XCopyFile (WINSYSDIR+"\\U8FileServerExtendProc.dll",m_WinDir+"\\system32\\", COMP_NORMAL);
        endif;
        CreateDir(m_WinDir+"\\system32\\config\\systemprofile\\Desktop");
       Enable(WOW64FSREDIRECTION);
     Enable(LOGGING); 
     
     
//设置进度条显示状态 创建服务
StatusUpdate( ON, 96);
SetStatusWindow(96, @ID_CreatingVirtualAddService);

if(!g_bDebug) then 
    ExFn_RegisterSpecialFiles();
     endif;
//放开标点符号  
SetStrException();  // ZHAOYIN 要求注册表BadStrException项是当初890补丁同步时给测试加上的,出上市盘不需要保留,请把这个键值去掉
if(!g_bDebug) then
    ExFn_EnableAllDir();  
    endif;
    //资源\英文   下迁移过来
解决 BM 打开分析表查询,然后打开执行分析表设计后在切换到分析表查询显示错误
//提前处理为了最后处理感觉安装完好像安装停止一样。
Settreeviewhtcfilereplace(); 
//复制adsutil.vbs IIsExt.vbs 到对应的目录下 在WIN8系统没有此文件. 
IISsetvbsCopy(m_WinDir);
if(!g_bDebug) then
        ExFn_AddAllWebs();
    endif; 
    SetapplicationPoolsidentityType();   
    //设置Windows Server 2008/Windows 7 不会自动配置WCF在IIS中的映射处理程序
SetMIMETypeForSpusms();

SetBsPortalStartGZip(); 
ReverseRegisterSystemfolderFiles(); 
 
ExFn_FeatureCheckType();  

添加智能安装服务,对纯客户端的安装模式添加

ExFn_InstallSmartClientService();


if m_CheckType & (CHECK_FOR_DATASERVER | CHECK_FOR_APPSERVER | CHECK_FOR_WEBSERVER | CHECK_FOR_LICENSESERVER | CHECK_FOR_FILESERVER | CHECK_FOR_EnterNetServer) then  
 if(!g_bDebug) then
ExFn_InstallU8Service();
 endif;   
endif;  
 
//设置MSDTC 的安全配置 设置 网络DTC访问
SetDtcSecturity();
 
//设置进度条显示状态
StatusUpdate( ON, 97);
SetStatusWindow(97, @ID_SETSystemEnv);
      
     //支持64bit操作系统,zhengyun要求
     if ( SYSINFO.bIsWow64 != 0 ) then
      ExFn_WriteLog("","the operation system is 64bit");
    if (FindFile(TARGETDIR^"UFServerMgr", "UFSoft.U8.Framework.Repair64Processor.UI.exe",svValue) = 0) then
ExFn_Run(TARGETDIR^"UFServerMgr\\UFSoft.U8.Framework.Repair64Processor.UI.exe");
ExFn_WriteLog("","Running the UFSoft.U8.Framework.Repair64Processor.UI.exe");
endif;
endif; 
 
if m_CheckType & (CHECK_FOR_DATASERVER | CHECK_FOR_APPSERVER) then
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;   
/*
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
if (RegDBSetKeyValueEx(szKey, "U8Installer", REGDB_STRING,TARGETDIR^"Installer\\SetupConfigure.exe",-1) = 0) then
  ExFn_WriteLog("SetupConfigure.exe ","RunOnce Success");    
else
   ExFn_WriteLog("SetupConfigure.exe ","RunOnce False"); 
endif; 
*/
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run";
if (RegDBSetKeyValueEx(szKey, "U8Installer", REGDB_STRING,TARGETDIR^"Installer\\SetupConfigure.exe",-1) = 0) then
  ExFn_WriteLog("SetupConfigure.exe ","RunOnce Success");    
else
   ExFn_WriteLog("SetupConfigure.exe ","RunOnce False"); 
endif;
endif; 

/*
//添加OPENAPI启动项目。。
if (FindFile (TARGETDIR+"\\openapi-client\\redis", "redis-server.exe", svValue2) = 0) then 
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run";
if (RegDBSetKeyValueEx(szKey, "redis-server", REGDB_STRING,"\""+TARGETDIR^"openapi-client\\redis\\redis-server.exe"+"\""+" "+"\""+ TARGETDIR^"openapi-client\\config\\redis.windows.conf"+"\"",-1) = 0) then
ExFn_WriteLog("redis-server.exe ","Run Success");    
else
ExFn_WriteLog("redis-server.exe ","Run False"); 
endif;
endif;
*/

   //ExFn_InstallU8SLSVR();
    //恢复系统的安全策略。
ResetPolicyScope();     
    ExFn_WriteLog("","begin DisableAutotuning"); 
UseDLL(SETUPKIT2_DLL);
DisableAutotuning();
UnUseDLL(SETUPKIT2_DLL);  

ExFn_WriteLog("","end DisableAutotuning");
//添加CRM相关的Apache服务  只要不是删除所有都执行.  必须放到最后执行.
ExFn_InstallU8CRMApacheService();
//添加科迈的相关设置。
svu8path="";
//如果是客户端集成应用模式(远程接入) 不设置这个参数应该留空,因为这时候并不知道u8服务器是谁
if(g_svSetupModeType ==@ID_STRING2003) then 
 svkmlocalserverip="";
else
 svkmlocalserverip="127.0.0.1";
    endif;  

//客户端集中应用模式(金万维远程接入) 不设置这个参数应该留空,因为这时候并不知道u8服务器是谁
if(g_svSetupModeType ==@ID_JWW1003) then 
 svkmlocalserverip="";
else
 svkmlocalserverip="127.0.0.1";
    endif;  
    
    
svsystemlanuage="2052";
svkmversion="4.1";
if FeatureIsItemSelected(MEDIA,"RAS")=1 then
ExFn_KMRemoteSet(svu8path,g_KMWebport,g_KMDataport,svkmlocalserverip,svsystemlanuage,svkmversion);
StartServiceU8("RasBasicManage");
StartServiceU8("RasWebService"); 
endif;

if FeatureIsItemSelected(MEDIA,"PDM")=1 then
 StartServiceU8("UFAllNet"); 
endif;

//解决 如果后安装CAD 打开U8的时候,点记都会出现安装CAD 的问题.
    ExFn_RegisterCadBUG();
    
    //解决 Windows 10上打开单据无响应的问题
    ExFn_RegisterMsvbvm60();
    SetUACBack();
    
     
     iseisonly=TRUE;
     //如果只安装EIS服务器删除快捷方式


     //如果只安装EIS服务器删除快捷方式
     if FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")=1 then 
       iseisonly=FALSE; 
        if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")=1 then
          iseisonly=TRUE;
        endif;
        if FeatureIsItemSelected(MEDIA,"Server\\FileManageServer")=1 then
          iseisonly=TRUE;
        endif;  
        if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1 then
          iseisonly=TRUE;
        endif;   
        if FeatureIsItemSelected(MEDIA,"Server\\DataServer")=1 then
          iseisonly=TRUE;
        endif;                    
     endif;
     if iseisonly=FALSE then
         DeleteShortCutByEis();
     endif;
     
     //如果是纯客户端删除不应该存在的快捷方式
     DeleteShortCutByOnlyInstallClient();
     
     //如果是非加密服务器删除不应该存在的快捷方式
     DeleteShortCutByOnlyInstallLicenseServer();
     CopySystemWOW64ToSYStem32();
     DeleteEBLonginFiles();
     
     
     //设置智能安装标示。
     if FeatureIsItemSelected(MEDIA,"Server\\U8AppServer")||FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")||FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")||FeatureIsItemSelected(MEDIA,"Server\\DataServer") then  
      ExFn_SetRegByVaule("SmartGuid","","smartclient");
     endif;
     
     UseDLL(ENVCHECK_DLL); 
        Disable(WOW64FSREDIRECTION);
    RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\system32\\UFAuthSrvMgr.exe"+"\"");  
    RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\system32\\UfAlertSvrMgr.exe"+"\""); 
   Enable(WOW64FSREDIRECTION);
UnUseDLL(ENVCHECK_DLL); 
 
     //添加智能安装服务
     CreateServiceSmartClientOnlySetUpClient();
     
     //U8V15.0 要求添加
     UseDLL(ENVCHECK_DLL); 
        if (FindFile (TARGETDIR+"\\u8webapi", "CreateServicesAndVirtual.exe", svValue) >= 0) then 
    RunNoBlock(TARGETDIR+"\\u8webapi\\CreateServicesAndVirtual.exe");  
   endif;
UnUseDLL(ENVCHECK_DLL); 
 
//设置进度条显示状态
StatusUpdate( ON, 99);
SetStatusWindow(99, @ID_FileCopySetENV);
end;


function void ExFn_DoBeforeModify()
begin                          
  g_bIsShowNoBar = FALSE; 
ExFn_FeatureCheckType();
  ExFn_PreSetRegs();  
  //停止U8的所有的启动服务。
    StopU8Allservices();
ExFn_UnInstallU8Service();
ExFn_RemoveAllDependenceMSi();
end;


function void ExFn_DoAfterModify()
begin     
if g_nSetupType == MODIFY then
CopyFile(TARGETDIR^"Installer\\MsiSet_Backup.log",TARGETDIR^"Installer\\MsiSet.log");
ExFn_ModifyInstallMsi();
ExFn_InstallAllDependenceMSi();
ExFn_InstallU8Service();  
//恢复系统的安全策略。
   ResetPolicyScope();     
   //放开标点符号  
  // SetStrException();
   //添加CRM相关的Apache服务  只要不是删除所有都执行.  必须放到最后执行.
   ExFn_InstallU8CRMApacheService();   
endif;
end;


function void ExFn_ModifyInstallMsi()
string AllMsiStr;
LIST msiList;
STRING msiStr;       
NUMBER nResult;
STRING guidStr;  
STRING svResult;  


begin
ExFn_WriteLog("begin","ExFn_Test");  
ExFn_GetAllInstalledMsi(AllMsiStr);

msiList = ListCreate(STRINGLIST);

StrGetTokens(msiList, AllMsiStr, ",");  

if (msiList = LIST_NULL) then
MessageBox("不能创建列表", SEVERE);
abort;
endif;  

nResult = ListGetFirstString (msiList, msiStr);


msiStr = "u8erp-"+msiStr+".msi";
while (nResult != END_OF_LIST)
guidStr = ExFn_GetMsiGuid(msiStr);  
ExFn_ComponentInstall(msiStr, guidStr);
        nResult = ListGetNextString (msiList, msiStr);
        msiStr = "u8erp-"+msiStr+".msi";
    endwhile;   



    ListDestroy(msiList);
    
ExFn_WriteLog("end","ExFn_Test");  
end;


function void ExFn_DoBeforeRepair()
NUMBER  nMsiCount;
begin  
ExFn_WriteLog("","ExFn_DoBeforeRepair Enter"); 
    //停止U8的所有的启动服务。
    StopU8Allservices();
nMsiCount =  ExFn_GetAllInstalledMsiCount();
nMsiCount +=  ExFn_GetAllDenpendenceMsiCount();    
    
SetMsiCount(nMsiCount,FALSE);

ExFn_UnInstallU8Service();
//ExFn_RemoveAllDependenceMSi();  
//ExFn_RemoveAllInstalledMSi();
ExFn_WriteLog("","ExFn_DoBeforeRepair Leave"); 
end;


function void ExFn_DoAfterRepair()
begin
ExFn_WriteLog("","ExFn_DoAfterRepair Enter"); 
//ExFn_InstallAllDependenceMSi();
ExFn_InstallU8Service(); 
//恢复系统的安全策略。
ResetPolicyScope();     
//放开标点符号  
//SetStrException();
//添加CRM相关的Apache服务  只要不是删除所有都执行.  必须放到最后执行.
ExFn_InstallU8CRMApacheService();    
ExFn_WriteLog("","ExFn_DoAfterRepair Leave"); 
end;   


function void ExFn_DoBeforeRemoveAll()
NUMBER  nMsiCount;
begin
ExFn_WriteLog("","in ExFn_DoBeforeRemoveAll"); 
//启动监控程序去掉卸载的时候弹出窗体。
LaunchAppAndWait(SUPPORTDIR + "\\DeletePromptWindows.exe", "", NOWAIT|LAAW_OPTION_HIDDEN);
    //停止U8的所有的启动服务。
    StopU8Allservices();
ExFn_UnInstallU8Service(); 
//UseDLL(ENVCHECK_DLL);
nMsiCount =  ExFn_GetAllInstalledMsiCount();
nMsiCount +=  ExFn_GetAllDenpendenceMsiCount();


//修复卸载的时候个数不对的问题。例如:U8ERP-PortalClient.msi 由于依赖的卸载安装的时候没有安装,但对U8的产品进行配置的时候会安装,卸载的时候需要清除。
//如果安装了 u8erp-webclient.msi 卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AF4430-4258-439C-8E1D-7525E7A3988B}") = 1 then 
nMsiCount +=1;
endif;
//如果安装了 U8ERP-PortalClient.msi  卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{78AD4430-4259-438B-8E2D-7535E7A3988B}") = 1 then 
nMsiCount +=1; 
endif; 
//如果安装了 U8ERP-SmartClient.msi   卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{81973461-2B34-448C-9F70-FB4C1C1E2602}") = 1 then 
nMsiCount +=1;
endif;      
//如果安装了 U8ERP-CRWebClient.msi    卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{66F46BEA-8854-4050-9057-E3BDBC3C0687}") = 1 then 
nMsiCount +=1;
endif;    
//如果安装了 U8ERP-HRWebClient.msi   卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{BA130354-4F21-4FE6-951A-4FCEFD4702C2}") = 1 then 
nMsiCount +=1;
endif;   
//如果安装了 yonyou up U8+V13.0.msi      卸载包的个数再加1
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{293C702A-6D44-45BA-B5BA-A0494D9CFC40}") = 1 then 
  nMsiCount +=1;
endif; 


SetMsiCount(nMsiCount,FALSE);

end;


function void ExFn_DoAfterRemoveAll()    
string sSetupType;
begin
NumToStr(sSetupType,g_nSetupType);
ExFn_WriteLog("g_nSetupType is: ",sSetupType);

if g_nSetupType == REMOVEALL then
 ExFn_WriteLog("ExFn_DoAfterRemoveAll SUPPORTDIR::TARGETDIR",SUPPORTDIR+"::"+TARGETDIR); 
UseDLL(SUPPORTDIR^"EnvCheckDLL.dll"); 
 //此处可能导致卸载卡死  
 //RemoveU8Silent(SUPPORTDIR,TARGETDIR);
 DeleteTargirFilesSilentNoForm(SUPPORTDIR,TARGETDIR);
UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
RegDBDeleteValue("Software\\Microsoft\\Windows\\CurrentVersion\\Run","U8EAITimer");

卸载 soapsdk.msi
        ExFn_UnistallSoapsdk();

//删除 放开标点符号
ExFn_DelStrException("Portal"); 
//设置删除 U8插件模块
ExFn_DeleteModuleAboutPlugIn();    
//删除注册表。
ExFn_ClearU8Reg();
//有些微软的系统文件卸载MSI包后需要重新的进行注册。不然其它的软件会出现问题。  
ReverseRegisterSystemfolderFiles();  
//删除快捷方式。
DeleteFolderShortCutICON(); 
//删除所有文件 
ExFn_DelALLRetainFils();    
//卸载是删除添加的脚本命令项目
UnSetupScriptconfig();  
//安装U8经典单独 卸载提供给U8的专版科迈(作为U8的一个模块来卸载) 
        UninstallForU8SpecialRas(); 
//删除给出的目录;
ExFn_ALLDELETEDirAndFiles(); 
//SetFTHRegister();  
//设置服务超时时间   
SetServiceTimeOut();
//卸载COM+组件..
UnistallCOMPlusMsi();
//恢复初始时候的端口为3389
SetRemotePortalToRetain();

//删除对应的注册表项目,64 32位下的注册表项目. 
ExFn_DelALLU8Registers(); 

//删除所有历史遗留虚拟目录.
ExFn_DeleteAllWebs();

//删除所有历史遗留应用程序池..
   ExFn_DeleteAllAppPool();
   
删除注册表设置隐私权协议.
ExFn_DelPrivacy();

   //删除筛选器
        ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "delete W3SVC/1/Filters/RemETag "); 
        //删除没有删除掉的快捷方式卸载使用
        DeleteShortCutAfterRemoveall();
       
        //卸载U8后执行卸载金万维相关设置
   UninstallJWWAfterRemove();
   
   DeleteSYStem32FilesInstall();
endif;
end;


  
function void ExFn_RemoveAllInstalledMSi()
string installedMsiStr;
LIST msi_list;
STRING msiStr;       
NUMBER nResult;
STRING guidStr;  
STRING svResult;  
begin
installedMsiStr = "";     
//UseDLL(ENVCHECK_DLL);     
ExFn_WriteLog("","ExFn_RemoveAllInstalledMSi");  
    
ExFn_GetAllInstalledMsi(installedMsiStr);           
//UnUseDLL(ENVCHECK_DLL);
msi_list = ListCreate(STRINGLIST);

StrGetTokens(msi_list, installedMsiStr, ",");  

if (msi_list = LIST_NULL) then
MessageBox("不能创建列表", SEVERE);
abort;
endif;  

nResult = ListGetFirstString (msi_list, msiStr);
    msiStr = "u8erp-"+msiStr+".msi";
while (nResult != END_OF_LIST)
guidStr = ExFn_GetMsiGuid(msiStr);
ExFn_FeatureUninstall(msiStr, guidStr);                     
        nResult = ListGetNextString (msi_list, msiStr);
   msiStr = "u8erp-"+msiStr+".msi";
    endwhile;
    
    ListDestroy(msi_list);
end;                                       


function BOOL ExFn_HasServerInstall()
begin     
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\AppServer") == 1 then
    return TRUE;
    endif;
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\U8AppServer") == 1 then
    return TRUE;
    endif; 
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\DBServer") == 1 then
    return TRUE;
    endif; 
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\WebServer") == 1 then
    return TRUE;
    endif; 
    if RegDBKeyExist ("SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\LicenseServer") == 1 then
    return TRUE;
    endif; 
    return FALSE;
end;




function void ExFn_ClearExistMsi(msiGuid) 
NUMBER iRetCode;
begin    
UseDLL(ENVCHECK_DLL);
iRetCode = Run("msiexec.exe /quiet /x " + msiGuid +" REBOOT=ReallySuppress");   
if iRetCode != 0  && iRetCode != 3010 then 
Run(SUPPORTDIR^"msizap.exe t " +msiGuid);
endif;
UnUseDLL(ENVCHECK_DLL);
end;
/*        
function void  ExFn_MsiInstallParam(cmdStr,logFile,msiName)
begin
       cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1";
if g_bDependenceInstall then
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1";
elseif g_nSetupType = MODIFY || msiName == "U8ERP-PUBLIC-LS.msi" then
cmdStr = cmdStr + " CADEPEND=1";         
else
cmdStr = cmdStr + " CAPEPEND=0";
endif;


if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+".log";
else
logFile = "";
endif; 
end;    


   
function void  ExFn_MsiUninstallParam(cmdStr,logFile,msiName,guid)
begin
  cmdStr = "REBOOT=ReallySuppress";  
if g_nSetupType == REMOVEALL then
cmdStr = cmdStr + " CAREMOVE=\"ALL\"";    
endif;


if g_bDependenceInstall then
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1";
elseif g_nSetupType = MODIFY || msiName == "U8ERP-PUBLIC-LS.msi" then
cmdStr = cmdStr + " CADEPEND=1";         
else
cmdStr = cmdStr + " CADEPEND=0";
endif;

if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+guid+".log";
else
logFile = "";
endif; 
end;
*/  


 /*
function void  ExFn_MsiInstallParam(cmdStr,logFile,msiName)
begin
       cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 CAREMOVE=\"NO\" ";
if g_bDependenceInstall then 
if  g_nSetupType = MODIFY  then
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName);
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"Y\" ";   
else
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"N\" ";
endif;
elseif g_nSetupType = MODIFY  then  //不单独处理LS包 郑芸 2007.11.29
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName); 
cmdStr = cmdStr + " CADEPEND=0 CACOMPAREDATE=\"Y\" ";         
else
cmdStr = cmdStr + " CAPEPEND=0 CACOMPAREDATE=\"N\" ";
endif;


if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+".log";
else
logFile = "";
endif; 
end;    
     
 */     
 
function void  ExFn_MsiInstallParam(cmdStr,logFile,msiName)
begin
       cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 CAREMOVE=\"NO\" ";
if g_bDependenceInstall then 
if  g_nSetupType = MODIFY  then
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName);
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"Y\" ";   
else
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CACOMPAREDATE=\"Y\" ";
endif;
elseif g_nSetupType = MODIFY  then  
//记录CACOMPAREDATE="Y"的msi列表文件
//ExFn_WriteCACompareDateile(msiName); 
cmdStr = cmdStr + " CADEPEND=0 CACOMPAREDATE=\"Y\" ";         
else
cmdStr = cmdStr + " CAPEPEND=0 CACOMPAREDATE=\"N\" ";
endif;


if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+".log";
else
logFile = "";
endif; 
end;


   
       


function void  ExFn_MsiUninstallParam(cmdStr,logFile,msiName,guid)
//STRING strCACOMPAREDATE;
begin
  cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1";  
        /*if ExFn_IsExistCACompareDateFile(msiName) then
strCACOMPAREDATE = " CACOMPAREDATE=\"Y\" ";
else
strCACOMPAREDATE = " CACOMPAREDATE=\"N\" ";
endif; 
*/
 
if g_bDependenceInstall then   
if g_nSetupType == REMOVEALL then 
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"ALL\"  CACOMPAREDATE=\"Y\" ";
elseif g_nSetupType = MODIFY then 
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"NO\" CACOMPAREDATE=\"Y\"";
else 
//不应该有的分支
ExFn_WriteLog("Error install","in ExFn_MsiUninstallParam1");
//安装时出错,程序自动回滚,执行此分支
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"ALL\"  CACOMPAREDATE=\"Y\" ";
endif;
endif;
if g_bDependenceInstall = FALSE then 
if g_nSetupType = REMOVEALL  then
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"ALL\"   CACOMPAREDATE=\"Y\" ";
elseif g_nSetupType = MODIFY /*|| msiName == "U8ERP-PUBLIC-LS.msi"*/ then
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"NO\" CACOMPAREDATE=\"Y\"  ";  
else  
//不应该有的分支
ExFn_WriteLog("Error install","in ExFn_MsiUninstallParam2");
//安装时出错,程序自动回滚,执行此分支
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"ALL\"   CACOMPAREDATE=\"Y\" ";
endif; 
endif;

if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+"_un.log";
else
logFile = "";
endif; 
end;  


function void  ExFn_MsiReinstallParam(cmdStr,logFile,msiName,guid)
begin 
cmdStr = "REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 REINSTALL=ALL REINSTALLMODE=emus";  
if g_bDependenceInstall then
cmdStr = cmdStr + " FAPPC=1 FDESC=1 FWEBC=1 CADEPEND=1 CAREMOVE=\"NO\" CACOMPAREDATE=\"N\"";
else
cmdStr = cmdStr + " CADEPEND=0 CAREMOVE=\"NO\" CACOMPAREDATE=\"N\"  ";  
endif;

if g_bInstallLog then
logFile = TARGETDIR^"Installer\\"+msiName+"_re.log";
else
logFile = "";
endif;   
end;     


//删除任务管理器中存在的进程  导致无法卸载此进程和此进程引用的文件,杀掉对应的进程。
function void    ExFn_TaskKillProcess(m_processname)   
string exedelete,msicmd,processnameexe;
begin       
      //执行 taskkill /im m_processname
       exedelete="taskkill /im ";
       processnameexe=m_processname;
       msicmd=WINSYSDIR +exedelete+processnameexe; 
       ExFn_Run(msicmd); 
       ExFn_WriteLog("ExFn_TaskKillProcess",msicmd);
end;

movedconfig.rul源码



//在迁移完数据后执行相关操作.
function void ExFn_OnMovedExcuted() 
begin  
   ExFn_SetWCFInIISMapping(); 
   ExFn_SetModuleAboutPlugIn();
end;






//设置Windows Server 2008/Windows 7 不会自动配置WCF在IIS中的映射处理程序.
function void ExFn_SetWCFInIISMapping() 
string svValue;
begin
ExFn_WriteLog("","ExFn_SetWCFInIISMapping");   
  if (FindFile (m_WinDir^"Microsoft.NET\\Framework\\v3.0\\Windows Communication Foundation","ServiceModelReg.exe",svValue) = 0)  then
      UseDLL(ENVCHECK_DLL); 
      Run(m_WinDir^"Microsoft.NET\\Framework\\v3.0\\Windows Communication Foundation\\ServiceModelReg.exe" +" -i");
    UnUseDLL(ENVCHECK_DLL);
    ExFn_WriteLog("ExFn_SetWCFInIISMapping",m_WinDir^"Microsoft.NET\\Framework\\v3.0\\Windows Communication Foundation\\ServiceModelReg.exe" +" -i");
  endif; 
ExFn_WriteLog("","out ExFn_SetWCFInIISMapping");
end;  


//添加U8插件模块
function void ExFn_SetModuleAboutPlugIn()  
string module;
begin   
     ExFn_WriteLog("添加U8插件模块","ExFn_SetModuleAboutPlugIn");  
     //添加 AllInone 模块
     ExFn_SetReg("u8allinone", "u8allinone");
     //添加 网银适配器模块  
     ExFn_SetReg("WYSP", "网银适配器");
end;   


//删除 U8插件模块
function void ExFn_DeleteModuleAboutPlugIn()  
string module;
begin    
      ExFn_WriteLog("删除 U8插件模块","ExFn_DeleteModuleAboutPlugIn"); 
     //删除 AllInone 模块
     ExFn_DelReg("u8allinone"); 
     //删除 网银适配器模块 
     ExFn_DelReg("WYSP");
end;   


msicount.rul源码

function NUMBER ExFn_MsiCount()
NUMBER count;
begin
    ExFn_WriteLog("ExFn_MsiCount---IN","start");
if FeatureIsItemSelected(MEDIA,"Client")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\UAP")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-UAP.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-UAP.msi");
endif;  

if FeatureIsItemSelected(MEDIA,"Client\\MERP")=1 then
ExFn_AddConfigFile("U8ERP-MA-MobileApp.xml");
ExFn_AddInstalledMsi("U8ERP-MA-MobileApp.msi");
endif;

if FeatureIsItemSelected(MEDIA,"Client\\UTU")=1 then
 ExFn_AddConfigFile("U8ERP-ECE-UTU.xml");
 ExFn_AddInstalledMsi("U8ERP-ECE-UTU.msi");
endif;   

if FeatureIsItemSelected(MEDIA,"Client\\iSD")=1 then  
  //如果ISD自己的包安装了ISD 会写入注册表这个键值。 
  RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
 ExFn_AddConfigFile("U8ERP-GreenService-ISD.xml");
 ExFn_AddInstalledMsi("U8ERP-GreenService-ISD.msi"); 
   endif;
endif;

if FeatureIsItemSelected(MEDIA,"Client\\PDMInterfacePlug")=1 then
 ExFn_AddConfigFile("U8ERP-SCM-PDM.xml");
 ExFn_AddInstalledMsi("U8ERP-SCM-PDM.msi");
endif; 


if FeatureIsItemSelected(MEDIA,"Client\\SSDHGZT")=1 then
 ExFn_AddConfigFile("U8ERP-PUBLIC-QSSS.xml");
 ExFn_AddInstalledMsi("U8ERP-PUBLIC-QSSS.msi");
endif;  
 
if FeatureIsItemSelected(MEDIA,"Client\\ModelAnalysis\\SafetyStockModel")=1 then
ExFn_AddConfigFile("U8ERP-BI-BW.xml");
ExFn_AddInstalledMsi("U8ERP-BI-BW.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources")=1 then
ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PersonnelContract")=1 then
ExFn_AddConfigFile("U8ERP-HR-HT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HT.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PersonnelManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-HM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\TrainingManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-TR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TR.msi");
endif;
    //V11.0 模块变更取消  宿舍管理模块 修改为插件模块维护  
    
    /*
if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\宿舍管理") then   

ExFn_AddConfigFile("U8ERP-HR-DM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-DM.msi"); 
endif; 
*/   



if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\RecruitmentManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-RT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-RT.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\BenefitsManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-WM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PerformanceManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-PF.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PF.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\AttendanceManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-TM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\SalaryManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-WA.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WA.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\HumanResources\\PieceworkWage")=1 then
ExFn_AddConfigFile("U8ERP-HR-PR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PR.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\EAIntergration")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-EAI.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-EAI.msi");
endif;

if FeatureIsItemSelected(MEDIA,"Client\\InternalAudit")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-AU.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-AU.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\EnterprisePortal")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct")=1 then
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
endif;
    /*
if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\GSP质量管理") then
ExFn_AddConfigFile("U8ERP-SCM-GS.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-GS.msi");
endif;
      */
      
if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ExportManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-EX.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EX.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ContractManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-CM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\SalesManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-PA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PA.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\OutsourceManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-OM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-OM.msi");
   ExFn_AddConfigFile("U8ERP-SCM-EZ.xml");
   ExFn_AddInstalledMsi("U8ERP-SCM-EZ.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\InventoryAccounting")=1 then
ExFn_AddConfigFile("U8ERP-SCM-IA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IA.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\InventoryManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-ST.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-ST.msi");  
ExFn_AddConfigFile("U8ERP-SCM-JA.xml");
   ExFn_AddInstalledMsi("U8ERP-SCM-JA.msi"); 
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\QualityManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-QM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-QM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ImportManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-IM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ProcurementManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-PU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PU.msi"); 

ExFn_AddConfigFile("U8ERP-SCM-HU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-HU.msi");   
ExFn_AddConfigFile("U8ERP-SCM-EZ.xml");
   ExFn_AddInstalledMsi("U8ERP-SCM-EZ.msi"); 
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\XSGLManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-SA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SA.msi");
ExFn_AddConfigFile("U8ERP-CRM-CS.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-CS.msi");
endif;

if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\AfterSaleService")=1 then
ExFn_AddConfigFile("U8ERP-CRM-SR.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-SR.msi");
endif;  

    if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\BarCodeManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-KC.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-KC.msi");
endif;    
//供应链 电商订单中心
    if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\ElectricOrderCenter")=1 then
ExFn_AddConfigFile("U8ERP-SCM-EB.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EB.msi");
endif;  


//供应链 会员管理
    if FeatureIsItemSelected(MEDIA,"Client\\GXLProduct\\VIPManagement")=1 then
ExFn_AddConfigFile("U8ERP-SCM-VM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-VM.msi");
endif;  

if FeatureIsItemSelected(MEDIA,"Client\\DecisionManagement\\FinancialAnalysis")=1 then
  /* U8V12.0 需求取消
ExFn_AddConfigFile("U8ERP-BPM-SG.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-SG.msi");
*/
endif;




if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct\\ProcessUutsourcing")=1 then
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-SCM-HY.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-HY.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct\\MMClient")=1 then
ExFn_AddConfigFile("U8ERP-U8M-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-PFFC.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-PFFC.msi");
//ExFn_AddConfigFile("U8ERP-U8M-PFBMCX.xml");
//ExFn_AddInstalledMsi("U8ERP-U8M-PFBMCX.msi");  
//ExFn_AddConfigFile("U8ERP-U8M-PFCJPG.xml");
//ExFn_AddInstalledMsi("U8ERP-U8M-PFCJPG.msi");  
ExFn_AddConfigFile("U8ERP-SCM-EZ.xml");
   ExFn_AddInstalledMsi("U8ERP-SCM-EZ.msi"); 
endif;
    
if FeatureIsItemSelected(MEDIA,"Client\\ManufactureProduct\\EquipmentManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-EQ.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-EQ.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount\\CostManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-CA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CA.msi");
ExFn_AddConfigFile("U8ERP-CW-CASC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CASC.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount\\MoneyManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-FM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\ManagementAccount\\ProjectManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-PM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\UFOReport")=1 then
ExFn_AddConfigFile("U8ERP-CW-MR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-MR.msi");
endif;




if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\CashierManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-SC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-SC.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\FixedAssets")=1 then
ExFn_AddConfigFile("U8ERP-CW-FA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FA.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\PayableManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-AP.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AP.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\ReceivablesManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-AR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AR.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\GeneralLedger")=1 then
ExFn_AddConfigFile("U8ERP-CW-GL.xml");
ExFn_AddInstalledMsi("U8ERP-CW-GL.msi");
endif;
//U8V12.0需求 添加FB 费用管理
if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\CostManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-FB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FB.msi");
endif;
    
    /*
if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\现金流量表")=1 then
ExFn_AddConfigFile("U8ERP-CW-FT.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FT.msi");
endif;
    */
if FeatureIsItemSelected(MEDIA,"Client\\FinacialAccount\\OnlineBank")=1 then
ExFn_AddConfigFile("U8ERP-CW-NB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NB.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications\\SettlementCenter")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-FD.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-FD.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications\\HYReport")=1 then
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
/* U8V12.0 需求取消 
ExFn_AddConfigFile("U8ERP-BPM-RC.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-RC.msi");
*/
endif;


if FeatureIsItemSelected(MEDIA,"Client\\GroupApplications\\GroupFinancial")=1 then
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-GF.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-GF.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\DataServer")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-DB.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-DB.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-DB2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-DB2.msi");
ExFn_AddConfigFile("U8ERP-CRM-CS.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-CS.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")=1 then  
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");  
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");  
endif;


if FeatureIsItemSelected(MEDIA,"Server\\SSDHGZT")=1 then
 ExFn_AddConfigFile("U8ERP-PUBLIC-QSSS.xml");
 ExFn_AddInstalledMsi("U8ERP-PUBLIC-QSSS.msi");
endif;  

if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\WEBApp")=1 then
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-SCM-SO.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SO.msi");
ExFn_AddConfigFile("U8ERP-CW-CO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CO.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\WebPortal")=1 then
ExFn_AddConfigFile("U8ERP-OA-PORTAL.xml");
ExFn_AddInstalledMsi("U8ERP-OA-PORTAL.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources")=1 then
ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources\\EmployeeSelf")=1 then
ExFn_AddConfigFile("U8ERP-HR-SS.xml");
ExFn_AddInstalledMsi("U8ERP-HR-SS.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources\\ManagerSelf")=1 then
ExFn_AddConfigFile("U8ERP-HR-MC.xml");
ExFn_AddInstalledMsi("U8ERP-HR-MC.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HumanResources\\PerformanceManagement")=1 then
ExFn_AddConfigFile("U8ERP-HR-PF.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PF.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\HHBB")=1 then
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-CR.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-CR.msi");
endif;


    // V11.0 模块取消变更   小集团情况下,现有产品无法替代.
    /*
if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\报账中心") then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-WH.xml");
ExFn_AddInstalledMsi("U8ERP-CW-WH.msi");
endif;  
*/


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\OnlineClaims")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-NE.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NE.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\FinancialManagement")=1 then
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-PO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PO.msi");
endif;

if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\BudgetManagement")=1 then
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-BPM-BM.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-BM.msi");
endif;  

    if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\CustomerRelationshipManagement")=1 then  
        ExFn_AddConfigFile("U8ERP-TruboCrm-U8.xml");
ExFn_AddInstalledMsi("U8ERP-TruboCrm-U8.msi"); 
    endif;    
    
if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-LS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-LS.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Server\\U8AppServer")=1 then
ExFn_WriteLog("MsiCount", "安装 应用服务器");

ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-COMMON2.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-COMMON2.msi");
ExFn_AddConfigFile("U8ERP-BPM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-CW-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-CW-COMMON.msi");
ExFn_AddConfigFile("U8ERP-HR-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-HR-COMMON.msi");
ExFn_AddConfigFile("U8ERP-SCM-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-COMMON.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-COMMON.msi");
ExFn_AddConfigFile("U8ERP-U8M-PFFC.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-PFFC.msi");
ExFn_AddConfigFile("U8ERP-BPM-BM.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-BM.msi");
ExFn_AddConfigFile("U8ERP-BPM-CR.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-CR.msi");
ExFn_AddConfigFile("U8ERP-BPM-FD.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-FD.msi");
ExFn_AddConfigFile("U8ERP-BPM-GF.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-GF.msi");
/* U8V12.0 需求取消 
ExFn_AddConfigFile("U8ERP-BPM-RC.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-RC.msi");
*/
/* U8V12.0 需求取消
ExFn_AddConfigFile("U8ERP-BPM-SG.xml");
ExFn_AddInstalledMsi("U8ERP-BPM-SG.msi");
*/
ExFn_AddConfigFile("U8ERP-CRM-CS.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-CS.msi");
ExFn_AddConfigFile("U8ERP-CRM-SR.xml");
ExFn_AddInstalledMsi("U8ERP-CRM-SR.msi");
ExFn_AddConfigFile("U8ERP-CW-AP.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AP.msi");
ExFn_AddConfigFile("U8ERP-CW-AR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-AR.msi");
ExFn_AddConfigFile("U8ERP-CW-CA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CA.msi");
ExFn_AddConfigFile("U8ERP-CW-CASC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CASC.msi");
ExFn_AddConfigFile("U8ERP-CW-CM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CM.msi");
ExFn_AddConfigFile("U8ERP-CW-CO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-CO.msi");
ExFn_AddConfigFile("U8ERP-CW-FA.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FA.msi");
ExFn_AddConfigFile("U8ERP-CW-FM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FM.msi");
/*  U8V12.0 需求取消 
ExFn_AddConfigFile("U8ERP-CW-FT.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FT.msi");
*/
ExFn_AddConfigFile("U8ERP-CW-GL.xml");
ExFn_AddInstalledMsi("U8ERP-CW-GL.msi");
//U8V12.0需求 添加FB 费用管理
ExFn_AddConfigFile("U8ERP-CW-FB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-FB.msi");

ExFn_AddConfigFile("U8ERP-CW-MR.xml");
ExFn_AddInstalledMsi("U8ERP-CW-MR.msi");
ExFn_AddConfigFile("U8ERP-CW-NB.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NB.msi");
ExFn_AddConfigFile("U8ERP-CW-NE.xml");
ExFn_AddInstalledMsi("U8ERP-CW-NE.msi");
ExFn_AddConfigFile("U8ERP-CW-PM.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PM.msi");
ExFn_AddConfigFile("U8ERP-CW-PO.xml");
ExFn_AddInstalledMsi("U8ERP-CW-PO.msi");
ExFn_AddConfigFile("U8ERP-CW-SC.xml");
ExFn_AddInstalledMsi("U8ERP-CW-SC.msi");
/* 模块变更 V11.0 将取消
ExFn_AddConfigFile("U8ERP-CW-WH.xml");
ExFn_AddInstalledMsi("U8ERP-CW-WH.msi");
ExFn_AddConfigFile("U8ERP-HR-DM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-DM.msi");
*/  
ExFn_AddConfigFile("U8ERP-HR-HM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HM.msi");
ExFn_AddConfigFile("U8ERP-HR-HT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-HT.msi");
ExFn_AddConfigFile("U8ERP-HR-MC.xml");
ExFn_AddInstalledMsi("U8ERP-HR-MC.msi");
ExFn_AddConfigFile("U8ERP-HR-PF.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PF.msi");
ExFn_AddConfigFile("U8ERP-HR-PR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-PR.msi");
ExFn_AddConfigFile("U8ERP-HR-RT.xml");
ExFn_AddInstalledMsi("U8ERP-HR-RT.msi");
ExFn_AddConfigFile("U8ERP-HR-SS.xml");
ExFn_AddInstalledMsi("U8ERP-HR-SS.msi");
ExFn_AddConfigFile("U8ERP-HR-TM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TM.msi");
ExFn_AddConfigFile("U8ERP-HR-TR.xml");
ExFn_AddInstalledMsi("U8ERP-HR-TR.msi");
ExFn_AddConfigFile("U8ERP-HR-WA.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WA.msi");
ExFn_AddConfigFile("U8ERP-HR-WM.xml");
ExFn_AddInstalledMsi("U8ERP-HR-WM.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-EAI.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-EAI.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-UAP.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-UAP.msi");
ExFn_AddConfigFile("U8ERP-SCM-EX.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-EX.msi");
//ExFn_AddConfigFile("U8ERP-SCM-GS.xml");
//ExFn_AddInstalledMsi("U8ERP-SCM-GS.msi");
ExFn_AddConfigFile("U8ERP-SCM-IA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IA.msi");
ExFn_AddConfigFile("U8ERP-SCM-IM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-IM.msi");
ExFn_AddConfigFile("U8ERP-SCM-OM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-OM.msi");
ExFn_AddConfigFile("U8ERP-SCM-PA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PA.msi");
ExFn_AddConfigFile("U8ERP-SCM-PU.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PU.msi");
ExFn_AddConfigFile("U8ERP-SCM-QM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-QM.msi");
ExFn_AddConfigFile("U8ERP-SCM-SA.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SA.msi");
ExFn_AddConfigFile("U8ERP-SCM-SO.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-SO.msi");
ExFn_AddConfigFile("U8ERP-SCM-ST.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-ST.msi");
ExFn_AddConfigFile("U8ERP-U8M-EQ.xml");
ExFn_AddInstalledMsi("U8ERP-U8M-EQ.msi");
ExFn_AddConfigFile("U8ERP-PUBLIC-AU.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-AU.msi");
   ExFn_AddConfigFile("U8ERP-ECE-UTU.xml");
ExFn_AddInstalledMsi("U8ERP-ECE-UTU.msi"); 
ExFn_AddConfigFile("U8ERP-SCM-PDM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PDM.msi");
   //如果ISD自己的包安装了ISD 会写入注册表这个键值。 
   RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
   if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
 ExFn_AddConfigFile("U8ERP-GreenService-ISD.xml");
 ExFn_AddInstalledMsi("U8ERP-GreenService-ISD.msi");
endif;  

 
ExFn_AddConfigFile("U8ERP-SCM-U8KCSN.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-U8KCSN.msi");

endif;


if FeatureIsItemSelected(MEDIA,"Server\\FileManageServer")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-FS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-FS.msi");
endif; 

if FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-EIS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-EIS.msi");
endif;   


if FeatureIsItemSelected(MEDIA,"Server\\PDMInterfacePlug")=1 then
ExFn_AddConfigFile("U8ERP-SCM-PDM.xml");
ExFn_AddInstalledMsi("U8ERP-SCM-PDM.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Resource\\ZH_CN")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-CN.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-CN.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Resource\\ZH_TW")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-TW.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-TW.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Resource\\EN_US")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-US.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-US.msi");
endif;


if FeatureIsItemSelected(MEDIA,"Resource\\ResCommon")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-RES.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-RES.msi");
endif;
    
    if FeatureIsItemSelected(MEDIA,"SSDHGZT")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-QSSS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-QSSS.msi");
endif;  

//U8V13.0去除科迈安装
/*
if FeatureIsItemSelected(MEDIA,"RAS")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-RAS.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-RAS.msi");
endif;  
*/

//金万维
if FeatureIsItemSelected(MEDIA,"JWW")=1 then
ExFn_AddConfigFile("U8ERP-PUBLIC-JWW.xml");
ExFn_AddInstalledMsi("U8ERP-PUBLIC-JWW.msi");
endif; 


/*  //u8v12.5版本删除PLM 
//如果没有选择Server\\WebServerAppServer\\WebPortal 基础服务,不安装PDM
if FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer\\WebPortal")=1 then 
if FeatureIsItemSelected(MEDIA,"PDM")=1 then
   ExFn_AddConfigFile("U8ERP-PDM-Server.xml");
   ExFn_AddInstalledMsi("U8ERP-PDM-Server.msi");    
   
   ExFn_AddConfigFile("U8ERP-PDM-Server2.xml");
   ExFn_AddInstalledMsi("U8ERP-PDM-Server2.msi"); 


        ExFn_AddConfigFile("U8ERP-PDM-FileServer.xml");
   ExFn_AddInstalledMsi("U8ERP-PDM-FileServer.msi");    


   ExFn_AddConfigFile("U8ERP-PDM-ServerForClient.xml");
   ExFn_AddInstalledMsi("U8ERP-PDM-ServerForClient.msi"); 
endif;  
endif;


//如果选择加密服务器,又选择了PDM安装模式,就可以直接的安装PDM加密
if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1&&(g_bSetupPDMSelected=TRUE) then
        ExFn_AddConfigFile("U8ERP-PDM-License.xml");
   ExFn_AddInstalledMsi("U8ERP-PDM-License.msi"); 
    endif;  
    */  
    ExFn_WriteLog("ExFn_MsiCount---IN","END");
end;



msiexist.rul 源码

function BOOL ExFn_MsiExist()
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{03FC4463-C12B-40B8-A4D0-FB1654987C14}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{096E3A78-5313-4FC5-8B3C-63E8EA599362}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0BA270DB-876E-4B4E-A0FC-89BE7CBFC623}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0EC7C9B6-61A0-43B5-B174-8DC6511BD2F7}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0EE3EEAC-D612-4B72-8795-CAE90510878A}") = 1 then 
return TRUE;
endif;
//bitao:这个不用了 oa-oa
/*
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0FAC7C1F-FAF9-4EA6-8CC6-87F1DC30E72F}") = 1 then 
return TRUE;
endif;
*/
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{17A6ADEB-7CAC-440A-AC71-122D66E10132}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{2166C7C8-B032-4A45-8C47-88ED6270BC5F}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{21B42064-DDA6-4231-A31E-5E3732D1744D}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{224DF229-95E5-4927-9DBE-D48320D1F05E}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{28AFDE6B-54E6-4D5D-8407-26126267722A}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{28B6C62A-D9DD-4352-80D2-C258F86F85F3}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{29935392-23EB-4FC7-AC8A-308D7101B133}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}") = 1 then 
return TRUE;
endif;
    //U8V12.0需求 添加FB 费用管理
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}") = 1 then 
return TRUE;
endif;

if RegDBKeyExist(UNINSTALL_KEY_NAME + "{2FF13841-EB92-4A67-849A-872FC4847F4A}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{402D419C-1AC3-42CA-8484-311C0BBBF7CC}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4644C0A7-90C0-468F-BFEB-3B6C352D0C9D}") = 1 then 
return TRUE;
endif;
//bitap:scm-gs 不用了
/*
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{47D6FBCA-D9AD-4D4A-B6D8-AA16FBB6676E}") = 1 then 
return TRUE;
endif;
*/
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{56106E75-31E9-4C12-BA0E-6C791FF65418}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{582E19C0-23C4-44A7-8772-F0C613297C16}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{63C31F73-6488-4784-99F2-C9FE2E77222E}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6BF16486-4C92-4E21-8103-67FCA1CB12A6}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{7303FF34-69E0-473E-817B-C27728E77073}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{7DED3042-9870-4504-95CB-7E1396A12DD5}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{8641ACF9-EEC4-4ED0-96ED-F1F651EBC401}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{865041D6-C60F-46A3-948F-B6AFEEB1D347}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{87D8570F-5D85-430A-97F5-1721592B14D5}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A33E5DFC-4075-454B-807D-10A63EE5E0A7}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A9304A69-3AB7-4FC1-9C37-6D797E94213E}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B2D6C198-095C-4A26-9840-98836AF70F23}") = 1 then 
return TRUE;
endif;
    //U8ERP-PUBLIC-COMMON2.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E10149AC-BE82-4760-8BD9-301C6B11B0F2}") = 1 then 
return TRUE;
endif;

if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B3470B1E-54CC-4DAB-AD77-881A1617037E}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B7AE865A-791B-4C8A-B813-06BC6E79B116}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{B7F76D73-44F5-4A16-8490-4D0F56E397BD}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C29B61D1-27F6-4B91-83F1-7D23E3B47DDD}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D057B835-1AB0-4439-945D-F3064030B8F3}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D1B612FA-71C3-4707-9E4B-D387306CB195}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D979201A-A74E-4705-A3A6-45D5B7F096CA}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{DA024A96-5C95-4E9B-87FE-EC2906717AAC}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E1CDD5B7-8952-490D-80D6-0880AA011CE5}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E2117546-2B2B-4E8E-A1A6-B2457D4774DC}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F147E096-2126-41C8-BDA5-E2ED297F2DC3}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F29D733D-C755-4F8D-85B1-1A8478D69A97}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F554F819-FDE7-406E-9095-A78CAABA22A6}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}") = 1 then 
return TRUE;
endif;


if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E9A2049E-FACF-4709-B81F-DCA7FD0B621E}") = 1 then 
return TRUE;
endif; 
 
 //bitao:qsss
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{782E19C0-23C4-44A7-8772-F0C613297C17}") = 1 then 
return TRUE;
endif; 
 
//bitao:new msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{036aeaaa-e767-4592-bcd1-52d9c47b4324}") = 1 then 
return TRUE;
endif; 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{a3be837c-b5f3-44db-8c3a-afb0433d997f}") = 1 then 
return TRUE;
endif; 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{125966e5-636a-4a6e-9524-bef9b75b58f6}") = 1 then 
return TRUE;
endif;
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{a5ab8f2c-a705-4d26-86a8-a7498a8737de}") = 1 then 
return TRUE;
endif;  

if RegDBKeyExist(UNINSTALL_KEY_NAME + "{61af2c59-2d09-47c9-81e4-5e59b9dcdea4}") = 1 then 
return TRUE;
endif;      
//U8ERP-SCM-KC.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{c33e6a1c-4317-4921-b3dc-092acdb31484}") = 1 then 
return TRUE;
endif;  

   if RegDBKeyExist(UNINSTALL_KEY_NAME + "{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}") = 1 then 
return TRUE;
endif;  
   if RegDBKeyExist(UNINSTALL_KEY_NAME + "{CBD50EDA-F170-4024-B7D0-B03E4345F5D5}") = 1 then 
return TRUE;
endif;  
    if RegDBKeyExist(UNINSTALL_KEY_NAME + "{EF92679D-5761-4F0F-BD64-7EE96749B3D9}") = 1 then 
return TRUE;
endif;        
//U8ERP-BI-BW.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D33F1EBC-627D-4EA7-BB0A-95F38967188B}") = 1 then 
return TRUE;
endif; 
    //U8ERP-SCM-U8KCSN.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6F26CF69-5612-4276-82B6-09DC5B9F12D0}") = 1 then 
return TRUE;
endif;    
//U8ERP-GreenService-ISD.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{8de00d6e-7467-4286-a9da-cc4fc3e02cf5}") = 1 then 
return TRUE;
endif; 
//U8ERP-SCM-EB.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{6F15ABFD-F426-43DE-A049-E5FEFC0F91A3}") = 1 then 
return TRUE;
endif;  
//U8ERP-SCM-VM.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{483B3F9C-6A9E-48AD-BB8A-AFBA2F29967A}") = 1 then 
return TRUE;
endif;  
//U8ERP-SCM-PDM.msi 
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{fdbbedb7-683f-46a0-94bb-c90e8c13b659}") = 1 then 
return TRUE;
endif;

//U8V13.0去除科迈安装
/*
// U8ERP-PUBLIC-RAS.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{1D0AB63F-23CA-4D78-8475-58A78C5D6533}") = 1 then 
return TRUE;
endif; 
    */
    
// U8ERP-PUBLIC-JWW.msi 金万维
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{1BD21323-FF20-430E-99A9-1294C95F592A}") = 1 then 
return TRUE;
endif;     
    
    /*  //u8v12.5版本删除PLM
// U8ERP-PDM-Server.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{E3B5EABE-ADAE-4083-B562-7D1A27A64CB6}") = 1 then 
return TRUE;
endif; 

    // U8ERP-PDM-Server2.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{DAD801B1-73AF-4AC7-AFAC-076F9F843B42}") = 1 then 
return TRUE;
endif;

// U8ERP-PDM-FileServer.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D94F0B75-A7B7-404A-8DB2-1C16B997C642}") = 1 then 
return TRUE;
endif; 

    // U8ERP-PDM-ServerForClient.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{5EE34741-6E21-4577-BE2E-DBAEF1C55A2F}") = 1 then 
return TRUE;
endif;

// U8ERP-PDM-License.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{D16DFDFD-ACD4-48F1-8E48-A401A19339AB}") = 1 then 
return TRUE;
endif;
*/

// U8ERP-PUBLIC-EIS.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}") = 1 then 
return TRUE;
endif; 


// U8ERP-PUBLIC-openapix64.msi
//if RegDBKeyExist(UNINSTALL_KEY_NAME + "{1c23de0c-5ff3-4f22-8044-ff314a490ed3}") = 1 then 
// return TRUE;
//endif; 

// U8ERP-PUBLIC-openapix86.msi
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}") = 1 then 
return TRUE;
endif;


return FALSE;
end;


runcommad.rul源码



//卸载所有的补丁。此函数只用用于卸载的时候,运行需要.netframwork3.5的运行时
function UnintallPatchMsis()   
string   szdllpath ;
object uninstallmsi; 
BOOL isreboot;
begin  
     ExFn_WriteLog("UnintallPatchMsis","卸载所有的补丁");
     isreboot=FALSE;
     szdllpath=SUPPORTDIR^"UnInstallMsi.dll";    
     //加载C# 动态库dll
     try
       set uninstallmsi=CoCreateObjectDotNet(szdllpath,"UnInstallMsi.UnInstallMsi");
       isreboot=uninstallmsi.UnInstallPatchMsiS(SUPPORTDIR); 
     catch
       isreboot=FALSE;
     endcatch;
     if(isreboot==TRUE) then
        SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
        MessageBox (@ID_STRINGNEEDREBOOT,INFORMATION);  
        abort;
     endif;
     ExFn_WriteLog("UnintallPatchMsis","卸载所有的补丁结束!");
end;  




//在64位系统中添加64位的注册表信息..
function AddRegisterIn64()   
string   szdllpath ;
object m_TimeoutMilliseconds;
begin  
     ExFn_WriteLog("AddRegisterIn64","在64位系统中添加64位的注册表信息"); 
     LaunchAppAndWait(SUPPORTDIR^"AddRegisterTo64SystemLocalMachine.exe","",WAIT|LAAW_OPTION_HIDDEN);
end;


 
//安装之前对操作系统的安全做对应的处理操作
function  SetOsSafeControl()
begin  
    SetPolicyScope(); 
    LaunchAppAndWait(WINSYSDIR^"net.exe","  stop msiserver",WAIT|LAAW_OPTION_HIDDEN); 
LaunchAppAndWait(WINSYSDIR^"net.exe","  start msiserver",WAIT|LAAW_OPTION_HIDDEN);
end;   




//解决补丁更新工具 在Vista以上版本打开服务端的WEB服务出现错误
//c:\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='.asmx',mimeType='text/plain']
function SetMIMETypeForSpusms()  
  string svResult;
  begin   
     ExFn_WriteLog("SetMIMETypeForSpusms()","解决补丁更新工具 在Vista以上版本打开服务端的WEB服务出现错误");
     if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==0)||(SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then   
         if(FindFile(WINSYSDIR+"\\inetsrv","appcmd.exe",svResult)==0) then 
           UseDLL(ENVCHECK_DLL);  
             Run(WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:staticContent /+[fileExtension='.asmx',mimeType='text/plain']");   
           UnUseDLL(ENVCHECK_DLL); 
           ExFn_WriteLog("CMD ExcuteCmdCommand:",WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:staticContent /+[fileExtension='.asmx',mimeType='text/plain']"); 
         endif;                                     
      endif; 
  end ;  


/*
 命令行
若要指定应用程序池要使用的帐户标识,请使用下面的语法:
appcmd set config /section:applicationPools /[name=' string '].processModel.identityType:SpecificUser|NetworkService|LocalService|LocalSystem
变量 string 为您要配置的应用程序池的名称。 例如,若要将名为 Marketing 的应用程序池的标识类型从 Network Service 更改为 Local Service,请在命令提示符处键入如下命令,然后按 Enter:
appcmd set config /section:applicationPools /[name=' Marketing '].processModel.identityType:LocalService 
appcmd set config /section:applicationPools "/[name='Classic .NET AppPool'].processModel.identityType:LocalService" 
*/   


function SetapplicationPoolsidentityType()  
  string svResult,svwin2003local;
  begin   
     ExFn_WriteLog("SetapplicationPoolsidentityType()","解决AllInOne来回调的问题。在Vista以上版本操作");
     if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==0)||(SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then   
         if(FindFile(WINSYSDIR+"\\inetsrv","appcmd.exe",svResult)==0) then 
           UseDLL(ENVCHECK_DLL);  
             Run(WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools /[name='DefaultAppPool'].processModel.identityType:LocalSystem "); 
             Run(WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].processModel.identityType:LocalSystem"+"\"");                               
             //修改应用程序池为Classic .NET AppPool 的 .NET Framework 版本为V2.0  
             Run(WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].managedRuntimeVersion:v2.0"+"\"");                               
             
             //设置U8SL默认应用程序池
             Run(WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='U8SLApplicationAppPool'].processModel.identityType:LocalSystem"+"\"");                               
             //修改应用程序池为Classic .NET AppPool 的 .NET Framework 版本为V2.0  
             Run(WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='U8SLApplicationAppPool'].managedRuntimeVersion:v2.0"+"\"");                               
             
           UnUseDLL(ENVCHECK_DLL); 
           ExFn_WriteLog("设置应用程序池DefaultAppPool CMD ExcuteCmdCommand:",WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools /[name='DefaultAppPool'].processModel.identityType:LocalSystem ");
           ExFn_WriteLog("设置应用程序池Classic .NET AppPool  CMD ExcuteCmdCommand:",WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].processModel.identityType:LocalSystem"+"\"");   
           ExFn_WriteLog("设置应用程序池Classic .NET AppPool  CMD ExcuteCmdCommand:",WINSYSDIR+"\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].processModel.managedRuntimeVersion:v2.0"+"\""); 
         elseif(FindFile(m_WinDir+"\\SysWOW64\\inetsrv","appcmd.exe",svResult)==0) then
           UseDLL(ENVCHECK_DLL);  
             Run(m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools /[name='DefaultAppPool'].processModel.identityType:LocalSystem "); 
             Run(m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].processModel.identityType:LocalSystem"+"\"");                               
             //修改应用程序池为Classic .NET AppPool 的 .NET Framework 版本为V2.0  
             Run(m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].managedRuntimeVersion:v2.0"+"\"");                               
             
             //设置U8SL默认应用程序池
             Run(m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='U8SLApplicationAppPool'].processModel.identityType:LocalSystem"+"\"");                               
             //修改应用程序池为Classic .NET AppPool 的 .NET Framework 版本为V2.0  
             Run(m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='U8SLApplicationAppPool'].managedRuntimeVersion:v2.0"+"\"");                               
             
           UnUseDLL(ENVCHECK_DLL); 
           ExFn_WriteLog("设置应用程序池DefaultAppPool CMD ExcuteCmdCommand:",m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools /[name='DefaultAppPool'].processModel.identityType:LocalSystem ");
           ExFn_WriteLog("设置应用程序池Classic .NET AppPool  CMD ExcuteCmdCommand:",m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].processModel.identityType:LocalSystem"+"\"");   
           ExFn_WriteLog("设置应用程序池Classic .NET AppPool  CMD ExcuteCmdCommand:",m_WinDir+"\\SysWOW64\\inetsrv"+"\\"+"appcmd.exe set config /section:applicationPools "+"\""+"/[name='Classic .NET AppPool'].processModel.managedRuntimeVersion:v2.0"+"\""); 
         
         endif;
      //如果是2003系统直接的设置默认的程序池为localsystem
      else
           svwin2003local="CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs "+"set W3SVC/AppPools/DefaultAppPool/AppPoolIdentityType 0 ";
           UseDLL(ENVCHECK_DLL); 
             Run(svwin2003local);
           UnUseDLL(ENVCHECK_DLL); 
           ExFn_WriteLog(svwin2003local,"如果是2003系统直接的设置默认的程序池为localsystem");
      endif; 
  end ;   


 //解决登陆门户比较慢的问题 Windows 2008,windows 7,windows vista要执行 netsh interface tcp set global autotuninglevel=disabled
function  ExcuteNetShImproveEfficiency()
string szWindownsDir; 
string svResult;
begin   
      ExFn_WriteLog("ExcuteNetShImproveEfficiency","解决登陆门户比较慢的问题 Windows 2008,windows 7,windows vista要执行 netsh interface tcp set global autotuninglevel=disabled");
      //判断Windows 2008版本 6.1 ,windows 7版本 6.1 ,windows vista版本 6.0环境的操作系统的版本。
      if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==0)||(SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then   
         if ( SYSINFO.bIsWow64 != 0 ) then  
           Disable(LOGGING);
            Disable(WOW64FSREDIRECTION);
            XCopyFile (WINSYSDIR+"\\netsh.exe", m_WinDir+"\\system32\\", COMP_NORMAL);
            Enable(WOW64FSREDIRECTION);
           Enable(LOGGING); 
           UseDLL(ENVCHECK_DLL);
            Run(m_WinDir+"\\system32\\"+"netsh.exe interface tcp set global autotuninglevel=disabled"); 
            RunWithDirectory(m_WinDir+"\\system32\\"+"netsh.exe interface tcp set global autotuninglevel=disabled",m_WinDir+"\\system32");
           UnUseDLL(ENVCHECK_DLL);
           ExFn_WriteLog("CMD ExcuteCmdCommand:",m_WinDir+"\\system32\\"+"netsh.exe interface tcp set global autotuninglevel=disabled"); 
           /*
           if(FindFile(m_WinDir+"\\system32","netsh.exe",svResult)==0) then 
             LaunchAppAndWait(m_WinDir+"\\system32\\"+"netsh.exe"," interface tcp set global autotuninglevel=disabled",LAAW_OPTION_NOWAIT|LAAW_OPTION_HIDDEN); 
             ExFn_WriteLog("LaunchAppAndWait:",m_WinDir+"\\system32\\"+"netsh.exe interface tcp set global autotuninglevel=disabled"); 
           endif;   
           */
          else
           UseDLL(ENVCHECK_DLL);    
            Run(WINSYSDIR+"\\"+"netsh.exe interface tcp set global autotuninglevel=disabled"); 
            RunWithDirectory(WINSYSDIR+"\\"+"netsh.exe interface tcp set global autotuninglevel=disabled",m_WinDir+"\\system32");  
           UnUseDLL(ENVCHECK_DLL);
           ExFn_WriteLog("CMD ExcuteCmdCommand:",WINSYSDIR+"\\"+"netsh.exe interface tcp set global autotuninglevel=disabled");
           /*
           if(FindFile(WINSYSDIR,"netsh.exe",svResult)==0) then 
             LaunchAppAndWait(WINSYSDIR+"\\"+"netsh.exe"," interface tcp set global autotuninglevel=disabled",LAAW_OPTION_NOWAIT|LAAW_OPTION_HIDDEN); 
             ExFn_WriteLog("LaunchAppAndWait:",WINSYSDIR+"\\"+"netsh.exe interface tcp set global autotuninglevel=disabled");
           endif;  
           */
         endif;
      endif; 
     if(FindFile(SUPPORTDIR,"CommandRun.exe",svResult)==0) then                                                       
      UseDLL(ENVCHECK_DLL);
       Run(SUPPORTDIR^"CommandRun.exe"+" \""+m_WinDir+"\\system32\\"+"netsh.exe"+" interface tcp set global autotuninglevel=disabled"+"\"");  
      UnUseDLL(ENVCHECK_DLL);
      //LaunchAppAndWait(SUPPORTDIR^"CommandRun.exe","\""+m_WinDir+"\\system32\\"+"netsh.exe"+" interface tcp set global autotuninglevel=disabled"+"\"",LAAW_OPTION_NOWAIT|LAAW_OPTION_HIDDEN);  
      ExFn_WriteLog("LaunchAppAndWait:",SUPPORTDIR^"CommandRun.exe"+" \""+m_WinDir+"\\system32\\"+"netsh.exe interface tcp set global autotuninglevel=disabled"+"\"");
     endif;
end;  


//放开标点符号
function SetStrException()
STRING szKey;
NUMBER nType, nSize;
begin
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SoftWare\\Ufsoft\\WF\\V8.700\\"+"Portal";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox ("Portal" + "创建失败", SEVERE);
    endif;  
    /*
    if (RegDBSetKeyValueEx (szKey, "BadStrException", REGDB_STRING, "\"|&,",-1) < 0) then
endif;
*/
end;   
//删除注册表放开标点.
function ExFn_DelStrException(szSubKey)
STRING szKey;  
NUMBER nType, nSize;
begin
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SoftWare\\Ufsoft\\WF\\V8.700\\"+szSubKey;
if (RegDBDeleteKey (szKey) < 0) then
endif;
end;  


//解决WIN2008 WIN7反复卸载后安装出现 无法打开项 UNKNOWN\Components 的问题。
//执行这个命令后解决 。。secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose 
//此命令执行后导致 dhcp client启动不成功,Inode SQLServer服务使用不了,只能安装出错后,手工的处理,。
//已经修改成使用  GrantprivilegeToRegister(RegKey) 方法了 。
function SetOSWin2008Win7InstallMsiProblem() 
string szdefltbaseinf,svResult,szWindowsDir;
begin  
     ExFn_WriteLog("SetOSWin2008Win7InstallMsiProblem()","解决WIN2008 WIN7反复卸载后安装出现UNKNOWN\Components问题");
     ExFn_WriteLog("WINSYSDIR:",WINSYSDIR);  
     if(FindFile(m_WinDir+"\\inf","defltbase.inf",svResult)==0) then     
       ExFn_WriteLog("FindFile defltbase.inf",m_WinDir+"\\inf\\defltbase.inf"); 
       if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then
           szdefltbaseinf= "\""+ m_WinDir+"\\inf\\defltbase.inf"+"\"";
           UseDLL(ENVCHECK_DLL);    
            Run("secedit /configure /cfg " + szdefltbaseinf + " /db defltbase.sdb /verbose");
           UnUseDLL(ENVCHECK_DLL);
           ExFn_WriteLog("secedit /configure /cfg " + szdefltbaseinf + " /db defltbase.sdb /verbose","解决WIN2008 WIN7反复卸载后安装出现 无法打开项 UNKNOWN\Components 的问题");
       endif;
     endif; 
end;  
  
/*解决WIN2008 WIN7反复卸载后安装出现 无法打开项 UNKNOWN\Components 的问题
subinacl.exe /subkeyreg HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData /grant=administrators=f
表示给HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData以及它下面的子键赋予管理员组完全访问。
以前使用secedit的方式,你们使用了默认安全模板,会将系统的安全性回到到默认值,修改范围太广,
subinacl.exe这个工具可以根据指定注册表赋值,不限操作系统版本。
*/
function  GrantprivilegeToRegister(RegKey)     
string  m_regkey,cmdargs,svresultpri;
begin    
      ExFn_WriteLog("GrantprivilegeToRegister(RegKey)","解决反复卸载后安装出现UNKNOWN\Components问题");
      m_regkey=RegKey;    
      if(FindFile(WINSYSDIR,"subinacl.exe",svresultpri)==0) then
        //cmdargs=WINSYSDIR+ "subinacl.exe /subkeyreg "+RegKey+" /grant=administrators=f";
        cmdargs=" /subkeyreg "+RegKey+" /grant=administrators=f";  
        ExFn_WriteLog(WINSYSDIR^"subinacl.exe"+cmdargs," GrantprivilegeToRegister(RegKey)");
        LaunchAppAndWait(WINSYSDIR^"subinacl.exe",cmdargs,LAAW_OPTION_WAIT_INCL_CHILD|LAAW_OPTION_HIDDEN); 
      endif;
end;


//修改 HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers 注册表项下面的 PolicyScope 的注册表值,将值从0改为1
//安装前,降低系统的安全策略,不会出现MSI包过大时出现内存加载不了的问题。   lilf
function SetPolicyScope()  
STRING szKey;  
    begin
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif; 
   szKey="SOFTWARE\\Policies\\Microsoft\\windows\\safer\\codeidentifiers"; 
   if (RegDBSetKeyValueEx (szKey, "PolicyScope", REGDB_NUMBER, "1",-1) < 0) then
     ExFn_WriteLog("SetPolicyScope()","安装前降低系统的安全策略设置失败:"+szKey); 
   else
     ExFn_WriteLog("SetPolicyScope()","安装前降低系统的安全策略设置成功:"+szKey);  
endif;
    end; 
    
//安装后,提高系统的安全策略,防止系统安全策略过低,影响系统的安全级别。  lilf
function ResetPolicyScope()
    STRING szKey;  
    begin
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif; 
   szKey="SOFTWARE\\Policies\\Microsoft\\windows\\safer\\codeidentifiers"; 
   if (RegDBSetKeyValueEx (szKey, "PolicyScope", REGDB_NUMBER, "0",-1) < 0) then  
     ExFn_WriteLog("ResetPolicyScope()","安装后提高系统的安全策略设置失败:"+szKey); 
   else
     ExFn_WriteLog("ResetPolicyScope()","安装后提高系统的安全策略设置成功:"+szKey);
endif;
    end; 
    
//解决 BM 打开分析表查询,然后打开执行分析表设计后在切换到分析表查询显示错误
function Settreeviewhtcfilereplace() 
string svResult;
begin  
    Disable(LOGGING);
     XCopyFile (TARGETDIR+"\\clientaccesspolicy.xml", WINDISK^"Inetpub\\wwwroot", COMP_NORMAL); 
     XCopyFile (TARGETDIR+"\\treeview.htc", WINDISK^"Inetpub\\wwwroot", COMP_NORMAL); 
    Enable(LOGGING);
if(FindFile(WINDISK+"\\Inetpub\\wwwroot\\webctrl_client\\1_0","treeview.htc",svResult)==0) then
  UseDLL(ENVCHECK_DLL);
   Run(SUPPORTDIR^"filereplace.exe "+"\""+WINDISK^"Inetpub\\wwwroot\\webctrl_client\\1_0\\treeview.htc"+ "\"  \""+WINDISK^"Inetpub\\wwwroot\\webctrl_client\\1_0\\treeview.htc\" " + "\""+"head.appendChild(base);"+"\" "+ "\""+"//head.appendChild(base) ;"+"\"");
  UnUseDLL(ENVCHECK_DLL);
  ExFn_WriteLog("Settreeviewhtcfilereplace ",SUPPORTDIR^"filereplace.exe "+"\""+WINDISK^"Inetpub\\wwwroot\\webctrl_client\\1_0\\treeview.htc"+ "\"  \""+WINDISK^"Inetpub\\wwwroot\\webctrl_client\\1_0\\treeview.htc\" " + "\""+"head.appendChild(base);"+"\" "+ "\""+"//head.appendChild(base) ;"+"\"");
     endif;   
 end;       
 //有些微软的系统文件卸载MSI包后需要重新的进行注册。
 function ReverseRegisterSystemfolderFiles()
 begin 
      ExFn_Run("regsvr32.exe  " + WINSYSDIR^"msxml3.dll" +" /s");  
      ExFn_Run("regsvr32.exe  " + WINSYSDIR^"msxml4.dll" +" /s");
 end;
 
 //停止进程中msiexec.exe taskkill /im msiexec.exe    
 function StopMsiexecInTaskKill()  
 string taskkillargs,svResult;
 begin 
     taskkillargs=WINSYSDIR+"\\taskkill.exe";
     if(FindFile(WINSYSDIR,"taskkill.exe",svResult)==0) then
       LaunchAppAndWait(taskkillargs,"  /im msiexec.exe", LAAW_OPTION_WAIT_INCL_CHILD|LAAW_OPTION_HIDDEN); 
       ExFn_WriteLog("StopMsiexecInTaskKill",taskkillargs+"  /im msiexec.exe"); 
     endif;
 end;
 /*
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDoDynamicCompression TRUE
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDoOnDemandCompression TRUE
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDoStaticCompression TRUE
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel 9
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "js" "xml" "css"
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcOnDemandCompLevel 9
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx"
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE
cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/extjs "IIsWebDirectory"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/extjs/HttpExpires "D, 0x15180"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/resources "IIsWebDirectory"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/resources/HttpExpires "D, 0x15180"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/crypto "IIsWebDirectory"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/crypto/HttpExpires "D, 0x15180"


REM 设置脚本1天的延期时间。后期合并为一个脚本文件。


cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/scripts "IIsWebDirectory"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/scripts/HttpExpires "D, 0x15180"


 


REM 设置Silverlight相关的Expires设置


cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/ClientBin/ "IIsWebDirectory"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/ClientBin/UFIDA.U8.Portal.EnterprisePortal.xap "IIsWebFile"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/ClientBin/UFIDA.U8.Portal.EnterprisePortal.xap/HttpExpires "D, 0x15180"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/silverlight.htm "IIsWebFile"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/silverlight.htm/HttpExpires "D, 0x15180"






cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/Filters "IISFilters"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/1/Filters/FilterLoadOrder "RemETag"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/Filters/RemETag "IISFilter"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/1/Filters/RemETag/FilterPath "D:\U8SOFT\U8SL\Component\RemEtag.dll"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/1/Filters/RemETag/FilterState "1"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/1/Filters/RemETag/FilterFlags "131072"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/1/Filters/RemETag/FilterDescription "Remove ETAG Header ISAPI filter, Version 1.0"






过期设置
REM 设置U8SL/ClientBin/Icons的Expires设置
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs CREATE W3SVC/1/ROOT/U8SL/ClientBin/Icons "IIsWebDirectory"
cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs SET w3svc/1/Root/U8SL/ClientBin/Icons/HttpExpires "D, 0x15180"






 */
 //BS门户站点启用GZip压缩
 function SetBsPortalStartGZip()
 begin 
     IISsetvbsCopy(m_WinDir); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcDoDynamicCompression TRUE"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcDoOnDemandCompression TRUE");
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcDoStaticCompression TRUE"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel 9"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcOnDemandCompLevel 9"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE"); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcFileExtensions"+" \""+"htm"+"\" "+"\""+"html"+"\" "+"\""+"txt"+"\" "+"\""+"js"+"\" "+"\""+"xml"+"\" "+"\""+"css"+"\" "+"\""+"vbs"+"\" "+"\""+"htc"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions"+" \""+"asp"+"\" "+"\""+"dll"+"\" "+"\""+"exe"+"\" "+"\""+"aspx"+"\" "+"\""+"asmx"+"\""); 
      
     //为了提高BS门户性能,将一些脚本、资源做了缓存处理 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/extjs "+"\""+"IIsWebDirectory"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/extjs/HttpExpires "+"\""+"D, 0x15180"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/resources "+"\""+"IIsWebDirectory"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/resources/HttpExpires "+"\""+"D, 0x15180"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/crypto "+"\""+"IIsWebDirectory"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/crypto/HttpExpires "+"\""+"D, 0x15180"+"\""); 
     
     //REM 设置脚本1天的延期时间。后期合并为一个脚本文件
    // ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/scripts "+"\""+"IIsWebDirectory"+"\"");  
    // ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/scripts/HttpExpires "+"\""+"D, 0x15180"+"\""); 
     //REM 设置Silverlight相关的Expires设置
    // ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/ClientBin/ "+"\""+"IIsWebDirectory"+"\"");  
    // ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/ClientBin/UFIDA.U8.Portal.EnterprisePortal.xap "+"\""+"IIsWebFile"+"\""); 
    // ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/ClientBin/UFIDA.U8.Portal.EnterprisePortal.xap/HttpExpires "+"\""+"D, 0x15180"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/silverlight.htm "+"\""+"IIsWebFile"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/silverlight.htm/HttpExpires "+"\""+"D, 0x15180"+"\""); 
     
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/Filters "+"\""+"IISFilters"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET W3SVC/1/Filters/FilterLoadOrder "+"\""+"RemETag"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/Filters/RemETag "+"\""+"IISFilter"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET W3SVC/1/Filters/RemETag/FilterPath "+"\""+TARGETDIR+"\\U8SL\\Component\\RemEtag.dll"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET W3SVC/1/Filters/RemETag/FilterState "+"\""+"1"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET W3SVC/1/Filters/RemETag/FilterFlags "+"\""+"131072"+"\"");  
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET W3SVC/1/Filters/RemETag/FilterDescription "+"\""+"Remove ETAG Header ISAPI filter, Version 1.0"+"\"");
     
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "CREATE W3SVC/1/ROOT/U8SL/ClientBin/Icons "+"\""+"IIsWebDirectory"+"\""); 
     ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "SET w3svc/1/Root/U8SL/ClientBin/Icons/HttpExpires "+"\""+"D, 0x15180"+"\"");  
     


 end;  
 
 //卸载是删除添加的脚本命令项目
 //cscript.exe %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs DELETE W3SVC/1/Filters/RemETag
  function UnSetupScriptconfig()    
  begin   
    ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "DELETE W3SVC/1/Filters/RemETag");  
  end;
   
  //卸载后删除快捷方式图标。
 function DeleteFolderShortCutICON()   
 NUMBER dwLanID;
 begin 
      //0x0804 8*16^2+4=2052 (简体中文)  
      if(SYSINFO.nSystemLangID==2052)  then 
        DeleteDir (FOLDER_PROGRAMS^"用友U8+V15.0", ALLCONTENTS);  
        DeleteFolderIcon(FOLDER_PROGRAMS,"用友U8+V15.0");
        DeleteFolderIcon(FOLDER_DESKTOP,"UU"); 
        if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
         DeleteFolderIcon(FOLDER_DESKTOP,"iSD用友绿色服务桌面"); 
        endif;
      //0x0404 4*16^2+4=1028 (繁体中文)
      elseif(SYSINFO.nSystemLangID==1028) then
        DeleteDir (FOLDER_PROGRAMS^"用友U8+V15.0", ALLCONTENTS); 
        DeleteFolderIcon(FOLDER_PROGRAMS,"用友U8+V15.0");
        DeleteFolderIcon(FOLDER_DESKTOP,"UU"); 
        if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
          DeleteFolderIcon(FOLDER_DESKTOP,"iSD用友綠色服務桌面");
        endif; 
      //英文环境。0x0009 
      else  
        DeleteDir (FOLDER_PROGRAMS^"yonyou u8+v15.0", ALLCONTENTS); 
        DeleteFolderIcon(FOLDER_PROGRAMS,"yonyou u8+v15.0");
        DeleteFolderIcon(FOLDER_DESKTOP,"UU");  
        if RegDBKeyExist ("SOFTWARE\\iSD") < 0 then
         DeleteFolderIcon(FOLDER_DESKTOP,"Intelligence Service Desktop"); 
        endif;
      endif;
 end;
 
 
 // 安装前,确认所有的U8的服务是关闭的,如果不是关闭,关闭U8的所有的服务
 function StopU8Allservices() 
 STRING U8TaskService,svValue;
   begin   
        //停止趋势服务
        StopServiceU8("tmlisten");  
        StopServiceU8("ntrtscan"); 
        StopServiceU8("TmProxy");  
        
        //360杀毒软件的服务
        StopServiceU8("360EntClientSvc"); 
        StopServiceU8("ZhuDongFangYu"); 
        
        //猎豹安全浏览器防御模块
        StopServiceU8("knbcenter");  
        //删除趋势进程  
        UseDLL(ENVCHECK_DLL);  
           RunNoBlock("CMD /C taskkill /F /IM PccNTMon.exe");
           //U8的可能启动的进程    
           RunNoBlock("CMD /C taskkill /F /IM UFIDA.U8.ECE.UTU.exe");
           RunNoBlock("CMD /C taskkill /F /IM UFIDA.U8.ECE.UTU.Services.exe");
           RunNoBlock("CMD /C taskkill /F /IM ShellStub.exe");
           RunNoBlock("CMD /C taskkill /F /IM dllhost.exe");  
           RunNoBlock("CMD /C taskkill /F /IM EnterprisePortal.exe");
           RunNoBlock("CMD /C taskkill /F /IM inetinfo.exe"); 
           RunNoBlock("CMD /C taskkill /F /IM EPStartHelper.exe"); 
           RunNoBlock("CMD /C taskkill /F /IM U8WorkerService.exe");  
           RunNoBlock("CMD /C taskkill /F /IM UUDesktop.exe");
           RunNoBlock("CMD /C taskkill /F /IM UFNote6.exe"); 
           RunNoBlock("CMD /C taskkill /F /IM PipClient.exe");
           RunNoBlock("CMD /C taskkill /F /IM MAService.exe");
           RunNoBlock("CMD /C taskkill /F /IM EisService.exe");
           RunNoBlock("CMD /C taskkill /F /IM java.exe");
           RunNoBlock("CMD /C taskkill /F /IM RasClntMgr.exe");
           RunNoBlock("CMD /C taskkill /F /IM MiniMonitor.exe");
           RunNoBlock("CMD /C taskkill /F /IM RasBasicManage.exe");
           RunNoBlock("CMD /C taskkill /F /IM RasClntMgr.exe");
           RunNoBlock("CMD /C taskkill /F /IM RasClntMgr.exe");
           
           //360杀毒软件
           RunNoBlock("CMD /C taskkill /F /IM ZhuDongFangYu.exe"); 
           RunNoBlock("CMD /C taskkill /F /IM 360tray.exe");  
           RunNoBlock("CMD /C taskkill /F /IM 360leakfixer.exe"); 
           RunNoBlock("CMD /C taskkill /F /IM 360EntClient.exe"); 
           
           //猎豹浏览器
           RunNoBlock("CMD /C taskkill /F /IM KNBCenter.exe");
           
           //PDM ftp下载服务器.
           RunNoBlock("CMD /C taskkill /F /IM ftpd.exe");
           RunNoBlock("CMD /C taskkill /F /IM ftpdx64.exe");
           
           //删除CRM 文件
           RunNoBlock("CMD /C taskkill /F /IM websocket.exe");
           RunNoBlock("CMD /C taskkill /F /IM http.exe");
           
           //删除U8启动文件
           RunNoBlock("CMD /C taskkill /F /IM admin.exe");
           
           //金万维启动EXE
           RunNoBlock("CMD /C taskkill /F /IM php-cgi.exe");
           
           RunNoBlock("CMD /C taskkill /F /IM SetupConfigure.exe");
           
           RunNoBlock("CMD /C iisreset /stop"); 
        UnUseDLL(ENVCHECK_DLL);
         
        ExFn_WriteLog("StopU8Allservices() "," Start");
        StopServiceU8("UFNet");  
        StopServiceU8("U8TaskService");  
        StopServiceU8("U8DispatchService");
StopServiceU8("U8KeyManagePool");
StopServiceU8("U8MPool");
StopServiceU8("U8SCMPool");
StopServiceU8("U8WebPool");
StopServiceU8("UFReportService");
StopServiceU8("UTUService");
StopServiceU8("U8SLReportService");   
StopServiceU8("TurboCRM70"); 
StopServiceU8("Apache4TurboCRM70");  
StopServiceU8("XYNTService"); 
StopServiceU8("U8MAService"); 
StopServiceU8("U8EISService"); 
StopServiceU8("Apache4U8AppServer"); 
StopServiceU8("U8AllAuthServer");


//停止智能客户端服务和监控服务
StopServiceU8("U8SmartClientMonitor"); 
StopServiceU8("U8SmartClient"); 

StopServiceU8("U8EISService"); 
StopServiceU8("U8EncryptService"); 

//停止邮件服务
StopServiceU8("U8SendMailAdmin"); 

UseDLL(ENVCHECK_DLL);   
        if (FindFile (TARGETDIR+"\\turbocrm70\\memcached", "memcached.exe", svValue) = 0) then 
        Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d stop");
        Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d uninstall");
        endif;    
        UnUseDLL(ENVCHECK_DLL);
StopServiceU8("memcached Server");   

//停止远程接入科迈服务    
   if FeatureIsItemSelected(MEDIA,"RAS")=1 then 
           StopServiceU8("Ras Database Service"); 
           StopServiceU8("RasBasicManage"); 
           StopServiceU8("RasMonitor"); 
           StopServiceU8("RasWebService");  
        endif;  
        
        if FeatureIsItemSelected(MEDIA,"PDM")=1 then 
           StopServiceU8("UFAllNet");
           //StopServiceU8("yonyouftpserver");
        endif;
//使用比较少的服务
StopServiceU8("UFMessageDispatchServices");
StopServiceU8("EngineController");
StopServiceU8("U8WorkFlowEngineService");
StopServiceU8("UfAutoLoadService");
StopServiceU8("UFTASKSCHEDULESERVICE");
StopServiceU8("U8BackupService");
StopServiceU8("UfMsgGhost");
StopServiceU8("UFALERTSERVICE");
StopServiceU8("U8SmsSrv");    

ExFn_WriteLog("StopU8Allservices() "," END");
   end; 
 //sc stop 停止服务
 function StopServiceU8(servicename)
 string m_servicenamearg;
 begin 
     m_servicenamearg="  stop "+"\""+ servicename+"\""; 
     ExFn_WriteLog("StopServiceU8(servicename) servicename= sc.exe ",m_servicenamearg);
     if(ServiceExistsService(servicename)==TRUE)  then 
      ServiceStopService(servicename);
      LaunchAppAndWait(WINSYSDIR^"sc.exe",m_servicenamearg,WAIT|LAAW_OPTION_HIDDEN); 
     endif;
 end; 
  //sc stop 启动服务
 function StartServiceU8(servicename)
 string m_servicenamearg;
 begin 
     m_servicenamearg="  start "+ "\""+servicename+"\""; 
     ExFn_WriteLog("StartServiceU8(servicename) servicename= sc.exe ",m_servicenamearg); 
     if(ServiceExistsService(servicename)==TRUE)  then 
       ServiceStartService(servicename,"");
       //LaunchAppAndWait(WINSYSDIR^"sc.exe",m_servicenamearg,WAIT|LAAW_OPTION_HIDDEN);  
     endif;
 end;
 //sc delete 删除服务
 function DeleteServiceU8(servicename)
 string m_servicenamearg;
 begin 
     m_servicenamearg=" delete "+ "\""+servicename+"\""; 
     ExFn_WriteLog("DeleteServiceU8(servicename) servicename= sc.exe ",m_servicenamearg); 
     if(ServiceExistsService(servicename)==TRUE)  then
      LaunchAppAndWait(WINSYSDIR^"sc.exe",m_servicenamearg,WAIT|LAAW_OPTION_HIDDEN); 
     endif;
 end;   
 
 //卸载平台包的时候停止平台包中含有的服务
 function StopPaltframeServices()
 begin  
    //停止趋势服务
    //StopServiceU8("tmlisten");  
    //StopServiceU8("ntrtscan"); 
    //StopServiceU8("TmProxy"); 
    //停止服务U8TaskService
    StopServiceU8("U8TaskService"); 
    StopServiceU8("U8AllAuthServer");
    //停止服务U8DispatchService
    StopServiceU8("U8DispatchService");
    //停止服务U8KeyManagePool
    StopServiceU8("U8KeyManagePool");  
    //停止服务U8MPool 
    StopServiceU8("U8MPool"); 
    //停止服务U8WebPool
    StopServiceU8("U8WebPool"); 
    //停止服务UFReportService
    StopServiceU8("UFReportService");   
    //停止服务U8SLReportService 
    StopServiceU8("U8SLReportService"); 
    //停止服务U8SCMPool  U8SCMPool.exe 
    StopServiceU8("U8SCMPool");  
    StopServiceU8("U8WorkerService1");  
    StopServiceU8("U8WorkerService2"); 
    StopServiceU8("Apache4U8AppServer");
    //打印服务
    StopServiceU8("Spooler");
    
    
    StopServiceU8("U8SmartClientMonitor");    
    StopServiceU8("U8SmartClient");
    StopServiceU8("U8EISService"); 
    StopServiceU8("U8EncryptService"); 
    //停止邮件服务
StopServiceU8("U8SendMailAdmin"); 


 end;
 
 
 //卸载平台包的时候删除平台包中含有的服务
 function DeletaPaltframeServices()
 begin       
    //删除服务U8TaskService 
DeleteServiceU8("U8TaskService");
DeleteServiceU8("U8AllAuthServer");
//删除服务U8DispatchService 
DeleteServiceU8("U8DispatchService"); 
//删除服务U8KeyManagePool 
DeleteServiceU8("U8KeyManagePool"); 
//删除服务U8MPool 
DeleteServiceU8("U8MPool"); 
//删除服务U8WebPool   
DeleteServiceU8("U8WebPool");
//删除服务UFReportService 
DeleteServiceU8("UFReportService"); 
//删除服务U8SLReportService UFIDA.U8.Report.SLReportService.exe
DeleteServiceU8("U8SLReportService"); 
//删除服务U8SCMPool  U8SCMPool.exe 
    DeleteServiceU8("U8SCMPool");
    DeleteServiceU8("U8WorkerService1");
    DeleteServiceU8("U8WorkerService2");  
    DeleteServiceU8("Apache4U8AppServer"); 
    
    
    DeleteServiceU8("U8SmartClientMonitor"); 
    DeleteServiceU8("U8SmartClient"); 
    DeleteServiceU8("U8EISService"); 
    DeleteServiceU8("U8EncryptService"); 
    
    //删除邮件服务
    DeleteServiceU8("U8SendMailAdmin"); 

 end;


//彻底删除MSI包残留的信息。调用msizap.exe    MSI清除工具。   
function void ExFn_AbsoluteDeleteMsi(msiGuid) 
begin   
    ExFn_WriteLog("ExFn_AbsoluteDeleteMsi",msiGuid); 
   if RegDBKeyExist(UNINSTALL_KEY_NAME +msiGuid)=1 then   
        ExFn_WriteLog(UNINSTALL_KEY_NAME+ msiGuid,""); 
        UseDLL(ENVCHECK_DLL);
               Run(SUPPORTDIR^"msizap.exe t "+msiGuid);  
             UnUseDLL(ENVCHECK_DLL);
             ExFn_WriteLog(SUPPORTDIR^"msizap.exe t "+msiGuid,""); 
endif;
end;    


//彻底删除MSI包残留的信息。服务器\应用服务器 安装的MSI包
function void   ExFn_AbsoluteDeleteAppserverMsi()
begin     
      ExFn_AbsoluteDeleteMsi("{B2D6C198-095C-4A26-9840-98836AF70F23}");
      //U8ERP-PUBLIC-COMMON2.msi
      ExFn_AbsoluteDeleteMsi("{E10149AC-BE82-4760-8BD9-301C6B11B0F2}");
      
      //U8ERP-PUBLIC-openapix64.msi
      //ExFn_AbsoluteDeleteMsi("{1c23de0c-5ff3-4f22-8044-ff314a490ed3}");
      //U8ERP-PUBLIC-openapix86.msi
      ExFn_AbsoluteDeleteMsi("{5937f0ce-25e4-4dcd-bc39-d0f19afd519f}");      
      
      ExFn_AbsoluteDeleteMsi("{F554F819-FDE7-406E-9095-A78CAABA22A6}");
      ExFn_AbsoluteDeleteMsi("{29935392-23EB-4FC7-AC8A-308D7101B133}");
      ExFn_AbsoluteDeleteMsi("{D057B835-1AB0-4439-945D-F3064030B8F3}");
      ExFn_AbsoluteDeleteMsi("{28AFDE6B-54E6-4D5D-8407-26126267722A}");
      ExFn_AbsoluteDeleteMsi("{3FD62FE5-F4B9-4C69-BC11-EC9531A69A41}");
      ExFn_AbsoluteDeleteMsi("{0101FF2B-33BE-451A-A7D1-7754DF2D4457}");
      ExFn_AbsoluteDeleteMsi("{87D8570F-5D85-430A-97F5-1721592B14D5}");
      ExFn_AbsoluteDeleteMsi("{DA024A96-5C95-4E9B-87FE-EC2906717AAC}");
      ExFn_AbsoluteDeleteMsi("{C7F51B39-F80D-4FDF-AC0B-665CE37DDEEB}");
      ExFn_AbsoluteDeleteMsi("{44D5956A-868C-4FBD-8C04-9C70A7AAF39A}");
      ExFn_AbsoluteDeleteMsi("{5C1C45AF-75A5-43C1-8768-06DC3D7F1B46}");
      ExFn_AbsoluteDeleteMsi("{17A6ADEB-7CAC-440A-AC71-122D66E10132}");
      ExFn_AbsoluteDeleteMsi("{7DED3042-9870-4504-95CB-7E1396A12DD5}");
      ExFn_AbsoluteDeleteMsi("{B7F76D73-44F5-4A16-8490-4D0F56E397BD}");
      ExFn_AbsoluteDeleteMsi("{D1B612FA-71C3-4707-9E4B-D387306CB195}");
      ExFn_AbsoluteDeleteMsi("{6BF16486-4C92-4E21-8103-67FCA1CB12A6}");
      ExFn_AbsoluteDeleteMsi("{21B42064-DDA6-4231-A31E-5E3732D1744D}");
      ExFn_AbsoluteDeleteMsi("{582E19C0-23C4-44A7-8772-F0C623297C16}");
      ExFn_AbsoluteDeleteMsi("{0FFB5988-4B88-4B14-9030-4BB3FF0C1F2F}");
      ExFn_AbsoluteDeleteMsi("{4EB76A0F-9902-4FF6-9D21-2B6C881FF706}");
      ExFn_AbsoluteDeleteMsi("{9ED67696-FCF0-4E8B-9BCD-975D86A4104D}");
      ExFn_AbsoluteDeleteMsi("{4F546DF9-E985-4C3A-A8E7-98BCE3D65A5D}");
      ExFn_AbsoluteDeleteMsi("{56106E75-31E9-4C12-BA0E-6C791FF65418}");
      ExFn_AbsoluteDeleteMsi("{2C29F6CF-2AC1-46A6-875D-D9FEDAA00770}");
      U8V12.0需求 添加FB 费用管理
      ExFn_AbsoluteDeleteMsi("{aeff21eb-25b6-4eb0-bd9e-5b45b0d0b6e9}");
      
      ExFn_AbsoluteDeleteMsi("{28B6C62A-D9DD-4352-80D2-C258F86F85F3}");
      ExFn_AbsoluteDeleteMsi("{7EE78EC5-5F48-4A6B-A949-8AE165ADD06E}");
      ExFn_AbsoluteDeleteMsi("{F7FA54DE-5590-4D95-A875-EC1EFB1281CD}");
      ExFn_AbsoluteDeleteMsi("{0A6D4ADE-5188-4A59-9681-4BFF25E950F9}");
      ExFn_AbsoluteDeleteMsi("{224DF229-95E5-4927-9DBE-D48320D1F05E}");
      ExFn_AbsoluteDeleteMsi("{4EAB69F1-1A21-4690-82AD-AAF6B4653E36}");   
      ExFn_AbsoluteDeleteMsi("{C44EEA8D-4D83-468B-AF0F-A74D5A2BFD1B}");
      ExFn_AbsoluteDeleteMsi("{7303FF34-69E0-473E-817B-C27728E77073}");
      ExFn_AbsoluteDeleteMsi("{865041D6-C60F-46A3-948F-B6AFEEB1D347}");
      ExFn_AbsoluteDeleteMsi("{A33E5DFC-4075-454B-807D-10A63EE5E0A7}");
      ExFn_AbsoluteDeleteMsi("{096E3A78-5313-4FC5-8B3C-63E8EA599362}");
      ExFn_AbsoluteDeleteMsi("{ADB273B6-59CC-4A51-83A3-C69A0249ABDE}");
      ExFn_AbsoluteDeleteMsi("{F147E096-2126-41C8-BDA5-E2ED297F2DC3}");
      ExFn_AbsoluteDeleteMsi("{F29D733D-C755-4F8D-85B1-1A8478D69A97}"); 
      ExFn_AbsoluteDeleteMsi("{E1CDD5B7-8952-490D-80D6-0880AA011CE5}");
      ExFn_AbsoluteDeleteMsi("{9BDE162C-7BCD-4722-B879-F4B6B7CF79B8}");
      ExFn_AbsoluteDeleteMsi("{582E19C0-23C4-44A7-8772-F0C613297C16}");
      ExFn_AbsoluteDeleteMsi("{6D0C9977-C0B5-4CE7-BE42-C1CFD7DB42D7}");
      ExFn_AbsoluteDeleteMsi("{2166C7C8-B032-4A45-8C47-88ED6270BC5F}");
      ExFn_AbsoluteDeleteMsi("{F9090D4A-18F7-4CB7-8677-F66F2AEA2D8A}");
      ExFn_AbsoluteDeleteMsi("{93D5982C-37FC-47DF-AD0A-16B3B05D6A97}");
      ExFn_AbsoluteDeleteMsi("{69B07330-FFD4-46C9-A8E4-7D4AF78DA495}");
      ExFn_AbsoluteDeleteMsi("{434FD333-A5E4-4A4E-BA45-A72EEECC8A4C}");
      ExFn_AbsoluteDeleteMsi("{2FF13841-EB92-4A67-849A-872FC4847F4A}");
      ExFn_AbsoluteDeleteMsi("{B7AE865A-791B-4C8A-B813-06BC6E79B116}");
      ExFn_AbsoluteDeleteMsi("{63C31F73-6488-4784-99F2-C9FE2E77222E}");
      ExFn_AbsoluteDeleteMsi("{501E0D28-2182-4B44-BCF2-DB3757ECFAF4}");
      ExFn_AbsoluteDeleteMsi("{C371DFC0-7C1D-48AA-8EB3-BAE2125F921F}");
      ExFn_AbsoluteDeleteMsi("{03FC4463-C12B-40B8-A4D0-FB1654987C14}");
      ExFn_AbsoluteDeleteMsi("{8EC2754D-4735-4379-B979-DB6E1F1AB8FB}");
      ExFn_AbsoluteDeleteMsi("{E67B2A0A-CFBB-4CDF-BF00-3A9086414FD9}");
      ExFn_AbsoluteDeleteMsi("{7F1089E1-2A10-4BC5-BD07-53432671B339}");
      ExFn_AbsoluteDeleteMsi("{CD5E1010-A0BD-4FBF-B91D-9EE7AE514378}");
      ExFn_AbsoluteDeleteMsi("{6F26CF69-5612-4276-82B6-09DC5B9F12D0}"); 
      //U8V13.0去除科迈安装
      /*
      ExFn_AbsoluteDeleteMsi("{1D0AB63F-23CA-4D78-8475-58A78C5D6533}");  //U8ERP-PUBLIC-RAS
      */
      ExFn_AbsoluteDeleteMsi("{1BD21323-FF20-430E-99A9-1294C95F592A}");  //U8ERP-PUBLIC-JWW 金万维    
      ExFn_AbsoluteDeleteMsi("{FDBBEDB7-683F-46A0-94BB-C90E8C13B659}");  //U8ERP-SCM-PDM.msi
      ExFn_AbsoluteDeleteMsi("{A1E93B88-2ED8-44B8-ABCC-2EBB3C043DA1}");  //U8ERP-PUBLIC-EIS.msi
      


end;  
//彻底删除所有的DLL OCX 和其它的配置,CONFIG 文件
function void   ExFn_DelALLRetainFils()
begin   
   UseDLL(ENVCHECK_DLL);   
    Run("CMD /C del /f/s/q  " + "\"" + TARGETDIR+"\\"+"*.dll"+"\""); 
    Run("CMD /C del /f/s/q  " + "\"" + TARGETDIR+"\\"+"*.exe"+"\""); 
    Run("CMD /C del /f/s/q  " + "\"" + TARGETDIR+"\\"+"*.ocx"+"\""); 
    Run("CMD /C del /f/s/q  " + "\"" + TARGETDIR+"\\"+"*.ocx"+"\""); 
    Run("CMD /C del /f/s/q  " + "\"" + TARGETDIR+"\\"+"*.log"+"\""); 
    
    
    //删除快捷方式缓存
    Run("CMD /C del /f/s/q  " + "\"" + "%userprofile%\appdata\Local\IconCache.db"+"\"");
    Run("CMD /C del /f/s/q  " + "\"" + "%userprofile%\Local Settings\Application Data\IconCache.db"+"\"");
   UnUseDLL(ENVCHECK_DLL);
end;     




 //彻底删除所有64,32位注册表项目
function void   ExFn_DelALLU8Registers()
begin   
   LaunchAppAndWait("\""+SUPPORTDIR^"U8CleanTool.exe"+"\"","",NOWAIT);    
   //执行两边确保注册表删除.
   UseDLL(ENVCHECK_DLL);   
    Run("\""+SUPPORTDIR^"U8CleanTool.exe"+"\""); 
   UnUseDLL(ENVCHECK_DLL);
end;                   




//添加删除对应的快截方式.
function void DeleteAddShortCut()
STRING svResult; 
STRING szItemName,szCommandLine,szWorkingDir,szIconPath,szShortCutKey;  
NUMBER  nIcon, nFlag, nResult;       
STRING szKey;
begin   
    ExFn_WriteLog("DeleteAddShortCut !","START");
     ExFn_WriteLog("DeleteAddShortCut !",FOLDER_PROGRAMS);
    //删除EAI环境检测与修复工具因为客户端没有安装这个文件,所以必须删除快截方式
    if (FindFile (TARGETDIR+"\\EAI\\Tools\\EnvDetector", "UFIDA.U8.EAI.EnvDetector.exe", svResult) < 0) then
    //删除中文快截方式
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\\企业应用集成(EAI)","U8EAI环境检测与修复工具"); 
    //删除英文的快截方式  
    DeleteFolderIcon(FOLDER_PROGRAMS^"yonyou u8+v15.0\\Enterprise Applicaton Integration (EAI)","EAI Tools"); 
    //删除繁体快截方式
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\\企業應用集成(EAI)","EAI環境檢測與修復工具");  
    UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_EAI+"\\"+@ID_STRING47+".lnk"+"\"");  
   UnUseDLL(ENVCHECK_DLL);  
    endif; 
    //没有找到这个文件UFIDA.U8.ECE.UTU.UTUServerAdmin.exe  删除快截方式.
    if (FindFile (TARGETDIR+"\\UTU", "UFIDA.U8.ECE.UTU.UTUServerAdmin.exe", svResult) < 0) then
        //删除中文快截方式
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\\UU","UTU管理控制台"); 
    //删除繁体快截方式 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UUU"+"\"",@ID_STRING62);
    DeleteFile ("\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UU"+"\\"+@ID_STRING62+".lnk"+"\"");  
    UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UU"+"\\"+@ID_STRING62+".lnk"+"\"");  
    UnUseDLL(ENVCHECK_DLL);   
    ExFn_WriteLog("DeleteAddShortCut !","\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UU"+"\\"+@ID_STRING62+".lnk"+"\"");
    //删除英文的快截方式    
    DeleteFolderIcon(FOLDER_PROGRAMS^"yonyou u8+v15.0\\UU","UTUService Management Console");
    endif;  
    //没有找到这个文件 UFIDA.U8.ECE.UTU.exe  删除快截方式.
    if (FindFile (TARGETDIR+"\\UTU", "UFIDA.U8.ECE.UTU.exe", svResult) < 0) then
        //删除中文快截方式
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\\UU","UU"); 
    //删除繁体快截方式 
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\\UU","UU");
    //删除英文的快截方式    
    DeleteFolderIcon(FOLDER_PROGRAMS^"yonyou u8+v15.0\\UU","UU");
    UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UU"+"\\"+@ID_STRING52+".lnk"+"\"");  
    UnUseDLL(ENVCHECK_DLL);  
    //删除桌面的快截方式
    DeleteFolderIcon(FOLDER_DESKTOP,"UU");
    endif;   
    
   //没有找到这个文件 UFIDA.U8.ECE.UTU.UTUMessageManager.exe  删除快截方式.
    if (FindFile (TARGETDIR+"\\UTU", "UFIDA.U8.ECE.UTU.UTUMessageManager.exe", svResult) < 0) then
        //删除中文快截方式
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0\\UU","UU消息管理"); 
    //删除繁体快截方式 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\UU"+"\"",@ID_STRING78);
    //删除英文的快截方式    
    DeleteFolderIcon(FOLDER_PROGRAMS^"yonyou u8+v15.0\\UU","UU Message Management");  
    UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UU"+"\\"+@ID_STRING78+".lnk"+"\"");  
    UnUseDLL(ENVCHECK_DLL); 
    endif;
 
    /*
    //删除PLM 的桌面快截方式,如果没有安装PLM
    if (FindFile (TARGETDIR+"\\pdmProfessional\\jboss-4.2.3.GA\\bin", "run.bat", svResult) < 0) then  
       DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING129); 
       UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING129+".lnk"+"\"");  
  UnUseDLL(ENVCHECK_DLL); 
    endif;
    */
    //U8V13.0 电商订单中心删除快捷方式如果对应的EXE不存在
     if (FindFile (TARGETDIR+"\\AppServer\\bin\\OCAPI", "WebUpdateClient.exe", svResult) < 0) then
    //删除快截方式 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_EBDirectory+"\"",@ID_EBServerShortDesc);
    UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_EBDirectory+"\\"+@ID_EBServerShortDesc+".lnk"+"\"");  
    UnUseDLL(ENVCHECK_DLL); 
    endif;
    
    
    
    //如果是ISD自己安装的ISD 不是U8安装的ISD 删除U8创建的快捷方式。
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);  
    if RegDBKeyExist ("SOFTWARE\\iSD") == 1 then
        //删除中文快截方式
    DeleteFolderIcon(FOLDER_PROGRAMS^"用友U8+V15.0","iSD用友绿色服务桌面"); 
    //删除繁体快截方式 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\UU"+"\"",@ID_STRING71);
    //删除英文的快截方式    
    DeleteFolderIcon(FOLDER_PROGRAMS^"yonyou u8+v15.0","Intelligence Service Desktop");  
    UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\UU"+"\\"+@ID_STRING71+".lnk"+"\"");  
   UnUseDLL(ENVCHECK_DLL); 
    else
        //添加快捷方式! 
    if(FindFile(TARGETDIR+"\\ISD", "UUDesktop.exe", svResult) = 0)  then
     //0x0804 8*16^2+4=2052 (简体中文)  
          if(SYSINFO.nSystemLangID==2052)  then   
              szItemName=@ID_STRING71;
          endif;
          //0x0404 4*16^2+4=1028 (繁体中文)
          if(SYSINFO.nSystemLangID==1028) then 
              szItemName=@ID_STRING71; 
          endif; 
          if(szItemName="") then    
               szItemName="Intelligence Service Desktop";
          endif;
     szCommandLine=TARGETDIR+"\\ISD\\UUDesktop.exe"; 
     szWorkingDir= TARGETDIR+"\\ISD";  
     szIconPath=  TARGETDIR+"\\ISD\\logo.ico";  
     nIcon=0;
     szShortCutKey = ""; 
          nFlag= REPLACE; 
     AddFolderIcon (FOLDER_DESKTOP, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); 
    endif; 
    endif;
ExFn_WriteLog("DeleteAddShortCut !","END");   

end;    




function NUMBER ExFn_IsDataPortCanUseCheck(nDataPort)
NUMBER dataport;
string setupbeforecpupath,svresult;
begin
    ExFn_WriteLog("ExFn_IsDataPortCanUseCheck !","Start");
    if(FindFile(SUPPORTDIR,"SetupBeforeCpy.dll",svresult)=0) then
       setupbeforecpupath=SUPPORTDIR^"SetupBeforeCpy.dll";
    endif;
    
    if(FindFile(WINSYSDIR,"SetupBeforeCpy.dll",svresult)=0) then
       setupbeforecpupath=WINSYSDIR^"SetupBeforeCpy.dll";  
    endif;
    ExFn_WriteLog(setupbeforecpupath,"");
    //UnUseDLL(setupbeforecpupath); 
UseDLL(setupbeforecpupath);
dataport=IsDataPortCanUseCheck(nDataPort);
UnUseDLL(setupbeforecpupath); 
ExFn_WriteLog("ExFn_IsDataPortCanUseCheck !","End");
return dataport;
end;  




function BOOL ExFn_IsWebPortCanUseCheck(nWebPort)
BOOL iscanuser;
string setupbeforecpupath,svresult;
begin 
    ExFn_WriteLog("ExFn_IsWebPortCanUseCheck !","Start");
    if(FindFile(SUPPORTDIR,"SetupBeforeCpy.dll",svresult)=0) then
       setupbeforecpupath=SUPPORTDIR^"SetupBeforeCpy.dll";
    endif;
    
    if(FindFile(WINSYSDIR,"SetupBeforeCpy.dll",svresult)=0) then
       setupbeforecpupath=WINSYSDIR^"SetupBeforeCpy.dll";  
    endif;
    ExFn_WriteLog(setupbeforecpupath,"");
    //UnUseDLL(setupbeforecpupath); 
UseDLL(setupbeforecpupath);
iscanuser=IsWebPortCanUseCheck(nWebPort); 
UnUseDLL(setupbeforecpupath); 
ExFn_WriteLog("ExFn_IsWebPortCanUseCheck !","End");
return iscanuser;
end;    


/* 科迈远程设置. 
执行U8SOFT\RasMini\SetupHelper.exe "" 8088 3309 "127.0.0.1" 1033 "3.6"
等待进程完成,就可以了
SetupHelper的命令行参数
1 安装文件所在的目录,这个可以暂时不用管,传空即可
2 web服务器端口
3 数据库端口
4 U8服务器的地址,默认传递"127.0.0.1"
5 语言,1033 英语,1028 繁体,2052 简体中文
6 版本,当前是3.6版本
*/  
function void ExFn_KMRemoteSet(M_u8path,g_KMWebport,g_KMDataport,ServerIP,Lanuage,Version) 
string  M_KMWebport,M_KMDataport; 
string svResult;


begin  
    NumToStr(M_KMWebport, g_KMWebport); 
NumToStr(M_KMDataport, g_KMDataport);  
//0x0804 8*16^2+4=2052 (简体中文)  
    if(SYSINFO.nSystemLangID==2052) then  
      Lanuage="2052";
    //0x0404 4*16^2+4=1028 (繁体中文)
    elseif(SYSINFO.nSystemLangID==1028) then
      Lanuage="1028";
      //英文环境。0x0009 
    else
      Lanuage="1033";
    endif;
if (FindFile(TARGETDIR+"\\RasMini", "SetupHelper.exe", svResult) = 0) then   
  ExFn_WriteLog("ExFn_KMRemoteSet(g_KMWebport,g_KMDataport,ServerIP,Lanuage,Version)::",M_u8path+"::"+M_KMWebport+"::"+M_KMDataport+"::"+ServerIP+"::"+Lanuage+"::"+Version); 
  UseDLL(ENVCHECK_DLL);
               RunWithDirectoryNoBlock("\""+TARGETDIR+"\\RasMini\\"+"SetupHelper.exe"+"\""+" "+"\""+M_u8path+"\""+" "+"\""+M_KMWebport+"\""+" "+"\""+M_KMDataport+"\""+" "+"\""+ServerIP+"\""+" "+"\""+Lanuage+"\""+" "+"\""+ Version+"\"",TARGETDIR+"\\RasMini");  
        UnUseDLL(ENVCHECK_DLL);
endif;
end;    




//regasm.exe /tlb 导出TLB 文件并注册.
function void  ExFn_RegasmTlb(assemblynamedir,assemblyname)
string  svResult;
begin 

ExFn_WriteLog("ExFn_RegasmTlb ! start ",assemblynamedir+"\\"+assemblyname);
if (FindFile(SUPPORTDIR, "RegAsm.exe", svResult) = 0) then  
    if (FindFile(assemblynamedir, assemblyname, svResult) = 0) then 
    UseDLL(ENVCHECK_DLL);
      RunNoBlock(SUPPORTDIR^"RegAsm.exe"+" /tlb "+"\""+assemblynamedir+"\\"+assemblyname+"\"");  
    UnUseDLL(ENVCHECK_DLL); 
    endif;
endif;
ExFn_WriteLog("ExFn_RegasmTlb ! end ",assemblynamedir+"\\"+assemblyname);

end; 


//regasm.exe /tlb 导出TLB 文件注册.
function void  ExFn_Regasm40Tlb(assemblynamedir,assemblyname)
string  svResult;
begin 

ExFn_WriteLog("ExFn_Regasm40Tlb ! start ",assemblynamedir+"\\"+assemblyname);
if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v4.0.30319","RegAsm.exe",svResult)==0) then   
    if (FindFile(assemblynamedir, assemblyname, svResult) = 0) then 
      UseDLL(ENVCHECK_DLL);
        RunNoBlock(m_WinDir+"\\MicroSoft.NET\\Framework\\v4.0.30319\\RegAsm.exe"+" /tlb "+"\""+assemblynamedir+"\\"+assemblyname+"\"");  
      UnUseDLL(ENVCHECK_DLL); 
    endif;
endif;
ExFn_WriteLog("ExFn_Regasm40Tlb ! end ",assemblynamedir+"\\"+assemblyname);
 
end;    
   


//复制adsutil.vbs IIsExt.vbs 到对应的目录下 在WIN8系统没有此文件.


function void  IISsetvbsCopy(m_WinDir)
string  svResult;
begin
     
ExFn_WriteLog("IISsetvbsCopy ! start ","");  
//COPY    IIsExt.vbs 
Disable(LOGGING);
if (FindFile(SUPPORTDIR, "IIsExt.vbs", svResult) = 0) then  
    if (FindFile(WINSYSDIR, "IIsExt.vbs", svResult) < 0) then 
     XCopyFile (SUPPORTDIR+"\\IIsExt.vbs", WINSYSDIR, COMP_NORMAL);
    endif;  
    Disable(WOW64FSREDIRECTION);
    if (FindFile(m_WinDir+"\\system32\\", "iisext.vbs", svResult) < 0) then 
     XCopyFile (SUPPORTDIR+"\\IIsExt.vbs", m_WinDir+"\\system32", COMP_NORMAL);
    endif;
    Enable(WOW64FSREDIRECTION);
endif; 
//COPY  adsutil.vbs
if (FindFile(SUPPORTDIR, "adsutil.vbs", svResult) = 0) then   
    if (ExistsDir(WINDISK^"Inetpub\\AdminScripts") != EXISTS) then  
        CreateDir(WINDISK^"Inetpub\\AdminScripts");
    endif;
    if (FindFile(WINDISK+"\\Inetpub\\AdminScripts","adsutil.vbs", svResult) < 0) then 
     XCopyFile (SUPPORTDIR+"\\adsutil.vbs", WINDISK+"\\Inetpub\\AdminScripts", COMP_NORMAL);
    endif;  
endif;
Enable(LOGGING); 
ExFn_WriteLog("IISsetvbsCopy ! end ","");

end;    




//删除目录和目录下的文件
function void  ExFn_DELETEDirAndFiles(DIR)
string  svResult;
begin 
ExFn_WriteLog("ExFn_DELETEDirAndFiles ! start ",DIR);
if (ExistsDir(DIR) = EXISTS) then  
    DeleteDir(DIR, ALLCONTENTS); 
endif;
ExFn_WriteLog("ExFn_DELETEDirAndFiles ! end ",DIR); 
end;  


//删除给出的目录;
function void  ExFn_ALLDELETEDirAndFiles()
string  givedir;
begin 
ExFn_WriteLog("ExFn_ALLDELETEDirAndFiles ! start ","");  
StopU8Allservices(); 
if FeatureIsItemSelected(MEDIA,"RAS")=1 then 
  if(IsSpecialRas())||FeatureIsItemSelected(MEDIA,"RAS")=1 then
    givedir=TARGETDIR^"RasMini";
         ExFn_DELETEDirAndFiles(givedir);
       endif;  
     endif; 
     givedir=TARGETDIR^"ufcomsql";
     ExFn_DELETEDirAndFiles(givedir);   
     givedir=TARGETDIR^"Portal";
     ExFn_DELETEDirAndFiles(givedir); 
     givedir=TARGETDIR^"Resources";  
     ExFn_DELETEDirAndFiles(givedir); 
     givedir=TARGETDIR^"UAP"; 
     ExFn_DELETEDirAndFiles(givedir); 
     givedir=TARGETDIR^"U8Framework"; 
     ExFn_DELETEDirAndFiles(givedir);  
     givedir=TARGETDIR^"Cache";
     ExFn_DELETEDirAndFiles(givedir);
     givedir=TARGETDIR^"Logs"; 
     ExFn_DELETEDirAndFiles(givedir);
      givedir=TARGETDIR^"Interop";  
     ExFn_DELETEDirAndFiles(givedir); 
      givedir=TARGETDIR^"U8M"; 
     ExFn_DELETEDirAndFiles(givedir);
      givedir=TARGETDIR^"U8Portal";  
     ExFn_DELETEDirAndFiles(givedir);
      givedir=TARGETDIR^"hrCommon";  
     ExFn_DELETEDirAndFiles(givedir); 
     /* givedir=TARGETDIR^"3rdPrograms"; 
     ExFn_DELETEDirAndFiles(givedir); 
     */
      givedir=TARGETDIR^"Framework"; 
     ExFn_DELETEDirAndFiles(givedir); 
      givedir=TARGETDIR^"KeyManage"; 
     ExFn_DELETEDirAndFiles(givedir); 
      givedir=TARGETDIR^"EAI"; 
     ExFn_DELETEDirAndFiles(givedir); 
      givedir=TARGETDIR^"Deploy"; 
     ExFn_DELETEDirAndFiles(givedir); 
      givedir=TARGETDIR^"AppServer"; 
     ExFn_DELETEDirAndFiles(givedir);
      givedir=TARGETDIR^"U8WEB";  
     ExFn_DELETEDirAndFiles(givedir);
      givedir=TARGETDIR^"Workflow";   
     ExFn_DELETEDirAndFiles(givedir);  
     
       givedir=TARGETDIR^"Resources";   
     ExFn_DELETEDirAndFiles(givedir);
     
       givedir=TARGETDIR^"HY";   
     ExFn_DELETEDirAndFiles(givedir);
                                       
       givedir=TARGETDIR^"MessageCenter";   
     ExFn_DELETEDirAndFiles(givedir);    
     
       givedir=TARGETDIR^"SLReportEngine";   
     ExFn_DELETEDirAndFiles(givedir);
     
     /*
       givedir=TARGETDIR^"turbocrm70";   
     ExFn_DELETEDirAndFiles(givedir);
     */




       givedir=TARGETDIR^"turbocrm70\\apache";   
     ExFn_DELETEDirAndFiles(givedir);


       givedir=TARGETDIR^"turbocrm70\\code";   
     ExFn_DELETEDirAndFiles(givedir);
          
       givedir=TARGETDIR^"turbocrm70\\doc";   
     ExFn_DELETEDirAndFiles(givedir);
               
       givedir=TARGETDIR^"turbocrm70\\emlsvr";   
     ExFn_DELETEDirAndFiles(givedir);
                    
       givedir=TARGETDIR^"turbocrm70\\jre";   
     ExFn_DELETEDirAndFiles(givedir);
               
       givedir=TARGETDIR^"turbocrm70\\licensesvr";   
     ExFn_DELETEDirAndFiles(givedir);
     
               
       givedir=TARGETDIR^"turbocrm70\\memcached";   
     ExFn_DELETEDirAndFiles(givedir);
     
               
       givedir=TARGETDIR^"turbocrm70\\php";   
     ExFn_DELETEDirAndFiles(givedir);


       givedir=TARGETDIR^"turbocrm70\\search_index_demo";   
     ExFn_DELETEDirAndFiles(givedir);
       givedir=TARGETDIR^"turbocrm70\\search";   
     ExFn_DELETEDirAndFiles(givedir);
               
       givedir=TARGETDIR^"turbocrm70\\solr";   
     ExFn_DELETEDirAndFiles(givedir);
     
       givedir=TARGETDIR^"turbocrm70\\spool";   
     ExFn_DELETEDirAndFiles(givedir);
     
       givedir=TARGETDIR^"turbocrm70\\temp";   
     ExFn_DELETEDirAndFiles(givedir);
       givedir=TARGETDIR^"turbocrm70\\ZendOptimizer";   
     ExFn_DELETEDirAndFiles(givedir);
       givedir=TARGETDIR^"turbocrm70\\tsvr";   
     ExFn_DELETEDirAndFiles(givedir);
                                        
                    
      givedir=TARGETDIR^"U8AuditWebSite";   
     ExFn_DELETEDirAndFiles(givedir);
     
       givedir=TARGETDIR^"U8SL";   
     ExFn_DELETEDirAndFiles(givedir);     
                                                      
       givedir=TARGETDIR^"UFMOM";   
     ExFn_DELETEDirAndFiles(givedir);  


       givedir=TARGETDIR^"WCF";   
     ExFn_DELETEDirAndFiles(givedir);       
 
        givedir=TARGETDIR^"ISD";   
     ExFn_DELETEDirAndFiles(givedir);                                                       
                                                             
        givedir=TARGETDIR^"u8remote";   
     ExFn_DELETEDirAndFiles(givedir); 
     
             givedir=TARGETDIR^"Installer";   
     ExFn_DELETEDirAndFiles(givedir);                                                              
     UseDLL(ENVCHECK_DLL); 
        RunNoBlock("CMD /C taskkill /F /IM PIPCLI~1.EXE");   
        RunNoBlock("CMD /C taskkill /F /IM dllhost.exe"); 
        RunNoBlock("CMD /C taskkill /F /IM ShellStub.exe"); 
        RunNoBlock("CMD /C taskkill /F /IM RalClntMgr.exe"); 
        
        
   RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\*.dll"+"\"");  
   RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\*.ocx"+"\""); 
  RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\*.exe"+"\""); 
  RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\*.log"+"\""); 
  RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\*.log"+"\"");
 UnUseDLL(ENVCHECK_DLL);   


ExFn_WriteLog("ExFn_ALLDELETEDirAndFiles ! end ",""); 
end;   




/*  初始化科迈注册表.  
[HKEY_LOCAL_MACHINE\SOFTWARE\Comexe Ras Sys\MiniRas]
"AllowTS"=dword:00000001
"ClipRunShell"="1"
"IsLoging"=dword:00000001
"RasDBAuthMode"=""
"RasDBString"=""
"RasDBUserDomain"=""
"RasDBUserName"="RASCOM"
"RasDBUserPW"=""
"RasDomainType"=dword:00000001
"ServerID"=dword:000001FA
"WebRoot"=""
  
 [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\RasMySql]
"DATABASE"="rasdatabase"
"Driver"="[INSTALLDIR]RasDepend\\RasDB\\bin\\myodbc5.dll"
"PORT"="[DataPort]"
"SERVER"="localhost"


[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources]
"RasMySql"="Ras ODBC Driver"
*/
//添加远程接入的注册表项目...              
function void AddRasRegister() 
STRING szKey;
NUMBER nType, nSize;
begin     
        ExFn_WriteLog("AddRasRegister()  !  start ","");
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   Disable(LOGGING);
   szKey="SoftWare\\Comexe Ras Sys\\MiniRas";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else  
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\Comexe Ras Sys\\MiniRas","GROUP","Users","Allow");  
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\Comexe Ras Sys\\MiniRas","GROUP","Everyone","Allow");
      if (RegDBSetKeyValueEx (szKey, "ClipRunShell", REGDB_STRING, "1",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "RasDBAuthMode", REGDB_STRING, "",-1) < 0) then
  endif;  
  if (RegDBSetKeyValueEx (szKey, "RasDBString", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "RasDBUserDomain", REGDB_STRING, "",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "RasDBUserName", REGDB_STRING, "RASCOM",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "RasDBUserPW", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "WebRoot", REGDB_STRING, "",-1) < 0) then
  endif;  
  //添加  dword键值;    
  if (RegDBSetKeyValueEx (szKey, "AllowTS", REGDB_NUMBER, "1",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "IsLoging", REGDB_NUMBER, "1",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "RasDomainType", REGDB_NUMBER, "1",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "u8uninstallcheck", REGDB_NUMBER, "0",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "ServerID", REGDB_NUMBER, "506",-1) < 0) then
  endif;    
    endif; 
   
    szKey="SOFTWARE\\ODBC\\ODBC.INI\\RasMySql";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else  
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\ODBC\\ODBC.INI\\RasMySql","GROUP","Users","Allow");  
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\ODBC\\ODBC.INI\\RasMySql","GROUP","Everyone","Allow");
      if (RegDBSetKeyValueEx (szKey, "DATABASE", REGDB_STRING, "rasdatabase",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "Driver", REGDB_STRING, "[INSTALLDIR]RasDepend\\\\RasDB\\\\bin\\\\myodbc5.dll",-1) < 0) then
  endif;  
  if (RegDBSetKeyValueEx (szKey, "PORT", REGDB_STRING, "[DataPort]",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "SERVER", REGDB_STRING, "localhost",-1) < 0) then
  endif;       
   endif;  
    szKey="SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else  
   ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources","GROUP","Users","Allow");  
   ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources","GROUP","Everyone","Allow");    
    if (RegDBSetKeyValueEx (szKey, "RasMySql", REGDB_STRING, "Ras ODBC Driver",-1) < 0) then
endif;
   endif;
  Enable(LOGGING); 
  // 安装包脚本里改个注册表值,因为如果2008或2012默认会把远程桌面安全验证勾选,导致远程客户端连接报terminal services错误。
  Disable(LOGGING);
         RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);    
         RegDBSetKeyValueEx("\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp", "UserAuthentication", REGDB_NUMBER, "0", -1);
    RegDBSetKeyValueEx("\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\RDP-Tcp", "fEnableWinStation", REGDB_NUMBER, "1", -1);
    RegDBSetKeyValueEx("\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server" ,"fDenyTSConnections" ,REGDB_NUMBER, "0", -1);
  Enable(LOGGING); 
   
  ExFn_WriteLog("AddRasRegister()  !  end ",""); 
end; 


//删除远程接入的注册表项目...              
function void RasDelRASRegister() 
STRING szKey;
NUMBER nType, nSize;
begin  
     ExFn_WriteLog("AddRasRegister()  !  start ",""); 
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SoftWare\\Comexe Ras Sys\\MiniRas";
if (RegDBDeleteKey (szKey) < 0) then
  ExFn_WriteLog("RegDBDeleteKey error ","SoftWare\\Comexe Ras Sys\\MiniRas"); 
endif;  
szKey="SOFTWARE\\ODBC\\ODBC.INI\\RasMySql";
if (RegDBDeleteKey (szKey) < 0) then
endif; 
szKey="SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources";
if (RegDBDeleteKey (szKey) < 0) then
endif; 
//删除桌面的快截方式
    DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING103);
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING103+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 
ExFn_WriteLog("AddRasRegister()  !  end ",""); 
end;




//判断是否是安装过科迈的产品..
/*
科迈服务端guid
1:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EC065B27-13AF-406B-B740-93A460DC6531}
2: HKEY_LOCAL_MACHINE\SOFTWARE\Comexe Ras Sys\MiniRas
*/
function BOOL IsSetUpRas()  
BOOL m_issetupras;  
STRING szKey;
string svResult;
begin  
     m_issetupras=FALSE; 
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif;   
if RegDBKeyExist(UNINSTALL_KEY_NAME + "{EC065B27-13AF-406B-B740-93A460DC6531}") = 1 then 
  m_issetupras=TRUE;
endif;  


if RegDBKeyExist(UNINSTALL_KEY_NAME + "InstallShield_{EC065B27-13AF-406B-B740-93A460DC6531}") = 1 then 
  m_issetupras=TRUE;
endif;  
 
/*
szKey="SOFTWARE\\Comexe Ras Sys\\MiniRas"; 
if RegDBKeyExist(szKey) = 1 then    
m_issetupras=TRUE;
endif;
*/
return m_issetupras;
end;             








//添加PDM注册表项目//


function void AddPDMRegister() 
STRING szKey,szpdmsetupdir,szpdmserverhome,szpdmtype,szCaption;
NUMBER nType, nSize;
begin
   ExFn_WriteLog("AddPDMRegister()  !  start ","");
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SOFTWARE\\yonyouPDM\\SERVER\\7.6";
   if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   endif;
   szpdmsetupdir=TARGETDIR+"\\"+"pdmProfessional";
   if (RegDBSetKeyValueEx (szKey, "InstallDIR", REGDB_STRING, szpdmsetupdir,-1) < 0) then
   endif;
   szpdmserverhome=TARGETDIR+"\\"+"pdmProfessional\\"+"jboss-4.2.3.GA"; 
   if (RegDBSetKeyValueEx (szKey, "SERVERHOME", REGDB_STRING, szpdmserverhome,-1) < 0) then
   endif;
   szpdmtype="yonyouPDMProfessional7.6"; 
   if (RegDBSetKeyValueEx (szKey, "TYPE", REGDB_STRING, szpdmtype,-1) < 0) then
   endif;    


   ExFn_SetReg("PDMProductU8Setup", "PDMALLPRODUCT");
   //设置版本...
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\"+"PDMProductU8Setup";
   szCaption="U8PDM";
   if (RegDBSetKeyValueEx (szKey, "setuptype", REGDB_STRING, szCaption,-1) < 0) then
   endif;
   szKey="SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\"+"PDMProductU8Setup";
   szCaption="7.6";
   if (RegDBSetKeyValueEx (szKey, "setupversion", REGDB_STRING, szCaption,-1) < 0) then
   endif;   


   ExFn_WriteLog("AddPDMRegister()  !  end ",""); 
end;


/*
//删除PDM的注册表项目...              
function void PDMDelPDMRegister() 
STRING szKey;
NUMBER nType, nSize;
begin  
     ExFn_WriteLog("PDMDelPDMRegister()  !  start ",""); 
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\"+"PDMProductU8Setup";
if (RegDBDeleteKey (szKey) < 0) then
endif;  
if FeatureIsItemSelected(MEDIA,"PDM")=1 then
 szKey="SOFTWARE\\yonyouPDM\\SERVER\\7.6";
 if (RegDBDeleteKey (szKey) < 0) then
 endif; 
    endif;  


ExFn_WriteLog("PDMDelPDMRegister()  !  end ",""); 
end;
*/




//卸载经典模式的时候判断是不是提供给U8的专版本科迈
function BOOL IsSpecialRas()
BOOL m_issperas;
STRING raskey,svresult,sKeyValue,sKeyValueTemp;  
NUMBER nvSize,nvType;
begin 
     m_issperas=FALSE;
     ExFn_WriteLog("IsSpecialRas  !  start","");
     raskey="SOFTWARE\\Comexe Ras Sys\\MiniRas";   
    // if(FindFile(TARGETDIR^"RasMini","RasU8License.exe",svresult)==0) then   
       if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
       endif;
       nvType = REGDB_NUMBER;
  if RegDBGetKeyValueEx(raskey,"u8uninstallcheck",nvType,sKeyValue,nvSize) = 0 then  
      StrToLower(sKeyValueTemp, sKeyValue);   
      if(sKeyValueTemp=="0") then  
         m_issperas=TRUE;  
         ExFn_WriteLog("IsSpecialRas m_issperas  !  true",""); 
      endif;
  endif;  
     // endif; 
      return m_issperas;
end; 




//安装U8经典单独  卸载提供给U8的专版科迈(作为U8的一个模块来卸载) 
function void UninstallForU8SpecialRas()  
STRING givedir;
begin 
   //停止远程接入的服务模块 
   if(IsSpecialRas())||FeatureIsItemSelected(MEDIA,"RAS")=1 then  
     UseDLL(ENVCHECK_DLL);
       RunNoBlock("CMD /C taskkill /F /IM PipClient.exe"); 
     UnUseDLL(ENVCHECK_DLL); 
     ExFn_WriteLog("UninstallForU8SpecialRas()  !  start ",""); 
     StopServiceU8("Ras Database Service"); 
     StopServiceU8("RasBasicManage"); 
     StopServiceU8("RasMonitor"); 
     StopServiceU8("RasWebService");      
     RasDelRASRegister();
     DeleteServiceU8("Ras Database Service"); 
     DeleteServiceU8("RasBasicManage"); 
     DeleteServiceU8("RasMonitor"); 
     DeleteServiceU8("RasWebService");  
givedir=TARGETDIR^"RasMini";
     ExFn_DELETEDirAndFiles(givedir);
     //删除桌面的快截方式
     DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING103); 
     DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING99);
     DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING98);
     DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING100);  
     //删除U8下面的快截方式
     DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"",@ID_STRING98); 
     DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"",@ID_STRING99);
     DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"",@ID_STRING100);    
     DeleteDir("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"", ALLCONTENTS);
     
     UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING103+".lnk"+"\"");  
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING99+".lnk"+"\""); 
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING98+".lnk"+"\""); 
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING100+".lnk"+"\"");
    
  //删除U8下面的快截方式     
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING96+"\\"+@ID_STRING98+".lnk"+"\"");  
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING96+"\\"+@ID_STRING99+".lnk"+"\"");  
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING96+"\\"+@ID_STRING100+".lnk"+"\"");  
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING96+"\\"+"*.lnk"+"\"");
  RunNoBlock("CMD /C rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING96+"\"");
  
  //删除安装目录
  RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\RasMini"+"\""); 
  RunNoBlock("CMD /C rmdir /s/q " +"\""+TARGETDIR+"\\RasMini"+"\""); 
UnUseDLL(ENVCHECK_DLL); 
     RegDBDeleteKey(UNINSTALL_KEY_NAME+"{EC065B27-13AF-406B-B740-93A460DC6531}"); //科迈产品
     ExFn_WriteLog("UninstallForU8SpecialRas()  !  end ","");
   endif;
end; 








//设置注册表解决
//[8560] FTH: (8560): *** Fault tolerant heap shim applied to current process. This is usually due to previous crashes. ***
function void SetFTHRegister()
STRING regkey; 
begin   
      if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
      endif; 
      regkey= "SoftWare\\Microsoft\\FTH";
      RegDBCreateKeyEx(regkey, "");
      RegDBSetKeyValueEx (regkey, "Enabled", REGDB_NUMBER, "0",-1);   
      RegDBSetKeyValueEx (regkey, "CrashVelocity", REGDB_NUMBER, "10",-1);
      RegDBSetKeyValueEx (regkey, "MaximumTrackedProcesses", REGDB_NUMBER, "20",-1);  
      RegDBSetKeyValueEx (regkey, "MaximumTrackedApplications", REGDB_NUMBER, "1280",-1);
end;  
        
//复制VS2011运行时       
function void CopyVS2011RuntimeDLL()
string svResult;  
begin 
   ExFn_WriteLog("IOBJSAFE.TLB","");
   Disable(LOGGING); 
     XCopyFile(SUPPORTDIR+"\\msvcp71.dll", WINSYSDIR, COMP_NORMAL); 
     XCopyFile(SUPPORTDIR+"\\msvcr70.dll", WINSYSDIR, COMP_NORMAL);
     XCopyFile(SUPPORTDIR+"\\msjava.dll", WINSYSDIR, COMP_NORMAL|COMP_UPDATE_SAME);
     
    Disable(WOW64FSREDIRECTION);
     XCopyFile(SUPPORTDIR+"IOBJSAFE.TLB", m_WinDir+"\\system32\\", COMP_NORMAL|COMP_UPDATE_SAME); 
     //COM+注册依赖文件的复制  
     if FindFile(m_WinDir+"\\system32\\","IOBJSAFE.TLB",svResult) < 0  then   //没有发现就复制.
         //ExFn_WriteLog("Not Find In IOBJSAFE.TLB",WINSYSDIR+"IOBJSAFE.TLB");
XCopyFile (WINSYSDIR+"IOBJSAFE.TLB", m_WinDir+"\\system32\\", COMP_NORMAL); 
     else
         //ExFn_WriteLog("Find In "+m_WinDir+"\\system32\\"+"IOBJSAFE.TLB","");
endif;  
   Enable(WOW64FSREDIRECTION);  
   Enable(LOGGING);
   ExFn_WriteLog(" END IOBJSAFE.TLB","");
end;


//设置服务超时时间   2013-08-27 lizheng liyong        
function void SetServiceTimeOut()
string sRegKey,sKeyValue;
number nvType,nvSize;
begin 
    //设置服务超时时间  
    ExFn_WriteLog("SetServiceTimeOut ","  START! ");
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
sRegKey =  "SYSTEM\\CurrentControlSet\\Control"; 
nvType = REGDB_NUMBER;
if RegDBGetKeyValueEx(sRegKey,"ServicesPipeTimeout",nvType,sKeyValue,nvSize) = 0 then 
   RegDBSetKeyValueEx (sRegKey, "ServicesPipeTimeout", REGDB_NUMBER, "30000",-1);
else 
RegDBCreateKeyEx(sRegKey,"ServicesPipeTimeout");
RegDBSetKeyValueEx (sRegKey, "ServicesPipeTimeout", REGDB_NUMBER, "30000",-1);
endif;
    ExFn_WriteLog("SetServiceTimeOut ","  END! ");
end;                                       




//回滚的时候设置进度条的递减数值...
function void SetUpRollback(m_reduction)   
begin                                  
//执行回滚操作...
    if g_bIsRollBack==TRUE then  
      if(g_statusprocesscurentvalue>3) then
        g_statusprocesscurentvalue=g_statusprocesscurentvalue-m_reduction;
        SetStatusWindow(g_statusprocesscurentvalue, @ID_setuprollbacklable);
      endif;
    endif;
    
end;  




//卸载的时候执行进度条的递增数值...
function void SetUpUnistallIncrease(m_reduction)   
begin                                  
//进度条的递增数值...
if g_bIsRollBack==FALSE then 
if(g_bprogressnumber>95) then
 g_bprogressnumber=95;
      SetStatusWindow(g_bprogressnumber, @ID_Uninstllrepair);
     else
      g_bprogressnumber=g_bprogressnumber+m_reduction;
      SetStatusWindow(g_bprogressnumber, @ID_Uninstllrepair);
     endif;      
    endif;
end;  


//安装实施导航,需要进行注册表注册,添加OFFICE插件注册表项目.


function void AddOfficeSetupQSSSRegister() 
STRING szKey,officepluginfilepath;
string szURL,szPublicKey;
NUMBER nType, nSize;
begin     
        ExFn_WriteLog("AddOfficeSetupQSSSRegister()  !  start ","");
        
        //向 HKEY_LOCAL_MACHINE 添加注册表项目
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="Software\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else  
      officepluginfilepath=TARGETDIR+"\\ImplementNavigation\\OBA\\U8SceneDesigner\\bin\\UFIDA.U8.IN.OBA.Word.Addins.vsto|vstolocal";
      Disable(LOGGING);
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins","GROUP","Users","Allow");  
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins","GROUP","Everyone","Allow");
      if (RegDBSetKeyValueEx (szKey, "Description", REGDB_STRING, "UFIDA.U8.IN.OBA.Word.Addins - Word add-in created with Visual Studio Tools for Office",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "FriendlyName", REGDB_STRING, "UFIDA.U8.IN.OBA.Word.Addins",-1) < 0) then
  endif;  
  if (RegDBSetKeyValueEx (szKey, "Manifest", REGDB_STRING,officepluginfilepath,-1) < 0) then
  endif; 
  //添加  dword键值;    
  if (RegDBSetKeyValueEx (szKey, "LoadBehavior", REGDB_NUMBER, "3",-1) < 0) then
  endif;  
  Enable(LOGGING);   
    endif; 
   
    //向 HKEY_LOCAL_MACHINE 添加注册表项目 HKEY_CURRENT_USER
    if (RegDBSetDefaultRoot(HKEY_CURRENT_USER)<0) then
   endif;
   szKey="Software\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else  
      officepluginfilepath=TARGETDIR+"\\ImplementNavigation\\OBA\\U8SceneDesigner\\bin\\UFIDA.U8.IN.OBA.Word.Addins.vsto|vstolocal";
      Disable(LOGGING);
      ExFn_SetRegPrivilege("CURRENT_USER\\SOFTWARE\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins","GROUP","Users","Allow");  
      ExFn_SetRegPrivilege("CURRENT_USER\\SOFTWARE\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins","GROUP","Everyone","Allow");
      if (RegDBSetKeyValueEx (szKey, "Description", REGDB_STRING, "UFIDA.U8.IN.OBA.Word.Addins - Word add-in created with Visual Studio Tools for Office",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "FriendlyName", REGDB_STRING, "UFIDA.U8.IN.OBA.Word.Addins",-1) < 0) then
  endif;  
  if (RegDBSetKeyValueEx (szKey, "Manifest", REGDB_STRING,officepluginfilepath,-1) < 0) then
  endif; 
  //添加  dword键值;    
  if (RegDBSetKeyValueEx (szKey, "LoadBehavior", REGDB_NUMBER, "3",-1) < 0) then
  endif;  
  Enable(LOGGING);   
    endif; 
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);


/* office 插件注册表,签名注册表信息.....
Windows Registry Editor Version 5.00


[HKEY_CURRENT_USER\Software\Microsoft\VSTO\Security\Inclusion\3e132c9d-58dd-4133-9ff6-f8f8c9d579f2]
"Url"="file:///D:/U8SOFT/ImplementNavigation/OBA/U8SceneDesigner/bin/UFIDA.U8.IN.OBA.Word.Addins.vsto"
"PublicKey"="<RSAKeyValue><Modulus>tSvxw7heI8tlXZDPwa3W+ogeRjgdCqaFYyBk/6b50h+ymq05REbRY2v24awJNmU0yhIT2qfJoHdY1jYLc7qPxbsGu4m8gwGTadUEIMoY2j2pliaBlIVFHz2eyg7DMxNYiwkuwMXGBdkrF5x1gzWOC8ISPd0cuwkV4ovqE4Olpik=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"
*/
    //向 HKEY_LOCAL_MACHINE 添加注册表项目 HKEY_CURRENT_USER
    if (RegDBSetDefaultRoot(HKEY_CURRENT_USER)<0) then
   endif;
   szKey="Software\\Microsoft\\VSTO\\Security\\Inclusion\\3e132c9d-58dd-4133-9ff6-f8f8c9d579f2";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else  
      szURL="file:///"+TARGETDIR+"\\ImplementNavigation\\OBA\\U8SceneDesigner\\bin\\UFIDA.U8.IN.OBA.Word.Addins.vsto";
      szPublicKey="<RSAKeyValue><Modulus>tSvxw7heI8tlXZDPwa3W+ogeRjgdCqaFYyBk/6b50h+ymq05REbRY2v24awJNmU0yhIT2qfJoHdY1jYLc7qPxbsGu4m8gwGTadUEIMoY2j2pliaBlIVFHz2eyg7DMxNYiwkuwMXGBdkrF5x1gzWOC8ISPd0cuwkV4ovqE4Olpik=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
      Disable(LOGGING);
      ExFn_SetRegPrivilege("CURRENT_USER\\Software\\Microsoft\\VSTO\\Security\\Inclusion\\3e132c9d-58dd-4133-9ff6-f8f8c9d579f2","GROUP","Users","Allow");  
      ExFn_SetRegPrivilege("CURRENT_USER\\Software\\Microsoft\\VSTO\\Security\\Inclusion\\3e132c9d-58dd-4133-9ff6-f8f8c9d579f2","GROUP","Everyone","Allow");
      if (RegDBSetKeyValueEx (szKey, "Url", REGDB_STRING, szURL,-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "PublicKey", REGDB_STRING, szPublicKey,-1) < 0) then
  endif;   
  Enable(LOGGING);   
    endif; 
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);


   
  ExFn_WriteLog("AddOfficeSetupQSSSRegister()  !  end ",""); 
end; 


//删除添加的注册表 OFFICE 插件给实施导航使用.


function ExFn_OfficeSetupQSSSRegister()
STRING szKey;
begin
if (RegDBSetDefaultRoot(HKEY_CURRENT_USER)<0) then
    endif;
    szKey="Software\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins";
if (RegDBDeleteKey (szKey) < 0) then
endif;
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="Software\\Microsoft\\Office\\Word\\Addins\\UFIDA.U8.IN.OBA.Word.Addins";
if (RegDBDeleteKey (szKey) < 0) then
endif;
end;   




function ExFn_DelReg(szSubKey)
STRING szKey;
begin
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SoftWare\\Ufsoft\\WF\\V8.700\\Install\\Installed\\"+szSubKey;
if (RegDBDeleteKey (szKey) < 0) then
endif;
end;   

runcommad2.rul源码





//===========================================================================
//
//  File Name:    runcommad3.rul
//   
// Author:  lilf
//
//  Description:  相关命令执行
//
//  Comments:     
//
//=========================================================================== 


#define REG_TS_PORT "\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\rdpwd\\Tds\\tcp"
#define REG_TS_PORT2 "\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp"
/* 
%1是端口,     上面一条是2008和2012系统的,下面的是2003系统的。    


set ts=%1
netsh advfirewall firewall add rule name="rasts"  protocol=TCP dir=in localport=%ts% action=allow >nul 2>nul
reg add "hklm\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List" /v %ts%:TCP /t REG_SZ /d "%ts%:TCP:*:Enabled:%ts%" /f >nul 2>nul
*/
//添加远程接入科迈的注册表...在防火墙例外加入6222端口为安装端口 
function AddFireWarePortRasRegister(DATAPORT)
STRING szKey;
STRING regdefault,regstringvalue;
STRING regfir,regfirvalue;
string regfirrule,regfirrulevalue;
begin
    regdefault=DATAPORT+":TCP";
    //regstringvalue=DATAPORT+":TCP:*:Enabled:"+DATAPORT;
    regstringvalue=DATAPORT+":TCP:*:Enabled:"+"rasts";
   //判断Windows 2008版本 6.1 ,windows 7版本 6.1 ,windows vista版本 6.0环境的操作系统的版本。
   if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==0)||(SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then   
         if (SYSINFO.bIsWow64 != 0 ) then  
           Disable(LOGGING);
           Disable(WOW64FSREDIRECTION);
            XCopyFile (WINSYSDIR+"\\netsh.exe", m_WinDir+"\\system32\\", COMP_NORMAL);
           Enable(WOW64FSREDIRECTION);
           Enable(LOGGING); 
           UseDLL(ENVCHECK_DLL);
            Run(m_WinDir+"\\system32\\"+"netsh.exe advfirewall firewall add rule name="+"\"rasts\""+"  protocol=TCP dir=in localport=\""+DATAPORT+"\" action=allow >nul 2>nul"); 
            RunWithDirectory(m_WinDir+"\\system32\\"+"netsh.exe advfirewall firewall add rule name="+"\"rasts\""+"  protocol=TCP dir=in localport=\""+DATAPORT+"\" action=allow >nul 2>nul",m_WinDir+"\\system32");
           UnUseDLL(ENVCHECK_DLL);
           ExFn_WriteLog("CMD ExcuteCmdCommand:",m_WinDir+"\\system32\\"+"netsh.exe advfirewall firewall add rule name="+"\"rasts\""+"  protocol=TCP dir=in localport=\""+DATAPORT+"\" action=allow >nul 2>nul"); 
         else
           UseDLL(ENVCHECK_DLL);  
            Run(WINSYSDIR+"\\"+"netsh.exe advfirewall firewall add rule name="+"\"rasts\""+"  protocol=TCP dir=in localport=\""+DATAPORT+"\" action=allow >nul 2>nul"); 
            RunWithDirectory(WINSYSDIR+"\\"+"netsh.exe advfirewall firewall add rule name="+"\"rasts\""+"  protocol=TCP dir=in localport=\""+DATAPORT+"\" action=allow >nul 2>nul",m_WinDir+"\\system32");
           UnUseDLL(ENVCHECK_DLL);
           ExFn_WriteLog("CMD ExcuteCmdCommand:",WINSYSDIR+"\\"+"netsh.exe advfirewall firewall add rule name="+"\"rasts\""+"  protocol=TCP dir=in localport=\""+DATAPORT+"\" action=allow >nul 2>nul");
         endif;
   else //下面的是2003系统的。
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    Disable(LOGGING);
    szKey="SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
    ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List","GROUP","Users","Allow");  
ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List","GROUP","Everyone","Allow");
    if (RegDBSetKeyValueEx (szKey, regdefault, REGDB_STRING,regstringvalue,-1) < 0) then
endif; 
  Enable(LOGGING);      
   endif;
   
   /* 添加下面的注册表。..
   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules]
     "2"="v2.10|Action=Allow|Active=TRUE|Dir=In|App=c:\\u8soft\\rasmini\\rasweb\\Apache2\\bin\\httpd.exe|Name=rasweb|"
   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List]
     "c:\\u8soft\\rasmini\\rasweb\\Apache2\\bin\\httpd.exe"="c:\\u8soft\\rasmini\\rasweb\\Apache2\\bin\\httpd.exe:*:Enabled:rasweb"
   */
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    Disable(LOGGING);
    szKey="SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List";
    ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List","GROUP","Users","Allow");  
ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List","GROUP","Everyone","Allow");
regfir=TARGETDIR+"\\RasMini\\rasweb\\Apache2\\bin\\httpd.exe";
regfirvalue=TARGETDIR+"\\RasMini\\rasweb\\Apache2\\bin\\httpd.exe:*:Enabled:rasweb";
    if (RegDBSetKeyValueEx (szKey, regfir, REGDB_STRING,regfirvalue,-1) < 0) then
endif; 


    //[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\AuthorizedApplications\List]
    szKey="SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\DomainProfile\\AuthorizedApplications\\List";
    ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\DomainProfile\\AuthorizedApplications\\List","GROUP","Users","Allow");  
ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\DomainProfile\\AuthorizedApplications\\List","GROUP","Everyone","Allow");
regfir=TARGETDIR+"\\RasMini\\rasweb\\Apache2\\bin\\httpd.exe";
regfirvalue=TARGETDIR+"\\RasMini\\rasweb\\Apache2\\bin\\httpd.exe:*:Enabled:rasweb";
    if (RegDBSetKeyValueEx (szKey, regfir, REGDB_STRING,regfirvalue,-1) < 0) then
endif; 


szKey="SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\FirewallRules";
    ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\FirewallRules","GROUP","Users","Allow");  
ExFn_SetRegPrivilege("MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\FirewallRules","GROUP","Everyone","Allow");
regfirrule="2";
regfirrulevalue="v2.10|Action=Allow|Active=TRUE|Dir=In|App="+TARGETDIR+"\\rasmini\\rasweb\\Apache2\\bin\\httpd.exe|Name=rasweb|";
    if (RegDBSetKeyValueEx (szKey, regfirrule, REGDB_STRING,regfirrulevalue,-1) < 0) then
endif; 
    Enable(LOGGING);
   
    //后期给出的新的解决方案.
    Disable(LOGGING);
     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
     RegDBSetKeyValueEx(REG_TS_PORT, "PortNumber", REGDB_NUMBER, DATAPORT, -1); 
     RegDBSetKeyValueEx(REG_TS_PORT2, "PortNumber", REGDB_NUMBER, DATAPORT, -1); 
     LaunchAppAndWait(SUPPORTDIR + "\\tsetting.bat", DATAPORT, LAAW_OPTION_NOWAIT|LAAW_OPTION_HIDDEN);
    Enable(LOGGING); 
end;      




//恢复初始时候的端口为3389
function void SetRemotePortalToRetain()
STRING DATAPORT;
begin 
    DATAPORT="3389";
    //恢复初始时候的端口为3389
    Disable(LOGGING);
     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
     RegDBSetKeyValueEx(REG_TS_PORT, "PortNumber", REGDB_NUMBER, DATAPORT, -1); 
     RegDBSetKeyValueEx(REG_TS_PORT2, "PortNumber", REGDB_NUMBER, DATAPORT, -1); 
    Enable(LOGGING); 
end;
//添加移动应用服务  到系统环境变量中.
//  Setx /M JAVA_HOME "C:\Program Files (x86)\Java\jdk1.6.0_26"


function void SetJavaHomeEnvPath()
STRING javakey16,javakey17,svresult,sKeyValue,sKeyValueTemp,svValue;  
NUMBER nvSize,nvType;
begin 
     ExFn_WriteLog("SetJavaHomeEnvPath  !  start","");
     javakey16="SOFTWARE\\JavaSoft\\Java Development Kit\\1.6";  
     javakey17="SOFTWARE\\JavaSoft\\Java Development Kit\\1.7";   
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif;
     nvType = REGDB_STRING;
     //JAVA 1.6
if RegDBGetKeyValueEx(javakey16,"JavaHome",nvType,sKeyValue,nvSize) = 0 then  
   StrToLower(sKeyValueTemp, sKeyValue);   
      if(ExistsDir(sKeyValueTemp)=EXISTS) then
       UseDLL(ENVCHECK_DLL);
     svValue = "Setx /M JAVA_HOME \"" + sKeyValueTemp + "\"";
     Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
      endif;
endif;  
 
//JAVA 1.7
if RegDBGetKeyValueEx(javakey17,"JavaHome",nvType,sKeyValue,nvSize) = 0 then  
   StrToLower(sKeyValueTemp, sKeyValue);   
      if(ExistsDir(sKeyValueTemp)=EXISTS) then
       UseDLL(ENVCHECK_DLL);
     svValue = "Setx /M JAVA_HOME \"" + sKeyValueTemp + "\"";
     Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
      endif;
endif;  


end; 


/*
//添加 PDM  JAVA_HOME 到系统环境变量中.
//  Setx /M JAVA_HOME ""
function void SetMaServerJavaHomeEnvPath()
STRING svresult,sKeyValue,sKeyJAVAValueTemp,svValue;  
string szFTPDHOME;
NUMBER nvSize,nvType;
begin 
     ExFn_WriteLog("SetMaServerJavaHomeEnvPath  !  start","");
  
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif; 
     sKeyJAVAValueTemp=TARGETDIR+"\\JDK";
if(ExistsDir(sKeyJAVAValueTemp)=EXISTS) then
       UseDLL(ENVCHECK_DLL);
     svValue = "Setx /M JAVA_HOME \"" + sKeyJAVAValueTemp + "\"";
     Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
endif;


end; 
*/


/*
//添加 PDM  JAVA_HOME 到系统环境变量中.
//  Setx /M JAVA_HOME ""
function void SetPDMJavaHomeEnvPath()
STRING pdmjdkdir,svresult,sKeyValue,sKeyJAVAValueTemp,svValue;  
NUMBER nvSize,nvType;
string szFTPDHOME;
begin 
     ExFn_WriteLog("SetPDMJavaHomeEnvPath  !  start","");
  
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif; 
     sKeyJAVAValueTemp=TARGETDIR+"\\JDK";
if(ExistsDir(sKeyJAVAValueTemp)=EXISTS) then
       UseDLL(ENVCHECK_DLL);
     svValue = "Setx /M JAVA_HOME \"" + sKeyJAVAValueTemp + "\"";
     Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
endif;
 
pdmjdkdir=TARGETDIR+"\\JDK";
if(ExistsDir(pdmjdkdir)=EXISTS) then
       UseDLL(ENVCHECK_DLL);
     svValue = "Setx /M EXE4J_JAVA_HOME \"" + pdmjdkdir + "\"";
     Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
endif;
 
end; 
*/


/*
//添加PDM对应的多语言快截方式.
function void AddPDMShortCut()
STRING svResult; 
STRING szItemName,szCommandLine,szWorkingDir,szIconPath,szShortCutKey;  
STRING SoftEntoolname,szmainmenudir;
string szdataimportpdm;
NUMBER  nIcon, nFlag, nResult;       
STRING szKey;
begin   
    ExFn_WriteLog("AddPDMShortCut !","START");
    ExFn_WriteLog("AddPDMShortCut !",FOLDER_PROGRAMS);
    //添加    软加密管理工具
    if FeatureIsItemSelected(MEDIA,"PDM")=1 then
       //0x0804 8*16^2+4=2052 (简体中文) 
       //添加中文快截方式.. 
       if(SYSINFO.nSystemLangID==2052)  then   
        //添加快捷方式! 软加密管理工具
        SoftEntoolname=@ID_STRING130+".exe";
    if(FindFile(TARGETDIR+"\\pdmProfessional\\SetupInfo", SoftEntoolname, svResult) = 0)  then
     szCommandLine=TARGETDIR+"\\pdmProfessional\\SetupInfo\\"+SoftEntoolname; 
     szWorkingDir= TARGETDIR+"\\pdmProfessional\\SetupInfo";  
     szIconPath=  TARGETDIR+"\\pdmProfessional\\SetupInfo\\"+"EncryptionManagement.ico";  
     nIcon=0;
     szShortCutKey = ""; 
          nFlag= REPLACE; 
          szItemName=@ID_STRING130;
          szmainmenudir=FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING122;
     AddFolderIcon (szmainmenudir, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); 
    endif; 
       endif;
  
      //0x0404 4*16^2+4=1028 (繁体中文)
      if(SYSINFO.nSystemLangID==1028) then   
        //添加快捷方式! 軟加密管理工具
        SoftEntoolname=@ID_STRING130+".exe";
    if(FindFile(TARGETDIR+"\\pdmProfessional\\SetupInfo", SoftEntoolname, svResult) = 0)  then
     szCommandLine=TARGETDIR+"\\pdmProfessional\\SetupInfo\\"+SoftEntoolname; 
     szWorkingDir= TARGETDIR+"\\pdmProfessional\\SetupInfo";  
     szIconPath=  TARGETDIR+"\\pdmProfessional\\SetupInfo\\"+"EncryptionManagement.ico";  
     nIcon=0;
     szShortCutKey = ""; 
          nFlag= REPLACE; 
          szItemName=@ID_STRING130;
          szmainmenudir=FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING122;
     AddFolderIcon (szmainmenudir, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); 
    endif;        
      endif;     
    endif;   
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++       
       //添加    PDM实施工具-U8数据导入
    if FeatureIsItemSelected(MEDIA,"PDM")=1 then
       //0x0804 8*16^2+4=2052 (简体中文) 
       //添加中文快截方式.. 
       if(SYSINFO.nSystemLangID==2052)  then   
        //添加快捷方式! PDM实施工具-U8数据导入
        szdataimportpdm=@ID_STRING132+".exe";
    if(FindFile(TARGETDIR+"\\pdmProfessional\\Tools\\U8import", szdataimportpdm, svResult) = 0)  then
     szCommandLine=TARGETDIR+"\\pdmProfessional\\Tools\\U8import\\"+szdataimportpdm; 
     szWorkingDir= TARGETDIR+"\\pdmProfessional\\Tools\\U8import";  
     szIconPath=  TARGETDIR+"\\pdmProfessional\\Tools\\U8import\\"+"PDMtools.ico";  
     nIcon=0;
     szShortCutKey = ""; 
          nFlag= REPLACE; 
          szItemName=@ID_STRING131;
          szmainmenudir=FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING122;
     AddFolderIcon (szmainmenudir, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); 
    endif; 
       endif;
  
      //0x0404 4*16^2+4=1028 (繁体中文)
      if(SYSINFO.nSystemLangID==1028) then   
        //添加快捷方式! PDM實施工具(U8資料導入)
        szdataimportpdm=@ID_STRING132+".exe";
    if(FindFile(TARGETDIR+"\\pdmProfessional\\Tools\\U8import", szdataimportpdm, svResult) = 0)  then
     szCommandLine=TARGETDIR+"\\pdmProfessional\\Tools\\U8import\\"+szdataimportpdm; 
     szWorkingDir= TARGETDIR+"\\pdmProfessional\\Tools\\U8import";  
     szIconPath=  TARGETDIR+"\\pdmProfessional\\Tools\\U8import\\"+"PDMtools.ico";  
     nIcon=0;
     szShortCutKey = ""; 
          nFlag= REPLACE; 
          szItemName=@ID_STRING131;
          szmainmenudir=FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING122;
     AddFolderIcon (szmainmenudir, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); 
    endif;        
      endif;     
    endif;
/====================================================================================
  ExFn_WriteLog("AddPDMShortCut !","END");   
end;    
*/




//判断是否是老版本的PDM
//返回1.表示没有安装.   
//返回2 表示成功检测到安装过同版本的PDM 不用再安装
//返回3. 表示有老的版本存在,需要卸载老的版本..
function INT CompareIsOlderPDMVersion()
STRING szpdmversionkey,svpdmversionresult,szKeyversionValue,sKeyValueTemp,svValue; 
NUMBER nvversionSize,nvversionbig,isNewversion;
BOOL nReturn,nResult;
LIST   listSubKeys;
begin 
     ExFn_WriteLog("CompareIsOlderPDMVersion  !  start","");
     szpdmversionkey="SOFTWARE\\yonyouPDM\\SERVER";
     nvversionbig=0;  
     isNewversion=1;
     //listSubKeys  = ListCreate(STRINGLIST); 
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)=1) then
     endif;
     //已经安装过老的版本PDM
     if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\6.0") =1 then
        isNewversion=3;
        return isNewversion;
     endif;
     //系统已安装用友PDM Professional 6.5,请删除PDM Professional 6.5,再安装PDM Professional 7.6!
     if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\6.5") =1 then
        isNewversion=3;
        return isNewversion;
     endif; 
     //系统已安装用友PDM Professional 7.0,请删除PDM Professional 7.0,再安装PDM Professional 7.6!
     if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\7.0") =1 then
        isNewversion=3;
        return isNewversion;
     endif;   
     //系统已安装用友PDM Professional 7.0SP1,请删除PDM Professional 7.0SP1,再安装PDM Professional 7.6!
     if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\7.0SP1") =1 then
        isNewversion=3;
        return isNewversion;
     endif;  
     
     //系统已安装用友PDM Professional 7.2,请删除PDM Professional 7.2,再安装PDM Professional 7.6! 
      if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\7.2") =1 then
        isNewversion=3;
        return isNewversion;
     endif;      
     
     //系统已安装用友PDM Professional 7.2SP1,请删除PDM Professional 7.2SP1,再安装PDM Professional 7.6!
     if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\7.2SP1") =1 then
        isNewversion=3;
        return isNewversion;
     endif;    
     //系统已安装用友PDM Professional 7.5,请删除PDM Professional 7.5,再安装PDM Professional 7.6!
       if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\7.5") =1 then
        isNewversion=3;
        return isNewversion;
     endif;      
     //系统已安装用友PDM Professional 7.5SP1,请删除PDM Professional 7.5SP1,再安装PDM Professional 7.6!
     if RegDBKeyExist ("SOFTWARE\\UFIDAPDM\\SERVER\\7.51") =1 then
        isNewversion=3;
        return isNewversion;
     endif;      
     
     //安装过最新的版本.不在安装PDM
     if RegDBKeyExist ("SOFTWARE\\yonyouPDM\\SERVER\\7.6") =1 then
        isNewversion=2;
        return isNewversion;
     else
         //没有安装最新的版本 安装PDM
        ExFn_WriteLog("Read  SOFTWARE\\yonyouPDM\\SERVER\\7.6 !  not found","");
        isNewversion=1;
        return isNewversion; 
     endif;    
     /*
     nReturn = RegDBQueryKey(szpdmversionkey, REGDB_KEYS, listSubKeys);
     if (nReturn < 0) then
        ExFn_WriteLog("Read  SOFTWARE\\yonyouPDM\\SERVER !  not found","");
        isNewversion=1;
        return isNewversion;
     else
        nResult = ListGetFirstString (listSubKeys, svpdmversionresult);
        if(svpdmversionresult=="7.51") then
           szKeyversionValue="75";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=3;
           endif;
        endif;
        if(svpdmversionresult=="7.6") then
           szKeyversionValue="76";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=2;
           endif;
        endif;
        if(svpdmversionresult=="7.7") then
           szKeyversionValue="77";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=2;
           endif;
        endif;
        if(svpdmversionresult=="7.8") then
           szKeyversionValue="78";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=2;
           endif;
        endif; 
 while (nResult != END_OF_LIST)
          nResult = ListGetNextString (listSubKeys, svpdmversionresult);
                  if(svpdmversionresult=="7.51") then
           szKeyversionValue="75";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=3;
           endif;
        endif;
        if(svpdmversionresult=="7.6") then
           szKeyversionValue="76";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=2;
           endif;
        endif;
        if(svpdmversionresult=="7.7") then
           szKeyversionValue="77";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=2;
           endif;
        endif;
        if(svpdmversionresult=="7.8") then
           szKeyversionValue="78";
           StrToNum(nvversionSize,szKeyversionValue);
           if(nvversionbig<=nvversionSize) then
              nvversionbig=nvversionSize;
              isNewversion=2;
           endif;
        endif; 
       endwhile;   
     endif;
     ListDestroy(listSubKeys);
     */
     return isNewversion;
end; 




//判断是否是老版本的PDM并提示
function void CompareIsOlderPDMAndPrompt()
STRING szWarningPDMUnistall; 
NUMBER numberpdm;
NUMBER isnewversionpdm;
begin 
    if FeatureIsItemSelected(MEDIA,"PDM")=1 then
          isnewversionpdm=CompareIsOlderPDMVersion();
          if(isnewversionpdm=2) then //同版本的不选择PDM再继续安装.
            g_bSetupPDMSelected=FALSE;
            FeatureSelectItem (MEDIA, "PDM", g_bSetupmodeleSelected); 
          elseif(isnewversionpdm=1) then //没有安装过PDM
            g_bSetupPDMSelected=TRUE;
            FeatureSelectItem (MEDIA, "PDM", TRUE);            
          else //低版本的提示卸载...
            szWarningPDMUnistall=@ID_PdmUnistallVersionWaring;
            numberpdm = MessageBox(szWarningPDMUnistall, MB_RETRYCANCEL);
            if (numberpdm == IDRETRY) then
              isnewversionpdm=CompareIsOlderPDMVersion();
              while(isnewversionpdm=3) //存在低版本的PDM
                 numberpdm=MessageBox(szWarningPDMUnistall, MB_RETRYCANCEL);
                 if (numberpdm == IDRETRY) then
                  isnewversionpdm=CompareIsOlderPDMVersion();
                 else
                   abort;
                 endif;
              endwhile;
            else
              abort;
            endif;
          endif;
    endif;
end;


/*
//获取终端服务端口
function STRING GetRASServicePort()
NUMBER nvSize,nvType;
string sRegKey,sKeyValue;
string lowport;
begin
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
sRegKey =  "SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp"; 
nvType = REGDB_NUMBER;
//默认一个端口.,
lowport="3389";
if RegDBGetKeyValueEx(sRegKey,"PortNumber",nvType,sKeyValue,nvSize) = 0 then 
  StrToLower(lowport,sKeyValue);
endif;
return lowport;
end;
*/         
         
//卸载COM+组件..
function void UnistallCOMPlusMsi()
string szcomplusguid;
string u8allinoneguid,u8interfacemsiguid,U8API_TransactionProxymsiguid;
begin 
    UseDLL(ENVCHECK_DLL);
       //U8AllInOne.msi
       u8allinoneguid="{3950F679-26F5-47E8-A86B-63D2E21B7C9C}";
RunNoBlock(WINSYSDIR^"msiexec.exe /x "+u8allinoneguid +" /quiet /qn");

//U8M_Interface.MSI
u8interfacemsiguid="{624FE591-2CE7-49C3-955C-53B9C2706BFF}";
RunNoBlock(WINSYSDIR^"msiexec.exe /x "+u8interfacemsiguid +" /quiet /qn"); 

//u8v12.5版本的U8M_Interface.MSI
u8interfacemsiguid="{7C0F8E39-DC54-42A9-B5E3-B5604FE77190}";
RunNoBlock(WINSYSDIR^"msiexec.exe /x "+u8interfacemsiguid +" /quiet /qn");

//U8API_TransactionProxy.msi
U8API_TransactionProxymsiguid="{2D20EB98-5A86-491F-8DFA-9C17B5A94352}";
RunNoBlock(WINSYSDIR^"msiexec.exe /x "+U8API_TransactionProxymsiguid +" /quiet /qn"); 
UnUseDLL(ENVCHECK_DLL);
end;


//设置MSDTC 的安全配置 设置 网络DTC访问
function void SetDtcSecturity()
string szdtcreg;
begin
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szdtcreg =  "SOFTWARE\\Microsoft\\MSDTC\\Security"; 
if (RegDBSetKeyValueEx (szdtcreg, "NetworkDtcAccess", REGDB_NUMBER, "1",-1) < 0) then
     ExFn_WriteLog("SetDtcSecturity()  SOFTWARE\\Microsoft\\MSDTC\\Security ","  NetworkDtcAccess=1 失败"); 
else
     ExFn_WriteLog("SetDtcSecturity()  SOFTWARE\\Microsoft\\MSDTC\\Security ","  NetworkDtcAccess=1 成功");
endif;


    UseDLL(ENVCHECK_DLL);
      RunNoBlock("sc start msdtc"); 
    UnUseDLL(ENVCHECK_DLL);
end;


//配置Apache 服务给ISD读取加密信息使用.. Apache4U8AppServe
function void ConfigureApacheServiceToIsd()
string svapachepath,svValue;
begin
     if (FindFile (TARGETDIR^"BackupWebServer", "SetupApacheServer.exe", svValue) = 0) then
           UseDLL(ENVCHECK_DLL);
   Run(TARGETDIR^"BackupWebServer\\SetupApacheServer.exe");
  UnUseDLL(ENVCHECK_DLL);
  StopServiceU8("Apache4U8AppServe");
endif; 
end;




//卸载的时候恢复PDM7.6的JDK的环境变量设置..
function void UninstallReSetJavaHomeEnvPath()
STRING javakey16,svresult,sKeyValue,sKeyValueTemp,svValue;  
NUMBER nvSize,nvType;
begin 
     ExFn_WriteLog("UninstallReSetJavaHomeEnvPath  !  start","");
     javakey16="SOFTWARE\\yonyouPDM\\SERVER\\7.6";   
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif;
     nvType = REGDB_STRING;
     //JAVA 1.6
if RegDBGetKeyValueEx(javakey16,"InstallDIR",nvType,sKeyValue,nvSize) = 0 then  
   StrToLower(sKeyValueTemp, sKeyValue);   
      if(ExistsDir(sKeyValueTemp)=EXISTS) then
       UseDLL(ENVCHECK_DLL);
         sKeyValueTemp=sKeyValueTemp+"\\JDK\\jdk1.6.0_26";
     svValue = "Setx /M JAVA_HOME \"" + sKeyValueTemp + "\"";
     Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
      endif;
endif;  
ExFn_WriteLog("UninstallReSetJavaHomeEnvPath  !  END","");  


end; 


//解决 如果后安装CAD 打开U8的时候,点记都会出现安装CAD 的问题.
function void ExFn_RegisterCadBUG()
string szKey;
begin
UseDLL(ENVCHECK_DLL);
RunNoBlock("regsvr32.exe " +" /u /s "+ WINSYSDIR^"Comdlg32.ocx");
RunNoBlock("regsvr32.exe " +" /u /s "+ WINSYSDIR^"comctl32.ocx");
RunNoBlock("regsvr32.exe " +" /u /s "+ WINSYSDIR^"MSSTDFMT.DLL");

    RunNoBlock("regsvr32.exe " +" /s "+ WINSYSDIR^"Comdlg32.ocx");
RunNoBlock("regsvr32.exe " +" /s "+ WINSYSDIR^"comctl32.ocx");
RunNoBlock("regsvr32.exe " +" /s "+ WINSYSDIR^"MSSTDFMT.DLL");



UnUseDLL(ENVCHECK_DLL);
end;


//解决 Windows 10上打开单据无响应的问题
function void ExFn_RegisterMsvbvm60()
string szKey,svValue;
begin
    
    if (FindFile (WINSYSDIR, "msvbvm60.dll", svValue) = 0) then
 UseDLL(ENVCHECK_DLL);
 RunNoBlock("regsvr32.exe " +" /s "+ WINSYSDIR^"msvbvm60.dll");
 RunNoBlock("regsvr32.exe " +" /s "+ WINSYSDIR^"msvbvm50.dll");
 UnUseDLL(ENVCHECK_DLL);
endif;
end;






//修改 Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System 注册表项下面的 EnableLUA 的注册表值,将值从1改为0
//修改UAC的权限,降低下,方便注册表的读写..
function void SetUAC()  
STRING szKey;  
    begin
        Disable(LOGGING);
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif; 
   //降低UAC 权限..
   szKey="Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; 
   if (RegDBSetKeyValueEx (szKey, "EnableLUA", REGDB_NUMBER, "1",-1) < 0) then
     ExFn_WriteLog("SetUAC ()","降低UAC权限失败:"+szKey); 
   else
     ExFn_WriteLog("SetUAC()","降低UAC权限成功"+szKey);  
endif;

   if (RegDBSetKeyValueEx (szKey, "ConsentPromptBehaviorAdmin", REGDB_NUMBER, "0",-1) < 0) then
         ExFn_WriteLog("SetUAC ()","降低ConsentPromptBehaviorAdmin权限失败:"+szKey); 
     else
        ExFn_WriteLog("SetUAC()","降低ConsentPromptBehaviorAdmin权限成功"+szKey);  
endif;
   if (RegDBSetKeyValueEx (szKey, "PromptOnSecureDesktop", REGDB_NUMBER, "0",-1) < 0) then
         ExFn_WriteLog("SetUAC ()","降低PromptOnSecureDesktop权限失败:"+szKey); 
     else
        ExFn_WriteLog("SetUAC()","降低PromptOnSecureDesktop权限成功"+szKey);  
endif; 
Enable(LOGGING);
    end; 


//在我们日常win7以上的系统使用过程,当某个程序出现非法操作或错误提示,WerFault.exe 系统会WER(启动错误报告机制),询问用户是否要将此错误发送给微软公司,同时停止程序的运行。
//如果选择不发送,则只要错误还存在,错误报告会再次出现。发送了却也要填一些麻烦的信息。如果不想弹窗询问干扰,同时又希望发送错误报告的话
//WerFault.exe
function void SetDontshowUI()
       STRING szKey;
        begin
          Disable(LOGGING);
          if (RegDBSetDefaultRoot(HKEY_CURRENT_USER)<0) then
     endif;
     szKey="Software\\Microsoft\\Windows\\Windows Error Reporting";
     if (RegDBSetKeyValueEx (szKey, "DontshowUI", REGDB_NUMBER, "1",-1) < 0) then
         ExFn_WriteLog("SetDontshowUI ()","启动错误报告机制失败:"+szKey); 
     else
         ExFn_WriteLog("SetDontshowUI()","启动错误报告机制成功"+szKey);  
 endif;
 
          if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif;
     szKey="Software\\Microsoft\\Windows\\Windows Error Reporting";
     if (RegDBSetKeyValueEx (szKey, "DontshowUI", REGDB_NUMBER, "1",-1) < 0) then
         ExFn_WriteLog("SetDontshowUI ()","启动错误报告机制失败:"+szKey); 
     else
         ExFn_WriteLog("SetDontshowUI()","启动错误报告机制成功"+szKey);  
 endif;
 Enable(LOGGING); 
        end;
//解决WIN10 SENDKEY 卡死问题.
function void SetUACBack()  
STRING szKey;  
    begin
         Disable(LOGGING);
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif; 
   szKey="Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; 
   if (SYSINFO.nOSMajor ==10&&SYSINFO.nOSMinor>=0)  then
     //降低UAC 权限..
     //设置 EnableLUA 
     if (RegDBSetKeyValueEx (szKey, "EnableLUA", REGDB_NUMBER, "1",-1) < 0) then
         ExFn_WriteLog("SetUAC ()","提升UAC权限失败:"+szKey); 
     else
        ExFn_WriteLog("SetUAC()","提升UAC权限成功"+szKey);  
 endif;
endif;
     if (RegDBSetKeyValueEx (szKey, "ConsentPromptBehaviorAdmin", REGDB_NUMBER, "0",-1) < 0) then
         ExFn_WriteLog("SetUACBack ()","降低ConsentPromptBehaviorAdmin权限失败:"+szKey); 
     else
        ExFn_WriteLog("SetUACBack()","降低ConsentPromptBehaviorAdmin权限成功"+szKey);  
 endif;
     if (RegDBSetKeyValueEx (szKey, "PromptOnSecureDesktop", REGDB_NUMBER, "0",-1) < 0) then
         ExFn_WriteLog("SetUACBack ()","降低PromptOnSecureDesktop权限失败:"+szKey); 
     else
        ExFn_WriteLog("SetUACBack()","降低PromptOnSecureDesktop权限成功"+szKey);  
 endif;
 Enable(LOGGING);
    end; 






//删除注册表设置隐私权协议.
function ExFn_DelPrivacy()
STRING szKey;  
begin
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SoftWare\\Privacy";
if (RegDBDeleteKey (szKey) < 0) then
endif;
end;  


//安装 soapsdk.msi
function void ExFn_SetUpSoapsdk()
STRING szKey;
string m_soapsdkpath,svResult;
int iRetCode;
begin
    
    //停止趋势服务
    StopServiceU8("tmlisten");  
    StopServiceU8("ntrtscan"); 
    StopServiceU8("TmProxy");  
        
    //360杀毒软件的服务
    StopServiceU8("360EntClientSvc"); 
    StopServiceU8("ZhuDongFangYu"); 
        
    //猎豹安全浏览器防御模块
    StopServiceU8("knbcenter");  
    UseDLL(ENVCHECK_DLL);
    //删除趋势进程 
    RunNoBlock("CMD /C taskkill /F /IM PccNTMon.exe");
      
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BCB4C18A-ACA6-4383-8688-E19933A705DD}";
    m_soapsdkpath=SUPPORTDIR^"soapsdk.msi";
if RegDBKeyExist(szKey) < 0 then
 if (FindFile(SUPPORTDIR, "soapsdk.msi", svResult) = 0) then 
     RunNoBlock("taskkill /f /im msiexec.exe "); 
     RunNoBlock("taskkill /f /im 360EntClient.exe "); 
     RunNoBlock(WINSYSDIR^"msiexec.exe /i "+m_soapsdkpath +" /quiet /qn"); 
     RunNoBlock("taskkill /f /im msiexec.exe "); 
 endif;
    else
       RunNoBlock("taskkill /f /im msiexec.exe "); 
       RunNoBlock("taskkill /f /im 360EntClient.exe "); 
     iRetCode=RunNoBlock(WINSYSDIR^"msiexec.exe /x "+"{BCB4C18A-ACA6-4383-8688-E19933A705DD}" +" /quiet /qn"); 
     if iRetCode != 0  && iRetCode != 3010 then 
     Run(SUPPORTDIR^"msizap.exe t " +"{BCB4C18A-ACA6-4383-8688-E19933A705DD}");
     endif;
     RunNoBlock("taskkill /f /im msiexec.exe "); 
if (FindFile(SUPPORTDIR, "soapsdk.msi", svResult) = 0) then 
     RunNoBlock("taskkill /f /im msiexec.exe "); 
     RunNoBlock("taskkill /f /im 360EntClient.exe "); 
     RunNoBlock(WINSYSDIR^"msiexec.exe /i "+m_soapsdkpath +" /quiet /qn"); 
     RunNoBlock("taskkill /f /im msiexec.exe "); 
 endif;
endif;
UnUseDLL(ENVCHECK_DLL);
end;


//卸载 soapsdk.msi
function void ExFn_UnistallSoapsdk()
STRING szKey;
string m_soapsdkpath,svResult;
begin
    //停止趋势服务
    StopServiceU8("tmlisten");  
    StopServiceU8("ntrtscan"); 
    StopServiceU8("TmProxy"); 
    
    UseDLL(ENVCHECK_DLL);
    //删除趋势进程 
    RunNoBlock("CMD /C taskkill /F /IM PccNTMon.exe");
    
  if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    szKey="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BCB4C18A-ACA6-4383-8688-E19933A705DD}";
    if RegDBKeyExist(szKey) = 1 then
      RunNoBlock("taskkill /f /im msiexec.exe "); 
      RunNoBlock("taskkill /f /im 360EntClient.exe "); 
      RunNoBlock(WINSYSDIR^"msiexec.exe /x "+"{BCB4C18A-ACA6-4383-8688-E19933A705DD}" +" /quiet /qn");
    endif;
RegDBDeleteKey(UNINSTALL_KEY_NAME + "{BCB4C18A-ACA6-4383-8688-E19933A705DD}");    
   UnUseDLL(ENVCHECK_DLL);
   
   //删除筛选器
   ExFn_Run("CMD /C Cscript " +WINDISK^"Inetpub\\AdminScripts\\adsutil.vbs " + "delete W3SVC/1/Filters/RemETag "); 
end;




//如果是纯客户端删除不应该存在的快捷方式
function void DeleteShortCutByOnlyInstallClient()
BOOL m_isonlyclient;
begin
    ExFn_WriteLog("DeleteShortCutByOnlyInstallClient !","START");
    m_isonlyclient=TRUE;
    m_isonlyclient=IsOnlySetUpClient();
    if m_isonlyclient=TRUE then
      ExFn_WriteLog("m_isonlyclient !"," true");
        UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@Shortcut_CloudRegister+".lnk"+"\""); 
   UnUseDLL(ENVCHECK_DLL);
    endif;
    ExFn_WriteLog("DeleteShortCutByOnlyInstallClient!","END");
end;


//如果是非加密服务器删除不应该存在的快捷方式
function void DeleteShortCutByOnlyInstallLicenseServer()
BOOL m_isonlylicenseserver;
begin
    ExFn_WriteLog("DeleteShortCutByOnlyInstallLicenseServer !","START");
    m_isonlylicenseserver=FALSE;
    if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1 then
m_isonlylicenseserver = TRUE;
endif;


    if m_isonlylicenseserver=FALSE then
      ExFn_WriteLog("m_isonlylicenseserver !"," false");
        UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@Shortcut_CloudRegister+".lnk"+"\""); 
   UnUseDLL(ENVCHECK_DLL);
    endif;
    
    ExFn_WriteLog("DeleteShortCutByOnlyInstallLicenseServer!","END");
end;






//U8V15.0 yangli提出修改 64为放SYSTEM32下
function void CopySystemWOW64ToSYStem32()
begin
  ExFn_WriteLog("CopySystemWOW64ToSYStem32!","START");
  UseDLL(ENVCHECK_DLL);
    //如果是64位系统。
    if (SYSINFO.bIsWow64 != 0 ) then
     Disable(WOW64FSREDIRECTION);
 RunNoBlock("CMD /C XCOPY " +"\""+WINSYSDIR+"\\x64"+"\" "+m_WinDir+"\\system32\\"+" /d/r/y/f/e"); 
Enable(WOW64FSREDIRECTION);
RunNoBlock("CMD /C del /f/s/q " +"\""+WINSYSDIR+"\\x64"+"\"");
    endif;  
  UnUseDLL(ENVCHECK_DLL);
  ExFn_WriteLog("CopySystemWOW64ToSYStem32!","END");
end;




//U8V15.0 yangli提出 删除安装到 64为放SYSTEM32下文件
function void DeleteSYStem32FilesInstall()
begin
  ExFn_WriteLog("DeleteSYStem32FilesInstall!","START");
  UseDLL(ENVCHECK_DLL);
    //如果是64位系统。
    if (SYSINFO.bIsWow64 != 0 ) then
     Disable(WOW64FSREDIRECTION);
      RunNoBlock("CMD /C del /f/s/q " +"\""+m_WinDir+"\\system32\\UFPAClient.dll"+"\"");
Enable(WOW64FSREDIRECTION);
endif;

RunNoBlock("CMD /C del /f/s/q " +"\""+WINSYSDIR+"\\licence.yht"+"\"");
RunNoBlock("CMD /C del /f/s/q " +"\""+WINSYSDIR+"\\licence.offline.json"+"\"");
RunNoBlock("CMD /C del /f/s/q " +"\""+WINSYSDIR+"\\profile.online.json"+"\"");

//RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\WXQYH\\bin\\U8Login.dll"+"\"");
//RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\WXQYH\\bin\\WA\\U8Login.dll"+"\"");
RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\HB\\HRDTS\\U8Login.dll"+"\"");
RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\U8KCSN\\bin\\U8Login.dll"+"\"");

  UnUseDLL(ENVCHECK_DLL);
  ExFn_WriteLog("DeleteSYStem32FilesInstall!","END");
end;




//U8V15.0电商提出删除对应的login文件,由于define2中的removefile  CAREMOVE="NO"导致不能执行删除需要使用命令删除
function void DeleteEBLonginFiles()
begin
  ExFn_WriteLog("DeleteEBLonginFiles!","START");
  UseDLL(ENVCHECK_DLL);
      RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\AppServer\\bin\\OCAPI\\BIN\\UFSoft.U8.Framework.Login.BO.dll"+"\"");
      RunNoBlock("CMD /C del /f/s/q " +"\""+TARGETDIR+"\\AppServer\\bin\\OCAPI\\BIN\\UFSoft.U8.Framework.Login.UI.dll"+"\"");
  UnUseDLL(ENVCHECK_DLL);
  ExFn_WriteLog("DeleteEBLonginFiles!","END");
end;






//删除对应的快截方式 只安装EIS的时候 移动引用服务器.
function void DeleteShortCutByEis()
STRING svResult; 
STRING szItemName,szCommandLine,szWorkingDir,szIconPath,szShortCutKey;  
NUMBER  nIcon, nFlag, nResult;       
STRING szKey;
begin   
    ExFn_WriteLog("DeleteShortCutEIS !","START");
    ExFn_WriteLog("DeleteShortCut eis!",FOLDER_PROGRAMS);
    
    
    //删除目录 
    //删除快截方式 ID_STRING5 工作流目录.


    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING5+"\"");  
UnUseDLL(ENVCHECK_DLL);


    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_STARTUP+@ID_STRING9+"\\"+@ID_STRING5+"\\"+@ID_STRING13+".lnk"+"\"");  
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_STARTUP+@ID_STRING9+"\\"+@ID_STRING5+"\\"+@ID_STRING22+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL);  



    //删除快截方式 SH_Folder_EAI 企业应用集成(EAI)目录.
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_EAI+"\"");  
UnUseDLL(ENVCHECK_DLL);  
    
    
    //删除快截方式   ID_STRING10 UAP目录.
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING10+"\"");  
UnUseDLL(ENVCHECK_DLL); 
 
    //删除快截方式,ID_STRING57  模型分析 目录 
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C  rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING57+"\"");  
UnUseDLL(ENVCHECK_DLL); 
    
    //删除快截方式,ID_STRING96   远程接入 目录 
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C  rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING96+"\"");  
UnUseDLL(ENVCHECK_DLL); 
  
    //删除快截方式,ID_STRING122  PDM-Professional 目录 
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C  rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING122+"\"");  
UnUseDLL(ENVCHECK_DLL); 


    //删除快截方式,   ID_STRING147  用友优普开放平台 目录 
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C  rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING147+"\"");  
UnUseDLL(ENVCHECK_DLL);

//删除快截方式,   ISH_Folder_XTFW  系统服务   SH_Folder_KMGJ  科目工具 目录 
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C  rmdir /s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_Folder_KMGJ+"\"");  
UnUseDLL(ENVCHECK_DLL);







//删除快捷方式
//删除 FOLDER_STARTUP 应用服务管理器
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_STARTUP+@COMP_UFSERVERMG+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL);  


//删除 FOLDER_PROGRAMS ID_STRING42 实施导航工作台
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@ID_STRING42+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_QYMH         企业应用平台
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_QYMH+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_WIZARD 快速使用向导
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_WIZARD+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_WEBPORTAL 企业信息门户
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_WEBPORTAL+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_Register 远程注册授权
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Register+".url"+"\"");  
UnUseDLL(ENVCHECK_DLL); 


//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   SH_XTGL  系统管理 
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_XTGL+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 
    
//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   SH_SJFZ  数据复制
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_SJFZ+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   SH_YYFW  应用服务器配置
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_YYFW+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   SH_ZZGL 总账工具 
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_ZZGL+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   SH_SJJY 数据解压缩工具
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_SJJY+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 

//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   SH_YCPZ 远程配置
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_YCPZ+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL);


//删除 FOLDER_PROGRAMS SH_Folder_XTFW 系统服务 下的   ID_STRING30 诊断工具
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@ID_STRING30+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL);

  //删除快截方式,   ISH_Folder_XTFW  系统服务   SH_YYPZ  语言配置工具 快捷方式
    UseDLL(ENVCHECK_DLL);
   RunNoBlock("CMD /C  del /f/s/q " +"\""+FOLDER_PROGRAMS+@ID_STRING9+"\\"+@SH_Folder_XTFW+"\\"+@SH_YYPZ+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL);  

    ///
 
    //删除桌面的快截方式
    //ID_STRING111 企业应用平台
    DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING111);    
    //ID_STRING112 企业信息门户
    DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING112); 
    //ID_STRING129 启动应用程序服务器
    DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING129); 
    //ID_STRING103  远程接入控制台
    DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING103); 
    
    //清除启动数据源配置。。
szKey="SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run";
if (RegDBSetKeyValueEx(szKey, "U8Installer", REGDB_STRING,"",-1) = 0) then
ExFn_WriteLog("Set  U8Installer ","为空  success");    
else
   ExFn_WriteLog("Set  U8Installer  ","为空  False"); 
endif;    
    
ExFn_WriteLog("AddShortCut EIS!","END");   

end;   




 //UAP智能输入功能
function ExFn_SetUAPRegByVaule(szvalue,szCaption)
STRING szKey;
NUMBER nType, nSize;
begin
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SOFTWARE\\yonyou\\UAP";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE);
    endif;
    if (RegDBSetKeyValueEx (szKey, szvalue, REGDB_STRING, szCaption,-1) < 0) then
endif;
end;



//添加智能安装服务,对纯客户端的安装模式添加
function ExFn_InstallSmartClientService()
string svValue;
begin 
     ExFn_WriteLog("ExFn_InstallSmartClientService"," 添加智能安装服务");
if(g_setuptype=="ClientSetType") then 
 if (FindFile (TARGETDIR, "U8SmartClient.exe", svValue) >= 0) then 
  ExFn_WriteLog("ExFn_InstallSmartClientService"," 创建服务智能客户端服务");
  UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE U8SmartClient binPath= \"\\\""+TARGETDIR^"U8SmartClient.exe\\\"\" DisplayName= U8SmartClient start= auto ");
    RunNoBlock("SC DESCRIPTION U8SmartClient \"智能客户端服务\"");
       RunNoBlock("SC failure U8SmartClient reset= 60 actions= restart/180000");
   UnUseDLL(ENVCHECK_DLL);
 endif;  
 //安装监控服务
 if (FindFile (TARGETDIR, "U8SmartClientMonitor.exe", svValue) >= 0) then 
   ExFn_WriteLog("ExFn_InstallSmartClientMonitor"," 创建智能客户端监控服务");
  UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE U8SmartClientMonitor binPath= \"\\\""+TARGETDIR^"U8SmartClientMonitor.exe\\\"\" DisplayName= U8SmartClientMonitor start= auto ");
    RunNoBlock("SC DESCRIPTION U8SmartClientMonitor \"智能客户端监控服务\"");
       RunNoBlock("SC failure U8SmartClientMonitor reset= 60 actions= restart/180000");
   UnUseDLL(ENVCHECK_DLL);
  endif;
endif;
end;




//基于以前安装进行的重新启动已挂起
function ExFn_SetReStartTip()
STRING szUpdateExeVolatile,szPendingFileRenameOperations,svresult,sKeyValue,sKeyValueTemp,svValue,szpeding;  
NUMBER nvSize,nvType,nupdate;
begin
     szUpdateExeVolatile="SOFTWARE\\Microsoft\\Updates";
     szPendingFileRenameOperations="SYSTEM\\CurrentControlSet\\Control\\Session Manager";
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif;
     
     nvType = REGDB_STRING;
if RegDBGetKeyValueEx(szPendingFileRenameOperations,"PendingFileRenameOperations",nvType,sKeyValue,nvSize) = 0 then 
        StrToLower(sKeyValueTemp, sKeyValue);
        szpeding=sKeyValueTemp;
        if(StrLength(szpeding)>10) then
              MessageBox (@ID_ResatrUpdateExeVolatile,WARNING);
              return;
        endif;
endif; 
 
//组合
     nvType = REGDB_NUMBER;
if RegDBGetKeyValueEx(szUpdateExeVolatile,"UpdateExeVolatile",nvType,sKeyValue,nvSize) = 0 then  
      StrToLower(sKeyValueTemp, sKeyValue);
      StrToNum(nupdate,sKeyValueTemp); 
      if(nupdate=1||nupdate=2||nupdate=3) then
        //提示重启
        MessageBox (@ID_ResatrUpdateExeVolatile,WARNING);
      elseif(nupdate>3) then
             //提示重启
             MessageBox (@ID_ResatrUpdateExeVolatile,WARNING);
      endif;
else
   //如果没有找到UpdateExeVolatile项设置状体为-1
   nupdate=-1;
endif;
 
nvType = REGDB_STRING;
if RegDBGetKeyValueEx(szPendingFileRenameOperations,"PendingFileRenameOperations",nvType,sKeyValue,nvSize) = 0 then 
        StrToLower(sKeyValueTemp, sKeyValue);
        szpeding=sKeyValueTemp;
        if(nupdate=-1) then
           if(StrLength(szpeding)>5) then
              MessageBox (@ID_ResatrUpdateExeVolatile,WARNING);
           endif;
        endif;
endif; 
end;




//判断是否是纯客户端
function BOOL IsOnlySetUpClient()
BOOL _isOnlyClient;
begin
   ExFn_WriteLog("IsOnlySetUpClient"," start");
   _isOnlyClient=TRUE;
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if RegDBKeyExist(INSTALLMODULES + "AppServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "CRMServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "DBServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "LicenseServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "U8AppServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "U8MServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "WebServer") = 1 then 
_isOnlyClient=FALSE;
endif;
ExFn_WriteLog("IsOnlySetUpClient"," END");
return _isOnlyClient;
end;




//创建服务只有安装客户端的时候进行创建
 function CreateServiceSmartClientOnlySetUpClient()
 BOOL _isOnlyClient;
 string svValue;
 begin
    _isOnlyClient=TRUE;
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if RegDBKeyExist(INSTALLMODULES + "AppServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "CRMServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "DBServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "LicenseServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "U8AppServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "U8MServer") = 1 then 
_isOnlyClient=FALSE;
endif;
if RegDBKeyExist(INSTALLMODULES + "WebServer") = 1 then 
_isOnlyClient=FALSE;
endif;
//如果是纯客户端添加服务
if(_isOnlyClient=TRUE) then
  if (FindFile (TARGETDIR, "U8SmartClient.exe", svValue) >= 0) then 
  ExFn_WriteLog("ExFn_InstallSmartClientService"," 创建服务智能客户端服务");
  UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE U8SmartClient binPath= \"\\\""+TARGETDIR^"U8SmartClient.exe\\\"\" DisplayName= U8SmartClient start= auto ");
    RunNoBlock("SC DESCRIPTION U8SmartClient \"智能客户端服务\"");
       RunNoBlock("SC failure U8SmartClient reset= 60 actions= restart/180000");
   UnUseDLL(ENVCHECK_DLL);
 endif;  
 //安装监控服务
 if (FindFile (TARGETDIR, "U8SmartClientMonitor.exe", svValue) >= 0) then 
   ExFn_WriteLog("ExFn_InstallSmartClientMonitor"," 创建智能客户端监控服务");
  UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE U8SmartClientMonitor binPath= \"\\\""+TARGETDIR^"U8SmartClientMonitor.exe\\\"\" DisplayName= U8SmartClientMonitor start= auto ");
    RunNoBlock("SC DESCRIPTION U8SmartClientMonitor \"智能客户端监控服务\"");
       RunNoBlock("SC failure U8SmartClientMonitor reset= 60 actions= restart/180000");
   UnUseDLL(ENVCHECK_DLL);
  endif;
endif;
 end;


  
 //sc create 创建服务
 function CreateService(servicename)
 string  szReportPath,svValue; 
 begin 
     //先复制文件
     CopyServiceFile("M80SGV_SD.dll");
     CopyServiceFile("ServiceCtrl.exe");
     CopyServiceFile("SrvCtl.dll");
     CopyServiceFile("U8AllAuthServer.exe");
     CopyServiceFile("U8AllClient.dll");
     /*
     if(ServiceExistsService(servicename)==FALSE)  then 
      if (FindFile (WINSYSDIR, "U8AllAuthServer.exe", svValue) >= 0) then 
        szReportPath = WINSYSDIR^"U8AllAuthServer.exe";
LongPathToQuote(szReportPath, TRUE); 
        LaunchAppAndWait(WINSYSDIR^"sc.exe"," CREATE UFAllNet binPath= \"\\\""+WINSYSDIR^"U8AllAuthServer.exe\\\"\" DisplayName= U8AllAuthServer start= auto ",WAIT|LAAW_OPTION_HIDDEN); 
        LaunchAppAndWait(WINSYSDIR^"sc.exe"," DESCRIPTION UFAllNet \"\"",WAIT|LAAW_OPTION_HIDDEN);
LaunchAppAndWait(WINSYSDIR^"sc.exe"," failure UFAllNet reset= 60 actions= restart/180000",WAIT|LAAW_OPTION_HIDDEN);
      endif;
     endif;
     */
 end; 
function CopyServiceFile(m_filename)
 string  svResult; 
 begin 
     //先复制文件 
     // CopyServiceFile("M80SGV_SD.dll")
     // CopyServiceFile("ServiceCtrl.exe")
     // CopyServiceFile("SrvCtl.dll")
     // CopyServiceFile("U8AllAuthServer.exe")
     // CopyServiceFile("U8AllClient.dll")
     if ( SYSINFO.bIsWow64 != 0 ) then
        if(FindFile(WINSYSDIR,m_filename,svResult)<0) then
         if(FindFile(TARGETDIR+"\\CopyTemp891\\system32",m_filename,svResult)==0) then 
Disable(LOGGING);
XCopyFile (TARGETDIR+"\\CopyTemp891\\system32\\"+m_filename, WINSYSDIR+"\\", COMP_NORMAL); 
Enable(LOGGING);
endif;
endif;
     endif;
 end; 


//获取机器名称
function string GetlocalMachineName() 
string szkey,sKeyValueTemp,sKeyValue;
NUMBER nvType,nvSize;
begin 
      ExFn_WriteLog("GetlocalMachineName ","Start");
      sKeyValueTemp=""; 
      UseDLL(ENVCHECK_DLL);
        sKeyValueTemp=GetMyLocalMachineName(); 
      UnUseDLL(ENVCHECK_DLL); 
      ExFn_WriteLog("GetlocalMachineName ",sKeyValueTemp);
      return  sKeyValueTemp;
end; 


runcommad3.rul源码

//===========================================================================
//
//  File Name:    runcommad3.rul
//   
// Author:  lilf
//
//  Description:  远程接入金万维相关设置
//
//  Comments:     
//
//=========================================================================== 
 //sc create 创建金万维服务
 function void CreateServiceJWW()
 string  szjwwgnwebserverPath,szjwwGNESLServiceHelperPath,svValue; 
 begin
     ExFn_WriteLog("CreateServiceJWW","START");
     //如果存在金万维的yonyouU8WebService服务,就删除服务,如果不存在,直接的创建
     if(ServiceExistsService("yonyouU8WebService")==FALSE)  then 
      if (FindFile (TARGETDIR+"\\U8remote", "GNWebServer.exe", svValue) >= 0) then 
        szjwwgnwebserverPath = TARGETDIR+"\\U8remote\\GNWebServer.exe";
LongPathToQuote(szjwwgnwebserverPath, TRUE); 
UseDLL(ENVCHECK_DLL);
          RunNoBlock("SC CREATE yonyouU8WebService binPath= \"\\\""+TARGETDIR+"\\U8remote\\GNWebServer.exe\\\"\" DisplayName= yonyouU8WebService start= delayed-auto "); 
          RunNoBlock("SC DESCRIPTION yonyouU8WebService \"\"");
 RunNoBlock("SC failure yonyouU8WebService reset= 60 actions= restart/180000");
UnUseDLL(ENVCHECK_DLL);
      endif;
     else
        UseDLL(ENVCHECK_DLL);
         Run("sc stop yonyouU8WebService");
     Run("sc delete yonyouU8WebService");
     Delay(4);
          RunNoBlock("SC CREATE yonyouU8WebService binPath= \"\\\""+TARGETDIR+"\\U8remote\\GNWebServer.exe\\\"\" DisplayName= yonyouU8WebService start= delayed-auto "); 
          RunNoBlock("SC DESCRIPTION yonyouU8WebService \"\"");
 RunNoBlock("SC failure yonyouU8WebService reset= 60 actions= restart/180000");
UnUseDLL(ENVCHECK_DLL);
     endif;
     
     //如果存在金万维的GNESLServiceHelper服务,就删除服务,如果不存在,直接的创建
     if(ServiceExistsService("GNESLServiceHelper")==FALSE)  then 
      if (FindFile (TARGETDIR+"\\U8remote", "GNStart.exe", svValue) >= 0) then 
        szjwwGNESLServiceHelperPath = TARGETDIR+"\\U8remote\\GNStart.exe";
LongPathToQuote(szjwwGNESLServiceHelperPath, TRUE); 
UseDLL(ENVCHECK_DLL);
 RunNoBlock("SC CREATE GNESLServiceHelper binPath= \"\\\""+TARGETDIR^"U8remote\\GNStart.exe\\\" startservice\" DisplayName= GNESLServiceHelper start= delayed-auto");
          RunNoBlock("SC DESCRIPTION GNESLServiceHelper \"\"");
 RunNoBlock("SC failure GNESLServiceHelper reset= 60 actions= restart/180000");
UnUseDLL(ENVCHECK_DLL);
      endif;
     else
        UseDLL(ENVCHECK_DLL);
         Run("sc stop GNESLServiceHelper");
     Run("sc delete GNESLServiceHelper");
     Delay(4);
     RunNoBlock("SC CREATE GNESLServiceHelper binPath= \"\\\""+TARGETDIR^"U8remote\\GNStart.exe\\\" startservice\" DisplayName= GNESLServiceHelper start= delayed-auto");
          //RunNoBlock("SC CREATE GNESLServiceHelper binPath= \"\\\""+TARGETDIR+"\\U8remote\\GNStart.exe\\\"\" DisplayName= GNESLServiceHelper start= auto "); 
          RunNoBlock("SC DESCRIPTION GNESLServiceHelper \"\"");
 RunNoBlock("SC failure GNESLServiceHelper reset= 60 actions= restart/180000");
UnUseDLL(ENVCHECK_DLL);
     endif;
     ExFn_WriteLog("CreateServiceJWW","END");
 end; 
 
 
//添加金万维注册表远程接入  第一部分         
function void AddJinWanWeiRegister()
STRING szKey,szeslKey,sztargirgww,szCloudDisk,szVirtualDisk,szWeb;
NUMBER nType, nSize;
NUMBER nvResult;
STRING svResultinfo,svResultinfoDATA,szInfotime,szInfodata;
begin
        ExFn_WriteLog("AddJinWanWeiRegister()  !  start ","");
        if (GetSystemInfo (TIME, nvResult, svResultinfo) < 0) then
          szInfotime = "Couldn't get TIME info.";
          ExFn_WriteLog("szInfo:",szInfotime); 
        else
          Sprintf(szInfotime, "%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, "%s", svResultinfoDATA);
          ExFn_WriteLog("szInfodata:",szInfodata); 
       endif;
    
    
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   Disable(LOGGING);
   szKey="SOFTWARE\\gnway\\esoonlink\\Server";
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szKey + "创建失败", SEVERE); 
   else
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\gnway\\esoonlink\\Server","GROUP","Users","Allow");  
      ExFn_SetRegPrivilege("MACHINE\\SOFTWARE\\gnway\\esoonlink\\Server","GROUP","Everyone","Allow");
      if (RegDBSetKeyValueEx (szKey, "activewndtype", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AddAutoUpdate", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AddressList", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AgentAddr", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AgentInfoDownloadTime", REGDB_STRING, "",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "AgentMail", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AgentPhone", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "apihook", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AppRedirect", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AUCustomeFields", REGDB_STRING, "",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "AutoFix", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "AvailableRDPPorts", REGDB_STRING, "",-1) < 0) then
  endif;
  sztargirgww=TARGETDIR+"\\U8remote";
  if (RegDBSetKeyValueEx (szKey, "base_dir", REGDB_STRING, sztargirgww,-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "BindCheckFlag", REGDB_STRING, "0010",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "BindToPhone", REGDB_STRING, "",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "Channel2012Mode", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "CloudDiskDelay", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "CloudDiskExcludeContent", REGDB_STRING, "~$;;;wert",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "CloudDiskInterval", REGDB_STRING, "2000",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "CompatibleClientFileVersion", REGDB_STRING, "",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "ContactAttribute", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "CustomDateFormat", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DDNSSufix", REGDB_STRING, "gnway.org",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DefaultInternalRDPPort", REGDB_STRING, "12893",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DefaultProgramSetting", REGDB_STRING, "1110",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "DetourPrograms", REGDB_STRING, "Portal.exe",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableCALLWNDPROC", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableConditionalDriverMap", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableDeskAndDocMap", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableDesktopAndMyDocumentMapping", REGDB_STRING, "1",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "DisableExplorer", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableFastLogin", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableGNPolicyX64", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableHideVirtualDisk", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableLog", REGDB_STRING, "1",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "DisableNginx", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableRdpClip", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableRemoteDesktop", REGDB_STRING, "0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisableSocketShare", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "DisNetImportAndExport", REGDB_STRING, "",-1) < 0) then
  endif;
      if (RegDBSetKeyValueEx (szKey, "EnableBindMac", REGDB_STRING, "0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableCPBDIME", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableEslCheckPsFile", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableEslGsWin32c", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableEslNumCopies", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableEslServiceLog", REGDB_STRING, "0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableEslSessionLog", REGDB_STRING, "",-1) < 0) then
  endif;                   
  if (RegDBSetKeyValueEx (szKey, "EnableMaxGroup", REGDB_STRING, "0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableMinimizeHelper", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnableMouseHook", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "enablerunas", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "EnhanceHook", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "ExceptLogicalDriver", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "FlashedWindowList", REGDB_STRING, "ThunderRT6MDIForm:::0;;;WindowsForms10.Window.8.app.0.33c0d9d:::1000;;;",-1) < 0) then
  endif;
  //添加  dword键值;    
  if (RegDBSetKeyValueEx (szKey, "GNCorePort", REGDB_NUMBER, "8001",-1) < 0) then
  endif; 
  if (RegDBSetKeyValueEx (szKey, "gneslDisableDuration", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "GNRTcpvalue", REGDB_STRING, "5366:TCP",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "HeartBeatInterval", REGDB_STRING, "30",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "HideIMEBar", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "HoldSessionList", REGDB_STRING, "javaw.exe",-1) < 0) then
  endif;                   
  if (RegDBSetKeyValueEx (szKey, "IgnoredPrograms", REGDB_STRING, "conime.exe KDSVRMGR.EXE K3ClientCache.exe dwm.exe splwow64.exe taskhost.exe wscntfy.exe TSAStart.exe TSAPolicy.exe GNPolicyX64.exe csc.exe cvtres.exe",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "sqlservr.exe", REGDB_STRING, "Sql2k.exe",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "InstallDate", REGDB_STRING, szInfodata,-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "InstallPrinter", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "KingDee", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "KingdeeTitle", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "LanguageType", REGDB_STRING, "2052",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "LastAUCheckTime", REGDB_STRING, szInfodata,-1) < 0) then
  endif;                
  if (RegDBSetKeyValueEx (szKey, "LastFileAUCheckTime", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "LogoffOldSession", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "LogoffOldSessionMultilogin", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "LogoSystemProcess", REGDB_STRING, "winlogon.exe,csrss.exe",-1) < 0) then
  endif;                   
  if (RegDBSetKeyValueEx (szKey, "MapClientDisk", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "MaxBakFileNumber", REGDB_STRING, "10",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "MBVFlag", REGDB_STRING, "de39421bb67cc96138a0b5c73b6a39e0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "MobileDeviceUseToken", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "msgBoxshowURL", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "msghook", REGDB_STRING, "11110",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "MultipleLogin", REGDB_STRING, "0",-1) < 0) then
  endif;
  szCloudDisk=TARGETDIR+"\\U8remote\\CloudDisk";
  if (RegDBSetKeyValueEx (szKey, "NetCloudDiskPath", REGDB_STRING, szCloudDisk,-1) < 0) then
  endif;
  szVirtualDisk=TARGETDIR+"\\U8remote\\VirtualDisk"; 
  if (RegDBSetKeyValueEx (szKey, "NetDiskBaseDir", REGDB_STRING, szVirtualDisk,-1) < 0) then
  endif;
 
  if (RegDBSetKeyValueEx (szKey, "NetExportFolder", REGDB_STRING, "Y:",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "NetImportFolder", REGDB_STRING, "Z:",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "OnlineMonitorIngoredPrograms", REGDB_STRING, "GNPolicyX64.exe conhost.exe",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "OnlineUpdateTimeSpan", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "OSVersion", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "PDFConvertTimeout", REGDB_STRING, "30000",-1) < 0) then
  endif;
  //添加  dword键值;    
  if (RegDBSetKeyValueEx (szKey, "PHPPort", REGDB_NUMBER, "9001",-1) < 0) then
  endif; 
  
  if (RegDBSetKeyValueEx (szKey, "port", REGDB_STRING, "81",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "PretendLocalSession", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "PrintDataCompress", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "PrintUseDiff", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "PrintUsePDFFile", REGDB_STRING, "1",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "ProdCheckSum", REGDB_STRING, "84b0e7dd0b49bbce42217465a8ab2ad0",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "ProductName", REGDB_STRING, "eSoonlinkServer",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "pType", REGDB_STRING, "esl",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "QuitDisconnectDuration", REGDB_STRING, "50",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "RdpclipRestartTime", REGDB_STRING, "",-1) < 0) then
  endif;   
  if (RegDBSetKeyValueEx (szKey, "RedirectDirs", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "RedirectRegs", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "s", REGDB_STRING, "gnWay",-1) < 0) then
  endif;
  szWeb=TARGETDIR+"\\U8remote\\web";
  if (RegDBSetKeyValueEx (szKey, "s1", REGDB_STRING, szWeb,-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "s2", REGDB_STRING, "index.htm",-1) < 0) then
  endif;         
  if (RegDBSetKeyValueEx (szKey, "SavePrinterSetting", REGDB_STRING, "0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "ServerName", REGDB_STRING, "U8远程服务器",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "session", REGDB_STRING, "60000",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "SessionCheckInterval", REGDB_STRING, "3",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "SessionFailCount", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "ShowMappedPrinterFlag", REGDB_STRING, "11111",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "ShowOnlineHelp", REGDB_STRING, "0",-1) < 0) then
  endif;
  //添加  dword键值;    
  if (RegDBSetKeyValueEx (szKey, "ShowPrintProgress", REGDB_NUMBER, "0",-1) < 0) then
  endif; 
    
  if (RegDBSetKeyValueEx (szKey, "ShowToolTip", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "sslport", REGDB_STRING, "443",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "StartRTPControl", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "SyncTimeout", REGDB_STRING, "200",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "TDSInfo", REGDB_STRING, szInfodata+",,MjAxNi0xMS0zMCyxsb6pytAgtefQxQ==",-1) < 0) then
  endif;         
  if (RegDBSetKeyValueEx (szKey, "TokenValidTime", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "UpdateLicense", REGDB_STRING, "-1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "UpdateSvrIP", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "useDDNS", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "useDog", REGDB_STRING, "0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "vendor", REGDB_STRING, "yonyouupcn",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "version", REGDB_STRING, "6.3.0.0",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "VirtualPrinter", REGDB_STRING, "GNPrinter",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "VLanPortMapFlag", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "VScrollRate", REGDB_STRING, "",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "WebADTime", REGDB_STRING, "1481040000",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "WinClassToUseCPBDIME", REGDB_STRING, "NotesRichText RichTextWndClass",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szKey, "WindowUpdateInterval", REGDB_STRING, "0",-1) < 0) then
  endif;                  
   endif;
   
   szeslKey="SOFTWARE\\gnway\\esoonlink\\Server\\es11019";
    if (RegDBCreateKeyEx(szeslKey, "") < 0) then
MessageBox (szeslKey + "创建失败", SEVERE); 
   else
      if (RegDBSetKeyValueEx (szeslKey, "vu", REGDB_STRING, "1",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szeslKey, "esl1019.gnway.cc", REGDB_STRING, "11",-1) < 0) then
  endif;
  if (RegDBSetKeyValueEx (szeslKey, "esl1019.gnway.org", REGDB_STRING, "11",-1) < 0) then
  endif;   
  
   endif;
   Enable(LOGGING);
end;
//删除金万维第一部分注册表
function void DeleteJinWanWeiRegister()
STRING szKey;
begin
    ExFn_WriteLog("","DeleteJinWanWeiRegister");
    szKey="SOFTWARE\\gnway\\esoonlink\\Server\\es11019";
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
    if(RegDBDeleteKey(szKey)<0) then
    endif;
    
    szKey="SOFTWARE\\gnway\\esoonlink\\Server";
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
    if(RegDBDeleteKey(szKey)<0) then
    endif;
    
    szKey="SOFTWARE\\gnway\\esoonlink";
    if(RegDBDeleteKey(szKey)<0) then
    endif;
    
    szKey="SOFTWARE\\gnway";
    if(RegDBDeleteKey(szKey)<0) then
    endif;
    
    ExFn_WriteLog("","DeleteJinWanWeiRegister_END");
end;






//添加金万维服务第二部分
function void AddSecondJinWanWeiRegister()
STRING szKey,szpdsKey,sztssecsrvgww,sztdsjww,sztcpjww,szWeb;
NUMBER nType, nSize;
begin
    ExFn_WriteLog("AddSecondJinWanWeiRegister()  !  start ",""); 
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
Disable(LOGGING);
    szKey="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR";
if (RegDBCreateKeyEx(szKey, "") < 0) then
endif;   
if (RegDBSetKeyValueEx (szKey, "AudioEnumeratorDll", REGDB_STRING, "rdpendp.dll",-1) < 0) then
endif;
//添加  dword键值;    
if (RegDBSetKeyValueEx (szKey, "BaudRate", REGDB_NUMBER, "57600",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "ByteSize", REGDB_NUMBER, "8",-1) < 0) then
endif; 

if (RegDBSetKeyValueEx (szKey, "CfgDll", REGDB_STRING, "RDPCFGEX.DLL",-1) < 0) then
endif;
//添加  dword键值;    
if (RegDBSetKeyValueEx (szKey, "ColorDepth", REGDB_NUMBER, "3",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "ConnectType", REGDB_NUMBER, "1",-1) < 0) then
endif;

if (RegDBSetKeyValueEx (szKey, "DeviceName", REGDB_STRING, "",-1) < 0) then
endif;

    //添加  dword键值;    
if (RegDBSetKeyValueEx (szKey, "fAutoClientDrives", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fAutoClientLpts", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableAudioCapture", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableCam", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableCcm", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableCdm", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableClip", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableCpm", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableEncryption", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fDisableLPT", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fEnableBreakDisconnect", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fEnableDsrSensitivity", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fEnableDTR", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fEnableRTS", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fFlowSoftwareRx", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fFlowSoftwareTx", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fForceClientLptDef", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "fInheritAutoClient", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "FlowHardwareRx", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "FlowHardwareTx", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "FlowType", REGDB_NUMBER, "1",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "InputBufferLength", REGDB_NUMBER, "2048",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "LoadableProtocol_Object", REGDB_STRING, "{18b726bb-6fe6-4fb9-9276-ed57ce7c7cb2}",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "MinEncryptionLevel", REGDB_NUMBER, "2",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "Parity", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "StartupPrograms", REGDB_STRING, "rdpclip",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "MinEncryptionLevel", REGDB_NUMBER, "2",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "StopBits", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "WdDLL", REGDB_STRING, "rdpwd",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "WdFlag", REGDB_NUMBER, "54",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "WdName", REGDB_STRING, "GNWAY ESL V2.2",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "WdPrefix", REGDB_STRING, "GNR",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "WsxDLL", REGDB_STRING, "rdpwsx",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "XoffChar", REGDB_NUMBER, "19",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szKey, "XonChar", REGDB_NUMBER, "17",-1) < 0) then
endif;

//添加PDS下的注册表项目
    szpdsKey="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR\\Pds";
if (RegDBCreateKeyEx(szpdsKey, "") < 0) then
endif;
    sztssecsrvgww="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR\\Pds\\tssecsrv";
if (RegDBCreateKeyEx(sztssecsrvgww, "") < 0) then
endif;         
    if (RegDBSetKeyValueEx (sztssecsrvgww, "PdClass", REGDB_NUMBER, "11",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztssecsrvgww, "PdDLL", REGDB_STRING, "tssecsrv",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztssecsrvgww, "PdFlag", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztssecsrvgww, "PdName", REGDB_STRING, "tssecsrv",-1) < 0) then
endif;    
    
    //添加TDS下的注册表项目
    sztdsjww="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR\\Tds";
if (RegDBCreateKeyEx(sztdsjww, "") < 0) then
endif;    
    sztcpjww="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR\\Tds\\tcp";
if (RegDBCreateKeyEx(sztcpjww, "") < 0) then
endif; 
    if (RegDBSetKeyValueEx (sztcpjww, "InteractiveDelay", REGDB_NUMBER, "10",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "OutBufCount", REGDB_NUMBER, "6",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "OutBufLength", REGDB_NUMBER, "530",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "PdClass ", REGDB_NUMBER, "2",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "PdDLL", REGDB_STRING, "tdtcp",-1) < 0) then
endif;  
    if (RegDBSetKeyValueEx (sztcpjww, "PdFlag", REGDB_NUMBER, "78",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "PdName", REGDB_STRING, "tcp",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "PortNumber", REGDB_NUMBER, "5366",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "RequiredPds", REGDB_STRING, "tssecsrv",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (sztcpjww, "ServiceName", REGDB_STRING, "tcpip",-1) < 0) then
endif;

    Enable(LOGGING);
    ExFn_WriteLog("AddSecondJinWanWeiRegister()  !  end ",""); 
end;




//删除金万维服务第二部分
function void DeleteSecondJinWanWeiRegister()
STRING szKey,szpdsKey,sztssecsrvgww,sztdsjww,sztcpjww,szWeb;
NUMBER nType, nSize;
begin
    szKey="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR";
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
    if(RegDBDeleteKey(szKey)<0) then
    endif;
end;
#define REG_RAS_PORT "\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\rdpwd\\Tds\\tcp"
#define REG_RAS_PORT2 "\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp"
//添加金万维服务第三部分
function void AddThirdJinWanWeiRegister()
STRING szKey,szCrashControlKey,szCrashControgww,szgnrtshjww,szpathjww,szFirewall,szFirewallRules,szList,szintalldir;
STRING szserverjww,szListglobally;
STRING sKeyValue,lowport,szGNRTcpport;
NUMBER nType,nvType, nSize,nvSize;
NUMBER nvResult;
STRING svResult,svResultinfoDATA,szInfo,szInfodata;
begin
    ExFn_WriteLog("AddThirdJinWanWeiRegister()  !  start ",""); 
    if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
       szInfo = "Couldn't get DATE info.";
       ExFn_WriteLog("szInfo:",szInfo); 
    else
        Sprintf(szInfo, "%s", svResult);
        ExFn_WriteLog("szInfo:",szInfo); 
    endif;


    if (GetSystemInfo (DATE, nvResult, svResultinfoDATA) < 0) then
       szInfodata = "Couldn't get DATE info.";
       ExFn_WriteLog("szInfodata:",szInfodata); 
    else
        Sprintf(szInfodata, "%s", svResultinfoDATA);
        ExFn_WriteLog("szInfodata:",szInfodata); 
    endif;


    szGNRTcpport="";
    if (RegDBSetDefaultRoot(HKEY_CURRENT_USER)<0) then
endif;

Disable(LOGGING);
//IE安全站点设置
    szKey="Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\security_GNAdminexe";
if (RegDBCreateKeyEx(szKey, "") < 0) then
endif;
    if (RegDBSetKeyValueEx (szKey, "*", REGDB_STRING, "2",-1) < 0) then
endif;

//转到 HKEY_LOCAL_MACHINE
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;


//获取远程端口
nvType = REGDB_NUMBER;
if RegDBGetKeyValueEx(REG_RAS_PORT,"PortNumber",nvType,sKeyValue,nvSize) = 0 then 
  StrToLower(lowport,sKeyValue);
endif;
szGNRTcpport=lowport+":TCP";

//由完全内存存储方式改为空
szCrashControlKey="SYSTEM\\ControlSet001\\Control\\CrashControl";
    if (RegDBCreateKeyEx(szCrashControlKey, "") < 0) then
endif;
if (RegDBSetKeyValueEx (szCrashControlKey, "CrashDumpEnabled", REGDB_NUMBER, "0",-1) < 0) then
endif;
szCrashControgww="SYSTEM\\CurrentControlSet\\Control\\CrashContro";
if (RegDBCreateKeyEx(szCrashControgww, "") < 0) then
endif;
    if (RegDBSetKeyValueEx(szCrashControgww, "CrashDumpEnabled", REGDB_NUMBER, "0",-1) < 0) then
endif;

//设置防火墙建立防火墙规则
szFirewall="SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile";
if (RegDBCreateKeyEx(szFirewall, "") < 0) then
endif;
if (RegDBSetKeyValueEx (szFirewall, "DoNotAllowExceptions", REGDB_NUMBER, "0",-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szFirewall, "DisableNotifications", REGDB_NUMBER, "0",-1) < 0) then
endif;
//如果操作系统版本》=6设置注册表
szFirewallRules="SYSTEM\\CurrentControlSet\\services\\SharedAccess\\Parameters\\FirewallPolicy\\FirewallRules";
szList ="SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List";
szListglobally="SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenPorts\\List";
if(SYSINFO.nOSMajor>=6) then
   if (RegDBCreateKeyEx(szFirewallRules, "") < 0) then
   endif;
if (RegDBSetKeyValueEx (szFirewallRules, "{5DE664C2-4D46-406E-9261-AB0578F91588}", REGDB_STRING, "v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|LPort=$WebPort|Name=GNWEB|",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szFirewallRules, "{38EA3034-D395-4F96-B1D9-426E9FFBC75E}", REGDB_STRING, "v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|LPort=$RDPPort|Name=GNRDP|",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szFirewallRules, "{43268708-8E5C-43DF-8BF9-56531528BC5B}", REGDB_STRING, "v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|LPort=$SSLPort|Name=GNSSL|",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szFirewallRules, "{F1F3B3C5-273E-4D2E-B1C9-52781A68A734}", REGDB_STRING, "v2.10|Action=Allow|Active=TRUE|Dir=In|App=$INSTDIR\GNCore.exe|Name=ESL Web Server|",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szFirewallRules, "{393A3BFF-9668-4A7B-8EC6-7074BBB477A0}", REGDB_STRING, "v2.10|Action=Allow|Active=TRUE|Dir=In|App=$INSTDIR\nginx\nginx.exe|Name=SSL Web Server|",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szFirewallRules, "{628F9F1C-30AD-489B-89C5-9575320C6BBF}", REGDB_STRING, "v2.10|Action=Allow|Active=TRUE|Dir=In|App=$INSTDIR\GNTunnelSrv.exe|Name=ESL Tunnel|",-1) < 0) then
   endif;
   szserverjww="SOFTWARE\\gnway\\esoonlink\\Server";
   if (RegDBSetKeyValueEx (szserverjww, "GNRTcpvalue", REGDB_STRING, szGNRTcpport,-1) < 0) then
   endif;        
else
   if (RegDBCreateKeyEx(szList, "") < 0) then
   endif;
   szintalldir=TARGETDIR+"\\U8remote";
   if (RegDBSetKeyValueEx (szList, szintalldir+"\\GNCore.exe", REGDB_STRING, szintalldir+"\\GNCore.exe:*:Enabled:ESL Web Server",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szList, szintalldir+"\\GNRdpFilter.exe", REGDB_STRING, szintalldir+"\\GNRdpFilter.exe:*:Enabled:GNR Filter",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szList, szintalldir+"\\GNTunnelSrv.exe", REGDB_STRING, szintalldir+"\\GNTunnelSrv.exe:*:Enabled:ESL Tunnel",-1) < 0) then
   endif;
   if (RegDBSetKeyValueEx (szList,szintalldir+"\\nginx\nginx.exe" , REGDB_STRING, szintalldir+"\\nginx\nginx.exe:*:Enabled:SSL Web Server",-1) < 0) then
   endif;
   
   if(szGNRTcpport!="") then
      if (RegDBSetKeyValueEx (szListglobally, szGNRTcpport, REGDB_STRING, szGNRTcpport+":*:Enabled:GNR",-1) < 0) then
      endif;
      szserverjww="SOFTWARE\\gnway\\esoonlink\\Server";
      if (RegDBSetKeyValueEx (szserverjww, "GNRTcpvalue", REGDB_STRING, szGNRTcpport,-1) < 0) then
      endif;         
   endif;
   if(szGNRTcpport!=""&&szGNRTcpport=="3389:TCP") then
      if (RegDBSetKeyValueEx (szListglobally, "3389:TCP", REGDB_STRING, "3389:TCP:*:Enabled:RemoteDesktop",-1) < 0) then
      endif;
   endif;            
endif;


//设置gnrtsh访问策略 64为系统为32位注册表下。
szgnrtshjww="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\TSAppAllowList\\Applications\\gnrtsh";
if (RegDBCreateKeyEx(szgnrtshjww, "") < 0) then
endif;
if (RegDBSetKeyValueEx (szgnrtshjww, "CommandLineSetting", REGDB_NUMBER, "1",-1) < 0) then
endif;
szpathjww=TARGETDIR+"\\U8remote\\gnrtsh.exe";
if (RegDBSetKeyValueEx (szgnrtshjww, "Path", REGDB_STRING, szpathjww,-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szgnrtshjww, "ShowInTSWA", REGDB_NUMBER, "1",-1) < 0) then
endif;

//设置gnrtsh访问策略 64为系统为64位注册表下。
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
szgnrtshjww="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\TSAppAllowList\\Applications\\gnrtsh";
if (RegDBCreateKeyEx(szgnrtshjww, "") < 0) then
endif;
if (RegDBSetKeyValueEx (szgnrtshjww, "CommandLineSetting", REGDB_NUMBER, "1",-1) < 0) then
endif;
szpathjww=TARGETDIR+"\\U8remote\\gnrtsh.exe";
if (RegDBSetKeyValueEx (szgnrtshjww, "Path", REGDB_STRING, szpathjww,-1) < 0) then
endif;
if (RegDBSetKeyValueEx (szgnrtshjww, "ShowInTSWA", REGDB_NUMBER, "1",-1) < 0) then
endif;
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY; 

Enable(LOGGING);
ExFn_WriteLog("AddThirdJinWanWeiRegister()  !  end ",""); 
end;


//复制金万维驱动文件
function void CopyJinWanWeiDriversFiles()
string m_winsys32dir,m_winsyswow64dir,szSrcFile,svResult;
begin
    ExFn_WriteLog("CopyJinWanWeiDriversFiles()  start ","");
    Disable(LOGGING);
    //如果是64位系统。
    if (SYSINFO.bIsWow64 != 0 ) then
      Disable(WOW64FSREDIRECTION);
      szSrcFile = "*.*";
      m_winsys32dir=m_WinDir+"\\system32";
    if (FindFile(m_winsys32dir, "vsock.dll", svResult) = 0) then 
     XCopyFile (WINSYSDIR+"\\vsock.dll", m_winsys32dir, COMP_NORMAL);
     XCopyFile (WINSYSDIR+"\\gnmonnt.dll", m_winsys32dir, COMP_NORMAL);
     DeleteFile(WINSYSDIR+"\\vsock.dll");
    endif;
    //复制SPOOL文件;
    XCopyFile (WINSYSDIR ^ "spool"^szSrcFile, m_winsys32dir ^ "spool" ^ "*.*",INCLUDE_SUBDIR | COMP_NORMAL | COMP_UPDATE_SAME | COMP_UPDATE_DATE | COMP_UPDATE_VERSION);
         DeleteFile (WINSYSDIR ^ "spool"^szSrcFile);
         //删除驱动目录下的spool\drivers\w32x86
         DeleteFile (m_winsys32dir ^ "spool\\drivers\\w32x86"^szSrcFile);
  Enable(WOW64FSREDIRECTION);
//如果系统是32位的。
    else
       DeleteFile (WINSYSDIR ^ "spool\\drivers\\x64"^szSrcFile);
    endif;  
    Enable(LOGGING);
    ExFn_WriteLog("CopyJinWanWeiDriversFiles()  END ","");
end;




//导入注册表ODBCFix1.reg 和 ODBCFix2.reg
function void ImportRegisterfileJWW()
STRING szODBCFix1,szODBCFix2,szODBCFix1_32,szODBCFix2_32,svResult;
begin
   ExFn_WriteLog("ImportRegisterfileJWW  START ","");
   szODBCFix1=TARGETDIR+"\\U8remote\\ODBCFix1.reg";
   szODBCFix2=TARGETDIR+"\\U8remote\\ODBCFix2.reg";
   szODBCFix1_32=TARGETDIR+"\\U8remote\\ODBCFix1_32.reg";
   szODBCFix2_32=TARGETDIR+"\\U8remote\\ODBCFix2_32.reg";
   if ( SYSINFO.bIsWow64 != 0 ) then
     if (FindFile(TARGETDIR+"\\U8remote", "ODBCFix1.reg", svResult) = 0) then 
       UseDLL(ENVCHECK_DLL);
          Run("regedit /s "+szODBCFix1);
        UnUseDLL(ENVCHECK_DLL);
     endif;
     if (FindFile(TARGETDIR+"\\U8remote", "ODBCFix2.reg", svResult) = 0) then 
       UseDLL(ENVCHECK_DLL);
     Run("regedit /s "+szODBCFix2);
        UnUseDLL(ENVCHECK_DLL);
     endif;  
   else
     if (FindFile(TARGETDIR+"\\U8remote", "ODBCFix1_32.reg", svResult) = 0) then 
       UseDLL(ENVCHECK_DLL);
          Run("regedit /s "+szODBCFix1_32);
        UnUseDLL(ENVCHECK_DLL);
     endif;
     if (FindFile(TARGETDIR+"\\U8remote", "ODBCFix2_32.reg", svResult) = 0) then 
       UseDLL(ENVCHECK_DLL);
          Run("regedit /s "+szODBCFix2_32);
        UnUseDLL(ENVCHECK_DLL);
     endif;     
   endif;
  ExFn_WriteLog("ImportRegisterfileJWW  END ","");
end;




//执行金万维其它的设置命令
function void JWWCmdCommandExcute()
STRING szGNFixer;
begin
  ExFn_WriteLog("JWWCmdCommandExcute  START ","");
  UseDLL(ENVCHECK_DLL);
     szGNFixer=TARGETDIR+"\\U8remote\\GNFixer.exe";
     try
       RunNoBlock(szGNFixer + " --regeditado");
     catch
       ExFn_WriteLog(szGNFixer + " --regeditado","EXCEPTION"); 
     endcatch;
  UnUseDLL(ENVCHECK_DLL);
  ExFn_WriteLog("JWWCmdCommandExcute  END ","");
end;








//判断是否是安装过金万维的产品..
/*
金万维服务端安装后的注册表项目
1:SOFTWARE\\gnway\\esoonlink\\Server
*/
function BOOL IsSetUpJww()  
BOOL m_issetupjww;  
STRING szKey;
string svResult;
begin  
     m_issetupjww=FALSE; 
     if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif;   
     szKey="SOFTWARE\\gnway\\esoonlink\\Server";
if RegDBKeyExist(szKey) = 1 then 
  m_issetupjww=TRUE;
endif;  
return m_issetupjww;
end;  




//添加金万维对应的快截方式.
function void AddJWWShortCut()
STRING svResult; 
STRING szItemName,szCommandLine,szWorkingDir,szIconPath,szShortCutKey;  
STRING szmainmenudir;
string szdataimportpdm;
NUMBER  nIcon, nFlag, nResult;       
STRING szKey;
begin 
     if(FindFile(TARGETDIR+"\\u8remote", "GNAdmin.exe", svResult) = 0)  then
     szCommandLine=TARGETDIR+"\\u8remote\\GNAdmin.exe"; 
     szWorkingDir= TARGETDIR+"\\u8remote";  
     szIconPath=  TARGETDIR+"\\u8remote\\"+"GNAdmin.exe";  
     nIcon=0;
     szShortCutKey = ""; 
          nFlag= REPLACE; 
          szItemName=@ID_JWWU8SERVER;
          szmainmenudir=FOLDER_PROGRAMS+@ID_STRING9+"\\";
     AddFolderIcon (szmainmenudir, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag); 
      endif;
end;   






//添加金万维程序调用
///$INSTDIR\GNMisc.dll::AutoCheckPort(客户输入的web端口)
//金万维web端口检测
//是否WEB端口可以使用
function  BOOL JWWIsWebPortCanUseCheck(m_webport)
STRING svResult,szGNMisc;
BOOL m_issuccess;
begin
  m_issuccess=FALSE;
  if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);
       try
         m_issuccess=AutoCheckPort(m_webport);
       catch
         ExFn_WriteLog("AutoCheckPort","EXCEPTION"); 
       endcatch;  
     UnUseDLL(szGNMisc);
  endif;
  /*
  if(FindFile(WINSYSDIR, "GNMisc.dll", svResult) = 0)  then
     szGNMisc=WINSYSDIR+ "GNMisc.dll";
     UseDLL(szGNMisc);
       try
         m_issuccess=AutoCheckPort(m_webport);
       catch
         ExFn_WriteLog("AutoCheckPort","EXCEPTION"); 
       endcatch;  
     UnUseDLL(szGNMisc);
  endif;
  */
  return m_issuccess;
end;






//客户输入的RDP端口
//$INSTDIR\GNMisc.dll::AutoCheckRDPPort(客户输入的RDP端口)
function  BOOL JWWIsRDPPortCanUseCheck(m_rdpport)
STRING svResult,szGNMisc;
BOOL m_issuccess;
begin
  ExFn_WriteLog("JWWIsRDPPortCanUseCheck","START"); 
  m_issuccess=FALSE;
  if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);  
       m_issuccess=AutoCheckRDPPort(m_rdpport);
     UnUseDLL(szGNMisc);
  endif;
  ExFn_WriteLog("JWWIsRDPPortCanUseCheck","END"); 
  return m_issuccess;
end;




//云盘安装执行
//异速联默安装设置路径 
//$INSTDIR\GNMisc.dll::AutoCheckDiskMap(“SOFTWARE\\gnway\\esoonlink\\Server”)
function  BOOL JWWAutoCheckDiskMap()
string szkey,svResult,szGNMisc;
begin
    ExFn_WriteLog("JWWAutoCheckDiskMap","START"); 
    szkey="SOFTWARE\\gnway\\esoonlink\\Server";
    if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);
       try
          AutoCheckDiskMap(szkey);
       catch
          ExFn_WriteLog("AutoCheckDiskMap","EXCEPTION"); 
       endcatch;  
     UnUseDLL(szGNMisc);
    endif;
    ExFn_WriteLog("JWWAutoCheckDiskMap","END"); 
end;


//$INSTDIR\GNMisc.dll::SetSpecifyURLTrustful()
function  BOOL JWWSetSpecifyURLTrustful()
string svResult,szGNMisc;
begin
    ExFn_WriteLog("JWWSetSpecifyURLTrustful","START"); 
    if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);  
       try
         SetSpecifyURLTrustful();
       catch
         ExFn_WriteLog("SetSpecifyURLTrustful","EXCEPTION"); 
       endcatch;
       
     UnUseDLL(szGNMisc);
    endif;
    ExFn_WriteLog("JWWSetSpecifyURLTrustful","END"); 
end;






//卸载执行
//$INSTDIR\GNMisc.dll::LogOffAllOnlineSession()
function  BOOL JWWUninstallLogOffAllOnlineSession()
string svResult,szGNMisc;
begin
    ExFn_WriteLog("JWWUninstallLogOffAllOnlineSession","START"); 
    if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);  
       LogOffAllOnlineSession();
     UnUseDLL(szGNMisc);
    endif;
    ExFn_WriteLog("JWWUninstallLogOffAllOnlineSession","END"); 
end;


//卸载执行
//$INSTDIR\GNMisc.dll::DeleteAllUsers('called_by_nsis')
function  BOOL JWWUninstallDeleteAllUsers()
string svResult,szGNMisc;
begin
    ExFn_WriteLog("JWWUninstallDeleteAllUsers","START");
    if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);  
       DeleteAllUsers("called_by_nsis");
     UnUseDLL(szGNMisc);
    endif;
    ExFn_WriteLog("JWWUninstallDeleteAllUsers","END");
end;


//虚拟打印机安装
//ExecWait '"$INSTDIR\InstallPrinter.exe" -INSTALL -APPDIR="$INSTDIR" -PRINTERNAME=虚拟打印机名称'
//HKLM"SYSTEM\CurrentControlSet\Control\Print\Monitors\GNMonitor\Ports\GNPort:" "RunUser" 0
function  BOOL JWWInstallPrinter()
string svResult,szinstallprint,szdirprint;
begin
    ExFn_WriteLog("JWWInstallPrinter","START");
    szinstallprint=TARGETDIR+"\\u8remote\\"+"InstallPrinter.exe";
    szdirprint=TARGETDIR+"\\u8remote";
    if(FindFile(TARGETDIR+"\\u8remote", "InstallPrinter.exe", svResult) = 0)  then
     UseDLL(ENVCHECK_DLL);  
       try
        RunNoBlock(szinstallprint+" -INSTALL -APPDIR="+szdirprint+ " -PRINTERNAME="+"GNPrinter"); 
       catch
        ExFn_WriteLog(szinstallprint+" -INSTALL -APPDIR="+szdirprint+ " -PRINTERNAME="+"GNPrinter","EXCEPTION"); 
       endcatch;
       
     UnUseDLL(ENVCHECK_DLL);
    endif;
    ExFn_WriteLog("JWWInstallPrinter","END");
end;




/*
//虚拟打印机安装
//$INSTDIR\GNMisc.dll::SetDefPrinter("GNPrinter");
function  BOOL JWWSetDefPrinter()
string svResult,szGNMisc;
begin
    ExFn_WriteLog("JWWSetDefPrinter","START");
    if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
     szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
     UseDLL(szGNMisc);  
      try
        SetDefPrinter("GNPrinter");
      catch
        ExFn_WriteLog("SetDefPrinter","error");
      endcatch;
     UnUseDLL(szGNMisc);
    endif;
    ExFn_WriteLog("JWWSetDefPrinter","END");
end;
*/


/*添加注册表项目给CRM使用
  安装完CRM的memcache服务,请帮忙修改对应的注册表项:
  修改位置:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\memcached Server
  修改项:ImagePath,将其修改为 "C:\U8SOFT\turbocrm70\memcached\memcached.exe" -d runservice -l 127.0.0.1
*/
function  void MemcacheRunservice()
string szKey;
NUMBER nvType;
begin
    //转到 HKEY_LOCAL_MACHINE
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
nvType = REGDB_STRING;
    szKey="SYSTEM\\ControlSet001\\Services\\memcached Server";
    if (RegDBSetKeyValueEx(szKey, "ImagePath", REGDB_STRING,"\""+TARGETDIR^"turbocrm70\\memcached\\memcached.exe"+"\""+" -d runservice -l 127.0.0.1",-1) = 0) then
 ExFn_WriteLog("MemcacheRunservice ImagePath "," Success");    
    else
 ExFn_WriteLog("MemcacheRunservice ImagePath "," False"); 
    endif;
end;


//删除没有删除掉的快捷方式卸载使用
function  void DeleteShortCutAfterRemoveall()
begin
    //删除桌面的快截方式
    DeleteFolderIcon(FOLDER_DESKTOP,@ID_STRING98);
    UseDLL(ENVCHECK_DLL);
  RunNoBlock("CMD /C del /f/s/q " +"\""+FOLDER_DESKTOP+@ID_STRING98+".lnk"+"\"");  
UnUseDLL(ENVCHECK_DLL); 
//删除U8下面的快截方式
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING98+"\"",@ID_STRING98); 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING98+"\"",@ID_STRING99);
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING98+"\"",@ID_STRING100);    
    DeleteDir("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING98+"\"", ALLCONTENTS);
    
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"",@ID_STRING98); 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"",@ID_STRING99);
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"",@ID_STRING100);    
    DeleteDir("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING9+"\\"+@ID_STRING96+"\"", ALLCONTENTS);
    
    
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING96+"\"",@ID_STRING98); 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING96+"\"",@ID_STRING99);
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING96+"\"",@ID_STRING100);    
    DeleteDir("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING96+"\"", ALLCONTENTS);
    
    
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING98+"\"",@ID_STRING98); 
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING98+"\"",@ID_STRING99);
    DeleteFolderIcon("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING98+"\"",@ID_STRING100);    
    DeleteDir("\""+FOLDER_PROGRAMS+"\\"+@ID_STRING98+"\"", ALLCONTENTS);
    
    
end;


//判断是否安装过智能客户端,如果安装提示
function BOOL CheckIsInstallU8SmartClient()
string szkey;
STRING sKeyValue,sKeyValueTemp;  
NUMBER nvSize,nvType;
BOOL m_issmartclientsetup;
begin
   m_issmartclientsetup=FALSE;
   szkey="SOFTWARE\\Ufsoft\\WF\\V8.700\\Install\\CurrentInstPath";
   if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   nvType = REGDB_STRING;
   if RegDBGetKeyValueEx(szkey,"smartclient",nvType,sKeyValue,nvSize) = 0 then  
 StrToLower(sKeyValueTemp, sKeyValue);   
 if(sKeyValueTemp=="1") then  
         m_issmartclientsetup=TRUE;  
         ExFn_WriteLog("CheckIsInstallU8SmartClient!"," TRUE"); 
 endif;
   endif;
   return m_issmartclientsetup;  
end;




//金万维注册表复制处理。
function void GWWGNCopyRegDealWith()
string svResult,szGNMisc;
string szWdsrdpwd,szWdsGNR,szTdstcp,szRDPTcp,szWinStationsGNR;
string szjwwremoteport;
begin
     ExFn_WriteLog("GWWGNCopyRegDealWith!"," TRUE"); 
     szWdsrdpwd="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\rdpwd";
     szWdsGNR="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR";
     szTdstcp="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR\\Tds\\tcp";
     if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
      szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
      UseDLL(szGNMisc);  
       try
         GNCopyReg(2,szWdsrdpwd,2,szWdsGNR);
       catch
         ExFn_WriteLog("GNCopyReg!"," error");
       endcatch;
      UnUseDLL(szGNMisc);
     endif;
    /* 
    if(FindFile(WINSYSDIR, "GNMisc.dll", svResult) = 0)  then
     szGNMisc=WINSYSDIR + "GNMisc.dll";
      UseDLL(szGNMisc);  
       try
         GNCopyReg(2,szWdsrdpwd,2,szWdsGNR);
       catch
         ExFn_WriteLog("GNCopyReg!"," error");
       endcatch;
      UnUseDLL(szGNMisc);
     endif; 
     */
    Disable(LOGGING);
//转到 HKEY_LOCAL_MACHINE
if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
    if (RegDBSetKeyValueEx (szWdsGNR, "WdName", REGDB_STRING, "GNWAY ESL V2.2",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szWdsGNR, "WdPrefix", REGDB_STRING, "GNR",-1) < 0) then
endif;
    RegDBDeleteValue (szTdstcp, "PortNumber");


szRDPTcp="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp";
szWinStationsGNR="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\GNR";

if(FindFile(TARGETDIR+"\\u8remote", "GNMisc.dll", svResult) = 0)  then
      szGNMisc=TARGETDIR+"\\u8remote\\"+ "GNMisc.dll";
      UseDLL(szGNMisc);  
       try
         GNCopyReg(2,szRDPTcp,2,szWinStationsGNR);
       catch
         ExFn_WriteLog("GNCopyReg!"," error"); 
       endcatch;
      UnUseDLL(szGNMisc);
    endif;
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;
if (RegDBSetKeyValueEx (szWinStationsGNR, "WdName", REGDB_STRING, "GNWAY ESL V2.2",-1) < 0) then
endif;
if (RegDBSetKeyValueEx(szWinStationsGNR, "fInheritAutoLogon", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szWinStationsGNR, "fTurnOffSingleAppMode", REGDB_NUMBER, "0",-1) < 0) then
endif;
RegDBDeleteValue (szWinStationsGNR, "PortNumber");
RegDBDeleteValue (szWinStationsGNR, "Username");
RegDBDeleteValue (szWinStationsGNR, "Domain");
RegDBDeleteValue (szWinStationsGNR, "fPromptForPassword");

NumToStr(szjwwremoteport,g_JWWRemotePort);
if (RegDBSetKeyValueEx(szWinStationsGNR, "PortNumber", REGDB_NUMBER, szjwwremoteport,-1) < 0) then
  ExFn_WriteLog(szWinStationsGNR,"Set PortNumber Error");
endif;


     
    Enable(LOGGING);
    ExFn_WriteLog("GWWGNCopyRegDealWith!"," END");
    
    
end;






//根据金万维操作系统设置相关设置
function void SetJWWWindowsSettingByWindowsVersion()
string szgnrtsh,szgnyinstallpath,szSourcePath,szSetup,sKeyValue,sKeyValueTemp;
string szServicePackSourcePath;
string szSourcePathU8,szServicePackSourcePathU8;
NUMBER nvType,nvSize;
string szTerminalServer,szLicensingCore,szTsAppAllowList;
string szsysosmajor,szsysosminor;
BOOL m_isserverIOS;
begin
    
    ExFn_WriteLog("SetJWWWindowsSettingByWindowsVersion!"," START");
    
    if(SYSINFO.nOSProductType=VER_NT_SERVER) then
        m_isserverIOS=TRUE;
        ExFn_WriteLog("读取操作系统是Server版本"," m_isserverIOS=TRUE");
    else
        m_isserverIOS=FALSE;
        ExFn_WriteLog("读取操作系统不是Server版本"," m_isserverIOS=FALSE");
    endif; 
   
   
    //${If}  $WinVersion S>= "6"
    if SYSINFO.nOSMajor >= 6 then
      SetingJWWWin7UP();
    endif;
    
    
    NumToStr(szsysosmajor,SYSINFO.nOSMajor);
    ExFn_WriteLog("SYSINFO.nOSMajor ",szsysosmajor);
    NumToStr(szsysosminor,SYSINFO.nOSMinor);
    ExFn_WriteLog("SYSINFO.nOSMinor ",szsysosminor);
    //IsWin2003
    if (SYSINFO.nOSMajor==5&&SYSINFO.nOSMinor==2)  then 
       SetingJWWWin2003();
    //IsWin2008
    elseif SYSINFO.nOSMajor==6&&SYSINFO.nOSMinor==0&&m_isserverIOS=TRUE then
      SetingJWWWin2008();
    //IsWin2008R2
    elseif SYSINFO.nOSMajor==6&&SYSINFO.nOSMinor==1&&m_isserverIOS=TRUE then
      SetingJWWWin2008R2();
    //Windows Server 2012 R2 Datacenter版本
    elseif SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==2&&m_isserverIOS=TRUE then
      //SetingJWWWIN2012R2();
    //"Windows Server 2012 R2"
    elseif SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==3&&m_isserverIOS=TRUE then
      //SetingJWWWIN2012R2();
    //Windows 10 如果不是server版本就是WIN10
    elseif SYSINFO.nOSMajor ==10&&SYSINFO.nOSMinor==0&&m_isserverIOS=FALSE then
      SetingJWWWIN10();
    //Windows Server 2016 Standard 如果是server版本就是Windows Server 2016 Standard
    elseif SYSINFO.nOSMajor ==10&&SYSINFO.nOSMinor==0&&m_isserverIOS=TRUE then
      SetingJWWWIN2016();
    else
      ExFn_WriteLog("SetJWWWindowsSettingByWindowsVersion!"," END");  
    endif;
    
    ExFn_WriteLog("SetJWWWindowsSettingByWindowsVersion!"," END");




end;


//设置金万维注册表设置 WIN7以上
function void SetingJWWWin7UP()
STRING szgnrtsh,szgnyinstallpath;
begin
      ExFn_WriteLog("SetingJWWWin7UP::","START");
      Disable(LOGGING);
      if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
 endif;  
      szgnrtsh="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\TSAppAllowList\\Applications\\gnrtsh";
      
      //64位32位注册表
      if (RegDBSetKeyValueEx (szgnrtsh, "CommandLineSetting", REGDB_NUMBER, "1",-1) < 0) then
 endif;
 szgnyinstallpath=TARGETDIR+"\\U8remote\\gnrtsh.exe";
 if (RegDBSetKeyValueEx (szgnrtsh, "Path", REGDB_STRING, szgnyinstallpath,-1) < 0) then
 endif;
 
      //64位64位注册表
      REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
      if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
 endif;  
      if (RegDBSetKeyValueEx (szgnrtsh, "CommandLineSetting", REGDB_NUMBER, "1",-1) < 0) then
 endif;
 szgnyinstallpath=TARGETDIR+"\\U8remote\\gnrtsh.exe";
 if (RegDBSetKeyValueEx (szgnrtsh, "Path", REGDB_STRING, szgnyinstallpath,-1) < 0) then
 endif;
      REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
      Enable(LOGGING);
      ExFn_WriteLog("SetingJWWWin7UP::","END");
end;


//设置金万维注册表设置 "Windows 2003" 
function void SetingJWWWin2003()
NUMBER nvType,nvSize;
string szSetup,sKeyValue;
STRING szSourcePath,szServicePackSourcePath,szSourcePathU8,szServicePackSourcePathU8;
begin
       ExFn_WriteLog("SetingJWWWin2003::","START");
       nvType = REGDB_STRING;
       szSetup="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup";
       
       Disable(LOGGING);
      
       if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
  endif;  
  
  if RegDBGetKeyValueEx(szSetup,"SourcePath",nvType,sKeyValue,nvSize) = 0 then
    StrToLower(szSourcePath, sKeyValue); 
    ExFn_WriteLog("szSourcePath::",szSourcePath);
  endif;
  if RegDBGetKeyValueEx(szSetup,"ServicePackSourcePath",nvType,sKeyValue,nvSize) = 0 then
    StrToLower(szServicePackSourcePath, sKeyValue); 
    ExFn_WriteLog("szServicePackSourcePath::",szServicePackSourcePath);
  endif;
  szSourcePathU8=TARGETDIR+"\\U8remote\\TerminalFiles";
  if (RegDBSetKeyValueEx (szSetup, "SourcePath", REGDB_STRING, szSourcePathU8,-1) < 0) then
  endif;
  szServicePackSourcePathU8=TARGETDIR+"\\U8remote\\TerminalFiles";
  if (RegDBSetKeyValueEx (szSetup, "ServicePackSourcePath", REGDB_STRING, szServicePackSourcePath,-1) < 0) then
  endif;
  if ( SYSINFO.bIsWow64 != 0 ) then
    UseDLL(ENVCHECK_DLL);  
          RunNoBlock("sysocmgr"+" /i:%windir%\\inf\\sysoc.inf"+" /u:"+"\""+TARGETDIR+"\\u8remote\\TerminalFiles\\amd64\\answer.xml"+"\""+" /r /c /q"); 
         UnUseDLL(ENVCHECK_DLL);
       else
    UseDLL(ENVCHECK_DLL);  
          RunNoBlock("sysocmgr"+" /i:%windir%\\inf\\sysoc.inf"+" /u:"+"\""+TARGETDIR+"\\u8remote\\TerminalFiles\\i386\\answer.xml"+"\""+" /r /c /q"); 
         UnUseDLL(ENVCHECK_DLL);          
       endif;
  //恢复原注册表值
  if (RegDBSetKeyValueEx (szSetup, "SourcePath", REGDB_STRING, szSourcePath,-1) < 0) then
  endif;
  szServicePackSourcePathU8=TARGETDIR+"\\U8remote\\TerminalFiles";
  if (RegDBSetKeyValueEx (szSetup, "ServicePackSourcePath", REGDB_STRING, szServicePackSourcePath,-1) < 0) then
  endif;
  Enable(LOGGING);
  ExFn_WriteLog("SetingJWWWin2003::","END");
end;
//设置金万维注册表设置 "Windows Server 2008" 
function void SetingJWWWin2008()
STRING szTerminalServer,szLicensingCore,szTsAppAllowList;
begin
      ExFn_WriteLog("SetingJWWWin2008!"," START");
      szTerminalServer="SYSTEM\\CurrentControlSet\\Control\\Terminal Server";
      szLicensingCore="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\RCM\\Licensing Core";
      szTsAppAllowList="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\TsAppAllowList";
      UseDLL(ENVCHECK_DLL);
          RunNoBlock("ServerManagerCmd.exe"+" -install ts-terminal-server ts-licensing"); 
      UnUseDLL(ENVCHECK_DLL);
      
      Disable(LOGGING);
      if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
 endif;  
      //64位32位注册表
      if (RegDBSetKeyValueEx (szTerminalServer, "fDenyTSConnections", REGDB_NUMBER, "0",-1) < 0) then
 endif;   
      
      if (RegDBSetKeyValueEx (szLicensingCore, "LicensingMode", REGDB_NUMBER, "4",-1) < 0) then
 endif;         
      
      if (RegDBSetKeyValueEx (szTsAppAllowList, "fDisabledAllowList", REGDB_NUMBER, "1",-1) < 0) then
 endif;
 
      //64位64位注册表
      REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
      if (RegDBSetKeyValueEx (szTerminalServer, "fDenyTSConnections", REGDB_NUMBER, "0",-1) < 0) then
 endif;   
      if (RegDBSetKeyValueEx (szLicensingCore, "LicensingMode", REGDB_NUMBER, "4",-1) < 0) then
 endif;         
      if (RegDBSetKeyValueEx (szTsAppAllowList, "fDisabledAllowList", REGDB_NUMBER, "1",-1) < 0) then
 endif; 
      REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;      
      if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
 endif;  
 
 
      Enable(LOGGING);
      ExFn_WriteLog("SetingJWWWin2008R2!"," end");
end;


//设置金万维注册表设置 "Windows Server 2008 R2" 
function void SetingJWWWin2008R2()
STRING szTerminalServer,szLicensingCore,szTsAppAllowList;
begin
      ExFn_WriteLog("SetingJWWWin2008R2!"," START");
      szTerminalServer="SYSTEM\\CurrentControlSet\\Control\\Terminal Server";
      szLicensingCore="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\RCM\\Licensing Core";
      szTsAppAllowList="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\TsAppAllowList";
      UseDLL(ENVCHECK_DLL);
          RunNoBlock("ServerManagerCmd.exe"+" -install rds-rd-server rds-licensing"); 
      UnUseDLL(ENVCHECK_DLL);
      Disable(LOGGING);
      if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
 endif;  
      //64位32位注册表
      if (RegDBSetKeyValueEx (szTerminalServer, "fDenyTSConnections", REGDB_NUMBER, "0",-1) < 0) then
 endif;   
      if (RegDBSetKeyValueEx (szLicensingCore, "LicensingMode", REGDB_NUMBER, "4",-1) < 0) then
 endif;         
      if (RegDBSetKeyValueEx (szTsAppAllowList, "fDisabledAllowList", REGDB_NUMBER, "1",-1) < 0) then
 endif; 

 if (RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\services\\TermService\\Parameters\\LicenseServers", "SpecifiedLicenseServers", REGDB_STRING_MULTI, "127.0.0.1",-1) < 0) then
 endif; 
      //64位64位注册表
      REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
      if (RegDBSetKeyValueEx (szTerminalServer, "fDenyTSConnections", REGDB_NUMBER, "0",-1) < 0) then
 endif;   
      if (RegDBSetKeyValueEx (szLicensingCore, "LicensingMode", REGDB_NUMBER, "4",-1) < 0) then
 endif;         
      if (RegDBSetKeyValueEx (szTsAppAllowList, "fDisabledAllowList", REGDB_NUMBER, "1",-1) < 0) then
 endif; 

 if (RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\services\\TermService\\Parameters\\LicenseServers", "SpecifiedLicenseServers", REGDB_STRING_MULTI, "127.0.0.1",-1) < 0) then
 endif; 
      REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
      Enable(LOGGING);
      ExFn_WriteLog("SetingJWWWin2008R2!"," end");
end;


//设置金万维注册表设置 "Windows Server 2012 R2" 
function void SetingJWWWIN2012R2()
begin
     ExFn_WriteLog("SetingJWWWIN2012R2!"," START");
     UseDLL(ENVCHECK_DLL);
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name Remote-Desktop-Services}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RDS-RD-Server}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RDS-Licensing}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name Server-Media-Foundation}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RSAT}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RSAT-Role-Tools}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RSAT-RDS-Tools}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RDS-Licensing-UI}"+"\""); 
          RunNoBlock("Powershell -NonInteractive -Command "+"\""+"& {Install-WindowsFeature -name RSAT-RDS-Licensing-Diagnosis-UI}"+"\""); 
     UnUseDLL(ENVCHECK_DLL);
     ExFn_WriteLog("SetingJWWWIN2012R2!"," END");
end;


//设置WIN10金万维注册表设置
function void SetingJWWWIN10()
string szregTerminalServer;
begin
    ExFn_WriteLog("SetingJWWWIN10!"," start");
    Disable(LOGGING);
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;  
    szregTerminalServer="SYSTEM\\CurrentControlSet\\Control\\Terminal Server";
    //64位32位注册表
    if (RegDBSetKeyValueEx (szregTerminalServer, "AllowTSConnections", REGDB_NUMBER, "1",-1) < 0) then
endif; 
    if (RegDBSetKeyValueEx (szregTerminalServer, "MaxInstanceCount", REGDB_NUMBER, "999999",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "SessionDirectoryActive", REGDB_NUMBER, "0",-1) < 0) then
endif; 
    if (RegDBSetKeyValueEx (szregTerminalServer, "TSEnabled", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "fEnableSalem", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "TSAdvertise", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "HonorLegacySettings", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "fSingleSessionPerUser", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "PerSessionTempDir", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "TSUserEnabled", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Licensing Core", "EnableConcurrentSessions", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Services\\TermService", "Start", REGDB_NUMBER, "2",-1) < 0) then
endif; 
    if (RegDBSetKeyValueEx ("SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services", "fAllowUnlistedRemotePrograms", REGDB_NUMBER, "1",-1) < 0) then
endif;  

  
    //64位64位注册表
    REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
    if (RegDBSetKeyValueEx (szregTerminalServer, "AllowTSConnections", REGDB_NUMBER, "1",-1) < 0) then
endif; 
    if (RegDBSetKeyValueEx (szregTerminalServer, "MaxInstanceCount", REGDB_NUMBER, "999999",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "SessionDirectoryActive", REGDB_NUMBER, "0",-1) < 0) then
endif; 
    if (RegDBSetKeyValueEx (szregTerminalServer, "TSEnabled", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "fEnableSalem", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "TSAdvertise", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "HonorLegacySettings", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "fSingleSessionPerUser", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "PerSessionTempDir", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregTerminalServer, "TSUserEnabled", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Licensing Core", "EnableConcurrentSessions", REGDB_NUMBER, "1",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Services\\TermService", "Start", REGDB_NUMBER, "2",-1) < 0) then
endif; 
    if (RegDBSetKeyValueEx ("SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services", "fAllowUnlistedRemotePrograms", REGDB_NUMBER, "1",-1) < 0) then
endif;
    REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
    Enable(LOGGING);
    ExFn_WriteLog("SetingJWWWIN10!"," end");
end;




//设置金万维注册表设置Windows Server 2016
function void SetingJWWWIN2016()
string szregServices,szmachinename;
begin
    ExFn_WriteLog("SetingJWWWIN2016!"," start");
    Disable(LOGGING);
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif;  
    szregServices="SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services";
    szmachinename=GetlocalMachineName();
    //64位32位注册表 
    if (RegDBSetKeyValueEx (szregServices, "LicenseServers", REGDB_STRING, szmachinename,-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "LicensingMode", REGDB_NUMBER, "4",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "fSingleSessionPerUser", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "UserAuthentication", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "UserAuthentication", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "SecurityLayer", REGDB_NUMBER, "0",-1) < 0) then
endif;
   
    //64位64位注册表
    REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;    
    if (RegDBSetKeyValueEx (szregServices, "LicenseServers", REGDB_STRING, szmachinename,-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "LicensingMode", REGDB_NUMBER, "4",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "fSingleSessionPerUser", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "UserAuthentication", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "UserAuthentication", REGDB_NUMBER, "0",-1) < 0) then
endif;
    if (RegDBSetKeyValueEx (szregServices, "SecurityLayer", REGDB_NUMBER, "0",-1) < 0) then
endif;
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;   
    Enable(LOGGING);
    ExFn_WriteLog("SetingJWWWIN2016!"," end");    
end;








//DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\GNR\Tds\tcp" "PortNumber"
//DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\GNR" "PortNumber"
//删除端口号
function void DeleteJWWWRemotePort()
string szTdstcp,szWinStationsGNR;
begin
    ExFn_WriteLog("DeleteJWWWRemotePort!"," start");
    Disable(LOGGING);
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
endif; 
szTdstcp="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\GNR\\Tds\\tcp"; 
szWinStationsGNR="SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\GNR";
RegDBDeleteValue (szTdstcp, "PortNumber");
  RegDBDeleteValue (szWinStationsGNR, "PortNumber");
  Enable(LOGGING);
    ExFn_WriteLog("DeleteJWWWRemotePort!"," end");
end;    
    
//卸载U8后执行卸载金万维相关设置
function void UninstallJWWAfterRemove()
string killprocessname,szKey;
begin
    ExFn_WriteLog("","JWW_UnInstalled");
    //if FeatureIsItemSelected(MEDIA,"JWW")=1 then
    ExFn_WriteLog("","UninstallJWWAfterRemove");
    killprocessname="php-cgi.exe";  
    ExFn_TaskKillProcess(killprocessname);
    ExFn_DelReg("JWW");
    
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    
    szKey="SoftWare\\gnway\\esoonlink\\Server";
if (RegDBDeleteKey (szKey) < 0) then
endif;


    szKey="SoftWare\\gnway\\esoonlink\\Client\\LocalInput";
if (RegDBDeleteKey (szKey) < 0) then
endif;
szKey="SoftWare\\gnway\\esoonlink\\Client\\PrintSetup";
if (RegDBDeleteKey (szKey) < 0) then
endif;
szKey="SoftWare\\gnway\\esoonlink\\Client\\ProxySetup";
if (RegDBDeleteKey (szKey) < 0) then
endif;
szKey="SoftWare\\gnway\\esoonlink\\Client\\RemoteProgram";
if (RegDBDeleteKey (szKey) < 0) then
endif;
szKey="SoftWare\\gnway\\esoonlink\\Client\\VirtualPrinter";
if (RegDBDeleteKey (szKey) < 0) then
endif;
szKey="SoftWare\\gnway\\esoonlink\\Client";
if (RegDBDeleteKey (szKey) < 0) then
endif;


if (RegDBDeleteKey ("SoftWare\\gnway\\esoonlink") < 0) then
endif;
if (RegDBDeleteKey ("SoftWare\\gnway") < 0) then
endif;



    //删除金万维第一部分注册表
    DeleteJinWanWeiRegister();
    //删除金万维服务第二部分
    DeleteSecondJinWanWeiRegister();    


StopServiceU8("GNWebService");
StopServiceU8("yonyouU8WebService");
StopServiceU8("GNESLServiceHelper");
DeleteServiceU8("GNWebService"); 
DeleteServiceU8("yonyouU8WebService");
    DeleteServiceU8("GNESLServiceHelper");


    卸载执行
    JWWUninstallLogOffAllOnlineSession();
    JWWUninstallDeleteAllUsers();
    //endif;
 
    DeleteJWWWRemotePort();
end;




//执行设置端口
//"\U8remote\GNESLSetup.exe" /WEBPORT=81 /RDPPORT=5366 /INSTDIR="C:\u8soft\U8remote" 
function void ExcuteGNESLSetupSetWebPortRdpPort()
string szGNESLSetup, szargsexe;
string szKMWebport,szRemotePort;
begin
    ExFn_WriteLog("ExcuteGNESLSetupSetWebPortRdpPort!"," start");
    NumToStr(szKMWebport, g_KMWebport);
    NumToStr(szRemotePort, g_JWWRemotePort);
  szGNESLSetup=TARGETDIR+"\\U8remote\\GNESLSetup.exe";
  szargsexe=" /WEBPORT="+szKMWebport+" /RDPPORT="+szRemotePort+" /INSTDIR="+"\""+TARGETDIR+"\\U8remote"+"\"";
    UseDLL(ENVCHECK_DLL);
       RunNoBlock(szGNESLSetup+szargsexe);
UnUseDLL(ENVCHECK_DLL);  
    ExFn_WriteLog("ExcuteGNESLSetupSetWebPortRdpPort!"," end");
end; 



runcommad4.rul源码

//===========================================================================
//
//  File Name:    runcommad4.rul
//   
// Author:  lilf
//
//  Description:  设置IIS相关设置
//
//  Comments:     
//
//===========================================================================


//设置IIS运行环境
function void ExFn_SetIISEnvirment()
string svPath,svResult;
begin
    ExFn_FeatureCheckType(); 
if m_CheckType & (CHECK_FOR_DATASERVER | CHECK_FOR_APPSERVER | CHECK_FOR_FILESERVER | CHECK_FOR_WEBSERVER | CHECK_FOR_LICENSESERVER | CHECK_FOR_EnterNetServer) then
UseDLL(ENVCHECK_DLL);
RunNoBlock("CMD /C iisreset");  
//VISTA 以上版本执行这个命令。64位环境执行:C:\WINDOWS\MicroSoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i -enable 
//32位环境执行 :C:\WINDOWS\MicroSoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable  
//如果是VISTA 以下版本都执行32位下的: C:\WINDOWS\MicroSoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable
if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==0)||(SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then   
 if (SYSINFO.bIsWow64 != 0) then 
  if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework64\\v2.0.50727","aspnet_regiis.exe",svResult)==0) then  
    Run(m_WinDir+"\\MicroSoft.NET\\Framework64\\v2.0.50727\\aspnet_regiis.exe -i -enable");  
  endif; 
 else
 
  if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727","aspnet_regiis.exe",svResult)==0) then  
    Run(m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727\\aspnet_regiis.exe -i -enable");  
  endif; 
 endif;
else
 if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727","aspnet_regiis.exe",svResult)==0) then  
    Run(m_WinDir+"\\MicroSoft.NET\\Framework\\v2.0.50727\\aspnet_regiis.exe -r -enable");  
 endif; 
endif;
  //endif; 
Run("regsvr32.exe " + WINSYSDIR^"scrrun.dll" +" /s");  
LaunchAppAndWait(WINSYSDIR^"Cscript.exe",WINSYSDIR^"iisext.vbs " + "/EnExt ASP",LAAW_OPTION_NOWAIT|LAAW_OPTION_HIDDEN);  
//Run("CMD /C "+WINSYSDIR^"Cscript.exe " + WINSYSDIR^"iisext.vbs " + "/EnExt ASP"); 
Run("CMD /C "+WINSYSDIR^"Cscript.exe " + WINSYSDIR^"iisext.vbs " + "/AddFile "+WINSYSDIR^"inetsrv\\gzip.dll"+" 1 "+"\""+"HTTP Compression"+"\""+" 1 "+"\""+"HTTP Compression"+"\"");
//2003操作系统64位的iisext.vbs 在system32 下     
Disable(LOGGING);
Disable(WOW64FSREDIRECTION);
if FindFile(m_WinDir+"\\system32","iisext.vbs",svResult)!=0  then   
  XCopyFile (WINSYSDIR+"\\iisext.vbs", m_WinDir+"\\system32\\", COMP_NORMAL); 
   endif;
  //2003操作系统64位的FindFile 在system32 下,方便allinone.msi的注册。
if FindFile(m_WinDir+"\\system32","IOBJSAFE.TLB",svResult) < 0  then   
  XCopyFile (WINSYSDIR+"\\IOBJSAFE.TLB", m_WinDir+"\\system32\\", COMP_NORMAL); 
else
   endif;  
   Enable(WOW64FSREDIRECTION); 
   Enable(LOGGING);
   LaunchAppAndWait(m_WinDir+"\\system32\\"+"Cscript.exe",m_WinDir+"\\system32\\iisext.vbs " + "/EnExt ASP",LAAW_OPTION_NOWAIT|LAAW_OPTION_HIDDEN);  
//Run("CMD /C "+m_WinDir+"\\system32\\"+"Cscript.exe " + m_WinDir+"\\system32\\iisext.vbs " + "/EnExt ASP"); 
Run("CMD /C "+m_WinDir+"\\system32\\"+"Cscript.exe " + m_WinDir+"\\system32\\iisext.vbs " + "/AddFile "+WINSYSDIR^"inetsrv\\gzip.dll"+" 1 "+"\""+"HTTP Compression"+"\""+" 1 "+"\""+"HTTP Compression"+"\"");
UnUseDLL(ENVCHECK_DLL);

   if FindFile(COMMONFILES^"System\\ado","msadox.dll",svResult)==0 then
      svPath = COMMONFILES^"System\\ado"^"msadox.dll";
      LongPathToQuote (svPath,TRUE);
      LaunchAppAndWait(WINSYSDIR^"regsvr32.exe",svPath+" /s",NOWAIT);
   endif;  


endif;
end;


//删除所有虚拟目录..只保留EIS
function void ExFn_DeleteWebsOnlyRetainEis()
NUMBER iRet;
begin
DeleteVirtual("U8NE");;
DeleteVirtual("U8CO");
DeleteVirtual("U8FORE");
DeleteVirtual("U8EAI");
DeleteVirtual("U8Application");
DeleteVirtual("U8ApplicationEx");  //U8V11.0版本 劲涛、郑芸确认可以删除 
DeleteVirtual("U8SCMApplication"); //U8V11.0版本 劲涛、郑芸确认可以删除 
DeleteVirtual("U8KeyManage");    // U8V11.0版本 劲涛、郑芸确认可以删除 
DeleteVirtual("U8GDP");          // U8V11.0版本U8GDP(管理驾驶仓):与伟星、姚健确认应该由心BA替代 (BI安装盘会创建一个虚拟目录 BA)
DeleteVirtual("U8BM");
DeleteVirtual("HBBB");
DeleteVirtual("UAP");
DeleteVirtual("U8AuditWebSite");
DeleteVirtual("UFWebUploadServices");
DeleteVirtual("UFFileManagerServices");
DeleteVirtual("U8Portal");
DeleteVirtual("OAWeb");   
DeleteVirtual("MOMAdapter");   
DeleteVirtual("MOMSM");   
DeleteVirtual("MOMSRV");   
DeleteVirtual("U8PFWEB");     
DeleteVirtual("U8SL"); 
DeleteVirtual("3rdPrograms"); 
DeleteVirtual("U8KCSN");
DeleteVirtual("U8FASN");
DeleteVirtual("ER");
DeleteVirtual("FileTransfer");
DeleteVirtual("u8virtualtest");
//DeleteVirtual("WXQYH");
DeleteVirtual("U8WebSO");
DeleteVirtual("U8ER");
DeleteVirtual("UFWeb");
DeleteVirtual("DSSWEB");
DeleteVirtual("Control");
DeleteVirtual("U8WEB");
DeleteVirtual("GDPDB");
DeleteVirtual("U8PO");
DeleteVirtual("TIService");
//U8V13.0
DeleteVirtual("webapi");
end;




//删除所有历史遗留虚拟目录..
function void ExFn_DeleteAllWebs()
NUMBER iRet;
begin
DeleteVirtual("U8NE");;
DeleteVirtual("U8CO");
DeleteVirtual("U8FORE");
DeleteVirtual("U8EAI");
DeleteVirtual("U8Application");
DeleteVirtual("U8ApplicationEx");  //U8V11.0版本 劲涛、郑芸确认可以删除 
DeleteVirtual("U8SCMApplication"); //U8V11.0版本 劲涛、郑芸确认可以删除 
DeleteVirtual("U8KeyManage");    // U8V11.0版本 劲涛、郑芸确认可以删除 
DeleteVirtual("U8GDP");          // U8V11.0版本U8GDP(管理驾驶仓):与伟星、姚健确认应该由心BA替代 (BI安装盘会创建一个虚拟目录 BA)
DeleteVirtual("U8BM");
DeleteVirtual("HBBB");
DeleteVirtual("UAP");
DeleteVirtual("U8AuditWebSite");
DeleteVirtual("UFWebUploadServices");
DeleteVirtual("UFFileManagerServices");
DeleteVirtual("U8Portal");
DeleteVirtual("OAWeb");   
DeleteVirtual("MOMAdapter");   
DeleteVirtual("MOMSM");   
DeleteVirtual("MOMSRV");   
DeleteVirtual("U8PFWEB");     
DeleteVirtual("U8SL"); 
DeleteVirtual("3rdPrograms"); 
DeleteVirtual("U8KCSN");
DeleteVirtual("U8FASN");
DeleteVirtual("ER");
DeleteVirtual("FileTransfer");
DeleteVirtual("u8virtualtest");
DeleteVirtual("WXQYH");
DeleteVirtual("U8CWWebService");
DeleteVirtual("EIS");
DeleteVirtual("3rdPrograms");
DeleteVirtual("U8WebSO");
DeleteVirtual("U8ER");
DeleteVirtual("UFWeb");
DeleteVirtual("DSSWEB");
DeleteVirtual("Control");
DeleteVirtual("U8WEB");
DeleteVirtual("GDPDB");
DeleteVirtual("U8PO");
DeleteVirtual("TIService");
DeleteVirtual("webapi");
end;


//删除所有历史遗留应用程序池..
function void ExFn_DeleteAllAppPool()
begin 
  ExFn_DELETEApplicationPool("U8ApplicationAppPool");
  ExFn_DELETEApplicationPool("U8ApplicationExAppPool");
  ExFn_DELETEApplicationPool("8KeyManageAppPool");
  ExFn_DELETEApplicationPool("U8SCMApplicationAppPool");
  ExFn_DELETEApplicationPool("TIServiceAppPool");
  //U8V13.0
  ExFn_DELETEApplicationPool("OrderCenterApplicationAppPool");
end;
//判断虚拟目录存在,删除虚拟目录.
function DeleteVirtual(webname)
NUMBER iRet;
begin
iRet = UseDLL (SETUPKIT_DLL);
if(AdsiIsExist(webname)) then 
  AdsiDeleteWeb(webname);
endif;
UnUseDLL(SETUPKIT_DLL);
end;






 
//设置web站点进行应用程序池为Classic .NET AppPool
function BOOL ExFn_SetApplicationPool(web)
string sCommand;
begin    
    if(AdsiIsExist(web)) then
    sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/1/root/"+web+"/AppPoolId "
    + " \"Classic .NET AppPool\" ";   
    ExFn_Run(sCommand); 
    ExFn_WriteLog("ExFn_SetApplicationPool ",sCommand);
    return TRUE;
    else
    return FALSE;
    endif;    
end;






//删除web站点进行应用程序池
function BOOL ExFn_DELETEApplicationPool(web)
string sCommand;
begin   
    UseDLL(SETUPKIT_DLL); 
    if(AdsiIsExist(web)) then
    sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "delete w3svc/apppools/"+web;   
    ExFn_Run(sCommand); 
    ExFn_WriteLog("ExFn_DELETEApplicationPool ",sCommand);
    return TRUE;
    else
    return FALSE;
    endif;   
    UnUseDLL(SETUPKIT_DLL); 
end;




//设置IIS 64位下兼容32位程序
function void ExFn_SetEnable32BitAppOnWin64()
string sCommand;
begin
  if ( SYSINFO.bIsWow64 != 0 ) then
        sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/apppools/Enable32BitAppOnWin64 True";  
    ExFn_Run(sCommand);
    endif;     
    
    //lilf: 64位IIS 启动32位组件支持   
    if ( SYSINFO.bIsWow64 != 0 ) then
        sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/apppools/defaultapppool/Enable32BitAppOnWin64 True";  
    ExFn_WriteLog("64位IIS 启动32位组件支持 ",sCommand);
    ExFn_Run(sCommand);
    endif; 
    //64位IIS 启动32位组件支持 
    if ( SYSINFO.bIsWow64 != 0 ) then
        sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set "+"\""+"w3svc/apppools/Classic .NET AppPool/Enable32BitAppOnWin64"+"\""+ " True";  
    ExFn_WriteLog("64位IIS 启动32位组件支持 ",sCommand);
    ExFn_Run(sCommand);
    endif;
    //64位IIS 启动32位组件支持  
   if (SYSINFO.bIsWow64 != 0 ) then
        sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set "+"\""+"w3svc/apppools/U8SLApplicationAppPool/Enable32BitAppOnWin64"+"\""+ " True";  
    ExFn_WriteLog("64位IIS 启动32位组件支持 ",sCommand);
    ExFn_Run(sCommand);
    endif;


    //64位IIS 启动32位组件支持 TI     
   if ( SYSINFO.bIsWow64 != 0 ) then
        sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/apppools/TIServiceAppPool/Enable32BitAppOnWin64 True";  
    ExFn_Run(sCommand);
    endif;  
    
    //64位IIS 启动32位组件支持 TI     
   if ( SYSINFO.bIsWow64 != 0 ) then
        sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/apppools/OrderCenterApplicationAppPool/Enable32BitAppOnWin64 True";  
    ExFn_Run(sCommand);
    endif;  
    
     
end;


//设置web站点进行应用程序池为U8SLApplicationAppPool
function BOOL ExFn_SetApplicationPoolU8SL(web)
string sCommand;
begin   
    UseDLL(SETUPKIT_DLL);
    if(AdsiIsExist(web)) then
    sCommand = 
    "CScript "
    + WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/1/root/"+web+"/AppPoolId "
    + " \"U8SLApplicationAppPool\" ";   
    ExFn_Run(sCommand); 
    ExFn_WriteLog("ExFn_SetApplicationPool ",sCommand);
    return TRUE;
    else
    return FALSE;
    endif;   
    UnUseDLL(SETUPKIT_DLL); 
end;




  
//设置TISERVICE的默认程序池的属性和相关设置
function void SetTiServicePoolProperty()
string windowPath,svResult,sCommanddefault;
begin
   ExFn_WriteLog("SetTiServicePoolProperty ","Start");
   
   //设置TIServiceAppPool默认应用程序池
   UseDLL(ENVCHECK_DLL);
   
     windowPath = m_WinDir + "\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_regiis.exe";
     if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v4.0.30319","aspnet_regiis.exe",svResult)==0) then
          RunNoBlock(windowPath + " -i -enable");
     endif;
              
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools /[name='TIServiceAppPool'].processModel.identityType:LocalSystem ");
    //TIServiceAppPool 的 集成模式为经典
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools " + "\"" + "/[name='TIServiceAppPool'].ManagedPipelineMode:Classic" + "\"");  
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools " + "\"" + "/[name='TIServiceAppPool'].managedRuntimeVersion:v4.0" + "\"");
   
    
    if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v4.0.30319","aspnet_regiis.exe",svResult)==0) then
      RunNoBlock(windowPath + " -s W3SVC/1/ROOT/TIService");
      RunNoBlock(windowPath + " -iru");
    endif;
    
    //设置默认启动首页
    sCommanddefault = "CScript " + WINDISK + "\\Inetpub\\AdminScripts\\adsutil.vbs "
        + "set w3svc/1/root/TIService/DefaultDoc TI_Service.asmx,default.htm,default.asp,default.aspx,index.htm,index.html,index.asp";
    RunNoBlock(sCommanddefault);
                                   
   UnUseDLL(ENVCHECK_DLL);           
   ExFn_WriteLog("SetTiServicePoolProperty ","END");
end;




//设置webapi的默认程序池OrderCenterApplicationAppPool的属性和相关设置
function void SetWebApiServicePoolProperty()
string windowPath,svResult,sCommanddefault;
begin
   ExFn_WriteLog("SetWebApiServicePoolProperty ","Start");
   //设置OrderCenterApplicationAppPool默认应用程序池
   UseDLL(ENVCHECK_DLL); 
   /*
     windowPath = m_WinDir + "\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_regiis.exe";
     if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v4.0.30319","aspnet_regiis.exe",svResult)==0) then
          RunNoBlock(windowPath + " -i -enable");
     endif;
    */             
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools /[name='OrderCenterApplicationAppPool'].processModel.identityType:LocalSystem ");
    //OrderCenterApplicationAppPool 的 集成模式为经典
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools " + "\"" + "/[name='OrderCenterApplicationAppPool'].ManagedPipelineMode:Integrated" + "\"");  
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools " + "\"" + "/[name='OrderCenterApplicationAppPool'].managedRuntimeVersion:v4.0" + "\"");
    RunNoBlock(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:system.webServer/modules " + "\"" + "/[name='ServiceModel'].preCondition:managedHandler,runtimeVersionv2.0" + "\"");
    
    if(FindFile(m_WinDir+"\\MicroSoft.NET\\Framework\\v4.0.30319","aspnet_regiis.exe",svResult)==0) then
      RunNoBlock(windowPath + " -s W3SVC/1/ROOT/webapi");
      RunNoBlock(windowPath + " -iru");
    endif;
    
                              
   UnUseDLL(ENVCHECK_DLL);           
   ExFn_WriteLog("SetTiServicePoolProperty ","END");
end;






//恢复默认的经典和默认应用程序池的.NET版本为2.0
function void ExFn_RevertApppoolToNet20()
begin
   ExFn_WriteLog("ExFn_RevertApppoolToNet20 ","start");
      UseDLL(ENVCHECK_DLL);  
        //修改应用程序池为DefaultAppPool 的 .NET Framework 版本为V2.0  
        Run(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools " + "\"" + "/[name='DefaultAppPool'].managedRuntimeVersion:v2.0" + "\"");  
       //修改应用程序池为Classic .NET AppPool 的 .NET Framework 版本为V2.0  
       Run(WINSYSDIR + "\\inetsrv" + "\\" + "appcmd.exe set config /section:applicationPools " + "\"" + "/[name='Classic .NET AppPool'].managedRuntimeVersion:v2.0" + "\"");                               
      
      UnUseDLL(ENVCHECK_DLL);    
   ExFn_WriteLog("ExFn_RevertApppoolToNet20 ","end");
end;
//更改应用程序池
function void ExFn_UpdateApplicationPools()
string svPathpath,svfileexist,szdllpath;
object setiis6DLLproject,setiis7DLLproject;
int isiis6existu8sl;
int isiis7existu8sl;
INT isiis7existu8TI,isiis6existu8TI;
begin
    ExFn_WriteLog("UpdateApplicationPools ","START");
    //更改应用程序池。
if (FindFile(SUPPORTDIR,"AppPoolSetting.exe", svfileexist) = 0) then 
 ExFn_Run(SUPPORTDIR^"AppPoolSetting.exe");
endif; 
//在vista以及2008上对web站点进行应用程序池设置
//考虑2012 也需要设置需要把这句替换 if SYSINFO.nISOSL == ISOSL_WINVISTA then 
//在vista以及2008以上版本上对web站点进行应用程序池设置
if((SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor==0)||(SYSINFO.nOSMajor ==6&&SYSINFO.nOSMinor>=1)||SYSINFO.nOSMajor>6)  then   
UseDLL(SETUPKIT_DLL);//子函数需要此dll中的方法
ExFn_SetApplicationPool("UFFileManagerServices");
ExFn_SetApplicationPool("U8NE");
ExFn_SetApplicationPool("U8CO");
ExFn_SetApplicationPool("U8FORE");
ExFn_SetApplicationPool("U8EAI");
ExFn_SetApplicationPool("U8Application");
ExFn_SetApplicationPool("U8BM");
ExFn_SetApplicationPool("HBBB");
ExFn_SetApplicationPool("UAP");
ExFn_SetApplicationPool("U8AuditWebSite");
//ExFn_SetApplicationPool("U8ApplicationEx");    U8V11.0版本 劲涛、郑芸确认可以删除 
//ExFn_SetApplicationPool("U8SCMApplication");   U8V11.0版本 劲涛、郑芸确认可以删除 
//ExFn_SetApplicationPool("U8GDP");     U8V11.0版本U8GDP(管理驾驶仓):与伟星、姚健确认应该由心BA替代 (BI安装盘会创建一个虚拟目录 BA)
ExFn_SetApplicationPool("U8Portal"); 
ExFn_SetApplicationPool("U8PFWEB");  
//if(!ExFn_SetApplicationPoolU8SL("U8SL")) then
ExFn_SetApplicationPool("U8SL");  
//endif;
ExFn_SetApplicationPool("3rdPrograms");    
ExFn_SetApplicationPool("U8KCSN");
ExFn_SetApplicationPool("U8FASN");
ExFn_SetApplicationPool("U8ER");
ExFn_SetApplicationPool("FileTransfer"); //U8V12.0 添加 For CRM
ExFn_SetApplicationPool("WXQYH"); 
ExFn_SetApplicationPool("U8CWWebService"); 
ExFn_SetApplicationPool("EIS");  
ExFn_SetApplicationPool("U8CJTM");
ExFn_SetApplicationPool("TIService");
ExFn_SetApplicationPool("webapi");
ExFn_SetApplicationPool("webctrl_client");
UnUseDLL(SETUPKIT_DLL);
endif;  
   

    //修改U8SL的应用程序池
    ExFn_WriteLog("SetIISDLLProperty","修改U8SL的应用程序池");
    //修改U8SL的应用程序池
    //添加应用程序池。
if (FindFile(SUPPORTDIR,"SetIISProperty.exe", svfileexist) = 0) then 
 ExFn_Run(SUPPORTDIR^"SetIISProperty.exe"+ " U8SLIIS6");
 ExFn_Run(SUPPORTDIR^"SetIISProperty.exe"+ " U8SLIIS7");
endif; 
     
     //添加TI的应用程序池 TIServiceAppPool
     if (FindFile(SUPPORTDIR,"SetIISProperty.exe", svfileexist) = 0) then 
 ExFn_Run(SUPPORTDIR^"SetIISProperty.exe"+ " TIServiceAppPool");
endif; 
 
//添加webapi的应用程序池 OrderCenterApplicationAppPool
     if (FindFile(SUPPORTDIR,"SetIISProperty.exe", svfileexist) = 0) then 
 ExFn_Run(SUPPORTDIR^"SetIISProperty.exe"+ " OrderCenterApplicationAppPool");
endif; 
 
 
     
     //添加U8SL的应用程序池 U8SLApplicationAppPool
     ExFn_AttachAppPool("U8SL","U8SLApplicationAppPool");
     
     //添加TI的应用程序池 TIServiceAppPool
     ExFn_AttachAppPool("TIService","TIServiceAppPool");
     
     //添加webapi的应用程序池OrderCenterApplicationAppPool
     ExFn_AttachAppPool("webapi","OrderCenterApplicationAppPool");
     ExFn_WriteLog("UpdateApplicationPools ","END");
end;


//绑定应用程序池
function void ExFn_AttachAppPool(webname,apppoolname)
object setiis6DLLproject,setiis7DLLproject;
INT isiis7existpool,isiis6existpool;
string szdllpath;
begin
     ExFn_WriteLog("ExFn_AttachAppPool ","start");
     szdllpath=SUPPORTDIR^"SetIISDLLProperty.dll";    
     //加载C# 动态库dll     
     try
       setiis6DLLproject=CoCreateObjectDotNet(szdllpath,"SetIISDLLProperty.IIS6Operator");
       isiis6existpool=setiis6DLLproject.IsExistClassicAppPoolForInstallshield(apppoolname); 
     catch
       isiis6existpool=0;
     endcatch;
     try
      setiis7DLLproject=CoCreateObjectDotNet(szdllpath,"SetIISDLLProperty.IIS7Operator");
      isiis7existpool=setiis7DLLproject.CreateAppPoolForInstallshield(apppoolname); 
     catch
      isiis7existpool=0;
     endcatch;
     //if(isiis6existpool==1||isiis7existpool==1) then 
     ExFn_WriteLog("ExFn_SetApplicationPoolWebApppool ","start");
     ExFn_SetApplicationPoolWebApppool(webname,apppoolname);
     //endif;
     ExFn_WriteLog("ExFn_AttachAppPool ","end");
end;


//设置web站点进行应用程序池为ExFn_SetApplicationPoolWebApppool
function BOOL ExFn_SetApplicationPoolWebApppool(web,apppoolname)
string sCommand;
begin  
    ExFn_WriteLog("ExFn_SetApplicationPoolWebApppool ","start"); 
    UseDLL(SETUPKIT_DLL);
    if(AdsiIsExist(web)) then
    sCommand = "CScript "+ WINDISK+"\\Inetpub\\AdminScripts\\adsutil.vbs "
    + "set w3svc/1/root/"+web+"/AppPoolId "
    + " \""+apppoolname+"\" "; 
        try
           ExFn_Run(sCommand); 
        catch
           ExFn_WriteLog("Exception:::: ",sCommand); 
        endcatch; 
   
    ExFn_WriteLog("ExFn_SetApplicationPoolWebApppool ",sCommand);
    return TRUE;
    else
    return FALSE;
    endif;   
    UnUseDLL(SETUPKIT_DLL); 
    ExFn_WriteLog("ExFn_SetApplicationPoolWebApppool ","end");
end;



runcommad5.rul源码

//===========================================================================
//
//  File Name:    runcommad5.rul
//   
// Author:  lilf
//
//  Description:  设置相关命令
//
//  Comments:     
//
//===========================================================================




//获取系统磁盘并判断空间决定是否使用
function LIST ExFn_GetSystemDisk()
string sKeyValueTemp,szeverydisk,szlastvalue;
string svResult;
NUMBER nStart,nLast,nvResult; 
LIST listIDDisk; 
string szkey;
STRING sKeyValueDisk;  
NUMBER nvSize,nvType;
begin 
    ExFn_WriteLog("ExFn_GetSystemDiskSpaceForUse"," start!"); 
    listIDDisk = ListCreate(STRINGLIST);  
    if (listIDDisk = LIST_NULL) then 
        ExFn_WriteLog("ExFn_GetSystemDiskSpaceForUse"," Unable to create list.");
    endif;


    //获取机器所有磁盘分区,包含CDROM
    UseDLL(ENVCHECK_DLL);
      GetAllDriveStrings(SUPPORTDIR);
      //sKeyValueTemp=GetIniFileStr(SUPPORTDIR+"\\DriveDiskInfo.ini","DriveDiskInfos","diskname");
    UnUseDLL(ENVCHECK_DLL);
   
    //由于返回值是乱码,只能通过写读注册表来决定。
    szkey="Software\\Diskinfos";
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
    endif;
    nvType = REGDB_STRING;
    if RegDBGetKeyValueEx(szkey,"DriveDiskInfos",nvType,sKeyValueDisk,nvSize) = 0 then  
 StrToUpper(sKeyValueTemp, sKeyValueDisk);   
 ExFn_WriteLog(sKeyValueTemp," TRUE"); 
    endif;
    
    if(StrLength(sKeyValueTemp)<3) then
      return;
    endif;
    
    StrRemoveLastSlash(sKeyValueTemp);
nStart = StrFind(sKeyValueTemp,"\\");
while(nStart>=0)
nLast = nStart+1;
StrSub(szeverydisk,sKeyValueTemp,0,nLast);

svResult=szeverydisk; 
StrRemoveLastSlash(svResult);
   if (GetSystemInfo (DRIVE, nvResult, svResult) < 0) then
     ExFn_WriteLog(" Couldn't get DRIVE info. ",""); 
        endif;
        /*IS_UNKNOWN—Target drive is unknown.
          IS_REMOVABLE—Target drive is a floppy drive.
          IS_FIXED—Target drive is a fixed drive.
          IS_CDROM—Target drive is a CD-ROM drive.
          IS_REMOTE—Target drive is a network drive.
        */
        //如果为4为逻辑磁盘分区。
        if nvResult=4 then
          ListAddString(listIDDisk, szeverydisk, AFTER);
        endif;
StrSub(sKeyValueTemp,sKeyValueTemp,nLast,StrLength(sKeyValueTemp)-nLast); 
nStart = StrFind(sKeyValueTemp,"\\");
endwhile; 
ExFn_WriteLog("ExFn_GetSystemDiskSpaceForUse"," END!"); 
return listIDDisk;
end; 


//判断可以使用的分区,剩余空间在8G以上的磁盘分区
function LIST GetCanUseDisk()
LIST listIDCanUseDisk,listiddisk; 
string svString,svDisk;
NUMBER nResult,lFreeSpace; 
begin 
    ExFn_WriteLog("GetCanUseDisk"," start!");
     
    listiddisk = ListCreate(STRINGLIST);  
    if (listiddisk = LIST_NULL) then 
        ExFn_WriteLog("GetCanUseDisk listiddisk"," Unable to create list.");
    endif;
    listIDCanUseDisk = ListCreate(STRINGLIST);  
    if (listIDCanUseDisk = LIST_NULL) then 
        ExFn_WriteLog("GetCanUseDisk listIDCanUseDisk"," Unable to create list.");
    endif;    
    listiddisk=ExFn_GetSystemDisk();
    // Get the first string in the list. 
    nResult = ListGetFirstString(listiddisk, svString); 
    // Loop while list items continue to be retrieved. 
    while (nResult != END_OF_LIST) 
       // Display the current element. 
       ExFn_WriteLog("GetCanUseDisk",svString);
       GetDisk(svString, svDisk);
       lFreeSpace = GetDiskSpace (svDisk);
       //******* 8G * 1024千字节 * 1024千字节 * 1024字节 = 10485760 字节 
       if (lFreeSpace > 8*1024*1024*1024) then
          ListAddString(listIDCanUseDisk, svString, AFTER); 
       endif;  
       // Get the next string in the list. 
       nResult = ListGetNextString (listiddisk, svString); 
    endwhile; 
    ExFn_WriteLog("GetCanUseDisk"," END!"); 
    return  listIDCanUseDisk;
end;


//返回除系统盘外的系统分区,如果只有系统盘返回系统盘
function LIST GetEliminateSystemDisk() 
NUMBER nCount,nResult;
LIST listsysID,listnoWinID; 
string svString,svwinString,svDisk;
begin
  ExFn_WriteLog("GetEliminateSystemDisk"," start!");
  listnoWinID = ListCreate(STRINGLIST);  
  if (listnoWinID = LIST_NULL) then 
        ExFn_WriteLog("GetCanUseDisk listnoWinID"," Unable to create list.");
  endif;   
  listsysID=GetCanUseDisk();  
  nCount = ListCount(listsysID); 
  if nCount=1 then
    return  listsysID;  
  endif;
  nResult = ListGetFirstString(listsysID, svString); 
  while (nResult != END_OF_LIST) 
       ExFn_WriteLog("GetEliminateSystemDisk",svString);
       GetDisk(svString, svDisk);
       GetDisk(WINDISK, svwinString);
       StrToUpper(svDisk, svDisk);
       StrToUpper(svwinString, svwinString);
       if svDisk=svwinString then
          ExFn_WriteLog("是系统盘"," TRUE");
       else
          ListAddString(listnoWinID, svString, AFTER); 
       endif;
       nResult = ListGetNextString (listsysID, svString); 
  endwhile; 
  ExFn_WriteLog("GetEliminateSystemDisk"," END!"); 
  return listnoWinID;
end;




function ExFn_Set870DownReg(szSubKey,szkeyname,szCaption)
STRING szKey;
NUMBER nType, nSize;
begin
   ExFn_WriteLog("ExFn_Set870DownReg"," start!"); 
    if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
   endif;
   szKey="SoftWare\\Ufsoft\\WF\\V8.700\\"+szSubKey;
    if (RegDBCreateKeyEx(szKey, "") < 0) then
MessageBox (szSubKey + "创建失败", SEVERE);
    endif;
    if (RegDBSetKeyValueEx (szKey, szkeyname, REGDB_STRING, szCaption,-1) < 0) then
endif;
ExFn_WriteLog("ExFn_Set870DownReg"," END!"); 
end;


SdLicenseSelf.rul 源码

//===========================================================================
//
//  File Name:    SdLicenseSelf.rul
//   
// Author:  LILONGFEI
//
//  Description:  添加用友隐私权政策的条款在许可协议中
//
//  Comments:     原有许可协议窗体无法支持添加其它控件
//
//===========================================================================


#define LicenseFile "license.txt"




function NUMBER ExFn_SdLicenseSelf()
string info,szDialogName,szTitle,m_licenseinfo,svString,svLine,svValue,szKey;
NUMBER nResult,nCmdValue,nvFileHandle,nFileHandle;
BOOL bDone,m_isneedaddprivacy;
HWND nHwnd,nHwndialog,nHwndialogNext;
LIST listlines;
begin
    szTitle=@TITLE_MAIN;
    m_isneedaddprivacy=FALSE;
    //读取LICENSE.TXT内容
    listlines = ListCreate (STRINGLIST);
    OpenFileMode (FILE_MODE_NORMAL);
    OpenFile (nFileHandle, SUPPORTDIR, LicenseFile);   
    while (GetLine (nFileHandle, svLine) = 0)
        m_licenseinfo=m_licenseinfo+svLine;
        ListAddString (listlines, svLine, AFTER);
    endwhile;
    
    szDialogName = "SdLicenseSelf"; 
    
    nResult = EzDefineDialog (szDialogName, "", "", RES_DLG_ID_License);
    if (nResult < 0) then 
        MessageBox ("An error occurred while defining the dialog license.", SEVERE); 
        bDone = TRUE; 
        abort; 
    endif; 


   bDone = FALSE; 
   repeat 
        DoStart:
        nCmdValue = WaitOnDialog(szDialogName); 
        switch (nCmdValue) 
            case DLG_CLOSE: 
                Do (EXIT); 
            case IDCANCEL: 
                Do (EXIT);                 
            case DLG_ERR: 
                MessageBox ("Unable to display dialog. Setup canceled.", SEVERE); 
                abort; 
            case DLG_INIT:  
                SetDialogTitle (RES_DLG_ID_License,@TITLE_MAIN);
                
                nHwndialog = CmdGetHwndDlg(szDialogName);  
                nHwndialogNext=GetDlgItem(nHwndialog,1); 
                
                CtrlSetText(szDialogName,RES_PBUT_edit_license,m_licenseinfo);
                CtrlSetMLEText(szDialogName, RES_PBUT_edit_license,listlines);




                CtrlSetState (szDialogName, RES_PBUT_checkbox_license, BUTTON_UNCHECKED);
                CtrlSetState (szDialogName, RES_PBUT_radiobuttonYes_license, BUTTON_UNCHECKED);
                CtrlSetState (szDialogName, RES_PBUT_radiobuttonNo_license, BUTTON_CHECKED);
                if (CtrlGetState (szDialogName, RES_PBUT_checkbox_license) = BUTTON_CHECKED) then 
                   //添加获取用户信息代码.
                   m_isneedaddprivacy=TRUE;
                 else
                   m_isneedaddprivacy=FALSE;
                 endif;   
                if (CtrlGetState (szDialogName, RES_PBUT_radiobuttonNo_license) = BUTTON_CHECKED) then 
                   EnableWindow(nHwndialogNext,FALSE); 
                 endif;             
                nHwnd = CmdGetHwndDlg(szDialogName);    
                SdSetDlgTitle(szDialogName,nHwnd,szTitle);
            case RES_PBUT_CANCEL: 
                Do (EXIT); 
            case RES_PBUT_Print:
                UseDLL(SUPPORTDIR^"EnvCheckDLL.dll"); 
                  PrintLicense(SUPPORTDIR^"license.txt");
                UnUseDLL(SUPPORTDIR^"EnvCheckDLL.dll");
                //if (FindFile (WINSYSDIR, "notepad.exe", svValue) = 0) then 
                  //LaunchAppAndWait(WINSYSDIR^"notepad.exe",SUPPORTDIR^"license.txt", LAAW_OPTION_WAIT); 
                //endif;  
            case RES_PBUT_NEXT:
                 if (CtrlGetState (szDialogName, RES_PBUT_radiobuttonYes_license) = BUTTON_UNCHECKED) then
                   EnableWindow(nHwndialogNext,FALSE);
                 else 
                  EnableWindow(nHwndialogNext,TRUE);
                 endif;


                 nResult = RES_PBUT_NEXT; 
                 bDone = TRUE;
            case RES_PBUT_radiobuttonYes_license:
                CtrlSetState (szDialogName, RES_PBUT_checkbox_license, BUTTON_CHECKED);
                CtrlSetState (szDialogName, RES_PBUT_radiobuttonYes_license, BUTTON_CHECKED);
                CtrlSetState (szDialogName, RES_PBUT_radiobuttonNo_license, BUTTON_UNCHECKED);
                if (CtrlGetState (szDialogName, RES_PBUT_checkbox_license) = BUTTON_CHECKED) then 
                   //添加获取用户信息代码.
                   m_isneedaddprivacy=TRUE;
                 endif;  
                EnableWindow(nHwndialogNext,YES);
            case RES_PBUT_radiobuttonNo_license:
                CtrlSetState (szDialogName, RES_PBUT_checkbox_license, BUTTON_UNCHECKED);
                CtrlSetState (szDialogName, RES_PBUT_radiobuttonYes_license, BUTTON_UNCHECKED);
                CtrlSetState (szDialogName, RES_PBUT_radiobuttonNo_license, BUTTON_CHECKED); 
                if (CtrlGetState (szDialogName, RES_PBUT_checkbox_license) = BUTTON_UNCHECKED) then 
                   //添加获取用户信息代码.
                   m_isneedaddprivacy=FALSE;
                 endif;   
                EnableWindow(nHwndialogNext,FALSE);
            case RES_PBUT_checkbox_license:
                 if (CtrlGetState (szDialogName, RES_PBUT_radiobuttonYes_license) = BUTTON_UNCHECKED) then
                   CtrlSetState (szDialogName, RES_PBUT_checkbox_license, BUTTON_UNCHECKED);
                 endif;   
                 if (CtrlGetState (szDialogName, RES_PBUT_checkbox_license) = BUTTON_CHECKED) then 
                   //添加获取用户信息代码.
                   m_isneedaddprivacy=TRUE;
                 endif;         
            case RES_PBUT_BACK: 
                bDone = TRUE; 
        endswitch; 
    until bDone; 
    EndDialog (szDialogName); 
    ReleaseDialog (szDialogName);    
    if (nCmdValue = RES_PBUT_NEXT) then
        //添加注册表.标示状态
        if(m_isneedaddprivacy=TRUE) then
          Disable(LOGGING);
          if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0) then
     endif; 
     szKey="SoftWare\\Privacy"; 
     if(RegDBCreateKeyEx(szKey, "")<0) then
       MessageBox ("Privacy" + "创建失败", SEVERE);
     endif;
     if (RegDBSetKeyValueEx (szKey, "PrivacyAgreement", REGDB_NUMBER, "1",-1) < 0) then
       ExFn_WriteLog("PrivacyAgreement","设置用户隐私权协议失败:"+szKey); 
     else
       ExFn_WriteLog("PrivacyAgreement","设置用户隐私权协议成功:"+szKey);  
     endif;
     Enable(LOGGING);
   endif;         
        nResult = NEXT;
    return nResult;
    else
        nResult = BACK;
    return nResult;
    endif;
end;


services.rul 源码


export prototype ExFn_RegistNETService(BYVAL STRING, BYVAL STRING);
function ExFn_RegistNETService(szPath, szFileName)
string szValue; 
string szFullPath;
begin      
if (FindFile (TARGETDIR^"szPath", szFileName, szValue) = 0) then
szFullPath = TARGETDIR^szPath+"\\UFIDA.U8.UAP.ReportService.exe";
LongPathToQuote(szFullPath, TRUE);
RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe -i " + szFullPath,
TARGETDIR^szPath);
endif;       
end;




function ExFn_InstallU8Service()
STRING szKey,svValue,szHBBBPath,szWorkFlowPath,szEnginePath,szFileManagePath,svResult;
string szReportPath;     
string szPath;       
string cmdStr; 
string sRegKey,sKeyValue, sKeyValueTemp;
number nvType,nvSize;
NUMBER iRetCode; 
string szRasDBPath,szRasBasicManagePath,szhttpdPath;
begin      

//old UseDLL(ENVCHECK_DLL);
//设置进度条显示状态
//启动服务  
if (FindFile (WINSYSDIR, "ServerNt.exe", svValue) >= 0) then   
 UseDLL(ENVCHECK_DLL);
if(Run(WINSYSDIR^"ServerNT.exe -install") != 0) then
   //MessageBox (@STR_064,SEVERE);
endif; 
 UnUseDLL(ENVCHECK_DLL);
   endif;


/*
   //U8V13.0添加U8EncryptService服务
   SetStatusWindow(96, @ID_CreateService+" "+"UFSoft.U8.Framework.EncryptManager.exe"); 
if (FindFile (WINSYSDIR, "UFSoft.U8.Framework.EncryptManager.exe", svValue) >= 0) then 
    szReportPath = WINSYSDIR^"UFSoft.U8.Framework.EncryptManager.exe";
    LongPathToQuote(szReportPath, TRUE); 
    UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE U8EncryptService binPath= \"\\\""+WINSYSDIR^"UFSoft.U8.Framework.EncryptManager.exe\\\"\" DisplayName= U8EncryptService start= auto ");
    RunNoBlock("SC DESCRIPTION U8EncryptService \"\"");
       RunNoBlock("SC failure U8EncryptService reset= 60 actions= restart/180000");
       UnUseDLL(ENVCHECK_DLL);
   endif;
   */
       
   
if(FindFile(WINSYSDIR,"MsgGhost.exe",svValue)==0) then 
  UseDLL(ENVCHECK_DLL);
            Run(WINSYSDIR^"MsgGhost.exe /service");  
           UnUseDLL(ENVCHECK_DLL);
        endif;
        
   
   //U8TaskService.exe服务
   /*
   if (FindFile (WINSYSDIR, "U8TaskService.exe", svValue) = 0) then
   if (Run(WINSYSDIR^"U8TaskService.exe -install") != 0) then
   endif;
endif;
if(FindFile(WINSYSDIR,"U8TaskService.exe.config",svResult)==0) then
       Run(SUPPORTDIR^"filereplace.exe "+"\""+WINSYSDIR^"U8TaskService.exe.config"+ "\"  \""+WINSYSDIR^"U8TaskService.exe.config\" " + "#root# "+ TARGETDIR);
        endif;
        */
        SetStatusWindow(96, @ID_CreateService+"  U8TaskService");
        if (FindFile (TARGETDIR, "U8TaskService.exe", svValue) = 0) then
           UseDLL(ENVCHECK_DLL);
   if (Run(TARGETDIR^"U8TaskService.exe -install") != 0) then
   endif; 
  UnUseDLL(ENVCHECK_DLL);
endif; 

if(FindFile(TARGETDIR,"U8TaskService.exe.config",svResult)==0) then
   UseDLL(ENVCHECK_DLL);
         RunNoBlock(SUPPORTDIR^"filereplace.exe "+"\""+TARGETDIR^"U8TaskService.exe.config"+ "\"  \""+TARGETDIR^"U8TaskService.exe.config\" " + "#root# "+ TARGETDIR);
       UnUseDLL(ENVCHECK_DLL);
        endif;
       


   if(FindFile(WINSYSDIR,"U8BackupService.exe.config",svResult)==0) then
       UseDLL(ENVCHECK_DLL);
         RunNoBlock(SUPPORTDIR^"filereplace.exe "+"\""+WINSYSDIR^"U8BackupService.exe.config"+ "\"  \""+WINSYSDIR^"U8BackupService.exe.config\" " + "#root# "+ TARGETDIR);
       UnUseDLL(ENVCHECK_DLL);
        endif;

    //启动合并报表服务
    SetStatusWindow(96, @ID_CreateService+" "+"TaskService");    
    szHBBBPath = " -i "+TARGETDIR+"\\GDP\\HBBB\\bin\\TaskService.exe";
    if (FindFile (TARGETDIR+"\\GDP\\HBBB\\bin", "TaskService.exe", svValue) = 0) then
      UseDLL(ENVCHECK_DLL);
           RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe"+szHBBBPath,
            TARGETDIR+"\\GDP\\HBBB\\bin");   
           UnUseDLL(ENVCHECK_DLL);
        endif;
        
        //启动工作流服务
        SetStatusWindow(96, @ID_CreateService+" "+"WorkFlowService"); 
        szWorkFlowPath = " -i "+TARGETDIR+"\\Workflow\\WorkFlowService.exe";
        if (FindFile (TARGETDIR+"\\Workflow", "WorkFlowService.exe", svValue) = 0) then
          UseDLL(ENVCHECK_DLL);
           RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe"+szWorkFlowPath,
            TARGETDIR+"\\Workflow");  
          UnUseDLL(ENVCHECK_DLL);
        endif;  
        
        
         //启动引擎命令监听服务  
        SetStatusWindow(96, @ID_CreateService+" "+"U8EngineCommandListen"); 
        szWorkFlowPath = " -i "+TARGETDIR+"\\Workflow\\U8EngineCommandListen.exe";
        if (FindFile (TARGETDIR+"\\Workflow", "U8EngineCommandListen.exe", svValue) = 0) then
           UseDLL(ENVCHECK_DLL);
           RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe"+szWorkFlowPath,
            TARGETDIR+"\\Workflow");  
           UnUseDLL(ENVCHECK_DLL);
        endif; 
        
         //启动MOM服务  
        SetStatusWindow(96, @ID_CreateService+" "+"MOMEngineSrv"); 
        szWorkFlowPath = " -i "+TARGETDIR+"\\UFMOM\\MOMServer\\MOMEngineSrv\\MOMEngineSrv.exe";
        if (FindFile (TARGETDIR+"\\UFMOM\\MOMServer\\MOMEngineSrv", "MOMEngineSrv.exe", svValue) = 0) then
          UseDLL(ENVCHECK_DLL);
           RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe"+szWorkFlowPath,
            TARGETDIR+"\\UFMOM\\MOMServer\\MOMEngineSrv");
          UnUseDLL(ENVCHECK_DLL);
        endif; 
        


        SetStatusWindow(96, @ID_CreateService+" "+"UFIDA.U8.UAP.ReportService"); 
if (FindFile (TARGETDIR^"UAP", "UFIDA.U8.UAP.ReportService.exe", svValue) = 0) then
szReportPath = TARGETDIR^"UAP\\UFIDA.U8.UAP.ReportService.exe"  ;
LongPathToQuote(szReportPath, TRUE);
UseDLL(ENVCHECK_DLL);
RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe -i " + szReportPath,
TARGETDIR^"UAP\\");   
   UnUseDLL(ENVCHECK_DLL);
endif;       

SetStatusWindow(96, @ID_AddComPlusComponent+" "+"U8Interface.MSI");
if FindFile (TARGETDIR^"AppServer\\Bin\\U8M", "U8Interface.MSI", svValue) = 0 then
szPath = TARGETDIR^"AppServer\\Bin\\U8M\\U8Interface.MSI";
LongPathToQuote(szPath, TRUE); 
UseDLL(ENVCHECK_DLL);
 RunNoBlock(WINSYSDIR^"msiexec.exe /i "+szPath +" /q");
UnUseDLL(ENVCHECK_DLL);
endif; 

SetStatusWindow(96,@ID_AddComPlusComponent+" "+"U8AllInOne.MSI");
//yangli U8V15.0要求删除此文件
if FindFile (TARGETDIR^"AppServer\\Bin\\U8M", "U8AllInOne.MSI", svValue) = 0 then
szPath = TARGETDIR^"AppServer\\Bin\\U8M\\U8AllInOne.MSI";
LongPathToQuote(szPath, TRUE); 
UseDLL(ENVCHECK_DLL);
 RunNoBlock("CMD /C del /f/s/q " +"\""+szPath+"\""); 
UnUseDLL(ENVCHECK_DLL);
endif;
/*
if FindFile (TARGETDIR^"AppServer\\Bin\\U8M", "U8AllInOne.MSI", svValue) = 0 then
szPath = TARGETDIR^"AppServer\\Bin\\U8M\\U8AllInOne.MSI";
LongPathToQuote(szPath, TRUE); 
UseDLL(ENVCHECK_DLL);
 RunNoBlock(WINSYSDIR^"msiexec.exe /i "+szPath +" /q");  
UnUseDLL(ENVCHECK_DLL);
endif;
        */      
//COM+服务 李静要求添加
SetStatusWindow(96, @ID_AddComPlusComponent+" "+"U8API_TransactionProxy.MSI");
if FindFile (TARGETDIR^"AppServer\\Bin\\MOMAdapter", "U8API_TransactionProxy.MSI", svValue) = 0 then
szPath = TARGETDIR^"AppServer\\Bin\\MOMAdapter\\U8API_TransactionProxy.MSI";
LongPathToQuote(szPath, TRUE);
UseDLL(ENVCHECK_DLL);
 RunNoBlock(WINSYSDIR^"msiexec.exe /i "+szPath +" /q");  
UnUseDLL(ENVCHECK_DLL);
endif;


        SetStatusWindow(96, @ID_CreateService+" "+"U8DispatchService");
if FindFile(TARGETDIR,"U8DispatchService.exe",svValue) = 0 then
szReportPath = TARGETDIR^"U8DispatchService.exe";
LongPathToQuote(szReportPath, TRUE); 
UseDLL(ENVCHECK_DLL);
RunWithDirectoryNoBlock(m_WinDir^"Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe -i " + szReportPath,
TARGETDIR);
RunNoBlock("net localgroup Remoting_Group /add");
RunNoBlock("net localgroup Remoting_Group administrator /add");
RunNoBlock("SC failure U8DispatchService reset= 60 actions= restart/180000");  
UnUseDLL(ENVCHECK_DLL);
endif;

SetStatusWindow(96, @ID_CreateService+" "+"U8KeyManagePool");   
if FindFile(TARGETDIR,"U8KeyManagePool.exe",svValue) = 0 then
szReportPath = TARGETDIR^"U8KeyManagePool.exe";
LongPathToQuote(szReportPath, TRUE);  
UseDLL(ENVCHECK_DLL);
RunNoBlock("SC CREATE U8KeyManagePool binPath= \"\\\""+TARGETDIR^"U8KeyManagePool.exe\\\" -name=U8KeyManagePool -appConfig=\\\""+TARGETDIR^"U8KeyManagePool.exe.config\\\"\" start= auto\"");
RunNoBlock("SC DESCRIPTION U8KeyManagePool \"作为U8 Key管理组件的远程工作进程,提供应用程序池功能。\"");
   RunNoBlock("SC failure U8KeyManagePool reset= 60 actions= restart/180000"); 
   UnUseDLL(ENVCHECK_DLL);
endif; 

//872新加的U8MPool服务  zhengyun
SetStatusWindow(96, @ID_CreateService+" "+"U8MPool");  
if FindFile(TARGETDIR,"U8MPool.exe",svValue) = 0 then
szReportPath = TARGETDIR^"U8MPool.exe";
LongPathToQuote(szReportPath, TRUE);  
UseDLL(ENVCHECK_DLL);
RunNoBlock("SC CREATE U8MPool binPath= \"\\\""+TARGETDIR^"U8MPool.exe\\\" -name=U8MPool  -appConfig=\\\""+TARGETDIR^"U8MPool.exe.config\\\"\" start= auto\"");
RunNoBlock("SC DESCRIPTION U8MPool \"作为生产制造管理组件的远程工作进程,提供应用程序池功能\"");
   RunNoBlock("SC failure U8MPool reset= 60 actions= restart/180000");  
   UnUseDLL(ENVCHECK_DLL);
endif; 

//872新加的U8SCMPool服务  zhengyun
SetStatusWindow(96, "正在创建服务 "+"U8SCMPool");
if FindFile(TARGETDIR,"U8SCMPool.exe",svValue) = 0 then
szReportPath = TARGETDIR^"U8SCMPool.exe";
LongPathToQuote(szReportPath, TRUE); 
UseDLL(ENVCHECK_DLL);
RunNoBlock("SC CREATE U8SCMPool binPath= \"\\\""+TARGETDIR^"U8SCMPool.exe\\\" -name=U8SCMPool  -appConfig=\\\""+TARGETDIR^"U8SCMPool.exe.config\\\"\" start= auto\"");
RunNoBlock("SC DESCRIPTION U8SCMPool \"作为供应链管理组件的远程工作进程,提供应用程序池功能\"");
   RunNoBlock("SC failure U8SCMPool reset= 60 actions= restart/180000");    
   UnUseDLL(ENVCHECK_DLL);
endif;   

//u8v11.0新加的 UFIDA.U8.Report.SLReportService 服务    lilf
SetStatusWindow(96, @ID_CreateService+" "+"UFIDA.U8.Report.SLReportService");
if FindFile(TARGETDIR,"UFIDA.U8.Report.SLReportService.exe",svValue) = 0 then
szReportPath = TARGETDIR^"UFIDA.U8.Report.SLReportService.exe";
LongPathToQuote(szReportPath, TRUE);  
UseDLL(ENVCHECK_DLL);
RunNoBlock("SC CREATE U8SLReportService binPath= \"\\\""+TARGETDIR^"UFIDA.U8.Report.SLReportService.exe\\\" -name=Silverlight报表服务  -appConfig=\\\""+TARGETDIR^"UFIDA.U8.Report.SLReportService.config\\\"\" start= auto\"");
RunNoBlock("SC DESCRIPTION U8SLReportService \"为Silverlight报表提供服务\"");
   RunNoBlock("SC failure U8SLReportService reset= 60 actions= restart/180000");
   UnUseDLL(ENVCHECK_DLL);
endif;

//U8V11.1 新加 U8WorkerService1 
SetStatusWindow(96, @ID_CreateService+" "+"U8WorkerService1");
if FindFile(TARGETDIR,"U8WorkerService.exe",svValue) = 0 then
szReportPath = TARGETDIR^"U8WorkerService.exe";
LongPathToQuote(szReportPath, TRUE);  
UseDLL(ENVCHECK_DLL);
RunNoBlock("SC CREATE U8WorkerService1 binPath= \"\\\""+TARGETDIR^"U8WorkerService.exe\\\" -Num=1\" depend= U8WebPool start= auto");
RunNoBlock("SC DESCRIPTION U8WorkerService1 \"U8WorkerService1\"");
   RunNoBlock("SC failure U8WorkerService1 reset= 60 actions= restart/180000"); 
   UnUseDLL(ENVCHECK_DLL);
endif;  

SetStatusWindow(96, @ID_CreateService+" "+"U8WorkerService2");
if FindFile(TARGETDIR,"U8WorkerService.exe",svValue) = 0 then
szReportPath = TARGETDIR^"U8WorkerService.exe";
LongPathToQuote(szReportPath, TRUE);  
UseDLL(ENVCHECK_DLL);
RunNoBlock("SC CREATE U8WorkerService2 binPath= \"\\\""+TARGETDIR^"U8WorkerService.exe\\\" -Num=2\" depend= U8WebPool start= auto");
RunNoBlock("SC DESCRIPTION U8WorkerService2 \"U8WorkerService2\"");
   RunNoBlock("SC failure U8WorkerService2 reset= 60 actions= restart/180000"); 
   UnUseDLL(ENVCHECK_DLL);
endif;


// UFIDA.U8.ECE.UTU.Services.exe 服务 
SetStatusWindow(96, @ID_CreateService+" "+"UFIDA.U8.ECE.UTU.Services"); 
if FeatureIsItemSelected(MEDIA,"Server\\U8AppServer")||FeatureIsItemSelected(MEDIA,"Server\\WebServerAppServer")||FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer") then  
 ExFn_WriteLog("FeatureIsItemSelected(MEDIA,服务器\\U8AppServer)||FeatureIsItemSelected(MEDIA,服务器\\WebServerAppServer) is ","TRUE");
  if FindFile(TARGETDIR^"UTU","UFIDA.U8.ECE.UTU.Services.exe",svValue) = 0 then
    szReportPath = TARGETDIR^"UTU\\UFIDA.U8.ECE.UTU.Services.exe";
    LongPathToQuote(szReportPath, TRUE); 
    UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE UTUService binPath= \"\\\""+TARGETDIR^"UTU\\UFIDA.U8.ECE.UTU.Services.exe\\\" -name=UTUService  -appConfig=\\\""+TARGETDIR^"UTU\\UFIDA.U8.ECE.UTU.Services.exe.config\\\"\" start= auto\"");
    RunNoBlock("SC DESCRIPTION UTUService \"为UTU即时通讯提供服务\"");
       RunNoBlock("SC failure UTUService reset= 60 actions= restart/180000");
       UnUseDLL(ENVCHECK_DLL);
     endif;
endif;   
       
       
       //u8v12.5修改为EIS 服务移动应用服务..EisService.exe
  SetStatusWindow(96, @ID_CreateService+" "+"EisService.exe"); 
if FeatureIsItemSelected(MEDIA,"Server\\EnterNetServer") then  
  if FindFile(TARGETDIR^"EIS","EisService.exe",svValue) = 0 then
    szReportPath = TARGETDIR^"EIS\\EisService.exe";
    LongPathToQuote(szReportPath, TRUE); 
    UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE U8EISService binPath= \"\\\""+TARGETDIR^"EIS\\EisService.exe\\\"\" start= auto ");
    RunNoBlock("SC DESCRIPTION U8EISService \" U8EISService U8企业互联网产品服务进程,移动应用等依赖互联网环境的U8产品使用该服务实现数据通信。\"");
       RunNoBlock("SC failure U8EISService reset= 60 actions= restart/180000");
       UnUseDLL(ENVCHECK_DLL);
     endif;
endif;  


//如果安装PDM加密添加PDM的ALLINONE加密服务..U8AllAuthServer.exe
/*
if FeatureIsItemSelected(MEDIA,"Server\\LicenseServer")=1 then
     SetStatusWindow(96, @ID_CreateService+" "+"U8AllAuthServer.exe"); 
     if (FindFile (WINSYSDIR, "U8AllAuthServer.exe", svValue) >= 0) then 
    szReportPath = WINSYSDIR^"U8AllAuthServer.exe";
    LongPathToQuote(szReportPath, TRUE); 
    UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE UFAllNet binPath= \"\\\""+WINSYSDIR^"U8AllAuthServer.exe\\\"\" DisplayName= U8AllAuthServer start= auto ");
    RunNoBlock("SC DESCRIPTION UFAllNet \"\"");
       RunNoBlock("SC failure UFAllNet reset= 60 actions= restart/180000");
       UnUseDLL(ENVCHECK_DLL);
         endif;
endif;
         */
         
        /* All-in-One加密服务在V15.0里没了,请在安装盘中移除这个服务
//U8V12.5 UU 修改加密  添加加密服务..U8AllAuthServer.exe  liums
  SetStatusWindow(96, @ID_CreateService+" "+"U8AllAuthServer.exe"); 
if (FindFile (WINSYSDIR, "U8AllAuthServer.exe", svValue) >= 0) then 
    szReportPath = WINSYSDIR^"U8AllAuthServer.exe";
    LongPathToQuote(szReportPath, TRUE); 
    UseDLL(ENVCHECK_DLL);
    RunNoBlock("SC CREATE UFAllNet binPath= \"\\\""+WINSYSDIR^"U8AllAuthServer.exe\\\"\" DisplayName= U8AllAuthServer start= auto ");
    RunNoBlock("SC DESCRIPTION UFAllNet \"\"");
       RunNoBlock("SC failure UFAllNet reset= 60 actions= restart/180000");
       UnUseDLL(ENVCHECK_DLL);
    endif;
*/

//配置Apache 服务给ISD读取加密信息使用..
        ConfigureApacheServiceToIsd();
    
        UseDLL(ENVCHECK_DLL);
RunNoBlock("cacls.exe " + TARGETDIR^"logs /E /T /G EveryOne:F"); 
RunNoBlock("sc config msdtc start= auto");   
UnUseDLL(ENVCHECK_DLL);

// old UnUseDLL(ENVCHECK_DLL); 

//2010-11-01 zhengyun

if (RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE) = 0) then
   
   szKey="SOFTWARE\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CertDllCreateCertificateChainEngine\\Config";
  if(!RegDBKeyExist(szKey)) then
  if (RegDBCreateKeyEx(szKey, "") < 0) then
ExFn_WriteLog("设置证书吊销列表注册表失败","ExFn_InstallU8Service");
  endif;
  endif;
 
  if(RegDBKeyExist(szKey)) then
  if (RegDBSetKeyValueEx (szKey, "ChainUrlRetrievalTimeoutMilliseconds", REGDB_NUMBER, "512",-1) < 0) then
ExFn_WriteLog("设置证书吊销列表注册表失败","ExFn_InstallU8Service");
endif;  
if (RegDBSetKeyValueEx (szKey, "ChainRevAccumulativeUrlRetrievalTimeoutMilliseconds", REGDB_NUMBER, "1280",-1) < 0) then
ExFn_WriteLog("设置证书吊销列表注册表失败","ExFn_InstallU8Service");
endif;
  endif;
 
  szKey = "SOFTWARE\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701";
    if(!RegDBKeyExist(szKey)) then
  if (RegDBCreateKeyEx(szKey, "") < 0) then
ExFn_WriteLog("设置w3wp注册表失败","ExFn_InstallU8Service");
  endif;
  endif;  
 
  if(RegDBKeyExist(szKey)) then
  if (RegDBSetKeyValueEx (szKey, "w3wp.exe", REGDB_NUMBER, "1",-1) < 0) then
ExFn_WriteLog("设置w3wp注册表失败","ExFn_InstallU8Service");
endif;  

  endif;
 
    endif; 
    上面的在64位系统中添加64位的注册表信息.
    AddRegisterIn64();
ExFn_WriteLog("Start Excute ExFn_InstallU8SLSVR ","Test load ENVCHECK_DLL");
// install  service for u8SL: fileversionsvr, copy policy to 80web,asmdepnedysvr
ExFn_InstallU8SLSVR();  
   
//把 c:\u8soft\admin\ 放在环境变量 PATH 中
//把   c:\U8SOFT\turbocrm70\php 放在环境变量 PATH 中

StrToLower(svValue, TARGETDIR + "\\admin");
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
sRegKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";

nvType = REGDB_STRING_EXPAND;
if RegDBGetKeyValueEx(sRegKey,"Path",nvType,sKeyValue,nvSize) = 0 then 
   StrToLower(sKeyValueTemp, sKeyValue);
   //if(! (sKeyValueTemp % svValue)) then
    //svValue = sKeyValue + ";" + svValue+";"+TARGETDIR+"\\turbocrm70\\php\\"+";"+TARGETDIR+"\\JDK\\jdk1.6.0_26\\bin"+";";
    svValue = sKeyValue + ";" + svValue+";"+TARGETDIR+"\\turbocrm70\\php\\"+";";
    UseDLL(ENVCHECK_DLL);
    svValue = "Setx /M Path " +"\""+ svValue +"\"" ;
    Run(svValue);
    UnUseDLL(ENVCHECK_DLL);
   //endif;
endif;

//停U8WebPool 服务
    StopServiceU8("U8WebPool"); 
    StopServiceU8("U8WorkerService1");
    StopServiceU8("U8WorkerService2"); 
end;


function ExFn_UnInstallU8Service()
begin 
    ExFn_WriteLog("","In ExFn_UnInstallU8Service");
    UseDLL(ENVCHECK_DLL);
    ClearU8Services(SUPPORTDIR);   
    //停止U8相关服务.
    Run("sc stop U8SLFileVersionService");
Run("sc delete U8SLFileVersionService");   
    Run("sc stop U8HostService");
Run("sc stop U8RouterHost");
Run("sc delete U8RouterHost");
Run("sc delete U8HostService");  
Run("sc stop U8WebPool");
Run("sc delete U8WebPool");  
Run("sc stop U8SLReportService");
Run("sc delete U8SLReportService"); 
Run("sc stop U8WorkerService1");
Run("sc delete U8WorkerService1");  
Run("sc stop U8WorkerService2");
Run("sc delete U8WorkerService2");  
Run("sc stop UTUService");
Run("sc delete UTUService");  
//停止并删除CRM相关的Apache服务
Run("sc stop Apache4TurboCRM70");
Run("sc delete Apache4TurboCRM70");   
Run("sc stop TurboCRM70");
Run("sc delete TurboCRM70");  
Run("sc stop U8MAService");
Run("sc delete U8MAService");
Run("sc stop U8EISService");
Run("sc delete U8EISService");
if FeatureIsItemSelected(MEDIA,"PDM")=1 then 
 Run("sc stop UFAllNet");
// Run("sc delete UFAllNet");
endif;


    UnUseDLL(ENVCHECK_DLL); 
       
    ExFn_WriteLog("","out ExFn_UnInstallU8Service");
end;       
      
function void ExFn_InstallU8SLSVR()
begin
ExFn_WriteLog("","ExFn_InstallU8SLSVR"); 
UseDLL(SETUPKIT2_DLL);
InstallU8SLSVR();
UnUseDLL(SETUPKIT2_DLL); 
ExFn_WriteLog("","out ExFn_InstallU8Service");
end;    


//添加CRM相关的Apache服务
function void ExFn_InstallU8CRMApacheService()   
INT iHttpProt;
STRING szCmdLine,szPort,szServer,szLicenseAddress,licenseservicename; 
string svValue,szPassword,szUser;
begin      
    iHttpProt=8072;
    licenseservicename=WINSYSDIR ^ "U8AllAuthServer.exe";
ExFn_WriteLog("","InstallU8CRMApacheService()"); 
UseDLL(ENVCHECK_DLL);
if (FindFile (TARGETDIR+"\\turbocrm70\\tsvr", "strreplace.exe", svValue) = 0) then 
  if (FindFile (TARGETDIR+"\\turbocrm70\\apache\\conf\\original", "httpd.conf", svValue) = 0) then 
      Run(TARGETDIR^"turbocrm70\\tsvr\\strreplace.exe "+TARGETDIR^"turbocrm70\\apache\\conf\\httpd.conf  c:\\turbocrm70 "+TARGETDIR+"\\turbocrm70");
       endif; 
       NumToStr(szPort,iHttpProt);  
       if (FindFile (TARGETDIR+"\\turbocrm70\\apache\\conf", "httpd.conf", svValue) = 0) then                                                
        Run(TARGETDIR^"turbocrm70\\tsvr\\strreplace.exe "+TARGETDIR^"turbocrm70\\apache\\conf\\httpd.conf  \"Listen 80 \"  \"Listen "+szPort+"\"");     
        Run(TARGETDIR^"turbocrm70\\tsvr\\strreplace.exe "+TARGETDIR^"turbocrm70\\apache\\conf\\httpd.conf  \"ServerName localhost:80 \"  \"ServerName localhost:"+szPort+"\"");
       endif;
        if (FindFile (TARGETDIR+"\\turbocrm70\\apache", "php.ini", svValue) = 0) then                                                   
         Run(TARGETDIR^"turbocrm70\\tsvr\\strreplace.exe "+TARGETDIR^"turbocrm70\\apache\\php.ini c:\\turbocrm70 "+TARGETDIR+"\\turbocrm70");  
        endif; 
        if (FindFile (TARGETDIR+"\\turbocrm70\\tsvr", "XYNTService.ini", svValue) = 0) then                                   
         Run(TARGETDIR^"turbocrm70\\tsvr\\strreplace.exe "+TARGETDIR^"turbocrm70\\tsvr\\XYNTService.ini  c:\\turbocrm70 "+TARGETDIR+"\\turbocrm70");
         endif;   
        if (FindFile (TARGETDIR+"\\turbocrm70\\tsvr", "turbocrm.ini", svValue) = 0) then                  
         Run(TARGETDIR^"turbocrm70\\tsvr\\strreplace.exe "+TARGETDIR^"turbocrm70\\tsvr\\turbocrm.ini "+"\""+"HTTPPort=80 ;"+"\" "+"\""+"HTTPPort="+szPort+";"+"\"") ;
        endif;  
        if (StrCompare(szServer,"(local)")=0) then 
        szServer="127.0.0.1";
        endif;   
endif;   
    
    if (FindFile (TARGETDIR+"\\turbocrm70\\memcached", "memcached.exe", svValue) = 0) then 
         Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d stop");
      Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d uninstall");
      Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d install");
      Run(TARGETDIR^"turbocrm70\\memcached\\memcached.exe "+"-d start");
    endif;   
     
//停上错误警告服务   
RunNoBlock(WINSYSDIR^"net.exe"+" stop ERSvc");
RunNoBlock(WINSYSDIR^"sc.exe"+" config ERSvc start= disabled");  
 
RunNoBlock(TARGETDIR^"turbocrm70\\apache\\bin\\httpd.exe"+" -n Apache4TurboCRM70 -k install"); 
//创建服务不启动服务 设置成手工启动
//RunNoBlock(TARGETDIR^"turbocrm70\\apache\\bin\\httpd.exe"+" -n Apache4TurboCRM70 -k start");
//Run(WINSYSDIR^"sc.exe"+" config Apache4TurboCRM70 start= demand"); 
RunNoBlock(TARGETDIR^"turbocrm70\\tsvr\\XYNTService.exe"+" -i");
RunNoBlock(TARGETDIR^"turbocrm70\\tsvr\\XYNTService.exe"+" -r TurboCRM70");   
 
 
//停止TurboCRM70服务并设置成手工启动。
//Run(WINSYSDIR^"sc.exe"+" stop TurboCRM70");
// Run(WINSYSDIR^"sc.exe"+" config TurboCRM70 start= demand");  
RunNoBlock(WINSYSDIR^"sc.exe"+" config ERSvc start= auto");
RunNoBlock(WINSYSDIR^"net.exe"+" start ERSvc");
UnUseDLL(ENVCHECK_DLL);
 
//安装完CRM的memcache服务,添加注册表。
     MemcacheRunservice();
//安装中不启动服务 TurboCRM70
StopServiceU8("TurboCRM70");
ExFn_WriteLog(""," out InstallU8CRMApacheService()");
end;   



SetupBeforeCpy.rul源码

//===========================================================================
//
//  File Name:    SetupBeforeCpy.rul
//   
// Author:  LiuQingJun
//
//  Description:  所有调用SetupBeforeCpy.dll库的操作,在此完成
//
//  Comments:     根据传入的不同参数名称,调用不能的函数
//
//===========================================================================




prototype cdecl LONG SetupBeforeCpy.InstallApache(HWND);
prototype cdecl LONG SetupBeforeCpy.InstallMySql(HWND);
prototype cdecl LONG SetupBeforeCpy.InstallODBC(HWND);
prototype cdecl LONG SetupBeforeCpy.RegTLB(HWND); 
prototype cdecl LONG SetupBeforeCpy.RegDataPort(HWND);
prototype cdecl LONG SetupBeforeCpy.UpdateRasDatabase(HWND); 
prototype cdecl LONG SetupBeforeCpy.AddEveryoneAccess(HWND);
prototype cdecl LONG SetupBeforeCpy.EnvCheck(HWND);
prototype cdecl LONG SetupBeforeCpy.IsValidInstallPath(HWND);   
prototype cdecl LONG SetupBeforeCpy.SetInstallPathToProperty(HWND);
prototype cdecl LONG SetupBeforeCpy.UnInstallApache(HWND); 
prototype cdecl LONG SetupBeforeCpy.UnInstallMySql(HWND);
prototype cdecl LONG SetupBeforeCpy.UnInstallODBC(HWND);
prototype cdecl LONG SetupBeforeCpy.CopyOtherFiles(HWND);
prototype cdecl BOOL SetupBeforeCpy.IsPortCanUse(HWND);
prototype cdecl BOOL SetupBeforeCpy.UpdateConsoleShortcut(HWND);
prototype cdecl BOOL SetupBeforeCpy.CheckInstallInfo(HWND);
prototype cdecl BOOL SetupBeforeCpy.SetMSDTC(HWND);   
prototype cdecl BOOL SetupBeforeCpy.GetDomainType(HWND);      
prototype cdecl BOOL SetupBeforeCpy.UnRegTLB(HWND);  
prototype cdecl BOOL SetupBeforeCpy.ConnectToDB(HWND);
prototype cdecl BOOL SetupBeforeCpy.AddServerToTeam(HWND);   
prototype cdecl BOOL SetupBeforeCpy.SetIsLogingFalse(HWND);


#define CALL_DLL_SUCCESS 0//dll调用成功
#define CALL_DLL_FAIL -1//dll调用失败     
 
  
prototype NUMBER ExFn_CallSetupBeforeCpy(STRING);


function NUMBER ExFn_CallSetupBeforeCpy(szDllFun)
STRING strDllFile,svUsername;
NUMBER nResult,nBuffer; 
HWND    hInstance;
begin  
    strDllFile = SUPPORTDIR^"SetupBeforeCpy.dll";
    nResult = UseDLL (strDllFile); 
    if (nResult < 0) then 
        return CALL_DLL_FAIL;
    endif;
    nResult = CALL_DLL_FAIL;


    if (szDllFun = "UpdateConsoleShortcut") then
    nResult =UpdateConsoleShortcut(hInstance);
    goto EndSub;
    endif;          
    
    if (szDllFun = "SetIsLogingFalse") then
    nResult =SetIsLogingFalse(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "GetDomainType") then
    nResult =GetDomainType(hInstance);
    goto EndSub;
    endif;  
    
    if (szDllFun = "UnRegTLB") then
    nResult =UnRegTLB(hInstance);
    goto EndSub;
    endif; 
    
    if (szDllFun = "IsPortCanUse") then
    nResult =IsPortCanUse(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "InstallApache") then
    nResult =InstallApache(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "InstallMySql") then
    nResult =InstallMySql(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "InstallODBC") then
    nResult =InstallODBC(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "RegTLB") then
    nResult =RegTLB(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "RegDataPort") then
    nResult =RegDataPort(hInstance);
    goto EndSub;
    endif; 
    
    if (szDllFun = "UpdateRasDatabase") then
    nResult =UpdateRasDatabase(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "AddEveryoneAccess") then
    nResult =AddEveryoneAccess(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "EnvCheck") then
    nResult =EnvCheck(hInstance);
    goto EndSub;
    endif; 
    
    if (szDllFun = "IsValidInstallPath") then
    nResult =IsValidInstallPath(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "SetInstallPathToProperty") then
    nResult =SetInstallPathToProperty(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "UnInstallApache") then
    nResult =UnInstallApache(hInstance);
    goto EndSub;
    endif;  
    
    if (szDllFun = "UnInstallMySql") then
    nResult =UnInstallMySql(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "UnInstallODBC") then
    nResult =UnInstallODBC(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "CopyOtherFiles") then
    nResult =CopyOtherFiles(hInstance);
    goto EndSub;
    endif;   
    
    if (szDllFun = "CheckInstallInfo") then
    nResult =CheckInstallInfo(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "SetMSDTC") then
    nResult =SetMSDTC(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "ConnectToDB") then
    nResult =ConnectToDB(hInstance);
    goto EndSub;
    endif;
    
    if (szDllFun = "AddServerToTeam") then
    nResult =AddServerToTeam(hInstance);
    goto EndSub;
    endif;  
EndSub:    
    UnUseDLL(strDllFile);
    return nResult; 
end;   


setuptype.rul 源码

#define RES_SETUPTYPE_LIST 401      
#define RES_TYPE_DESC_TEXT 711
#define RES_SETUPTYPEMODE_LIST 40002    
#define RES_TYPEMODE_DESC_TEXT 40004      
#define RES_ZH_CN_CHECK 1202
#define RES_ZH_TW_CHECK 1203
#define RES_EN_US_CHECK 1204     


STRING g_svSetupType;
//STRING g_svSetupModeType;


prototype ExFn_UFGetSetupTypeDesc(LIST, STRING, BYREF STRING);    
prototype string  ExFn_UFGetSetupModeTypeDesc(LIST, STRING, BYREF STRING);  
prototype BOOL  ExFn_CacaulateRasCount(BYREF STRING, BYREF STRING,int,int); 


//安装模式选择
function ExFn_UFSetupTypeMode(hMSI, svResult)
    STRING  szDialogModeName, szDLLName, szDialog,svSelection,svcomboxSelection;
    NUMBER  nDialog, nResult, nCmdValue;
    NUMBER  numberpdm;
    BOOL    bDone,issupportrascount,m_IsSetupRas,m_IsSetupJww;
    NUMBER    isnewversionpdm;
    HWND    hInstance, hwndParent,nHwnd;
    LIST listID,listIDCombox;   
    LIST    listName;        
    NUMBER  nvInfo;
    STRING  svInfo;  
    STRING  svDesc,svModeDesc;
    STRING szTitle;
    STRING szWarningPDMUnistall;
    int corecunt,memerysize;   
    STRING sz_corecunt,sz_memerysize;   
    HWND hwndDlg,hwndcombox,hwndtextras;
 begin 
    szDialogModeName = "UFSetupTypeMode";   
    szTitle=@TITLE_MAIN; 
    issupportrascount=TRUE;
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;   
    memerysize=0;
    corecunt=0;
    svModeDesc="";  
    isnewversionpdm=1; //是否是老版本的pdm
    listID = ListCreate (STRINGLIST);
    if (listID = LIST_NULL) then 
        MessageBox ("Unable to create list.", SEVERE); 
        abort; 
    endif;  
    //获取当前总内存和  当前CPU核数
    UseDLL(ENVCHECK_DLL);
      corecunt=getProcessNumber();
      memerysize=getMemorySize(); 
UnUseDLL(ENVCHECK_DLL);  

NumToStr(sz_corecunt,corecunt);
NumToStr(sz_memerysize,memerysize);

ExFn_WriteLog("实际计算机的CPU核数:",sz_corecunt);
ExFn_WriteLog("可用实际内存最大数:",sz_memerysize);
//判断是否安装过科迈. 
    m_IsSetupRas=IsSetUpRas();

//判断是否安装过金万维。
m_IsSetupJww=IsSetUpJww();
//取窗体的句柄

//添加安装模式...例如: 经典应用模式..
    ListAddString (listID,@ID_STRING2001 , AFTER);
    //ListAddString (listID,@ID_STRING2004 , AFTER);
    //ListAddString (listID,@ID_STRING2005 , AFTER);  //全产品集中应用模式(远程接入含PDM)
    
    
    //U8V13.0去除科迈选项
    //ListAddString (listID,@ID_STRING2002 , AFTER);  
    //ListAddString (listID,@ID_STRING2003 , AFTER); 
    
    ListAddString (listID,@ID_JWW1002 , AFTER); //全产品集中应用模式(金万维远程接入)
    ListAddString (listID,@ID_JWW1003 , AFTER); //客户端集中应用模式(金万维远程接入)
    nResult  = DefineDialog (szDialogModeName, hInstance, szDLLName,
                            RES_SETUPTYPEMODE_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL, 
                            DLG_MSG_STANDARD|DLG_CENTERED);
    
    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.", SEVERE);
        bDone = TRUE;
        abort;
    endif;
    bDone = FALSE;
    repeat 
    nCmdValue = WaitOnDialog(szDialogModeName);
        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT: 
                SetDialogTitle (RES_SETUPTYPEMODE_DLG_ID,@TITLE_MAIN);
            CtrlSetList (szDialogModeName, RES_SETUPTYPEMODE_LIST, listID); 
            CtrlGetCurSel(szDialogModeName, RES_SETUPTYPEMODE_LIST, svSelection); 
            g_svSetupModeType= svSelection;             
            svModeDesc=ExFn_UFGetSetupModeTypeDesc(listID, svSelection, svDesc); 
            CtrlSetText (szDialogModeName, RES_TYPEMODE_DESC_TEXT, svModeDesc);  
            //nHwnd = GetWindowHandle (HWND_INSTALL);  
            nHwnd = CmdGetHwndDlg(szDialogModeName);    
                SdSetDlgTitle(szDialogModeName,nHwnd,szTitle); 
                //SendMessage(hInstance,WM_SETTEXT,0,&szTitle);
                //添加科迈安装客户端的安装个数确认.
                listIDCombox = ListCreate(STRINGLIST); 
                ListAddString(listIDCombox, @ras_setupcountstring1, AFTER); 
                ListAddString(listIDCombox, @ras_setupcountstring2, AFTER);  
                ListAddString(listIDCombox, @ras_setupcountstring5, AFTER); 
                ListAddString(listIDCombox, @ras_setupcountstring10, AFTER); 
                ListAddString(listIDCombox, @ras_setupcountstring15, AFTER);  
                ListAddString(listIDCombox, @ras_setupcountstring20, AFTER);
                CtrlSetList(szDialogModeName, RES_ComboBoxSeletClient_ID, listIDCombox); //sets the values into your combo box where listbox is the id of combo box
                CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);  
                
                hwndcombox=GetDlgItem(nHwnd,40008);
                hwndtextras=GetDlgItem(nHwnd,40007); 
                if(g_svSetupModeType ==@ID_STRING2001) then    
             EnableWindow(hwndcombox,FALSE);
             EnableWindow(hwndtextras,FALSE); 
                endif;  
               /*
                需求:
                1.  增加选择集中部署,安装Ras时支持用户选择大概需要多少人使用远程。下拉选择:1,2,5,10,15,20。
                2.  基本内存计算方式:
                A. 只有客户端与Ras一同安装:(总内存-2GB)/(400MB)  如果超出范围需要提示并不让通过。
                B. 应用服务器与Ras一同安装:(总内存-4GB)/(400MB)  如果超出范围需要提示并不让通过。
                C. 应用服务器数据库服务器与Ras同装:(总内存-3GB-数据库内存)/(400MB)  如果超出范围需要提示并不让通过。 数据库服务器内存按总内存的70%计算。
                D. 1,2个用远程可暂时不判断。
                3.  5人用远程至少4核CPU,10,15至少6核,20以上至少8核CPU
                */      
            case RES_SETUPTYPEMODE_LIST: 
            CtrlGetCurSel(szDialogModeName, RES_SETUPTYPEMODE_LIST, svSelection);   
            g_svSetupModeType= svSelection;
            svModeDesc=ExFn_UFGetSetupModeTypeDesc(listID, svSelection, svDesc); 
            CtrlSetText (szDialogModeName, RES_TYPEMODE_DESC_TEXT, svModeDesc);  
            //全产品集中应用模式(远程接入)
            if(g_svSetupModeType == @ID_STRING2002) then  
            ExFn_WriteLog("安装模式:",@ID_STRING2002);
            issupportrascount=TRUE;  
            EnableWindow(hwndcombox,TRUE);
            EnableWindow(hwndtextras,TRUE);
            if((memerysize-3*1024-400)>0) then 
              //如果核数在4,5核,可以支持5人用远程    
              if(corecunt>3&&corecunt<6)   then 
                ExFn_WriteLog("yyyyyyyyyy:","1");
                if((memerysize-3*1024-5*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                  ExFn_WriteLog("最佳配置数:",@ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                  ExFn_WriteLog("最佳配置数:",@ras_setupcountstring2);
                endif; 
               
              //如果核数在6,7核,可以支持10,15人用远程   
              elseif (corecunt>5&&corecunt<8) then
                if((memerysize-3*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-3*1024-15*400)<0&&(memerysize-3*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-3*1024-10*400)<0&&(memerysize-3*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
              
              //如果核数在8核以上,可以支持20人以上用远程  
              elseif (corecunt>7) then
                if((memerysize-3*1024-20*400)>0)  then
                 CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring20); 
                elseif((memerysize-3*1024-20*400)<0&&(memerysize-3*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-3*1024-15*400)<0&&(memerysize-3*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-3*1024-10*400)<0&&(memerysize-3*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
                
              else
                CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);  
              endif;  
            //如果实际内存小于3GB*1024 +400MB 只能实现 1,2个用远程
                 else 
                     CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2); 
                 endif; 
                 
 /
               //全产品集中应用模式(金万维远程接入)
               elseif(g_svSetupModeType == @ID_JWW1002) then  
            ExFn_WriteLog("安装模式:",@ID_JWW1002);
            issupportrascount=TRUE;  
            EnableWindow(hwndcombox,TRUE);
            EnableWindow(hwndtextras,TRUE);
            if((memerysize-3*1024-400)>0) then 
              //如果核数在4,5核,可以支持5人用远程    
              if(corecunt>3&&corecunt<6)   then 
                ExFn_WriteLog("yyyyyyyyyy:","1");
                if((memerysize-3*1024-5*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                  ExFn_WriteLog("最佳配置数:",@ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                  ExFn_WriteLog("最佳配置数:",@ras_setupcountstring2);
                endif; 
               
              //如果核数在6,7核,可以支持10,15人用远程   
              elseif (corecunt>5&&corecunt<8) then
                if((memerysize-3*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-3*1024-15*400)<0&&(memerysize-3*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-3*1024-10*400)<0&&(memerysize-3*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
              
              //如果核数在8核以上,可以支持20人以上用远程  
              elseif (corecunt>7) then
                if((memerysize-3*1024-20*400)>0)  then
                 CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring20); 
                elseif((memerysize-3*1024-20*400)<0&&(memerysize-3*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-3*1024-15*400)<0&&(memerysize-3*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-3*1024-10*400)<0&&(memerysize-3*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
                
              else
                CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);  
              endif;  
            //如果实际内存小于3GB*1024 +400MB 只能实现 1,2个用远程
                 else 
                     CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2); 
                 endif; 


 
              //全产品集中应用模式(远程接入含PDM)
              //u8v12.5版本删除PLM 
              /*
            elseif(g_svSetupModeType == @ID_STRING2005) then  
            issupportrascount=TRUE;  
            EnableWindow(hwndcombox,TRUE);
            EnableWindow(hwndtextras,TRUE);
            if((memerysize-3*1024-400)>0) then 
             
              //如果核数在4,5核,可以支持5人用远程    
              if(corecunt>3&&corecunt<6)   then 
                if((memerysize-3*1024-5*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif; 
               
              //如果核数在6,7核,可以支持10,15人用远程   
              elseif (corecunt>5&&corecunt<8) then
                if((memerysize-3*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-3*1024-15*400)<0&&(memerysize-3*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-3*1024-10*400)<0&&(memerysize-3*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
              
              //如果核数在8核以上,可以支持20人以上用远程  
              elseif (corecunt>7) then
                if((memerysize-3*1024-20*400)>0)  then
                 CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring20); 
                elseif((memerysize-3*1024-20*400)<0&&(memerysize-3*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-3*1024-15*400)<0&&(memerysize-3*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-3*1024-10*400)<0&&(memerysize-3*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
                
              else
                CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);  
              endif;  
            //如果实际内存小于3GB*1024 +400MB 只能实现 1,2个用远程
                 else 
                     CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2); 
                 endif;  
                 
                 */
                  
                //客户端集中应用模式(金万维远程接入)
                elseif(g_svSetupModeType ==@ID_JWW1003) then 
                 issupportrascount=TRUE;
                 EnableWindow(hwndcombox,TRUE);
            EnableWindow(hwndtextras,TRUE); 
                  if((memerysize-2*1024-400)>0) then 
              //如果核数在4,5核,可以支持5人用远程    
              if(corecunt>3&&corecunt<6)   then 
                if((memerysize-2*1024-5*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif; 
               
              //如果核数在6,7核,可以支持10,15人用远程   
              elseif (corecunt>5&&corecunt<8) then
                if((memerysize-2*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-2*1024-15*400)<0&&(memerysize-2*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-2*1024-10*400)<0&&(memerysize-2*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
              
              //如果核数在8核以上,可以支持20人以上用远程  
              elseif (corecunt>7) then
                if((memerysize-2*1024-20*400)>0)  then
                 CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring20); 
                elseif((memerysize-2*1024-20*400)<0&&(memerysize-2*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-2*1024-15*400)<0&&(memerysize-2*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-2*1024-10*400)<0&&(memerysize-2*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
                
              else
                CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);  
              endif;  
            //如果实际内存小于3GB*1024 +400MB 只能实现 1,2个用远程
                 else
                    CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2); 
                     
                 endif;                  
 //                 
                //客户端集中应用模式(远程接入)
                elseif(g_svSetupModeType ==@ID_STRING2003) then 
                 issupportrascount=TRUE;
                 EnableWindow(hwndcombox,TRUE);
            EnableWindow(hwndtextras,TRUE); 
                  if((memerysize-2*1024-400)>0) then 
              //如果核数在4,5核,可以支持5人用远程    
              if(corecunt>3&&corecunt<6)   then 
                if((memerysize-2*1024-5*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif; 
               
              //如果核数在6,7核,可以支持10,15人用远程   
              elseif (corecunt>5&&corecunt<8) then
                if((memerysize-2*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-2*1024-15*400)<0&&(memerysize-2*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-2*1024-10*400)<0&&(memerysize-2*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
              
              //如果核数在8核以上,可以支持20人以上用远程  
              elseif (corecunt>7) then
                if((memerysize-2*1024-20*400)>0)  then
                 CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring20); 
                elseif((memerysize-2*1024-20*400)<0&&(memerysize-2*1024-15*400)>0) then 
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring15);  
                elseif ((memerysize-2*1024-15*400)<0&&(memerysize-2*1024-10*400)>0) then  
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring10);
                elseif ((memerysize-2*1024-10*400)<0&&(memerysize-2*1024-5*400)>0)  then
                   CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring5);
                else
                  CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);
                endif;
                
              else
                CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2);  
              endif;  
            //如果实际内存小于3GB*1024 +400MB 只能实现 1,2个用远程
                 else
                 
                    CtrlSetCurSel (szDialogModeName, RES_ComboBoxSeletClient_ID, @ras_setupcountstring2); 
                     
                 endif; 
                //其它应用模式... 
                else 
                    EnableWindow(hwndcombox,FALSE);
               EnableWindow(hwndtextras,FALSE);  
                endif;  
            case RES_ComboBoxSeletClient_ID:
                 CtrlGetCurSel(szDialogModeName, RES_ComboBoxSeletClient_ID, svcomboxSelection);  
                 if(svcomboxSelection=="20") then 
                   issupportrascount=ExFn_CacaulateRasCount(g_svSetupModeType, svcomboxSelection,corecunt,memerysize);   
                 elseif(svcomboxSelection=="15") then    
                   issupportrascount=ExFn_CacaulateRasCount(g_svSetupModeType, svcomboxSelection,corecunt,memerysize);
                 elseif(svcomboxSelection=="10") then 
                   issupportrascount=ExFn_CacaulateRasCount(g_svSetupModeType, svcomboxSelection,corecunt,memerysize);
                 elseif(svcomboxSelection=="5") then
                   issupportrascount=ExFn_CacaulateRasCount(g_svSetupModeType, svcomboxSelection,corecunt,memerysize);
                 else 
                   issupportrascount=TRUE;  
                               
                 endif;
            case RES_PBUT_CANCEL:  
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
            bDone = TRUE; 
            //if(g_svSetupModeType !=@ID_STRING2001&&g_svSetupModeType !=@ID_STRING2004)  then
            u8v12.5版本删除PLM  
            if(g_svSetupModeType !=@ID_STRING2001)  then
            //如果安装过科迈,就不能安装金万维;如果安装过金万维,就不能安装科迈
            //选择安装科迈
            if(g_svSetupModeType ==@ID_STRING2002||g_svSetupModeType ==@ID_STRING2003)  then
               //如果安装了科迈提示安装过科迈
               if(m_IsSetupRas==TRUE) then 
                 bDone = FALSE;   
                 SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
                 MessageBox(@ID_Rasissetup,INFORMATION); 
               endif;
               //如果安装了金万维提示安装过金万维,不能继续安装科迈
               if(m_IsSetupJww==TRUE) then 
                 bDone = FALSE;   
                 SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
                 MessageBox(@ID_JWWissetupForRAS,INFORMATION); 
               endif;               
            endif; 
             
            //选择安装金万维
            if(g_svSetupModeType ==@ID_JWW1002||g_svSetupModeType ==@ID_JWW1003)  then
                 if(m_IsSetupJww==TRUE) then 
                   bDone = FALSE;   
                   SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
                   MessageBox(@ID_JWWissetup,INFORMATION); 
                 endif;  
                 //如果科迈安装过,提示不能安装金万维
                 if(m_IsSetupRas==TRUE) then 
                 bDone = FALSE;   
                 SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);
                 MessageBox(@ID_RasissetupForJww,INFORMATION); 
               endif;
            endif; 
            endif;
           
            if(bDone==TRUE) then
             //下一步不检测了.直接的通过,即使不符合安装的个数.
             issupportrascount=TRUE;
             if((issupportrascount==FALSE)&&(g_svSetupModeType !=@ID_STRING2001))  then
               bDone = FALSE;
               SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
               MessageBox(@ID_RasupportNext,INFORMATION);
             else
               bDone = TRUE;  
             endif; 
            endif;
                ///
                        // 全产品集中应用模式(远程接入)
                        if(g_svSetupModeType ==@ID_STRING2002)  then   
                            g_bSetupmodeleSelected=TRUE;
                            FeatureSelectItem (MEDIA, "RAS", g_bSetupmodeleSelected);  
                            g_bSetupPDMSelected=FALSE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif; 
                        // 全产品集中应用模式(金万维远程接入)
                        if(g_svSetupModeType ==@ID_JWW1002)  then   
                            g_bSetupmodeleSelected=TRUE;
                            FeatureSelectItem (MEDIA, "JWW", g_bSetupmodeleSelected);  
                            g_bSetupPDMSelected=FALSE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif; 
                        /*
                        // 全产品集中应用模式(远程接入含PDM) 
                        u8v12.5版本删除PLM 
                        if(g_svSetupModeType ==@ID_STRING2005)  then   
                            g_bSetupmodeleSelected=TRUE;
                            FeatureSelectItem (MEDIA, "RAS", g_bSetupmodeleSelected);  
                            g_bSetupPDMSelected=TRUE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif; 
                        */
                        //客户端集中应用模式(远程接入) 
                        if(g_svSetupModeType ==@ID_STRING2003)  then    
                            g_bSetupmodeleSelected=TRUE;
                            FeatureSelectItem (MEDIA, "RAS", g_bSetupmodeleSelected);  
                            g_bSetupPDMSelected=FALSE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif; 
                        //客户端集中应用模式(金万维远程接入)
                        if(g_svSetupModeType ==@ID_JWW1003)  then    
                            g_bSetupmodeleSelected=TRUE;
                            FeatureSelectItem (MEDIA, "JWW", g_bSetupmodeleSelected);  
                            g_bSetupPDMSelected=FALSE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif;                         
                        //经典应用模式
                        if(g_svSetupModeType ==@ID_STRING2001)  then   
                            g_bSetupmodeleSelected=FALSE;
                            FeatureSelectItem (MEDIA, "RAS", g_bSetupmodeleSelected); 
                            g_bSetupPDMSelected=FALSE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif;
                        /* //u8v12.5版本删除PLM 
                        //经典应用模式(含PDM)
                        if(g_svSetupModeType ==@ID_STRING2004)  then   
                            g_bSetupmodeleSelected=FALSE;
                            FeatureSelectItem (MEDIA, "RAS", g_bSetupmodeleSelected); 
                            g_bSetupPDMSelected=TRUE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                        endif;
                        */
                        /* //u8v12.5版本删除PLM 
                        //如果选择了PDM并PDM已经安装而且是版本比较低的.提示卸载老的版本才允许继续安装.
                        if FeatureIsItemSelected(MEDIA,"PDM")=1 then
                            isnewversionpdm=CompareIsOlderPDMVersion();
                            if(isnewversionpdm=2) then //同版本的不选择PDM再继续安装.
                            g_bSetupPDMSelected=FALSE;
                            //提示客户 系统已安装PDM Professional V7.6版本,本次安装将不再安装PDM软件。 
                            MessageBox(@ID_PDMISinstallED, MB_OK);
                            
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected); 
                            elseif(isnewversionpdm=1) then //没有安装过..
                            g_bSetupPDMSelected=TRUE;
                            FeatureSelectItem (MEDIA, "PDM", g_bSetupPDMSelected);  
                            else //低版本的提示卸载...
                            szWarningPDMUnistall=@ID_PdmUnistallVersionWaring;
                            numberpdm = MessageBox(szWarningPDMUnistall, MB_RETRYCANCEL);
            
                            if (numberpdm == IDRETRY) then
                                isnewversionpdm=CompareIsOlderPDMVersion();
                                while(isnewversionpdm=3&&numberpdm!=IDCANCEL)
                                    numberpdm=MessageBox(szWarningPDMUnistall, MB_RETRYCANCEL);
                                    if (numberpdm == IDRETRY) then
                                    isnewversionpdm=CompareIsOlderPDMVersion();
                                    else
                                      bDone = FALSE;
                                    endif;
                                endwhile;
                            else
                                bDone = FALSE;
                            endif;
                            endif;
                        endif;
                        */
                //            
           
            case RES_PBUT_BACK:      
            nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;
    until bDone;   


    if  nCmdValue = RES_PBUT_NEXT then    
        
    endif;
    
    //SendMessage(nHwnd,WM_SETTEXT,0,&szTitle);
    
    EndDialog (szDialogModeName);
    ReleaseDialog (szDialogModeName);        
    svResult = g_svSetupModeType;
return nResult;
 end;     
 
 
 
//安装类型选择
function ExFn_UFSetupType(hMSI, svResult)
    STRING  szDialogName, szDLLName, szDialog;
    NUMBER  nDialog, nResult, nCmdValue;
    BOOL    bDone;
    HWND    hInstance, hwndParent;
    LIST listID;   
    LIST    listName;      
    STRING  svSetupType;   
    NUMBER  nvInfo;
    STRING  svInfo;  
    STRING  svDesc;
begin 
    SetTitle (@TITLE_MAIN, 0, BACKGROUNDCAPTION);
    szDialogName = "UFSetupType";
    hInstance = 0;
    szDLLName = "";
    szDialog = "";
    hwndParent = 0;   
    g_svSetupType="";    
    listID = ListCreate ( STRINGLIST ); 
           
    if (FeatureSetupTypeEnum( MEDIA, listID) < 0 ) then
        MessageBox ("FeatureSetupTypeEnum failed.", WARNING);
    endif;           

    nResult = ListGetFirstString (listID, svSetupType);


    listName = ListCreate(STRINGLIST);


while (nResult != END_OF_LIST)
FeatureSetupTypeGetData (MEDIA, svSetupType, 
SETUPTYPE_INFO_DISPLAYNAME, nvInfo, svInfo );
        ListAddString(listName,svInfo,AFTER);
        nResult = ListGetNextString (listID, svSetupType);
    endwhile;


    
    
    nResult  = DefineDialog (szDialogName, hInstance, szDLLName,
                            RES_SETUPTYPE_DLG_ID, szDialog, hwndParent,
                            HWND_INSTALL, 
DLG_MSG_STANDARD|DLG_CENTERED);
    
    if (nResult < 0) then
        MessageBox ("An error occurred while defining the dialog box.", 
SEVERE);
        bDone = TRUE;
        abort;
    endif;


   bDone = FALSE;


   repeat


        nCmdValue = WaitOnDialog(szDialogName);


        switch (nCmdValue)
            case DLG_CLOSE:
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT:   
            CtrlSetList (szDialogName, RES_SETUPTYPE_LIST, listName); 
            CtrlGetCurSel(szDialogName, RES_SETUPTYPE_LIST, svInfo);
            ExFn_UFGetSetupTypeDesc(listID, svInfo, svDesc); 
            CtrlSetText (szDialogName, RES_TYPE_DESC_TEXT, svDesc);   
                g_bCnSelected = TRUE;
            if g_bCnSelected then
            CtrlSetState(szDialogName, RES_ZH_CN_CHECK, BUTTON_CHECKED);
            else
            CtrlSetState(szDialogName, RES_ZH_CN_CHECK, BUTTON_UNCHECKED);
            endif;
            Disable(RES_ZH_CN_CHECK);
           
            if g_bTwSelected then
            CtrlSetState(szDialogName, RES_ZH_TW_CHECK, BUTTON_CHECKED);
            else
            CtrlSetState(szDialogName, RES_ZH_TW_CHECK, BUTTON_UNCHECKED);
            endif;
           
            if g_bEnSelected then
            CtrlSetState(szDialogName, RES_EN_US_CHECK, BUTTON_CHECKED);
            else
            CtrlSetState(szDialogName, RES_EN_US_CHECK, BUTTON_UNCHECKED);
            endif;    
           
            case RES_SETUPTYPE_LIST: 
            CtrlGetCurSel(szDialogName, RES_SETUPTYPE_LIST, svInfo);
            ExFn_UFGetSetupTypeDesc(listID, svInfo, svDesc); 
            CtrlSetText (szDialogName, RES_TYPE_DESC_TEXT, svDesc);    
case RES_ZH_CN_CHECK: ;
case RES_ZH_TW_CHECK: ;
case RES_EN_US_CHECK: ;
            case RES_PBUT_CANCEL:   
                Do (EXIT);
            case RES_PBUT_NEXT:
            nResult = RES_PBUT_NEXT;
                bDone = TRUE;
            case RES_PBUT_BACK:      
            nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;


    until bDone;     
    
    if  nCmdValue = RES_PBUT_NEXT then   
    if CtrlGetState(szDialogName, RES_ZH_CN_CHECK) = BUTTON_CHECKED then
g_bCnSelected = TRUE;
else
g_bCnSelected = FALSE;
    endif;    
   
    if CtrlGetState(szDialogName, RES_ZH_TW_CHECK) = BUTTON_CHECKED then
g_bTwSelected = TRUE;
else
g_bTwSelected = FALSE;
    endif; 


    if CtrlGetState(szDialogName, RES_EN_US_CHECK) = BUTTON_CHECKED then
g_bEnSelected = TRUE;
else
g_bEnSelected = FALSE;
    endif; 
   
    FeatureSelectItem (MEDIA, "Resource\\ZH_CN", g_bCnSelected); 
    FeatureSelectItem (MEDIA, "Resource\\ZH_TW", g_bTwSelected); 
    FeatureSelectItem (MEDIA, "Resource\\EN_US", g_bEnSelected);  
    FeatureSelectItem (MEDIA, "Resource\\ResCommon", TRUE); 
    /*
        //经典应用模式(含PDM)
        if(g_installmode=@ID_STRING2004) then 
           FeatureSelectItem (MEDIA, "PDM", TRUE); 
           ExFn_WriteLog("选择了PDM","PDM");
        endif;
        */
   
if g_bCnSelected then
ExFn_SetReg("zh-cn", "简体中文");
else
ExFn_DelReg("zh-cn");
endif;      


if g_bTwSelected then
ExFn_SetReg("zh-tw", "繁体中文");
else
ExFn_DelReg("zh-tw");
endif;      


if g_bEnSelected then
ExFn_SetReg("en-us", "英文");
else
ExFn_DelReg("en-us");
endif;      
   
    endif;


    EndDialog (szDialogName);
    ReleaseDialog (szDialogName);        
    svResult = g_svSetupType;
return nResult;

end; 




//获取应用模式描述信息
function string ExFn_UFGetSetupModeTypeDesc(listID, svDisplay, svDesc)
NUMBER nResult;
STRING svSetupModeType;    
STRING svInfo;    
NUMBER nvInfo;
begin
    svDesc = "";
    nResult = ListGetFirstString (listID, svSetupModeType);
while (nResult != END_OF_LIST)
if svDisplay ==@ID_STRING2001  then  
svDesc = @ID_STRING2011; 
elseif svDisplay ==@ID_STRING2002  then  
   svDesc = @ID_STRING2012;    
elseif svDisplay ==@ID_STRING2003  then
svDesc = @ID_STRING2013;
elseif svDisplay ==@ID_JWW1002  then  //全产品集中应用模式(金万维远程接入)
svDesc = @ID_JWW1012;
elseif svDisplay ==@ID_JWW1003  then  //客户端集中应用模式(金万维远程接入)
svDesc = @ID_JWW1013;
/*
elseif svDisplay ==@ID_STRING2004  then
svDesc = @ID_STRING2014;  
elseif svDisplay ==@ID_STRING2005  then
svDesc = @ID_STRING2015; 
*/
endif;
        nResult = ListGetNextString (listID, svSetupModeType);
    endwhile;  
    return   svDesc;
end;




//获取描述信息
function ExFn_UFGetSetupTypeDesc(listID, svDisplay, svDesc)
NUMBER nResult;
STRING svSetupType;    
STRING svInfo;    
NUMBER nvInfo;
begin
    svDesc = "";
    nResult = ListGetFirstString (listID, svSetupType);
while (nResult != END_OF_LIST)
FeatureSetupTypeGetData (MEDIA, svSetupType, 
SETUPTYPE_INFO_DISPLAYNAME, nvInfo, svInfo );  
if svInfo == svDisplay then
FeatureSetupTypeGetData (MEDIA, svSetupType, 
SETUPTYPE_INFO_DESCRIPTION, nvInfo, svDesc);  
FeatureSetupTypeSet(MEDIA, svSetupType);
// MessageBox(SETUPTYPE,INFORMATION);    
g_svSetupType = svSetupType;
return 0;
endif;
        nResult = ListGetNextString (listID, svSetupType);
    endwhile;  
end; 




//计算支持的多少人远程的个数
//获取描述信息
function BOOL  ExFn_CacaulateRasCount(m_svSetupModeType, m_svcomboxSelection,corecunt,memerysize)    
BOOL issupport;
begin   
     issupport=TRUE;
    //全产品集中应用模式(远程接入含PDM) 
    //u8v12.5版本删除PLM 
    /*
    if(m_svSetupModeType ==@ID_STRING2005)  then   
        if(m_svcomboxSelection=="20") then 
          if((corecunt<7)||(memerysize-3*1024-20*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="15") then 
          if((corecunt<6)||(memerysize-3*1024-15*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="10") then 
          if((corecunt<6)||(memerysize-3*1024-10*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="5") then 
          if((corecunt<4)||(memerysize-3*1024-5*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;                        
     endif;    
     */  
     // 全产品集中应用模式(远程接入)  
     if(m_svSetupModeType ==@ID_STRING2002)  then   
        if(m_svcomboxSelection=="20") then 
          if((corecunt<7)||(memerysize-3*1024-20*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="15") then 
          if((corecunt<6)||(memerysize-3*1024-15*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="10") then 
          if((corecunt<6)||(memerysize-3*1024-10*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="5") then 
          if((corecunt<4)||(memerysize-3*1024-5*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;                        
     endif;
//      
     //全产品集中应用模式(金万维远程接入)
    if(m_svSetupModeType ==@ID_JWW1002)  then   
        if(m_svcomboxSelection=="20") then 
          if((corecunt<7)||(memerysize-3*1024-20*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="15") then 
          if((corecunt<6)||(memerysize-3*1024-15*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="10") then 
          if((corecunt<6)||(memerysize-3*1024-10*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="5") then 
          if((corecunt<4)||(memerysize-3*1024-5*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;                        
     endif; 
    
     //客户端集中应用模式(金万维远程接入)
     if(m_svSetupModeType ==@ID_JWW1003)  then
      if(m_svcomboxSelection=="20") then 
          if((corecunt<7)||(memerysize-2*1024-20*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="15") then 
          if((corecunt<6)||(memerysize-2*1024-15*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="10") then 
          if((corecunt<6)||(memerysize-2*1024-10*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="5") then 
          if((corecunt<4)||(memerysize-2*1024-5*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif; 
     endif;  

     //客户端集中应用模式(远程接入) 
     if(m_svSetupModeType ==@ID_STRING2003)  then
      if(m_svcomboxSelection=="20") then 
          if((corecunt<7)||(memerysize-2*1024-20*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="15") then 
          if((corecunt<6)||(memerysize-2*1024-15*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="10") then 
          if((corecunt<6)||(memerysize-2*1024-10*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif;
        if(m_svcomboxSelection=="5") then 
          if((corecunt<4)||(memerysize-2*1024-5*400)<0) then
             issupport=FALSE; 
             SetDialogTitle (DLG_MSG_INFORMATION, @TITLE_MAIN);   
             MessageBox(@ID_Raserrorcount,INFORMATION);
          endif;
        endif; 
     endif;   
    return issupport;     
end;



SmartClientTip.rul 源码

//===========================================================================
//
//  File Name:    SmartClientTip.rul
//   
// Author:  lilf
//
//  Description:  智能安装提示界面
//
//  Comments:     用于指定对应的应用服务器和IIS端口。
//
//===========================================================================




#include "Ifx.h"




function NUMBER ExFn_SmartClientDialog(szTitle)
    STRING  szDialogName, szDLLName, szDialog,szAppIISWebPort,szgetAppaddress,info,szurl;
    NUMBER  nDialog, nResult, nCmdValue,nappiisWebPort,nExitCode;
    BOOL    bDone,m_isconnectAppserver;
    HWND    hInstance, hwndParent, hwndDlg;
begin
    szDialogName = "SmartClientTip";
    nResult = EzDefineDialog (szDialogName, "", "", RES_DLG_ID_SmartClient);
    if (nResult < 0) then
        MessageBox ("Error in defining dialog", SEVERE);
        abort;
    endif;
    // Initialize the indicator used to control the while loop.
    bDone = FALSE;
    // Loop until done.
    repeat
        DoStart:
        // Display the dialog and return the next dialog event.
        nCmdValue = WaitOnDialog(szDialogName);
        // Respond to the event.
        switch (nCmdValue)
            case DLG_CLOSE:
                // The user clicked the window's Close button.
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT:
                hwndDlg = CmdGetHwndDlg(szDialogName);
                SdGeneralInit(szDialogName, hwndDlg, 0, "");
                SetDialogTitle(RES_DLG_ID_SmartClient,@TITLE_MAIN);
                SdSetDlgTitle(szDialogName,hwndDlg,@TITLE_MAIN);
            case RES_PBUT_CANCEL:
                // The user clicked the Cancel button.
                Do (EXIT);
            case RES_PBUT_NEXT:
                bDone = TRUE;
            case RES_PBUT_Try:
CtrlGetText(szDialogName,RES_TEXT_U8AppIISPort,szAppIISWebPort);   
if (StrToNum(nappiisWebPort,szAppIISWebPort) < 0) then   
            LoadStringFromStringTable("smartclienttext6666", info );
            MessageBox (info, SEVERE);
            goto DoStart;            
            endif; 
            //如果没有输入端口,给出提示.
            if (szAppIISWebPort="") then   
            LoadStringFromStringTable("smartclienttext6666", info );
            MessageBox (info, SEVERE);
            goto DoStart;            
            endif; 
       //取终端服务端口,即是输入的服务端口.   
       CtrlGetText(szDialogName,RES_TEXT_U8AppAdress,szgetAppaddress);
       if (szgetAppaddress="") then   
            LoadStringFromStringTable("smartclienttext7777", info );
            MessageBox (info, SEVERE);
            goto DoStart;            
            endif;  
             
            UseDLL(ENVCHECK_DLL);
          m_isconnectAppserver=SmartClientPortCheck(szgetAppaddress,szAppIISWebPort);
          if(m_isconnectAppserver=FALSE) then
            
            goto DoStart;  
          endif;
       UnUseDLL(ENVCHECK_DLL);
                       
            //打开WEB服务
            UseDLL("Shell32.dll");
                  szurl="http://"+szgetAppaddress+":"+szAppIISWebPort+"//u8sl";
                  nExitCode = Shell32.ShellExecuteA(NULL, "open","IEXPLORE.EXE", szurl,0,SW_SHOWMAXIMIZED);
                UnUseDLL("Shell32.dll");
                if nExitCode < 32 then
                  MessageBox(@smartclienttext8888, SEVERE);
                endif;


            case RES_PBUT_BACK:
                nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;
    until bDone;
    // Close the dialog.
    EndDialog (szDialogName);
    // Free the dialog from memory.
    ReleaseDialog (szDialogName);
    return nResult;
end;



SmartClientTraditionSmartClientTip.rul 源码

//===========================================================================
//
//  File Name:    SmartClientTraditionSmartClientTip.rul
//   
// Author:  lilf
//
//  Description:  智能安装提示界面
//
//  Comments:     打开智能客户端和继续安装
//
//===========================================================================




#include "Ifx.h"




function NUMBER ExFn_SmartTraditionClientDialog(szTitle)
    STRING  szDialogName, szDLLName, szDialog,szAppIISWebPort,szgetAppaddress,info,szsmartclientexe,szinstallarg;
    NUMBER  nDialog, nResult, nCmdValue,nappiisWebPort,nExitCode;
    BOOL    bDone,m_isconnectAppserver;
    HWND    hInstance, hwndParent, hwndDlg,nHwndialogNext;
begin
    szDialogName = "SmartTraditionClientTip";
    nResult = EzDefineDialog (szDialogName, "", "", RES_DLG_ID_SmartTraditionClient);
    if (nResult < 0) then
        MessageBox ("Error in defining dialog", SEVERE);
        abort;
    endif;
    // Initialize the indicator used to control the while loop.
    bDone = FALSE;
    // Loop until done.
    repeat
        DoStart:
        // Display the dialog and return the next dialog event.
        nCmdValue = WaitOnDialog(szDialogName);
        // Respond to the event.
        switch (nCmdValue)
            case DLG_CLOSE:
                // The user clicked the window's Close button.
                Do (EXIT);
            case DLG_ERR:
                MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
                abort;
            case DLG_INIT:
                SdGeneralInit(szDialogName, hwndDlg, 0, "");
                hwndDlg = CmdGetHwndDlg(szDialogName);
                nHwndialogNext=GetDlgItem(hwndDlg,1);
                CtrlSetState (szDialogName, RES_PBUT_checkbox_smartcleint, BUTTON_UNCHECKED);
                CtrlSetState (szDialogName, RES_PBUT_checkbox_Traditionclient, BUTTON_UNCHECKED);
                SetDialogTitle(RES_DLG_ID_SmartTraditionClient,@TITLE_MAIN);
                SdSetDlgTitle(szDialogName,hwndDlg,@TITLE_MAIN);
                EnableWindow(nHwndialogNext,FALSE);
                 //Disable (NEXTBUTTON);
            case RES_PBUT_CANCEL:
                // The user clicked the Cancel button.
                Do (EXIT);
            case RES_PBUT_NEXT:
                //如果都没选择,设置下一步按钮为灰的
                if (CtrlGetState (szDialogName, RES_PBUT_checkbox_smartcleint) = BUTTON_UNCHECKED) then
                   if (CtrlGetState (szDialogName, RES_PBUT_checkbox_Traditionclient) = BUTTON_UNCHECKED) then
                      hwndDlg = CmdGetHwndDlg(szDialogName);
                      nHwndialogNext=GetDlgItem(hwndDlg,1);
                      //Enable(NEXTBUTTON);
                      EnableWindow(nHwndialogNext,FALSE);
                      MessageBox(@smarttraditionclient1, SEVERE);
                      goto DoStart;
                   endif;
                endif;
            //打开智能安装和继续
                if (CtrlGetState (szDialogName, RES_PBUT_checkbox_smartcleint) = BUTTON_CHECKED) then
                  szinstallarg="/SRC:InstallShiled /"+TARGETDIR;
                  ExFn_WriteLog("szinstallarg______:",szinstallarg); 
             UseDLL("Shell32.dll");
                    szsmartclientexe=SUPPORTDIR^"setupsmartclient.exe";
                    //nExitCode = Shell32.ShellExecuteA(NULL, "open",szsmartclientexe, "",0,SW_SHOWNORMAL);
                    nExitCode = Shell32.ShellExecuteA(NULL, "open",szsmartclientexe, szinstallarg,0,SW_SHOWNORMAL);
                  UnUseDLL("Shell32.dll");
                  bDone = FALSE;
                  if nExitCode < 32 then
                  MessageBox(@smarttraditionclient2, SEVERE);
                  else
                    //exit;
                    goto DoStart;
                  endif;
                endif;
                //如果传统客户端被选择
                if (CtrlGetState (szDialogName, RES_PBUT_checkbox_Traditionclient) = BUTTON_CHECKED) then
                  //删除智能客户端的程序
                    UseDLL(ENVCHECK_DLL);
                        RunNoBlock("CMD /C taskkill /F /IM setupsmartclient.exe");
                        RunNoBlock("CMD /C taskkill /F /IM setupsmartclient.exe");
                     UnUseDLL(ENVCHECK_DLL);
                  bDone = TRUE;
                endif;
                //bDone = TRUE;
            case RES_PBUT_checkbox_smartcleint:
                 if (CtrlGetState (szDialogName, RES_PBUT_checkbox_smartcleint) = BUTTON_CHECKED) then
                   CtrlSetState (szDialogName, RES_PBUT_checkbox_Traditionclient, BUTTON_UNCHECKED);
                   nHwndialogNext=GetDlgItem(hwndDlg,1);
                   EnableWindow(nHwndialogNext,TRUE); 
                  endif; 
                   //如果都没选择,设置下一步按钮为灰的
                   if (CtrlGetState (szDialogName, RES_PBUT_checkbox_smartcleint) = BUTTON_UNCHECKED) then
                      if (CtrlGetState (szDialogName, RES_PBUT_checkbox_Traditionclient) = BUTTON_UNCHECKED) then
                         hwndDlg = CmdGetHwndDlg(szDialogName);
                         nHwndialogNext=GetDlgItem(hwndDlg,1);
                         //Enable(NEXTBUTTON);
                         EnableWindow(nHwndialogNext,FALSE);
                      endif;
                   endif;
                   //Enable(NEXTBUTTON);
            case RES_PBUT_checkbox_Traditionclient:
                 if (CtrlGetState (szDialogName, RES_PBUT_checkbox_Traditionclient) = BUTTON_CHECKED) then
                   CtrlSetState (szDialogName, RES_PBUT_checkbox_smartcleint, BUTTON_UNCHECKED);
                   nHwndialogNext=GetDlgItem(hwndDlg,1);
                   EnableWindow(nHwndialogNext,TRUE); 
                  endif; 
                   //Enable(NEXTBUTTON);
                   //如果都没选择,设置下一步按钮为灰的
                    if (CtrlGetState (szDialogName, RES_PBUT_checkbox_smartcleint) = BUTTON_UNCHECKED) then
                      if (CtrlGetState (szDialogName, RES_PBUT_checkbox_Traditionclient) = BUTTON_UNCHECKED) then
                         hwndDlg = CmdGetHwndDlg(szDialogName);
                         nHwndialogNext=GetDlgItem(hwndDlg,1);
                         //Enable(NEXTBUTTON);
                         EnableWindow(nHwndialogNext,FALSE);
                      endif;
                   endif;
            case RES_PBUT_BACK:
                nResult = RES_PBUT_BACK;
                bDone = TRUE;
        endswitch;
    until bDone;
    // Close the dialog.
    EndDialog (szDialogName);
    // Free the dialog from memory.
    ReleaseDialog (szDialogName);
    return nResult;
end;




uninstallcost.rul 源码

function void ExFn_FeatureUninstallCost()
begin
FeatureAddUninstallCost(MEDIA, "Dependence",25600,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client",0,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Client\\OA",0,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Client\\OA\\WorkBench",3101,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\UAP",2987,FEATURE_OPCOST_UNINSTALL_FILE); 
FeatureAddUninstallCost(MEDIA, "Client\\iSD",20000000,FEATURE_OPCOST_UNINSTALL_FILE);   
FeatureAddUninstallCost(MEDIA, "Client\\PDMInterfacePlug",7098368,FEATURE_OPCOST_UNINSTALL_FILE); 
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\PersonnelContract",1146,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\PersonnelManagement",1334,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\TrainingManagement",1664,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\宿舍管理",804,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\RecruitmentManagement",1969,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\BenefitsManagement",1075,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\PerformanceManagement",1862,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\AttendanceManagement",2428,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\SalaryManagement",6302,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\HumanResources\\PieceworkWage",1374,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\EAIntergration",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\EnterprisePortal",216425996,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct",0,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\GSP质量管理",932,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\ExportManagement",4336,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\ContractManagement",2163,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\SalesManagement",1021,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\OutsourceManagement",1937,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\InventoryAccounting",8594,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\InventoryManagement",6613,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\QualityManagement",4921,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\ImportManagement",1448,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\ProcurementManagement",4465,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GXLProduct\\XSGLManagement",3648,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\DecisionManagement",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\DecisionManagement\\FinancialAnalysis",4711,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\CustomerRelationshipManagement",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\CustomerRelationshipManagement\\CustomerRelationshipManagement",3994,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\CustomerRelationshipManagement\\服务管理",402,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManufactureProduct",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManufactureProduct\\ProcessUutsourcing",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManufactureProduct\\MMClient",7450,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManufactureProduct\\EquipmentManagement",6302,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManagementAccount",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManagementAccount\\CostManagement",3881,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManagementAccount\\MoneyManagement",2815,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\ManagementAccount\\ProjectManagement",2991,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\UFOReport",15591,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\公司对账",410,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\CashierManagement",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\FixedAssets",2321,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\PayableManagement",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\ReceivablesManagement",7257,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\GeneralLedger",22826,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\现金流量表",6315,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\FinacialAccount\\OnlineBank",2486,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GroupApplications",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GroupApplications\\SettlementCenter",5114,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GroupApplications\\HYReport",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Client\\GroupApplications\\GroupFinancial",4349,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\DataServer",92351,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer",0,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\OA服务器",8948,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\WEBApp",11209,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\WebPortal",31849,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\HumanResources",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\EmployeeSelf",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\ManagerSelf",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\HumanResources\\PerformanceManagement",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\HHBB",17743,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\CustomerRelationshipManagement",0,FEATURE_OPCOST_UNINSTALL_FILE);
//FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\报账中心",3166,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\OnlineClaims",4964,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\FinancialManagement",10677,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\BudgetManagement",6295,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\WebServerAppServer\\CustomerRelationshipManagement",91586041,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\LicenseServer",2144,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\U8AppServer",18502,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Server\\FileManageServer",2144,FEATURE_OPCOST_UNINSTALL_FILE); 
FeatureAddUninstallCost(MEDIA, "Server\\EIS",455495973,FEATURE_OPCOST_UNINSTALL_FILE);
    
FeatureAddUninstallCost(MEDIA, "Server\\PDMInterfacePlug",7098368,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Envirment",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "PDM", 2512990094, FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Envirment\\Jet 3.51",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Envirment\\Jet 4.0",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Resource",0,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Resource\\ZH_CN",13126,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Resource\\ZH_TW",13134,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Resource\\EN_US",13591,FEATURE_OPCOST_UNINSTALL_FILE);
FeatureAddUninstallCost(MEDIA, "Resource\\ResCommon",5197,FEATURE_OPCOST_UNINSTALL_FILE);
end;

userintroduce.rul 源码

//InstallShield系统变量
InstallShield系统变量:
BATCH_INSTALL 指示当传输文件采用LOCKEDFILE或SHAREDFILE时是否锁定文件
CMDLINE Setup.exe传递的命令行参数
COMMONFILES Common files全路径如"c:\program file\common files"
ERRORFILENAME
FOLDER_DESKTOP Windows 95 或Windows NT 4.0桌面folder的路径
FOLDER_PROGRAMS Windows 95 或Windows NT 4.0 开始菜单中 开始\程序 的folder
FOLDER_STARTMENU Windows 95 或Windows NT 4.0 开始菜单中 开始 的folder
FOLDER_STARTUP Windows 95 or Windows NT 4.0 开始菜单中 启动 的folder
INFOFILENAME InstallShield创建的备份文件全文件名
ISRES _isres.dll全文件名
ISUSER _isuser.dll全文件名
ISVERSION 版本
MEDIA 当前Media库名
MODE 指示程序运行于normal还是silent模式
PROGRAMFILES Windows 95 or Windows NT 4.0 "Program files" folder
SELECTED_LANGUAGE 安装选择的语言号
SRCDIR 安装源目录的全路径(此路径并不是setup.exe所在路径,而是安装过程中拷贝到临时文件下的路径)
SRCDISK 安装源目录的盘符
SUPPORTDIR 临时文件路径
TARGETDIR 安装目的目录的全路径
TARGETDISK 安装目的目录的盘符
UNINST unInstallShield程序用的反安装文件全文件名
WINDIR Windows的全路径(c:\windows)
WINDISK Windows位于的盘符
WINSYSDIR Windows\system的全路径(c:\windows\system)
WINSYSDISK Windows\system位于的盘符 
//
  解决WIN2008 WIN7反复卸载后安装出现 无法打开项 UNKNOWN\Components 的问题。
  执行这个命令后解决 。。
   secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose 
  此命令执行后导致 dhcp client启动不成功,Inode SQLServer服务使用不了,只能安装出错后,手工的处理,。
 已经修改成使用  GrantprivilegeToRegister(RegKey) 方法了 。







// 远程接入科迈
在防火墙例外加入6222端口为安装端口
%1是端口,     上面一条是2008和2012系统的,下面的是2003系统的。    
set ts=%1
netsh advfirewall firewall add rule name="rasts"  protocol=TCP dir=in localport=%ts% action=allow >nul 2>nul
reg add "hklm\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List" /v %ts%:TCP /t REG_SZ /d "%ts%:TCP:*:Enabled:%ts%" /f >nul 2>nul


///


///
 WIN7 以上..设置右键
[HKEY_CLASSES_ROOT\Directory\Background\shell\重启计算机]
@="重启计算机"
"Icon"="Shell32.dll,215"
"Position"="button"


[HKEY_CLASSES_ROOT\Directory\Background\shell\重启计算机\command]
"(默认)"="shutdown.exe -r -f -t 00"










重新的启动
shutdown.exe -r -f -t 00
/




设置WIN2003的AppPoolIdentityType标示为localsystem
CString m_indentifylocalsystem = _T("CScript ")+ m_sysdisk+_T("\\Inetpub\\AdminScripts\\adsutil.vbs ")+ _T("set W3SVC/AppPools/DefaultAppPool/AppPoolIdentityType 0 ");   
Run(m_indentifylocalsystem);


设置asp.net版本
asp.net版本为v2.0.50727
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -s W3SVC/1/ROOT/HBBB
asp.net版本为v4.0.30319
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -s W3SVC/1/ROOT/HBBB
设置所有的虚拟目录ASP.NET版本设置
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i -enable






appcmd add apppool /name:Marketing /managedRuntimeVersion:v2.0 /managedPipelineMode:Classic








操作系统版本
const TCHAR *lpBuffer = GetOSVersionString();
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
DWORD dwBuildNumber = 0;
DWORD dwOther = 0;
_stscanf(lpBuffer, _T("%u.%u.%u.%u"), 
&dwMajorVersion, &dwMinorVersion, &dwBuildNumber, &dwOther);


LPCTSTR lpszOSName = _T("");
if (IsWindowsServer())   // server window
{
if (dwMajorVersion == 5)
{
if (dwMinorVersion == 2)
{
lpszOSName = _T("Windows Server 2003");
//lpszOSName = _T("Windows Server 2003 R2");
}
}
else if (dwMajorVersion == 6)
{
if (dwMinorVersion == 0)
{
lpszOSName =  _T("Windows Server 2008");
}
else if (dwMinorVersion == 1)
{
lpszOSName = _T("Windows Server 2008 R2");
}
else if (dwMinorVersion == 2)
{
lpszOSName = _T("Windows Server 2012");
}
else if (dwMinorVersion == 3)
{
lpszOSName = _T("Windows Server 2012 R2");
}
}
else if (dwMajorVersion == 10)
{
if (dwMinorVersion == 0)
{
lpszOSName = _T("Windows Server 2016");
}
}
}
else  // desktop window
{
if (dwMajorVersion == 5)
{
if (dwMinorVersion == 0)
{
lpszOSName = _T("Windows 2000");
}
else if (dwMinorVersion == 1)
{
lpszOSName = _T("Windows XP");
}
else if (dwMinorVersion == 2)
{
lpszOSName = _T("Windows XP 64-Bit Edition");
}
}
else if (dwMajorVersion == 6)
{
if (dwMinorVersion == 0)
{
lpszOSName = _T("Windows Vista");
}
else if (dwMinorVersion == 1)
{
lpszOSName = _T("Windows 7");
}
else if (dwMinorVersion == 2)
{
lpszOSName = _T("Windows 8");
}
else if (dwMinorVersion == 3)
{
lpszOSName = _T("Windows 8.1");
}
}
else if (dwMajorVersion == 10)
{
if (dwMinorVersion == 0)
{
lpszOSName = _T("Windows 10");
}

}
}




 





















  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值