Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

CAB Files in MSI


1 reply to this topic

soso2k

soso2k
  • Members
  • 3 posts

Posted 15 October 2001 - 20:08

I have packed my files into a CAB file, and I filled in all the necessary tables, but now I have to insert the CAB file into the MSI file. How do I do that, using MSI functions API? (a source code example would be very helpful). Thanks a lot, Sorin

Doug Paida

Doug Paida
  • Members
  • 55 posts

Posted 17 October 2001 - 20:40

I'm not sure what language you're using, but this is what I did using VB.   The basic idea is that you need to add an entry to the "_Streams" table in the msi database.   The first field in the record is the name of the stream, which should be whatever the cabinet filename is.   The second field is the actual data stream, which would be the contents of the cabinet file.

In VB, I did the following:

Set msiView = msiDB.OpenView("SELECT * FROM _Streams WHERE Name = '" + cabinetName +"'")msiView.Execute
Set msiRecord = msiView.Fetch()
If msiRecord Is Nothing Then
   Set msiRecord = msiInstaller.CreateRecord(2)
   msiRecord.StringData(1) = cabinetName
   msiRecord.SetStream 2, (App.Path + "\" + cabinetName)
   msiView.Modify msiViewModifyInsert, msiRecord
End If

You also need to add an entry to the Media table.  The cabinet field (column 4) should contain the cabinet name prefixed with a "#" character (for example, #TEST.CAB).  This tells Windows Installer that the cabinet is embedded in the msi file.

For more information, in the Windows Installer help file you can use the Index to go to the "Cabinet" topic, and then click on "Including a Cabinet File in an Installation" at the bottom.