5

I'm using the Microsoft.Deployment.WindowsInstaller libraries to read out values from a .msi file. Properties are no problem, and the summary-information can also be read out, example:

 static void Main(string[] args)
 {
    using (var database = new QDatabase(@"C:\myMsi.msi", DatabaseOpenMode.ReadOnly))
    {
         Console.WriteLine(database.ExecutePropertyQuery("ProductVersion"));
         Console.WriteLine(database.ExecutePropertyQuery("ProductName"));
         Console.WriteLine(database.ExecutePropertyQuery("Manufacturer"));
         Console.WriteLine(database.ExecutePropertyQuery("ARPREADME"));
     }
 }

The QDatabase object even has a nice SummaryInfo property, holding the summary information. However, I haven't found out how to get the platform for which the .MSI is intended for.

It would seem that platform can be read out, as Orca also does this (the platform can be seen when opening the Summary Information in Orca).

How can I get the platform for which the .msi was intended?

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Daniel
  • 471
  • 5
  • 28

1 Answers1

5

You are using a class that is meant to do LINQ queries of the database. ExecutePropertyQuery is a method that simplifies querying the Property table. As you noted the information you seek isn't in the property table, it's in the Summary Information Stream. Specifically:

Template Summary property

using Microsoft.Deployment.WindowsInstaller;
using(Database database = new Database(PATH_TO_MSI, DatabaseOpenMode.ReadOnly))
{
  Console.WriteLine(database.SummaryInfo.Template);
}

The QDatabase class also exposes the SummaryInfo property also as it extends the Database class.

Queryable MSI database - extends the base Database class with LINQ query functionality along with predefined entity types for common tables.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Actually, I didn't see that the Database class also has an ExecutePropertyQuery function, this really means that I don't need the QDatabase (Linq) version. Thanks a lot for your answer, I now will just check if "64" occurs somewhere in the SummaryInfo.Template string. – Daniel Nov 12 '14 at 14:57
  • 2
    For future readers: checking if 64 occurs in the SummaryInfo.Template string only works if we are not interested on a distinction between Intel64 and x64 installers, see the http://msdn.microsoft.com/en-us/library/aa372070(v=vs.85).aspx for the actual possible values. – Daniel Nov 12 '14 at 15:06