开发者

Read an MST file with vbscript

开发者 https://www.devze.com 2022-12-18 22:39 出处:网络
I\'m trying to do a sc开发者_C百科ript that gets information out of some MSI and MST files and write it into a text file. I achieved reading the MSI files. However, I get the following message.

I'm trying to do a sc开发者_C百科ript that gets information out of some MSI and MST files and write it into a text file. I achieved reading the MSI files. However, I get the following message.

Msi API Error 80004005: OpenDatabase, DatabasePath, OpenMode
1:2219  2:  3:4:

I open the file like this

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
Dim database : Set database = installer.OpenDatabase(FileName, msiOpenDatabaseModeReadOnly) : CheckError

It works just fine with MSI files. I believe MST files should be read in a different way.

How can a read an MST file using vbscript?


I haven't tried myself, but according to MSDN, to view a transform file (MST) you need to open your MSI database and then use the ApplyTransform method with the msiTransformErrorViewTransform parameter. This will give you a temporary _TransformView table, which you can query to get the desired information.

So, your code should look like this:

Const msiOpenDatabaseModeReadOnly    = 0
Const msiTransformErrorViewTransform = 256
Dim installer, database

Set installer = CreateObject("WindowsInstaller.Installer") : CheckError
Set database = installer.OpenDatabase(MSIFileName, msiOpenDatabaseModeReadOnly) : CheckError
database.ApplyTransform MSTFileName, msiTransformErrorViewTransform : CheckError
0

精彩评论

暂无评论...
验证码 换一张
取 消