0
votes

Many file types can be identified by their magic number, see e.g. here.

I want to tell if a file is a Microsoft Merge Module (see here)

Do Microsoft Merge Modules (.msm files) have a magic number? If not, how can I programmatically find out if a file is a Merge Module? I do not want to rely on the file extension (.msm).

1

1 Answers

1
votes

I'm not sure if merge modules have a magic number, but if you are looking to somehow inspect a generic file and determine if it's a .msm or not, maybe you could do something like this:

  1. Take a look at the vbscripts here - https://msdn.microsoft.com/en-us/library/windows/desktop/aa372865(v=vs.85).aspx

  2. Write a custom vb script to attempt to call OpenDatabase() on the file to see if it's a valid installer database file.

  3. Use WiRunSQL.vbs to run some SQL statement on the file and check to see if it has the table "Property" with a value for "ProductName".
    a. If so, it's a .msi
    b. If not, it's a .msm