MSI installer flaw

EA Durbin ead1234 at
Thu May 25 20:45:58 CDT 2006

Currently the MSI Installer is working backwards, In the file files.c it 
reads the files from the msi package and iterates through them and queries 
the Media table in order by LastSequence. The sort order for the media table 
should be DiskId according to MSDN. Just changing the sort order wont work 
unless the msi installer is revamped to work the right way. The code is 
written wrong for this. Currently its using LIST_FOR_EACH_ENTRY in the 
Install Files function for the files and then trying to ready the media per 
file using the sequence number of the file in the query on the media table 
using the file sequence as last sequence and returning the results order by 

It should first be reading the Media table first and  sorting by DiskId. The 
installer then iterates through each row returned by the query from the 
media table  and then for each file in the file table that falls within that 
disk id it should ready the media. Currently wine is doing it backwards 
which ends up trying to ready the wrong media if the last sequence.

It needs to read the media table, then starting with DiskId 1, iterate 
through all of disk Id 1 and read from the file table order by sequence 
until it reaches the last sequence as indicated in the media table for the 
working DiskId, then it jumps to the next DiskId 2, 3, and so on. The 
lastsequence of the working DiskId should always be greater than that of the 
last sequence of the previous DiskId, if not the results should be skipped, 
currently it is trying to read from DiskId's that have zero as the 
LastSequence but 22 as the DiskId. Zero indicates the first entry in the 
media table(if your in DiskId 1). as you increment through the DiskId's the 
LastSequence should increment as well, if it doesnt you skip that install 

This is what causes the cabinet bugs in bugs #4533 and #5139.

A quick fix , but not the solution would be to change the query so it 
doesn't return the results from the media table if the LastSequence is 0 and 
the DiskId is greater than 1.

The solution would be to rewrite the installer to do things the right way 
querying the Media table first, and then installing the files in order from 
the media table.

If someone could help me work on this it would be much appreciated as I'm 
kind of rusty in C, I'm a perl monger by trade and not very familiar with 
wine's msi innerworkings.

As you'll see in MSDN the file and media table sequence and LastSequence 
correspond with one another. Each has checks upon the other to determine the 
proper install order.

More information about the wine-devel mailing list