Skip to content

Commit

Permalink
Merge pull request #182 from ne1llee/msi
Browse files Browse the repository at this point in the history
Add support for MSI file format
  • Loading branch information
gabriel-vasile committed Aug 30, 2021
2 parents 3937c11 + 1f64204 commit c20b02e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions internal/magic/ms_office.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ func Msg(raw []byte, limit uint32) bool {
})
}

// Msi matches a Microsoft Windows Installer file.
// http://fileformats.archiveteam.org/wiki/Microsoft_Compound_File
func Msi(raw []byte, limit uint32) bool {
return matchOleClsid(raw, []byte{
0x84, 0x10, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
})
}

// Helper to match by a specific CLSID of a compound file.
//
// http://fileformats.archiveteam.org/wiki/Microsoft_Compound_File
Expand Down
Binary file added testdata/msi.msi
Binary file not shown.
8 changes: 5 additions & 3 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ var (
pptx = newMIME("application/vnd.openxmlformats-officedocument.presentationml.presentation", ".pptx", magic.Pptx)
epub = newMIME("application/epub+zip", ".epub", magic.Epub)
jar = newMIME("application/jar", ".jar", magic.Jar)
ole = newMIME("application/x-ole-storage", "", magic.Ole, aaf, msg, xls, pub, ppt, doc)
aaf = newMIME("application/octet-stream", ".aaf", magic.Aaf)
doc = newMIME("application/msword", ".doc", magic.Doc).
ole = newMIME("application/x-ole-storage", "", magic.Ole, msi, aaf, msg, xls, pub, ppt, doc)
msi = newMIME("application/x-ms-installer", ".msi", magic.Msi).
alias("application/x-windows-installer", "application/x-msi")
aaf = newMIME("application/octet-stream", ".aaf", magic.Aaf)
doc = newMIME("application/msword", ".doc", magic.Doc).
alias("application/vnd.ms-word")
ppt = newMIME("application/vnd.ms-powerpoint", ".ppt", magic.Ppt).
alias("application/mspowerpoint")
Expand Down

0 comments on commit c20b02e

Please sign in to comment.