1

we have msi installer build with MSI Factory with a couple of custom action scripts (lua & vbs). one of the scripts try to get a custom property from package and write it to file after successfully installation. this custom property is added to downloaded package via MSI.ChangeMSIProperty in asp.NET handler when download was requested with parameters. problem is, that property change brokes the signature of msi file, so we try to add some data to the msi filename. now I need to change that vbscript to handle this. but I can't get the installers filename.

Dim data, tokens
Dim fso, f
Dim setupExeFilename, setupExeFilenameParts

data = Session.Property("CustomActionData")
tokens = Split(data,"|")

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.CreateTextFile(tokens(0) & "\\data.txt", True)

    if tokens(1) = "_DEFAULT_" then
        setupExeFilename = Session.Property("SETUPEXENAME")
        setupExeFilenameParts = Split(data,".")
        f.Write setupExeFilenameParts(UBound(setupExeFilenameParts) - 1)
    else
        f.Write tokens(1)
    end if

f.Close

I found Session.Property("SETUPEXENAME") somewhere but doesn't work for me. I search for some property in Session, Session.Property, Session.ProductProperty, Installer but no luck yet. Installer object is present as I try, but no property returns what I need.

If not Installer is nothing then
    msgbox "Installer ok"
    msgbox Installer.version
end if

is it possible to get the installer filename?

4

1 回答 1

2

OriginalDatabase 属性具有您要查找的内容。但是,您对 CustomActionData 的引用告诉我您的自定义操作正在延迟上下文中运行。您将无权访问此属性。无论立即运行并序列化您的 CustomActionData 属性的自定义操作都必须获取此属性并将其放入 CustomActionData。

应该警告您,VB/JScript 自定义操作以其脆弱性而闻名。您提到了 SETUPEXENAME,所以我假设您正在使用 InstallShield,因为这是一个 InstallShield 属性。我建议改用 InstallScript、C/C++ 或 C#。如果您选择 InstallScript,我在 InstallSite.org 上有一个示例 CustomActionData 序列化/反序列化模式。如果是 C#,它内置在 Microsoft.Deployment.WindowsInstaller 库的 Session 类中。

于 2013-05-29T13:17:31.313 回答