Chris said:
The MsiViewGetColumnInfo API can get you all the information you need and is the
supported method for obtaining this information. Select the columns you are
interested in (or perform a "SELECT *" to simply grab everything in the table)
then call MsiViewGetColumnInfo to get both the names and\or the column types.
This is a lot more expensive: to discover the entire schema, I have to
iterate over _Tables, and then perform SELECT* on each - even though I'm
not interested in a single record. It's also more tedious to obtain the
information, as MsiViewGetColumnInfo does *not* tell me what the primary
keys are.
Reading the internal column state is dangerous both because the values could
concievably change and because correctly interpreting the values requires a
understanding of the internal implementation details of MSI. (In fact, the
definitions you list below are actually incorrect for many of the bits).
It's really unfortunate that that no documentation is provided. Even if
the interpretation changes, there must be a mechanism somehwere to
detect the change, or else future installers might not be
backward-compatible with old packages.
With this post, I'm hoping that the community starts maintaining the
information that Microsoft is unwilling to provide.
This entire approach would not be necessary if there was, for each
schema version, a sequence of SQL statements that initializes the
schema, instead of a template database. I would then just incorporate
this series of statements into my MSI generator.
Regards,
Martin