生成MSI脚本批命令
例如1:
set wixpath=G:\U8V13.1安装程序包\Wix
set packpath="G:\U8V13.1安装程序包\所有补丁文件包"
set packname=U8ERP-User-Define2
pushd %wixpath%
C:\Windows\system32\cscript /NoLogo %wixpath%\DEFINEWixcreater.vbs %packpath%\Define2Tobeinstall %packpath%\%packname%.wxs /Name %packname% /SPID %packname% /RegVersion V8.700 /ID a0000000-0000-0000-0000-000000000002 /Packageid a0000000-0000-0000-0000-000000000002 /RESTOREDISABLED /FORCEREBOOTcandle -nologo -sw1044 -sw1031 -out %packpath%\%packname%.wixobj %packpath%\%packname%.wxsLight -nologo -out %packpath%\%packname%.msi %packpath%\%packname%.wixobjdel /f/s/q H:\制作HotFix大包\U8ERP-User-Define2.wixobj
del /f/s/q H:\制作HotFix大包\U8ERP-User-Define2.wxs
例如2:
cscript.exe   /NoLogo H:\U813.1_SOURCE\打所有包的目录\Wix\\Wixcreater.vbs H:\U813.1_SOURCE\package\MSIOBJ\uap H:\U813.1_SOURCE\package\MSI\U8ERP-PUBLIC-UAP.wxs /Name U8ERP-PUBLIC-UAP /SPID U8ERP-PUBLIC-UAP /RegVersion V8.700 /ID 2166c7c8-b032-4a45-8c47-88ed6270bc5f /PackageID 2166c7c8-b032-4a45-8c47-88ed6270bc5f /FORCEREBOOT /RESTOREDISABLEDcandle.exe -nologo -sw1044 -sw1031 -out "H:\U813.1_SOURCE\package\MSI\U8ERP-PUBLIC-UAP.wixobj" "H:\U813.1_SOURCE\package\MSI\U8ERP-PUBLIC-UAP.wxs"Light.exe -nologo -out H:\U813.1_SOURCE\package\MSI\U8ERP-PUBLIC-UAP.msi H:\U813.1_SOURCE\package\MSI\U8ERP-PUBLIC-UAP.wixobj
Wixcreater.vbs 文件内容

''''''''''''''''''''''''''''''''''''
'
' BuildMSI.vbs
'
' KENLY
' Date: Nov.16.2005
' Copyright(c) 1988-2005 UFIDA.Inc,Ltd.
'
' Revision History:
'     Date         Comment
'
' 根据相关信息,自动生成Wix源文件,然后调用Wix toolSet
' 自动生成MSI适合U8补丁包安装文件
'
'
''''''''''''''''''''''''''''''''''''
Option Explicit
'On Error Resume Nextdim productName            ' 产品名称
dim productId           ' 产品ID
dim productManufacturer ' 生产产商
dim productVersion      ' 产品版本 格式为xx.xx.xx.xx
dim productLanguage     ' 语言
dim productUpgradeCode  ' 升级ID  dim packageID           ' PackageID
dim packageKeywords     ' 关健字
dim packageDescription  ' 说明
dim packageComment      ' 意见
dim installVersion      ' MSI安装程序版本
dim codepage            ' 代码页
dim Compressed          '
dim SummaryCodepage
dim Platformsdim spid               ' KB 问题号
dim regVersionKey           '
dim regKeyPath
dim regGuidPath           'GUID 设置 dim DomObject            '
dim ndProduct
dim ndUI
dim ndrootDirectory
dim sourceDirectory
dim outwixfilename
dim licencefile         ' 许可文件Path
dim envCheckfile            ' 环境检测的配置文件路径
dim serviceControlFile                  '控制服务的配置文件
dim fso                 ' Scripting.FileSystemObject对象
dim dict                '记录CustomAction
Dim dictdeferca         '记录延迟的CustomAction
dim dictbefore              '记录安装前的CustomAction
dim dependchecklist     ' 依赖补丁的ID,多个用逗号分隔dim arrSystemFolders()
dim arrMyCatalog()
dim disabledRollback
dim RestoreDisabled      ' 卸载的时候是否支持恢复老版本=true,禁止恢复
dim filecount
dim forceReboot         ' 安装包完成后是否强制重启系统 ,=true 强制重启
dim justuap             '
dim file_gacutil        '记录需要注册到全局程序级的文件
dim file_regasm         '记录使用REGASM导出程序集tlb文件,并注册的文件集
dim file_regasm40         '记录使用REGASM v4.0.30319版本导出程序集tlb文件,并注册的文件集
dim file_regsvcs        '记录需要COM+注册的文件集
dim file_regserver      '记录需要使用/RegServer或-RegServer注册的文件集
dim file_regsvr32      '记录需要使用regsvr32注册的文件集,通常用于msi无法正常注册的com组件
dim DBEnginSysPath      '记录DBEngin的路径
dim SQLITERUNSysPath    '记录SQLLite导入数据库的路径
dim AFTERRUNSysPath     '记录SQLLite卸载数据库的路径
dim cataSetupType
CONST CATA_OTHERS   = 0     ' 一般的目录
CONST CATA_COM      = 1     ' 需要regsvr32注册的
CONST CATA_COMPLUS  = 2     ' 需要COM+注册
CONST CATA_NET      = 3     ' 需要.Net注册
CONST CATA_RUN      = 4     ' 安装完成后需要进行的组件
CONST CATA_SERVICE  = 5     ' 服务安装类型
CONST CATA_SPF      = 6     ' Windows SPF文件
CONST CATA_RUNONCE  = 7     ' 安装完后重起自动运行一次
CONST CATA_WEBVIRTUAL = 8    ' Web Virtual Directory
CONST CATA_NETREGASM  = 9   ' 使用REGASM导出程序集tlb文件,并注册
CONST CATA_NETBOTH  = 10    ' 同时注册到GAC,并且使用REGASM注册CONST CATA_APP   = 11        ' 应用服务器
CONST CATA_CLIENT   = 12        '客户端
CONST CATA_DB   = 13        '数据库服务器
CONST CATA_REMOVE   =14         '需要删除的目录
CONST CATA_REGSERVER   =15      'COM组件(EXE),使用/RegServer或-RegServer注册
CONST CATA_REGISTRY   =16       '需要写在注册表中的注册键值
CONST CATA_WEB  = 17        'Web服务器
CONST CATA_LS   = 18        'license server 服务器
CONST CATA_COMMONAD = 19        '数据库服务器或者应用服务器
CONST CATA_REGSVR32   =20      'COM组件,使用regsvr32 注册,主要针对一些经常注册不成功的com组件
CONST CATA_NOTUNINSTALL   =21   '卸载时不删除的文件 add by lilf
CONST CATA_NOTUNINSTALLCOM      = 22        ' 需要regsvr32注册的且卸载不删除文件 add by lilf
CONST CATA_RUNWITHARGSP = 23        ' 安装后运行EXE 传递MSI包的名称 EXE名称固定为SetPatchInfoToSqlLite.exe 才执行  add by lilf
CONST CATA_RUNAFTERREMOVE = 24      ' 卸载后运行EXE 传递MSI包的名称 EXE名称固定为SetPatchInfoToSqlLite.exe 才执行 add by lilf
CONST CATA_RUNUNINSTALL = 25        ' 卸载后运行EXE 直接的运行,不做任何处理。 add by lilf
CONST CATA_COMMON = 26  '所有安装方式都安装的模式add by lilf
CONST CATA_RUNBEFORE = 28       ' 安装前需要进行的组件 add by lilf
CONST CATA_NETREGASM40  = 29    ' 使用REGASM.exe此是v4.0.30319版本的导出程序集tlb文件,并注册
const ForReading = 1
CONST REG_RUNONCE_KEYPATH = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
CONST REINSTALLMODE ="emus"     '重安装类型 =emus 按版本控制 ;=amus 强迫所有文件无条件安装''''''''''''''''''''''''''''''''''''
' Main Entry Point
''''''''''''''''''''''''''''''''''''CALL Main''''''''''''''''''''''''''''''''''''
' END Main Entry Point
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Main Function
''''''''''''''''''''''''''''''''''''
Function Main()Call INITIf Not ProcessCommandLine ThenExit FunctionEnd IfCALL CreateWixSourceFileDOMObject.Save outwixfilenameEnd Function''''''''''''''''''''''''''''''''''''
'
' 处理命令行参数
'
' 读取命令行参数,并解析初始化相关变
' 量值
'
''''''''''''''''''''''''''''''''''''
Function ProcessCommandLine()dim argsdim idim countdim bregKeyPath '是否已经指定完整的注册键值set args = WScript.ArgumentsndrootDirectory = ""outwixfilename = ""bregKeyPath=falsecount = 0If args.Count < 2 ThenCall DisplayUsageMessageProcessCommandLine = FALSEExit FunctionEnd IfFor i=0 to args.Count - 1Select case Ucase(args(i))Case "/NAME","-NAME"i = i+1productName = args(i)Case "/ID","-ID"i = i+1productId = args(i)           Case "/VENDOR","-VENDOR"i = i+1productManufacturer = args(i)Case "/VERSION","-VERSION"i = i+1productVersion = args(i)Case "/LANG","-LANG"i = i+1productLanguage = args(i)Case "/UPID","-UPID"i = i+1productUpgradeCode = args(i)Case "/PACKAGEID","-PACKAGEID"i = i+1packageID = args(i)Case "/KEYWORDS","-KEYWORDS"i = i+1packageKeywords = args(i)Case "/DESCRIPTION","-DESCRIPTION"i = i+1packageDescription = args(i)Case "/COMMENT","-COMMENT"i = i+1packageComment = args(i)Case "/MSIV", "-MSIV"i = i+1installVersion = args(i)Case "/CODEPAGE","-CODEPAGE"i = i+1codepage = args(i)Case "/SPID","-SPID"i = i+1spid = args(i)regKeyPath = regKeyPath & spidCase "/REGVERSION","-REGVERSION"i = i+1regVersionKey = args(i)Case "/FULLREGPATH","-FULLREGPATH"i = i+1regKeyPath = args(i)bregKeyPath=trueCase "/LICENCEFILE", "-LICENCEFILE", "/L", "-L"i = i+1licencefile = args(i)Case "/DEPENDLIST", "-DEPENDLIST", "/D", "-D"i = i+1dependchecklist = args(i)Case "/ENVCHECKFILE", "-ENVCHECKFILE"i = i+1envCheckfile= args(i)Case "/FORCEREBOOT", "-FORCEREBOOT"forceReboot=TrueCase "/RESTOREDISABLED", "-RESTOREDISABLED"RestoreDisabled=TrueCase Elsecount = count + 1If count = 1 Then sourceDirectory = CStr(args(i))If count = 2 Then outwixfilename  = CStr(args(i))End SelectNextIf sourceDirectory = "" Or outwixfilename = "" ThenCall DisplayUsageMessageProcessCommandLine = FALSEExit FunctionEnd Ifif bregKeyPath=false thenregKeyPath="SOFTWARE\Ufsoft\WF\" + regVersionKey + "\SPINFO\" + spidend ifProcessCommandLine = TRUE
End Function''''''''''''''''''''''''''''''''''''
'
' 显示使用帮助信息
'
''''''''''''''''''''''''''''''''''''
Sub DisplayUsageMessage()Wscript.Echo "Copyright(c) 1988-2005 UFIDA.Inc.Ltd,"Wscript.Echo ""WScript.Echo "Usage:"WScript.Echo "      CScript Wixcreater.VBS [[/|-]option] <Source Path> <Output File Name>"WScript.Echo "                                                             "WScript.Echo "Options:"WScript.Echo "        /Name <Product Name>"WScript.Echo "       /Id <Product Id> a unique identifier for the particular product release"WScript.Echo "        /Vendor         <Manufacturer>"WScript.Echo "     /Version        <Product Version>"WScript.Echo "      /Lang           <Product Language>"WScript.Echo "     /UpId           <UpgradeCode> a unique identifier"WScript.Echo "      /PackageId      <GUID for PackageId>"WScript.Echo "       /Keywords       <Keywords for this Install package>"WScript.Echo "        /Description    <Description for this Install package>"WScript.Echo "     /Comment        <Comment for this install package>"WScript.Echo "     /MSIV           <Windows Install version>"WScript.Echo "      /CodePage       <Codepage for this Install package>"WScript.Echo "        /SPID           <UFIDA Support KB Number>"WScript.Echo "      /RegVersion     <UFIDA U8 Product Register Key(e.g. V8.600)>"Wscript.Echo "       /FullRegPath    <UFIDA U8 Product Full Register Key Path>"Wscript.Echo "      /LICENCEFILE    <Licence file Path>"Wscript.Echo "        /DEPENDLIST     Depend SPID List, use comma split"Wscript.Echo "        /ENVCHECKFILE   <enviroment check file  Path>"Wscript.Echo "      /FORCEREBOOT    prompts the user for a reboot of the system at the end of installation"Wscript.Echo "       /RESTOREDISABLED        Disabled to restore the files during uninstalling  "WScript.Echo
End Sub''''''''''''''''''''''''''''''''''''
'
' 创建Wix源文件的入口点
'
''''''''''''''''''''''''''''''''''''
Function CreateWixSourceFile()Call processProductNodeCall processPackageNodeCall processUpgradeNodeCall AddConditionNode(ndProduct, _"Version9X OR ((VersionNT > 400) OR ((VersionNT = 400) AND (ServicePackLevel >= 6)))", _"[ProductName] 无法安装在 [WindowsTypeNT] 或更早的版本")Call processMediaCall ProcessRootDirectoryCall ProcessRootDriveProperty CALL processBackupDirectory(ndrootDirectory)CALL RegisterSPInfoCALL RegisterGUIDInfoCall processFolder(sourceDirectory, 0, ndrootDirectory, NOTHING, "", "")Call ProcessCustomProperty(ndProduct)Call ProcessCustomPropertyAction(ndProduct)Call processUIsCall processInstallExecuteSequenceCall ProcessPropertysCall processBinaryCall ProcesslegalFile   Call ProcessServiceControlFileCall ProcessCustomActionDll(ndProduct,"CAFileDatingRule","check","ufutils","CompareFilesDate","immediate","yes")Call ProcessCustomActionDll(ndProduct,"CARemoveFiles","ignore","ufutils","RemoveAllFiles","immediate","yes")Call ProcessUninstallCustomAction(ndProduct)
End FunctionFunction processInstallUISequence(ndparent)dim domdim ndSet dom = WScript.CreateObject("MSXML2.DOMDocument")If dom.Load("Lib\UISequence.xml") ThenFor Each nd in dom.documentElement.childNodesndParent.appendChild ndNextEnd Ifdim ndroot set ndroot = AppendChild(ndProduct, "InstallUISequence")set nd = NewChild(ndroot, "Custom")nd.setAttribute "Action", "CARootDrive"   nd.setAttribute "Before", "AppSearch"
End FunctionFunction GetDirecotryCatalogType(dirName)Select case UCase(dirName)case "COM"GetDirecotryCatalogType = CATA_COMcase "COMPLUS"GetDirecotryCatalogType = CATA_COMPLUScase "NET"GetDirecotryCatalogType = CATA_NETcase "RUN"GetDirecotryCatalogType = CATA_RUNcase "RUNBEFORE"GetDirecotryCatalogType = CATA_RUNBEFORE     case "RUNWITHARGSP"GetDirecotryCatalogType = CATA_RUNWITHARGSPcase "RUNAFTERREMOVE"GetDirecotryCatalogType = CATA_RUNAFTERREMOVEcase "RUNUNINSTALL"GetDirecotryCatalogType = CATA_RUNUNINSTALLcase "SERVICE"GetDirecotryCatalogType = CATA_SERVICEcase "SPF"GetDirecotryCatalogType = CATA_SPFcase "RUNONCE"GetDirecotryCatalogType = CATA_RUNONCEcase "WEBDIR"GetDirecotryCatalogType = CATA_WEBVIRTUALcase "NETREGASM","NETWITHOUTGAC"GetDirecotryCatalogType = CATA_NETREGASMcase "NETREGASM40"GetDirecotryCatalogType = CATA_NETREGASM40        case "NETBOTH"GetDirecotryCatalogType = CATA_NETBOTHcase "REMOVE"GetDirecotryCatalogType = CATA_REMOVEcase "REGSERVER"GetDirecotryCatalogType = CATA_REGSERVERcase "REGISTRY"GetDirecotryCatalogType = CATA_REGISTRYcase "REGSVR32"GetDirecotryCatalogType = CATA_REGSVR32case "NOTUNINSTALL" GetDirecotryCatalogType = CATA_NOTUNINSTALLcase "NOTUNINSTALLCOM" GetDirecotryCatalogType = CATA_NOTUNINSTALLCOMcase else ' OthersGetDirecotryCatalogType = CATA_OTHERSEnd Select
End FunctionFunction processInstallExecuteSequence()dim ndrootdim nddim idim ndcdatadim itemsdim lastsequenceset ndroot = AppendChild(ndProduct, "InstallExecuteSequence")set nd = NewChild(ndroot, "RemoveExistingProducts")nd.setAttribute "After", "InstallValidate"set nd = NewChild(ndroot, "AppSearch")nd.setAttribute "Before", "LaunchConditions"set nd = NewChild(ndroot, "Custom")nd.setAttribute "Action", "CARemoveFiles"'nd.setAttribute "Before", "CARollbackFiles"nd.setAttribute "After", "InstallFinalize" Set ndcdata = NewChildEx(nd, "Custom",4)ndcdata.text = "REMOVE = ""ALL"" AND CAREMOVE=""ALL"""set nd = NewChild(ndroot, "Custom")nd.setAttribute "Action", "CARollbackFiles"nd.setAttribute "After", "CARemoveFiles"Set ndcdata = NewChildEx(nd, "Custom",4)ndcdata.text = "REMOVE = ""ALL"""set nd = NewChild(ndroot, "MoveFiles")Set ndcdata = NewChildEx(nd, "MoveFiles",4)ndcdata.text = "ProductState = -1"set nd = NewChild(ndroot, "RemoveFiles")Set ndcdata = NewChildEx(nd, "RemoveFiles",4)ndcdata.text = "CAREMOVE=""""" set nd = NewChild(ndroot, "InstallValidate")Set ndcdata = NewChildEx(nd, "InstallValidate",4)ndcdata.text = "CAREMOVE="""""     if REINSTALLMODE  <>"amus" thenset nd = NewChild(ndroot, "Custom")nd.setAttribute "Action", "CAFileDatingRule"nd.setAttribute "After", "CostFinalize" Set ndcdata = NewChildEx(nd, "Custom",4)'ndcdata.text = "CADEPEND=1"'ndcdata.text = "REINSTALLMODE <>""amus"""end if'安装前调用事件items=dictbefore.itemslastsequence = "InstallValidate"For i = dictbefore.Count -1 to  0 Step -1set nd = NewChild(ndroot, "Custom")  nd.setAttribute "Action", items(i)nd.setAttribute "After", lastsequenceSet ndcdata = NewChildEx(nd, "Custom",4)ndcdata.text = "ProductState = -1"lastsequence=items(i)Nextitems=dictdeferca.itemslastsequence = "InstallFinalize"For i = dictdeferca.Count -1 to  0 Step -1set nd = NewChild(ndroot, "Custom")  nd.setAttribute "Action", items(i)nd.setAttribute "Before", lastsequence      lastsequence=items(i)Nextlastsequence = "CARollbackFiles"if forceReboot thenset nd = NewChild(ndroot, "ScheduleReboot")nd.setAttribute "After", lastsequenceSet ndcdata = NewChildEx(nd, "Custom",4)ndcdata.text = "FAPPEC <> """""lastsequence = "ScheduleReboot"end ifitems = dict.itemsFor i = 0 to dict.Count -1set nd = NewChild(ndroot, "Custom")                dim arrarr=split(items(i),"#")         nd.setAttribute "Action", arr(0)nd.setAttribute "After", lastsequenceSet ndcdata = NewChildEx(nd, "Custom",4)                if arr(0)="errDBEnginSys" thenndcdata.text = "EXCUTEDBENGINSYS = ""0"""        elseif arr(0)="CACustomAction_CreateBinaryFile" thenndcdata.text = ""elseif arr(0)="errSqlLiteSys" thenndcdata.text = "EXCUTESQLLITESYS = ""0"""        elseif arr(0)="errExeSys" thenndcdata.text = "EXCUTEEXESYS = ""0""" elseif arr(0)="CACustomPropertyAction5" thenndcdata.text = "REMOVE = ""ALL"""elseif arr(0)="CACustomPropertyAction6" thenndcdata.text = "REMOVE = ""ALL"""              else            if Ubound(arr)>0 then             ndcdata.text = "ProductState = -1 AND " & arr(1) & "<> """""elsendcdata.text = "ProductState = -1"end if                         end if          lastsequence = arr(0)NextSet processInstallExecuteSequence = nd
End FunctionFunction processFeature(id)dim ndSet nd = ndProduct.SelectSingleNode("Feature[@Id='" & id & "']")If Not nd is Nothing ThenSet processFeature = ndExit FunctionEnd IfSet nd = NewChild(ndProduct, "Feature")nd.setAttribute "Id", idnd.setAttribute "Title", idnd.setAttribute "Description", idnd.setAttribute "Display", "expand"nd.setAttribute "Level", "1"' 增加条件Select case Ucase(id)Case "APP"Call AddConditionNodeEx(nd, _"FAPPC=""""", _"", _"", _"0")cataSetupType  =CATA_APPCase "CLIENT"Call AddConditionNodeEx(nd, _"FDESC=""""", _"", _"", _"0")cataSetupType   =CATA_CLIENTCase "DB"Call AddConditionNodeEx(nd, _"FDBC=""""", _"", _"", _"0")cataSetupType =CATA_DBCase "WEB","WEBSERVER"Call AddConditionNodeEx(nd, _"FWEBC=""""", _"", _"", _"0")cataSetupType   =CATA_WEBCase "LS"Call AddConditionNodeEx(nd, _"FLSC=""""", _"", _"", _"0")cataSetupType    =CATA_LSCase "COMMONAD"Call AddConditionNodeEx(nd, _"FAPPC="""" OR FDBC=""""", _"", _"", _"0")cataSetupType =CATA_COMMONADCase "COMMON"cataSetupType    =CATA_COMMONEnd SelectSet processFeature = nd
End FunctionFunction processDirectory(ndparent,id, name, longname)dim nd Set nd = NewChild(ndparent, "Directory")nd.setAttribute "Id", idnd.setAttribute "Name", nameIf longname<>"" Then nd.setAttribute "LongName", longnameSet processDirectory = nd
End FunctionFunction processComponentRef(ndfeature, id)dim nd Set nd = NewChild(ndfeature, "ComponentRef")nd.setAttribute "Id", idSet processComponentRef = nd
End FunctionFunction processComponent(ndparent,id, guid)dim ndset processComponent = processComponentEx(ndparent,id, guid,"no")'set nd = NewChild(ndparent, "Component")'nd.setAttribute "Id", id'nd.setAttribute "Guid", guid'nd.setAttribute "SharedDllRefCount", "yes"'Set processComponent = nd
End FunctionFunction processComponentEx(ndparent,id, guid,Permanent)dim ndset nd = NewChild(ndparent, "Component")nd.setAttribute "Id", idnd.setAttribute "Guid", guidif Permanent<>"" then nd.setAttribute "Permanent", PermanentSet processComponentEx = nd
End FunctionFunction processProperty(ndparent, id, value)dim nddim ndcdataSet nd = NewChild(ndparent, "Property")nd.setAttribute "Id", idSet ndcdata = NewChildEx(nd, "Property", 4)ndcdata.text = valueset processProperty = nd
End FunctionFunction GetGuididentifier(guid)GetGuididentifier = Replace(guid, "-", "_")
End FunctionFunction RegisterSPInfo()dim ndcommFeaturedim ndcomponentdim guiddim guidreplacedguid = CreateGUIDguidreplaced = GetGuididentifier(guid)'将注册表的Feature独立出来Set ndcommFeature = processFeature("SPINFORegister")'Set ndcommFeature = processFeature("COMMON")Set ndcomponent   = processComponent(ndrootDirectory, "SPINFORegister" + guidreplaced, guid)CALL processRegister(ndcomponent, "SPSIGNED", "HKLM", regKeyPath, "string", productId, "")CALL processComponentRef(ndcommFeature, "SPINFORegister" + guidreplaced)End FunctionFunction RegisterGUIDInfo()dim ndcommFeaturedim ndcomponentdim guiddim guidreplaced'添加注册表GUID变化项目供智能安装使用guid = CreateGUIDguidreplaced = GetGuididentifier(guid)Set ndcommFeature = processFeature("SPGUIDRegister")Set ndcomponent  = processComponent(ndrootDirectory, "SPGUIDRegister" + guidreplaced, guid)'CALL processRegister(ndcomponent, "SPGUID", "HKLM", regGuidPath, "string", guid, "smartclient")CALL processComponentRef(ndcommFeature, "SPGUIDRegister" + guidreplaced)End Function
'自定义的注册表信息
Function RegisterCustomInfo(opt ,freg)dim ndcommFeaturedim ndcomponentdim guiddim actiondim guidreplacedDim  arr guid = CreateGUIDguidreplaced = GetGuididentifier(guid)'将注册表的Feature独立出来Set ndcommFeature = processFeature("SPINFORegister")'Set ndcommFeature = processFeature("COMMON")Set ndcomponent   = processComponent(ndrootDirectory, "Reg" & guidreplaced, guid)                 arr = Split(freg, vbTab, -1, 1)Select case Ucase(opt )case "ADD"if UBound(arr)<4 thenWscript.Echo  "addRegistry format wrong.field:"&UBound(arr)     end ifCALL processRegister(ndcomponent, "reg" & guidreplaced, arr(0), arr(1), arr(2), arr(4),arr(3))case "REMOVE"if UBound(arr)<1 thenWscript.Echo  "removeRegistry format wrong.field:"&UBound(arr)     end ifCALL processRemoveRegister(ndcomponent, "reg" & guidreplaced, arr(0), arr(1))end selectCALL processComponentRef(ndcommFeature, "Reg" & guidreplaced)
End FunctionFunction processRegister(ndparent, id, root, key, regtype, value, name)dim nd Set nd = NewChild(ndparent, "Registry")nd.setAttribute "Id", idnd.setAttribute "Root", rootnd.setAttribute    "Key", keynd.setAttribute   "Type", regtypeIf name<> "" Then nd.setAttribute  "Name", name    nd.setAttribute "Value", valueSet processRegister = nd
End FunctionFunction processRemoveRegister(ndparent, id, root, key)dim nd Set nd = NewChild(ndparent, "Registry")nd.setAttribute "Id", idnd.setAttribute "Root", rootnd.setAttribute    "Key", key  nd.setAttribute "Action", "removeKeyOnUninstall"    Set processRemoveRegister= nd
End FunctionFunction processFile(ndparent, id, name, longname, src, vital, keypath, diskid, selfreg,assembly)dim ndset nd = NewChild(ndparent, "File")nd.setAttribute "Id", idnd.setAttribute "Name", nameIf longname <> "" Then nd.setAttribute "LongName", longnameIf src <> "" Then nd.setAttribute "src", srcIf vital <> "" Then nd.setAttribute "Vital", vitalIf keypath <> "" Then nd.setAttribute "KeyPath", keypathIf selfreg <> "" Then nd.setAttribute "SelfRegCost", selfregIf diskid <> "" Then nd.setAttribute "DiskId", diskidIf assembly<>"" Then nd.setAttribute "Assembly", assemblyif justuap = true thenif name="UAP.exe" thendim shortCutNd set shortCutNd = Newchild(nd,"Shortcut")shortCutNd.setAttribute "Id",idshortCutNd.setAttribute "Advertise","no"shortCutNd.setAttribute "Description","二次开发平台"shortCutNd.setAttribute "Directory","UAPShortCut"shortCutNd.setAttribute "Name",nameshortCutNd.setAttribute "LongName","UAP开发平台"shortCutNd.setAttribute "WorkingDirectory","UAPdir"end ifend ifSet processFile = nd
End FunctionFunction processRemoveFile(ndparent, id, name, longname, onmode)dim ndset nd = NewChild(ndparent, "RemoveFile")nd.setAttribute "Id", idnd.setAttribute "Name", nameIf longname <> "" Then nd.setAttribute "LongName", longnameIf onmode<> "" Then nd.setAttribute "On", onmode  Set processRemoveFile = nd
End FunctionFunction processBackupDirectory(ndparent)dim nddim ndchilddim compdim guiddim guidreplaceddim ndFeatureSet nd       = processDirectory(ndparent, "Backupdir", "UFBAK", "UFUNINSTALL")Set ndchild = processDirectory(nd, "currbak", "bak", "$" & productName & "$")if justuap = True thenSet nd      = processDirectory(ndparent, "UAPdir", "UFUAP", "UAP")Set ndDesktop = processDirectory(ndparent, "DesktopFolder", "DTFOLDER", "DesktopFolder")Set ndDesktop = processDirectory(ndparent, "ProgramMenuFolder", "PMenu", "Programs")Set ndDesktop = processDirectory(ndDesktop, "U8ShortCut", "U8PMenu", "用友ERP-U8")Set ndDesktop = processDirectory(ndDesktop, "UAPShortCut", "UAPPMenu", "UAP")end if
End FunctionFunction processCopyFileEx(ndparent, _Id, _delete, _DestinationDirectory, _DestinationLongName, _DestinationName, _DestinationProperty, _FileId, _SourceDirectory, _SourceName, _SourceProperty)If Id = "" Then Exit FunctionDim ndSet nd = NewChild(ndparent, "CopyFile")nd.setAttribute "Id", IdIf delete <> "" Then nd.setAttribute "Delete", deleteIf DestinationDirectory <> "" Then nd.setAttribute "DestinationDirectory", DestinationDirectoryIf DestinationLongName <> "" Then nd.setAttribute "DestinationLongName", DestinationLongNameIf DestinationName <> "" Then nd.setAttribute "DestinationName", DestinationNameIf DestinationProperty <> "" Then nd.setAttribute "DestinationProperty", DestinationPropertyIf FileId <> "" Then nd.setAttribute "FileId", FileIdIf SourceDirectory <> "" Then nd.setAttribute "SourceDirectory", SourceDirectoryIf SourceName <> "" Then nd.setAttribute "SourceName", SourceNameIf SourceProperty <> "" Then nd.setAttribute "SourceProperty", SourcePropertySet processCopyFileEx = nd
End FunctionFunction processUninstallXMLFile(ndparent, id, Action, File, ElementPath, Name,Value)dim ndset nd = NewChild(ndparent, "XmlFile")nd.setAttribute "Id", idnd.setAttribute "Action", Actionnd.setAttribute "File", Filend.setAttribute "ElementPath", ElementPathnd.setAttribute "Name", Namend.setAttribute "Value", ValueSet processUninstallXMLFile = nd
End FunctionFunction processFolder(folder, byval depth, ndparent, ndFeature,catatype, directoryIDKey)dim    f, folderlist, fnddim filelist, filedim fremove dim fregistrydim fname       dim    ndNewFeaturedim ndNewDirectorydim ndComponentdim ndFiledim guiddim guidreplaceddim selfregdim nddim assemblydim bksrcdirdim ndParentNodedim cp1dim cp2dim doactiondim directoryIDdim aliasnamedim Permanentdim gacregSet ndNewFeature = ndFeatureSet f = fso.GetFolder(folder)Set folderlist = f.SubFoldersFor each fnd in folderlistSelect case depthCase 0            ' 第一级分类目录 如:应该服务器,客户端,数据服务器Set ndNewFeature = processFeature(fnd.Name)Set ndNewDirectory = ndparent' 如果根目下有License.rtf文件的时候,自动增加到License属性值If licencefile = "" Thenlicencefile = f.Path & "\license.rtf" End If' 如果没有指定环境检测配置文件,则默认取根目录下的envCheck.xml文件If envCheckfile= "" ThenenvCheckfile= f.Path & "\envCheck.xml" End IfIf serviceControlFile= "" ThenserviceControlFile= f.Path & "\ServiceControl.xml" End IfCase 1           ' 第二级分类表示改目录分别是什么类型的文件,如COM,COM+,NET,RUNSet ndNewDirectory = ndparentcatatype = GetDirecotryCatalogType(fnd.Name)Case ElseIf Ucase(fnd.Name) = "TARGET" and depth=2 ThenSet ndNewDirectory = ndrootDirectoryElseSet ndNewDirectory = ndparent.SelectSingleNode("Directory[@Name='" & fnd.ShortName & "']")If ndNewDirectory is NOTHING ThenIf depth = 2 and IsSystemFolderProperties(fnd.Name)  ThendirectoryID = fnd.NameElsedirectoryID = "_" & GetGuididentifier(CreateGUID)End IfIf fnd.ShortName = fnd.Name ThenSet ndNewDirectory = processDirectory(ndparent, directoryID, fnd.ShortName, "")ElseSet ndNewDirectory = processDirectory(ndparent, directoryID, fnd.ShortName, fnd.Name)End IfElsedirectoryID = ndNewDirectory.getAttribute("Id")End IfEnd IfEnd Select processFolder fnd, depth + 1, ndNewDirectory, ndNewFeature, catatype, directoryIDNextSelect case depthCase 0Case 1Case ElseSELECT CASE catatypeCASE CATA_COM,CATA_NOTUNINSTALLCOMselfreg = "1"If catatype = CATA_NOTUNINSTALLCOM Then Permanent = "yes"End IfCASE CATA_NET,CATA_NETBOTHgacreg = "1"'assembly = ".net"case CATA_NOTUNINSTALL,CATA_RUN,CATA_RUNBEFORE,CATA_RUNWITHARGSP,CATA_RUNAFTERREMOVE,CATA_RUNUNINSTALLPermanent = "yes"END SELECTSet filelist = f.FilesFor each file in filelistIf UCASE(f.Name) = "TARGET" Thenbksrcdir = "TARGETDIR"Elsebksrcdir = directoryIDKeyEnd Ifdoaction = "CP"If selfreg = "1" thendoaction = "RG"elseif gacreg = "1" then              doaction = "GC"         End Ifif lcase(file.Name) = "$$$$$webvirtualdir$$$" then' 虚拟WEB目录Set fvir = fso.OpenTextFile(file.Path, 1)aliasname = fvir.ReadLineguid = CreateGUIDguidreplaced = GetGuididentifier(guid)Set ndComponent = processComponent(ndparent, "cpt." + guidreplaced, guid)processComponentRef ndFeature, "cpt." + guidreplacedProcessWebvirtual ndComponent, "virtauldir" & guidreplaced, aliasname, bksrcdir, "", "","默认网站"               Elseif lcase(file.Name) = "$$$$$removefile$$$" then' 需要删除的文件集合Set fremove = fso.OpenTextFile(file.Path, ForReading)                                Do  While Not  fremove.AtEndOfStreamguid = CreateGUIDguidreplaced = GetGuididentifier(guid)Set ndComponent = processComponent(ndparent, "cpt." + guidreplaced, guid)processComponentRef ndFeature, "cpt." + guidreplacedfname = fremove.ReadLineprocessRemoveFile ndComponent, _"file." + guidreplaced, _fname , _fname, _"install"                                                     LoopfRemove.Close    Elseif lcase(file.Name) = "$$$$$addregistry$$$" then' 注册键值集合    dim faddreg         Set fregistry = fso.OpenTextFile(file.Path, ForReading)                                              Do  While Not  fregistry.AtEndOfStreamfaddreg = fregistry.ReadLineCall RegisterCustomInfo("ADD",faddreg)Loopfregistry.Close    Elseif lcase(file.Name) = "$$$$$removeregistry$$$" then' 注册键值集合 ,由配置文件决定对键值的操作dim freg          Set fregistry = fso.OpenTextFile(file.Path, ForReading)                                              Do  While Not  fregistry.AtEndOfStreamfreg = fregistry.ReadLineCall RegisterCustomInfo("REMOVE",freg)Loopfregistry.Close               Elseguid = CreateGUIDguidreplaced = GetGuididentifier(guid)guidreplaced=guidreplaced& "." & CreateFileDateStr(file.Path)if file.Name= "WINGDNG2.TTF" or file.Name = "pdf417.ttf" or file.Name = "BCSPDF417.ttf" or file.Name = "Resources.Config.xml" or file.Name = "uffilemanager.mdb" ThenSet ndComponent = processComponentEx(ndparent, "cpt." + guidreplaced, guid,"yes")Elseif Permanent="yes" thenSet ndComponent = processComponentEx(ndparent, "cpt." + guidreplaced, guid,"yes") elseSet ndComponent = processComponent(ndparent, "cpt." + guidreplaced, guid)end if'AddConditionNode ndComponent, _'                "file." +guidreplaced &" = ""1""", _'                ""if RestoreDisabled=False thenprocessCopyFileEx ndComponent, _"toback." & guidreplaced, _"yes", _"currbak", _file.Name & "#file." & guid & "." & CreateFileDateStr(file.Path) & "#" & doaction, _file.ShortName, _"", _"", _bksrcdir, _file.Name, _""end iffilecount = filecount + 1processComponentRef ndFeature, "cpt." + guidreplacedSet ndFile = processFile(ndComponent, _"file." + guidreplaced, _file.ShortName, _file.Name, _file.Path, _"yes", _"yes", _"1", _selfreg, _assembly)if justuap = True thenIf lcase(file.Name) = "ufida.u8.uap.services.billservice.dll" and instr(1,file.path,"SOURCEDIR\APP")>0 then'ProcessCustomAction ndProduct, "ccaReg" + guidreplaced, "ignore", "regsvcs", " /fc [#file." + guidreplaced + "] "   'If Not dict.Exists("ccaReg" + guidreplaced) Then'  dict.Add "ccaReg" + guidreplaced, "ccaReg" + guidreplaced'End IfAppendCustomProperty "regsvcs","file." + guidreplacedEnd Ifend ifSELECT CASE catatypeCASE CATA_RUNif cataSetupType=CATA_DB then'ProcessCustomAction ndProduct, "cca" + guidreplaced, "asyncWait", "DBEnginSys", " -q -n:"   +spid'ProcessCustomActionDll ndProduct, "cca" + guidreplaced, "check", "ufutils","ExcuteDBEnginSys"'ProcessCustomActionError ndProduct ,"errDBEnginSys","由于数据库脚本执行时出错,当前补丁安装失败!请卸载当前补丁并联系补丁开发人员."'ProcessPropertyEx ndProduct,"DBEnginSysPath","[#file." + guidreplaced + "]"'If Not dict.Exists("cca" + guidreplaced) Then'  dict.Add "cca" + guidreplaced, "cca" + guidreplaced'End if'If Not dict.Exists("errDBEnginSys") Then'    dict.Add "errDBEnginSys", "errDBEnginSys"'End ifAppendCustomProperty "DBRUN","[#file." + guidreplaced + "]"elseProcessCustomAction ndProduct, "cca" + guidreplaced, "asyncWait", "viewer", "[#file." + guidreplaced + "]"   If Not dict.Exists("cca" + guidreplaced) Then'dict.Add "cca" + guidreplaced, "cca" + guidreplacedif cataSetupType=CATA_APP thendict.Add "cca" + guidreplaced, "cca" + guidreplaced + "#FAPPC"elsedict.Add "cca" + guidreplaced, "cca" + guidreplaced                                end ifEnd ifend if  CASE CATA_RUNBEFOREProcessCustomAction ndProduct, "CACustomAction_RunBefore", "asyncWait", "viewer", "[#file." + guidreplaced + "]"If Not dictbefore.Exists("CACustomAction_RunBefore") Thendictbefore.Add "CACustomAction_RunBefore", "CACustomAction_RunBefore"End if                  CASE CATA_RUNWITHARGSPAppendCustomProperty "SQLITERUN","[#file." + guidreplaced + "]"  CASE CATA_RUNAFTERREMOVEAppendCustomProperty "AFTERRUN","[#file." + guidreplaced + "]"      CASE CATA_RUNUNINSTALLProcessCustomAction ndProduct, "CACustomPropertyAction6", "asyncWait", "viewer", "[#file." + guidreplaced + "]"   If Not dict.Exists("CACustomPropertyAction6") Then'dict.Add "cca" + guidreplaced, "cca" + guidreplacedif cataSetupType=CATA_APP thendict.Add "CACustomPropertyAction6" , "CACustomPropertyAction6"  + "#FAPPC"elsedict.Add "CACustomPropertyAction6" , "CACustomPropertyAction6"                                end ifEnd ifCASE CATA_NET'ProcessCustomAction ndProduct, "ccagacutil" + guidreplaced, "ignore", "gacutil", " -i [#file." + guidreplaced + "] -f"'If Not dict.Exists("ccagacutil" + guidreplaced) Then'  dict.Add "ccagacutil" + guidreplaced, "ccagacutil" + guidreplaced'End ifAppendCustomProperty "gacutil","file." + guidreplacedCASE CATA_NETBOTH'ProcessCustomAction ndProduct, "ccagacutil" + guidreplaced, "ignore", "gacutil", "-i [#file." + guidreplaced + "] -f"'If Not dict.Exists("ccagacutil" + guidreplaced) Then'  dict.Add "ccagacutil" + guidreplaced, "ccagacutil" + guidreplaced'End if'ProcessCustomAction ndProduct, "ccaregasm" + guidreplaced, "ignore", "RegAsm", "[#file." + guidreplaced + "] /tlb /codebase /silent"'If Not dict.Exists("ccaregasm" + guidreplaced) Then'  dict.Add "ccaregasm" + guidreplaced, "ccaregasm" + guidreplaced'End ifAppendCustomProperty "gacutil","file." + guidreplacedAppendCustomProperty "regasm","file." + guidreplaced                 CASE CATA_NETREGASM'ProcessCustomAction ndProduct, "ccaregasm" + guidreplaced, "ignore", "RegAsm", "[#file." + guidreplaced + "] /tlb /codebase /silent"'If Not dict.Exists("ccaregasm" + guidreplaced) Then'   dict.Add "ccaregasm" + guidreplaced, "ccaregasm" + guidreplaced'End ifAppendCustomProperty "regasm","file." + guidreplacedCASE CATA_NETREGASM40'ProcessCustomAction ndProduct, "ccaregasm" + guidreplaced, "ignore", "RegAsm40", "[#file." + guidreplaced + "] /tlb /codebase /silent"'If Not dict.Exists("ccaregasm" + guidreplaced) Then' dict.Add "ccaregasm" + guidreplaced, "ccaregasm" + guidreplaced'End ifAppendCustomProperty "regasm40","file." + guidreplaced                    CASE CATA_COMPLUS'ProcessCustomAction ndProduct, "ccaregsvcs" + guidreplaced, "ignore", "RegSvcs", " /fc [#file." + guidreplaced + "] "'If Not dict.Exists("ccaregsvcs" + guidreplaced) Then'   dict.Add "ccaregsvcs" + guidreplaced, "ccaregsvcs" + guidreplaced'End ifAppendCustomProperty "regsvcs","file." + guidreplacedCASE CATA_RUNONCEDIM ndcommFeaturerunonceDIM ndcomponentrunonceDIM guidrunonceDIM guidreplacedrunonceforceReboot = Trueguidrunonce = CreateGUIDguidreplacedrunonce = GetGuididentifier(guidrunonce)Set ndcommFeaturerunonce = processFeature("App")Set ndcomponentrunonce   = processComponent(ndparent, "RUNONCE" + guidreplacedrunonce, guidrunonce)CALL processRegister(ndcomponentrunonce, "ONCE" & guidreplacedrunonce, "HKLM", REG_RUNONCE_KEYPATH, "string", "[$RUNONCE" & guidreplacedrunonce & "]\" & file.Name,file.ShortName)CALL processComponentRef(ndcommFeaturerunonce, "RUNONCE" + guidreplacedrunonce)                                    CASE CATA_REGSERVER                 'ProcessCustomAction ndProduct, "cca" + guidreplaced, "asyncWait", "viewer", "[#file." + guidreplaced + "] /RegServer"  'If Not dict.Exists("cca" + guidreplaced) Then' dict.Add "cca" + guidreplaced, "cca" + guidreplaced'End if  AppendCustomProperty "regserver","file." + guidreplaced     CASE CATA_REGSVR32      AppendCustomProperty "regsvr32","file." + guidreplacedEND SELECTEnd ifNextEnd Select
End FunctionFunction processBinary()dim nddim filelist, f, folderdim pathpath = "Lib\Resource\"Set folder       = fso.GetFolder(path)Set filelist   = folder.FilesFor each f in filelistSet nd = NewChild(ndProduct, "Binary")nd.setAttribute "Id", fso.GetBaseName(f.Path)nd.setAttribute "src", path + f.NameNext
End FunctionFunction CreateGUID()dim odim guidSet o = CreateObject("CAUTILS.Utils")guid = o.CreateGuid()CreateGUID = Replace(guid, "{", "")CreateGUID = Replace(CreateGUID, "}", "")
End FunctionFunction CreateFileDateStr(fileName)dim o   Set o = CreateObject("CAUTILS.Utils")CreateFileDateStr = o.GetFileDateStr(fileName)
End Function'''''''''''''''''''''''''''''''''''
'
' 初始化
'
''''''''''''''''''''''''''''''''''''
Function INIT()Set dict = CreateObject("Scripting.Dictionary")Set dictdeferca = CreateObject("Scripting.Dictionary")Set dictbefore = CreateObject("Scripting.Dictionary")set DOMObject = WScript.CreateObject("MSXML2.DOMDocument")IF NOT DOMObject is NOTHING THENDOMObject.LoadXML "<?xml version='1.0' encoding='utf-8'?>" & _"<Wix>" & _"</Wix>"ELSEWscript.Echo "Couldn't create DOMDocument Instance!"END IFSet fso = Wscript.CreateObject("Scripting.FileSystemObject")CALL InitMyCatalogCall InitSystemFolderPropertiesCALL InitDefaultValue
End Function''''''''''''''''''''''''''''''''''''
'
' 初始化系统默认值
'
''''''''''''''''''''''''''''''''''''
Function InitDefaultValue()productName          = "安装程序"productManufacturer = "用友优普信息技术有限公司"productVersion      = "12.0.0.0"productLanguage     = "2052"codepage            = "936"packageKeywords      = "Installer, MSI, Database"packageDescription  = "补丁安装程序"packageComment        = "Comment"Compressed           = "yes"SummaryCodepage      = codepageinstallVersion        = "200"Platforms            = "Intel"productId          = CreateGUIDproductUpgradeCode  = CreateGUIDpackageID           = CreateGUIDspid                = ""regVersionKey       = "V8.700"regKeyPath            = "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\SPINFO\" + spidregGuidPath         = "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\SmartGuid"disabledRollback   = Truefilecount         = 0forceReboot          = FalseRestoreDisabled             = Falsedependchecklist       = "" '"U8-V861-19-82987,U8-V861-19-82988"justuap                = False
End FunctionFunction InitMyCatalog()Redim arrMyCatalog(11)arrMyCatalog(0) = "COM"arrMyCatalog(1) = "COMPLUS"arrMyCatalog(2) = "NET"arrMyCatalog(3) = "OTHERS"arrMyCatalog(4) = "RUN"arrMyCatalog(5) = "SERVICE"arrMyCatalog(6) = "SPF"arrMyCatalog(7) = "RUNWITHARGSP"arrMyCatalog(8) = "RUNAFTERREMOVE"arrMyCatalog(9) = "RUNUNINSTALL"arrMyCatalog(10) = "RUNBEFORE"
End Function''''''''''''''''''''''''''''''''''''
'
' 初始化MSI系统能识别的系统目录关键值
'
''''''''''''''''''''''''''''''''''''
Function InitSystemFolderProperties()Redim arrSystemFolders(27)arrSystemFolders(0) = "AdminToolsFolder"arrSystemFolders(1) = "AppDataFolder"arrSystemFolders(2) = "CommonAppDataFolder"arrSystemFolders(3) = "CommonFiles64Folder"arrSystemFolders(4) = "CommonFilesFolder"arrSystemFolders(5) = "DesktopFolder"arrSystemFolders(6) = "FavoritesFolder"arrSystemFolders(7) = "FontsFolder"arrSystemFolders(8) = "LocalAppDataFolder"arrSystemFolders(9) = "MyPicturesFolder"arrSystemFolders(10) = "PersonalFolder"arrSystemFolders(11) = "ProgramFiles64Folder"arrSystemFolders(12) = "ProgramFilesFolder"arrSystemFolders(13) = "ProgramMenuFolder"arrSystemFolders(14) = "SendToFolder"arrSystemFolders(15) = "StartMenuFolder"arrSystemFolders(16) = "StartupFolder"arrSystemFolders(17) = "System16Folder"arrSystemFolders(18) = "System64Folder"arrSystemFolders(19) = "SystemFolder"arrSystemFolders(20) = "TempFolder"arrSystemFolders(21) = "TemplateFolder"arrSystemFolders(22) = "WindowsFolder"arrSystemFolders(23) = "WindowsVolume"
End Function''''''''''''''''''''''''''''''''''''
'
' 判断指定的目录是否为已为识别的系统
' 目录
'
''''''''''''''''''''''''''''''''''''
Function IsSystemFolderProperties(foldername)dim fFor each f in arrSystemFoldersIf Ucase(f) = Ucase(foldername) ThenIsSystemFolderProperties = TRUEExit FunctionEnd IfNextIsSystemFolderProperties = FALSE
End Function''''''''''''''''''''''''''''''''''''
'
' 处理产品结点
'
''''''''''''''''''''''''''''''''''''
Function processProductNode()dim ndset nd = AppendChild(DomObject.documentElement, "Product")set ndProduct = ndnd.setAttribute "Id", productIdnd.setAttribute "Name", productNamend.setAttribute "Manufacturer", productManufacturernd.setAttribute "Language", productLanguagend.setAttribute "Version", productVersionnd.setAttribute "UpgradeCode", productUpgradeCodend.setAttribute "Codepage", codepage
End Function''''''''''''''''''''''''''''''''''''
'
' 处理Package结点
'
''''''''''''''''''''''''''''''''''''
Function processPackageNode()dim ndset nd = AppendChild(ndProduct, "Package")nd.setAttribute "Id", packageIDIf packageKeywords<> "" Then nd.setAttribute "Keywords", packageKeywordsIf packageDescription<> "" Then nd.setAttribute "Description", packageDescriptionIf productManufacturer<> "" Then nd.setAttribute "Manufacturer", productManufacturerIf installVersion<> "" Then nd.setAttribute "InstallerVersion", installVersionIf Platforms<> "" Then nd.setAttribute "Platforms", PlatformsIf productLanguage<> "" Then nd.setAttribute "Languages", productLanguageIf Compressed<> "" Then nd.setAttribute "Compressed", CompressedIf SummaryCodepage<> "" Then nd.setAttribute "SummaryCodepage", SummaryCodepage
End Function''''''''''''''''''''''''''''''''''''
'
' 处理UI结点
'
''''''''''''''''''''''''''''''''''''
Function processUIs()set ndUI = AppendChild(ndProduct, "UI")processProperty ndUI, "ErrorDialog", "ErrorDlg"processProperty ndUI, "DefaultUIFont", "DlgFont8"processTextStyles ndUIprocessDialog ndUIprocessUITexts ndUIprocessActionTexts ndUIprocessErrors ndUIprocessInstallUISequence ndUIprocessDialogPropertys ndProduct
End Function''''''''''''''''''''''''''''''''''''
'
' 处理UI=>UIText结点
'
''''''''''''''''''''''''''''''''''''
Function processUITexts(ndParent)dim domdim ndrootdim ndSet dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load "Lib\UITextTable.xml"Set ndroot = dom.SelectSingleNode("//UITextInfo/UITexts[@Language='" + productLanguage + "']")For Each nd in ndroot.childNodesndParent.appendChild ndNext
End Function''''''''''''''''''''''''''''''''''''
'
' 处理UI=>ActionText结点
'
''''''''''''''''''''''''''''''''''''
Function processActionTexts(ndParent)dim domdim ndrootdim ndSet dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load "Lib\ActionTextTable.xml"Set ndroot = dom.SelectSingleNode("//ActionTextInfo/ActionTexts[@Language='" + productLanguage + "']")For Each nd in ndroot.childNodesndParent.appendChild ndNext
End Function''''''''''''''''''''''''''''''''''''
'
' 处理UI=>Error结点
'
''''''''''''''''''''''''''''''''''''
Function processErrors(ndParent)dim domdim ndrootdim ndSet dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load "Lib\ErrorTable.xml"Set ndroot = dom.SelectSingleNode("//ErrorsInfo/Errors[@Language='" + productLanguage + "']")For Each nd in ndroot.childNodesndParent.appendChild ndNext
End FunctionFunction processDialogPropertys(ndParent)dim domdim ndrootdim ndSet dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load "Lib\DialogTable.xml"Set ndroot = dom.SelectSingleNode("//DialogInfo/PropertyUIs[@Language='" + productLanguage + "']")For Each nd in ndroot.childNodesndParent.appendChild ndNext
End FunctionFunction processTextStyles(ndParent)processTextStyle ndParent, "DlgFont8", "SimSun", "8", "", "", "", "", "", "", ""processTextStyle ndParent, "SimSun__8", "SimSun", "8", "", "", "", "", "", "", ""processTextStyle ndParent, "TitleFontBold13", "SimSun", "11", "yes", "", "", "", "", "", ""processTextStyle ndParent, "DlgFontBold8", "SimSun", "8", "yes", "", "", "", "", "", ""processTextStyle ndParent, "VerdanaBold13", "Verdana", "11", "yes", "", "", "", "", "", ""
End FunctionFunction processTextStyle(ndParent,id,faceName, size, bold, italic, strike,underline,red,green,blue)dim ndset nd = NewChild(ndParent, "TextStyle")nd.setAttribute "Id", idnd.setAttribute "FaceName", faceNamend.setAttribute "Size", sizeIf bold <> "" Then  nd.setAttribute "Bold", boldIf italic <> "" Then  nd.setAttribute "Italic", italicIf strike <> "" Then  nd.setAttribute "Strike", strikeIf underline <> "" Then   nd.setAttribute "Underline", underlineIf red <> "" Then   nd.setAttribute "Red", redIf green <> "" Then     nd.setAttribute "Green", greenIf blue <> "" Then  nd.setAttribute "Blue", blue
End FunctionFunction processDialog(ndParent)dim domdim ndrootdim ndSet dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load "Lib\DialogTable.xml"Set ndroot = dom.SelectSingleNode("//DialogInfo/Dialogs[@Language='" + productLanguage + "']")For Each nd in ndroot.childNodesndParent.appendChild ndNext
End Function''''''''''''''''''''''''''''''''''''
'
' 增加一个条件结点
'
''''''''''''''''''''''''''''''''''''
Function AddConditionNode( _ndparent, _condition, _message)Set AddConditionNode = AddConditionNodeEx(ndparent, condition, message, "", "")
End Function''''''''''''''''''''''''''''''''''''
'
' 增加一个条件结点
'
''''''''''''''''''''''''''''''''''''
Function AddConditionNodeEx( _ndparent, _condition, _message, _action, _level)dim nddim ndcdataIf condition="" Then Exit FunctionSet nd = NewChild(ndparent, "Condition")If action <> "" Then nd.setAttribute "Action", actionIf level <> "" Then nd.setAttribute "Level", levelIf message <> "" Then nd.setAttribute "Message", messageSet ndcdata = NewChildEx(nd, "Condition",4)ndcdata.text = conditionset AddConditionNodeEx = nd
End Function''''''''''''''''''''''''''''''''''''
'
' 处理RootDirectory结点
'
''''''''''''''''''''''''''''''''''''
Function ProcessRootDirectory()set ndrootDirectory = AppendChild(ndProduct, "Directory")ndrootDirectory.setAttribute "Id", "TARGETDIR"ndrootDirectory.setAttribute "Name", "SourceDir"
End Function''''''''''''''''''''''''''''''''''''
'
' 处理Media结点
'
''''''''''''''''''''''''''''''''''''
Function processMedia()dim ndset nd = AppendChild(ndProduct, "Media")nd.setAttribute "Id", "1"nd.setAttribute "EmbedCab", "yes"nd.setAttribute "Cabinet", "product.cab"
End Function''''''''''''''''''''''''''''''''''''
'
' 为指点的XML结点增加一个子结点
'
''''''''''''''''''''''''''''''''''''
Function AppendChildEx(ndParent, ndName, nodeType)Set AppendChildEx = AppendChildEx2(ndParent,ndName,nodeType, True)
End FunctionFunction AppendChildEx2(ndParent, ndName, nodeType, toreplace)dim ndIf Not ndParent is NOTHING ThenSet nd = NOTHINGIf toreplace ThenSet nd = ndParent.SelectSingleNode(ndName)End IfIf nd Is NOTHING ThenSet nd = DOMObject.createNode(nodeType, ndName, "")ndParent.appendChild ndEnd IfEnd IfSet AppendChildEx2 = nd
End FunctionFunction NewChild(ndParent, ndName)Set NewChild = NewChildEx(ndParent, ndName, 1)
End FunctionFunction NewChildEx(ndParent, ndName, nodeType)Set NewChildEx = AppendChildEx2(ndParent, ndName, nodeType, False)
End FunctionFunction AppendChild(ndParent, ndName)Set AppendChild = AppendChildEx(ndParent, ndName, 1)
End FunctionFunction ProcessPropertys()Call ProcessTargetPropertyCall ProcessReInstallModePropertyIf disabledRollback Then Call ProcessDisableRollback()Call ProcessFeatureCatalogPropertyif dependchecklist<> "" thenCall ProcessDependCheckedend ifCall ProcessEnvCheckFilecall ProcessSPIDProperty
End FunctionFunction ProcessDisableRollback()dim ndSet nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "RollbackDisabled"nd.setAttribute "Value", "True"
End FunctionFunction ProcessReInstallModeProperty()dim ndSet nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "REINSTALLMODE"'nd.setAttribute "Value", "amus"nd.setAttribute "Value", REINSTALLMODE
End FunctionFunction ProcessSPIDProperty()dim ndSet nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "SPID"nd.setAttribute "Value", spid
End FunctionFunction ProcessPropertyEx(ndParent,id,value)dim ndSet nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", idnd.setAttribute "Value", value
End FunctionFunction ProcessDependChecked()dim nddim ndpropertydim ndChilddim idim arrdim curi = 0arr = split(dependchecklist, ",")for each cur in arrset ndproperty = NewChild(ndProduct, "Property")ndproperty.setAttribute "Id", "DEPEND" & iSet ndChild = NewChild(ndproperty, "RegistrySearch")ndChild.setAttribute "Id", "ppyDepend" & indChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\SPINFO\" & curndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"Call AddConditionNode(ndProduct, _"DEPEND" & i & " <>""""", _"[ProductName] 无法安装,因为相关补丁"& cur &"不存在")i = i+1nextEnd FunctionFunction ProcessEnvCheckFile()dim domdim ndrootdim nddim ndpropertydim ndChilddim iIf envCheckfile= "" Then Exit FunctionIf Not fso.FileExists(envCheckfile) Then Exit Function    i = 0Set dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load envCheckfileSet ndroot = dom.SelectSingleNode("//RegistryInfos")For Each nd in ndroot.childNodesset ndproperty = NewChild(ndProduct, "Property")ndproperty.setAttribute "Id", "ENVCHECK" & iSet ndChild = NewChild(ndproperty, "RegistrySearch")ndChild.setAttribute "Id", "ppyEnvCheck" & indChild.setAttribute "Key", nd.getAttribute("Key")if nd.getAttribute("Name")<>"" then ndChild.setAttribute "Name", nd.getAttribute("Name")ndChild.setAttribute "Root", nd.getAttribute("Root")ndChild.setAttribute "Type", nd.getAttribute("Type")Call AddConditionNode(ndProduct, _"ENVCHECK" & i & " =""" & nd.getAttribute("Value")&"""", _nd.getAttribute("Desc"))i = i+1Next   End FunctionFunction ProcessTargetProperty()dim nddim ndChildSet nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "TARGETDIR"Set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "ppyTarget"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\CurrentInstPath"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"
End FunctionFunction ProcessRootDriveProperty() dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", "CARootDrive"   nd.setAttribute "Property", "ROOTDRIVE"nd.setAttribute "Value", "[SystemFolder]"    End Function
Function ProcessFeatureCatalogProperty()dim nddim ndChildset nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "FAPPC"set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "FAPPCppy"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\Installed\U8AppServer"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"set nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "FAPPEC"set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "FAPPECppy"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\Installed\AppServer"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"set nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "FDBC"set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "FDBCppy"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\Installed\DBServer"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"set nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "FDESC"set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "FDESCppy"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\Installed\Client"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"set nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "FWEBC"set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "FWEBCppy"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\Installed\WebServer"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"set nd = NewChild(ndProduct, "Property")nd.setAttribute "Id", "FLSC"set ndChild = NewChild(nd, "RegistrySearch")ndChild.setAttribute "Id", "FLSCppy"ndChild.setAttribute "Key", "SOFTWARE\Ufsoft\WF\" + regVersionKey + "\Install\Installed\LicenseServer"ndChild.setAttribute "Root", "HKLM"ndChild.setAttribute "Type", "raw"
End FunctionFunction ProcesslegalFile()dim bufferdim filedim nddim ndTextdim ncdataIf licencefile = "" Then Exit FunctionIf Not fso.FileExists(licencefile) Then Exit FunctionSet nd = DOMObject.SelectSingleNode("//Control[@Id='AgreementText']")If nd is NOTHING Then Exit FunctionEnd IFSet file = fso.OpenTextFile(licencefile, ForReading)If file is NOTHING ThenExit FunctionEnd IFbuffer = file.ReadAll()Set ndText = nd.SelectSingleNode("Text")If NOT ndText is NOTHING Thennd.removeChild(ndText)End IfSet ndText = AppendChild(nd, "Text")Set ncdata = AppendChildEx(nd, "Text",4)ncdata.text = buffer
End FunctionFunction ProcessIniFile(ndParent, id, FileName, FileLongName, DirProperty,Section, Key,Value,Action)dim ndset nd = NewChild(ndParent, "IniFile")nd.setAttribute "Id", idnd.setAttribute "Action", Actionif DirProperty <> "" Then nd.setAttribute "Directory", DirPropertynd.setAttribute "Key", Keynd.setAttribute "Section", Sectionnd.setAttribute "Value", Valuend.setAttribute "Name", FileNameif FileLongName <> "" Then nd.setAttribute "LongName", FileLongNameSet ProcessIniFile = nd
End FunctionFunction ProcessCustomAction(ndparent, id,  return, binaryKey, execommand)dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", idnd.setAttribute "Return", returnnd.setAttribute "BinaryKey", binaryKeynd.setAttribute "ExeCommand", execommandset ProcessCustomAction = nd
End FunctionFunction ProcessCustomActionExe(ndparent, id,  return,binaryKey, PropertyKey, execommand)dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", idnd.setAttribute "Return", returnnd.setAttribute "BinaryKey", binaryKeynd.setAttribute "Property", PropertyKeynd.setAttribute "ExeCommand", execommandset ProcessCustomActionExe = nd
End FunctionFunction ProcessCustomActionDll(ndparent, id,  return,binaryKey, dllentry,execute,impersonate)dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", idnd.setAttribute "Return", returnnd.setAttribute "BinaryKey", binaryKey  nd.setAttribute "DllEntry", dllentrynd.setAttribute "Execute", execute'"deferred"nd.setAttribute "Impersonate", impersonate'"no"set ProcessCustomActionDll = nd
End FunctionFunction ProcessCustomActionError(ndparent, id, error)dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", idnd.setAttribute "Error", error  set ProcessCustomActionError = nd
End FunctionFunction ProcessUninstallCustomAction(ndparent)dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", "CARollbackFiles"nd.setAttribute "Return", "asyncWait"nd.setAttribute "BinaryKey", "ufutils"nd.setAttribute "DllEntry", "RollbackBackupFiles"set ProcessUninstallCustomAction = nd
End FunctionFunction ProcessCustomActionProperty(ndparent, id,  PropertyKey, PropertyValue)dim ndSet nd = NewChild(ndProduct, "CustomAction")nd.setAttribute "Id", idnd.setAttribute "Property", PropertyKeynd.setAttribute "Value", PropertyValue  set ProcessCustomActionProperty = nd
End Function'Function ProcessDependCheckedCustomAction(ndparent)
'   dim nd
'   Set nd = NewChild(ndProduct, "CustomAction")
'   nd.setAttribute "Id", "CADependChecked"
'   'nd.setAttribute "Return", "asyncWait"
'   nd.setAttribute "BinaryKey", "ufutils"
'   nd.setAttribute "DllEntry", "DependChecked"
'
'   set ProcessDependCheckedCustomAction = nd
'End FunctionFunction ProcessWebvirtual(ndParent, id, Alias, Directory, DirProperties,WebApplication,WebSite)dim nddim ndaddrdim ndwebapplicateIf nddefualtWebSite is Nothing Thenset nddefualtWebSite = NewChild(ndProduct, "WebSite")nddefualtWebSite.setAttribute "Id", "DefaultWebSite"nddefualtWebSite.setAttribute "Description", "Defualt Web Site"set ndaddr = NewChild(nddefualtWebSite,"WebAddress")ndaddr.setAttribute "Id", "AllUnassigned"ndaddr.setAttribute "Port", "80"End IfSet nd = NewChild(ndParent, "WebVirtualDir")nd.setAttribute "Id", idnd.setAttribute "Alias", Aliasif Directory<>"" Then nd.setAttribute "Directory", Directoryif DirProperties<>"" Then nd.setAttribute "DirProperties", DirPropertiesif WebApplication<>"" Then nd.setAttribute "WebApplication", WebApplicationnd.setAttribute "WebSite", "DefaultWebSite"set ndwebapplicate = NewChild(nd,"WebApplication")ndwebapplicate.setAttribute "Id", "DefulatWebApplication"ndwebapplicate.setAttribute "Name", AliasSet ProcessWebvirtual = nd
End Function
'处理自定义行为的属性,用属性记录这些文件的关键字Function AppendCustomProperty( key, id)    Select case Ucase(key)case "GACUTIL"if file_gacutil<>"" thenfile_gacutil=file_gacutil + "|" +"[#"+id+"]"elsefile_gacutil="[#"+id+"]"end ifcase "REGSVCS"if file_regsvcs<>"" thenfile_regsvcs=file_regsvcs + "|" +"[#"+id+"]"else         file_regsvcs="[#"+id+"]"end if  case "REGASM"if file_regasm<>"" thenfile_regasm=file_regasm + "|" +"[#"+id+"]"elsefile_regasm="[#"+id+"]"end if   case "REGASM40"if file_regasm40<>"" thenfile_regasm40=file_regasm40 + "|" +"[#"+id+"]"elsefile_regasm40="[#"+id+"]"end if         case "REGSERVER"if file_regserver<>"" thenfile_regserver=file_regserver+"|" +"[#"+id+"]"elsefile_regserver="[#"+id+"]"end if  case "REGSVR32"if file_regsvr32<>"" thenfile_regsvr32=file_regsvr32+"|" +"[#"+id+"]"elsefile_regsvr32="[#"+id+"]"end if   case "DBRUN"DBEnginSysPath=id   case "SQLITERUN"SQLITERUNSysPath=id case "AFTERRUN"AFTERRUNSysPath=id            end select
End Function
'给自定义的属性赋值
Function ProcessCustomProperty(ndParent)  Dim prefix    Dim limiterlimiter="   "prefix="/REMOVE=[REMOVE]"+limiter+"/FILEPATH="if file_gacutil<>"" then'ProcessPropertyEx ndParent,"file_gacutil",file_gacutilProcessCustomActionProperty ndParent,"CACustomPropertyAction_gacutil","CACustomAction_gacutil",prefix+file_gacutil+limiter+"/EXE=gacutil"end ifif file_regsvcs<>"" then'ProcessPropertyEx ndParent,"file_regsvcs",file_regsvcsProcessCustomActionProperty ndParent,"CACustomPropertyAction_regsvcs","CACustomAction_regsvcs",prefix+file_regsvcs+limiter+"/EXE=RegSvcs"end ifif file_regasm<>"" then'ProcessPropertyEx ndParent,"file_regasm",file_regasmProcessCustomActionProperty ndParent,"CACustomPropertyAction_regasm","CACustomAction_regasm",prefix+file_regasm+limiter+"/EXE=RegAsm"end Ifif file_regasm40<>"" then'ProcessPropertyEx ndParent,"file_regasm40",file_regasm40ProcessCustomActionProperty ndParent,"CACustomPropertyAction_regasm40","CACustomAction_regasm40",prefix+file_regasm40+limiter+"/EXE=RegAsm40"end Ifif file_regserver<>"" Or file_regsvr32<>"" Then   ProcessCustomActionProperty ndParent,"CACustomPropertyAction_regserver","CACustomPropertyAction2","/REMOVE=[REMOVE]"+limiter+"/REGSERVER="+file_regserver+limiter+"/REGSVR="+file_regsvr32End if'if file_regserver<>"" then'ProcessPropertyEx ndParent,"file_regserver",file_regserver'end if'if file_regsvr32<>"" then'ProcessPropertyEx ndParent,"file_regsvr32",file_regsvr32'end ifif DBEnginSysPath<>"" then     ProcessPropertyEx ndParent,"DBEnginSysPath",DBEnginSysPathend ifif SQLITERUNSysPath<>"" then      ProcessPropertyEx ndParent,"SQLITERUNSysPath",SQLITERUNSysPathend ifif AFTERRUNSysPath<>"" then       ProcessPropertyEx ndParent,"AFTERRUNSysPath",AFTERRUNSysPathend if  End Function
'给自定义的属性增加自定义的行为
Function ProcessCustomPropertyAction(ndParent)If file_gacutil<>"" Or file_regsvcs<>"" Or file_regasm<>"" Or file_regasm40<>"" ThenCall ProcessCustomActionDll(ndParent,"CACustomAction_CreateBinaryFile","ignore","ufutils","CreateBinaryFile","immediate","yes")   If Not dictdeferca.Exists("CACustomAction_CreateBinaryFile") Thendictdeferca.Add "CACustomAction_CreateBinaryFile", "CACustomAction_CreateBinaryFile"End ifEnd ifif file_gacutil<>""  thenCall ProcessCustomActionDll(ndParent,"CACustomAction_gacutil","ignore","ufutils","ExcuteApp","deferred","no")       If Not dictdeferca.Exists("CACustomAction_gacutil") Thendictdeferca.Add "CACustomPropertyAction_gacutil", "CACustomPropertyAction_gacutil"dictdeferca.Add "CACustomAction_gacutil", "CACustomAction_gacutil"End ifend if    if  file_regsvcs<>""  thenCall ProcessCustomActionDll(ndParent,"CACustomAction_regsvcs","ignore","ufutils","ExcuteApp","deferred","no")       If Not dictdeferca.Exists("CACustomAction_regsvcs") Thendictdeferca.Add "CACustomPropertyAction_regsvcs", "CACustomPropertyAction_regsvcs"dictdeferca.Add "CACustomAction_regsvcs", "CACustomAction_regsvcs"End ifend if    if  file_regasm<>"" thenCall ProcessCustomActionDll(ndParent,"CACustomAction_regasm","ignore","ufutils","ExcuteApp","deferred","no")      If Not dictdeferca.Exists("CACustomAction_regasm") Thendictdeferca.Add "CACustomPropertyAction_regasm", "CACustomPropertyAction_regasm"dictdeferca.Add "CACustomAction_regasm", "CACustomAction_regasm"End ifend if if  file_regasm40<>"" thenCall ProcessCustomActionDll(ndParent,"CACustomAction_regasm40","ignore","ufutils","ExcuteApp","deferred","no")      If Not dictdeferca.Exists("CACustomAction_regasm40") Thendictdeferca.Add "CACustomPropertyAction_regasm40", "CACustomPropertyAction_regasm40"dictdeferca.Add "CACustomAction_regasm40", "CACustomAction_regasm40"End ifend if   if file_regserver<>"" or file_regsvr32<>"" thenCall ProcessCustomActionDll(ndParent,"CACustomPropertyAction2","ignore","ufutils","ExcuteRegServer","deferred","no")     If Not dictdeferca.Exists("CACustomPropertyAction2") Thendictdeferca.Add "CACustomPropertyAction_regserver", "CACustomPropertyAction_regserver"dictdeferca.Add "CACustomPropertyAction2", "CACustomPropertyAction2"End ifend if if DBEnginSysPath<>"" then    ProcessCustomActionDll ndParent, "CACustomPropertyAction3", "check", "ufutils","ExcuteDBEnginSys","immediate","yes"ProcessCustomActionError ndParent ,"errDBEnginSys","由于数据库脚本执行时出错,当前补丁安装失败!请卸载当前补丁并联系补丁开发人员."If Not dict.Exists("CACustomPropertyAction3") Thendict.Add "CACustomPropertyAction3", "CACustomPropertyAction3"End ifIf Not dict.Exists("errDBEnginSys") Thendict.Add "errDBEnginSys", "errDBEnginSys"End ifend ifif SQLITERUNSysPath<>"" then   ProcessCustomActionDll ndParent, "CACustomPropertyAction4", "check", "ufutils","ExcuteSqlLiteSys","immediate","yes"ProcessCustomActionError ndParent ,"errSqlLiteSys","补丁信息导入出错,请联系补丁开发人员."If Not dict.Exists("CACustomPropertyAction4") Thendict.Add "CACustomPropertyAction4", "CACustomPropertyAction4"End ifIf Not dict.Exists("errSqlLiteSys") Thendict.Add "errSqlLiteSys", "errSqlLiteSys"End ifend if    if AFTERRUNSysPath<>"" then   ProcessCustomActionDll ndParent, "CACustomPropertyAction5", "check", "ufutils","UninstallExcuteEnginSys","immediate","yes"ProcessCustomActionError ndParent ,"errExeSys","卸载补丁信息出错,请联系补丁开发人员."If Not dict.Exists("CACustomPropertyAction5") Thendict.Add "CACustomPropertyAction5", "CACustomPropertyAction5"End ifIf Not dict.Exists("errExeSys") Thendict.Add "errExeSys", "errExeSys"End ifend if End Function
''''''''''''''''''''''''''''''''''''
'
' 处理Upgrade结点
'
''''''''''''''''''''''''''''''''''''
Function processUpgradeNode()dim nddim ndUpgradeVersionset nd = AppendChild(ndProduct, "Upgrade")nd.setAttribute "Id", productUpgradeCodeset ndUpgradeVersion=NewChild(nd ,"UpgradeVersion")ndUpgradeVersion.setAttribute "Property" ,"RELATEDPROPROPERTY"
End Function
Function ProcessServiceControlFile()dim domdim ndrootdim nddim ndpropertydim ndChilddim idim ndcommFeaturedim ndcomponentdim guiddim actiondim guidreplacedDim  arr If serviceControlFile= "" Then Exit FunctionIf Not fso.FileExists(serviceControlFile) Then Exit FunctionSet dom = WScript.CreateObject("MSXML2.DOMDocument")dom.Load serviceControlFileSet ndroot = dom.SelectSingleNode("//Services")Set ndcommFeature = processFeature("APP")For Each nd in ndroot.childNodesguid = CreateGUIDguidreplaced = GetGuididentifier(guid)Set ndcomponent   = processComponent(ndrootDirectory, "Srv" & guidreplaced, guid)call processServiceStop(ndcomponent,"srv" & guidreplaced,nd.getAttribute("Name"),nd.getAttribute("Stop"),nd.getAttribute("Wait"))CALL processComponentRef(ndcommFeature, "Srv" & guidreplaced)   Next    End Function
Function processServiceStop(ndparent, id, name, stopflag, wait)dim nd Set nd = NewChild(ndparent, "ServiceControl")nd.setAttribute "Id", idnd.setAttribute "Name", namend.setAttribute  "Stop", stopflagnd.setAttribute "Wait", waitSet processServiceStop = nd
End Function

动态生成MSI包的WIX脚本文件内容相关推荐

  1. BuildMSI.vbs 生成MSI中间件 并通过连接生成MSI包

    BuildMSI.vbs内容如下: '''''''''''''''''''''''''''''''''''' ' ' BuildMSI.vbs  ' ' KENLY ' Date: Nov.16.20 ...

  2. 一个完整的MSI包的配置文件XML的内容形式和查看方法ORCA

    完成的XML配置形式内容模式 <?xml version="1.0" encoding="utf-8"?> <Wix><Produ ...

  3. VS2019install插件生成MSI安装包缺少Dll文件的解决方法

    在学习了VS2019简单快速的打包exe文件(图文教程)_兔子你等着的博客-CSDN博客_vs打包exe所显示的打包流程之后还是出现了一定的问题,安装文件MSI在其他主机上安装的时候可能会由于缺少DL ...

  4. pdfboxiText生成PDF文件格式及读取PDF文件内容的小示例--完美支持中文版

    最近项目中有个需求需要将数据库中的数据导出到PDF文件中,所以在网上查找了相关的开源框架--pdfbox&itext 于是乎写了一个简单的工具类,如有需要的可以直接拿去用,切勿跟俺客气~. 本 ...

  5. python读取log文件生成图形表_python提取log文件内容并画出图表

    之前在excel里面分析log数据,简直日了*了. 现在用python在处理日志数据. 主要涉及 matplotlib,open和循环的使用. 日志内容大致如下 2016-10-21 21:07:59 ...

  6. php动态生成apk渠道包,Android自动生成渠道包

    承接上文Android应用的自动化构建,我们已经通过ANT自动构建了应用,那接下来的问题是,如何自动构建渠道包,这里强烈推荐一篇文章美团Android自动化之旅-生成渠道包. 美团提到的第三种方式,截 ...

  7. php动态生成链接,PHP动态生成javascript文件的2个例子

    一.PHP动态生成 第一步:在PHP文件中直接写入JS代码,并在头部声明这是一个JavaScript文件 复制代码 代码如下:<?php header("Content-Type: a ...

  8. java ant war包_java利用Ant脚本生成war包全过程

    使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...

  9. gradle 修改java代码_自定义一个gradle插件动态修改jar包Class文件

    动态修改jar包中的class文件,预埋占位符字符串,在编译代码时动态植入要修改的值.记录一下整个过程及踩过的坑. 创建一个Android项目,再创建一个Android library,删掉里面所有代 ...

最新文章

  1. 如何使用Create-React-App和自定义服务人员构建PWA
  2. 【译】如何精确判断最终用户响应时间过长的原因?
  3. python搭建django框架,Python之Web框架Django项目搭建全过程
  4. Postman安装与使用(网络请求神器)--post、get请求
  5. Linux 系统检测工具
  6. 厉害了!他是 Facebook 开国元老,30 分钟解决 Instagram 服务器挂机难题
  7. Vmware虚拟机linux系统混合模式上网
  8. Xcode中查看宏在预处理阶段的展开
  9. 阶段1 语言基础+高级_1-3-Java语言高级_08-JDK8新特性_第3节 两种获取Stream流的方式_7_Stream流中的常用方法_limit...
  10. Spring Cloud微服务实战视频教程百度网盘下载
  11. Google Safe Browsing API的实施
  12. C语言枚举类 口袋中有红、黄、蓝、白、黑5种颜色的球若干个
  13. 基于眼底照片的病理性近视眼及识别
  14. 阳光系统下载 Win7电脑锁屏壁纸怎么设置
  15. 软件测试简历自我评价范文,测试工程师求职简历自我评价范文
  16. 使用pcb-tools解码Gerber文件报错IndexError: list index out of range
  17. SDNU 1221
  18. C#学习--dotnetbar控件学习
  19. android8.1字体,Android 8.1采用全新字体:圆润舒适
  20. 【嵌入式】工程模板的编写以及工程代码的理解

热门文章

  1. 学计算机要自己买电脑吗,大一新生有必要买电脑吗?辅导员给出理由,高考生快来看看...
  2. 计算机科学与技术班级口号八字,霸气八字班级口号_班级口号大全霸气十足
  3. 【不容错过】西南大学907计算机电子信息经验分享
  4. Maya 对象打组 保护数据
  5. 教资学习:法律法规之义务教育法
  6. CC00053.pbpositions——|HadoopPB级数仓.V11|——PB数仓.v11|核心交易分析|DIM层建表|加载数据|
  7. Matplotlib绘图技巧——自定义横轴
  8. Cupid - Typecho情侣主题
  9. 计算机操作快捷方式,电脑操作快捷键
  10. 周杰伦演唱会总是抢不到票?教你用Python做一个自动抢票脚本!