-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsummary.go
More file actions
40 lines (29 loc) · 808 Bytes
/
summary.go
File metadata and controls
40 lines (29 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package msi
import (
"bytes"
"fmt"
"github.com/asalih/go-mscfb"
)
type SummaryInfo struct {
Properties *PropertySet
}
const defaultOsVersion = 10
var fmtIdSummaryInfo = []byte("\xe0\x85\x9f\xf2\xf9\x4f\x68\x10\xab\x91\x08\x00\x2b\x27\xb3\xd9")
func NewSummary() *SummaryInfo {
propset := NewPropertySet(Win32, defaultOsVersion, fmtIdSummaryInfo)
propset.CodePage = CodePageDefault()
return &SummaryInfo{
Properties: propset,
}
}
func (s *SummaryInfo) ReadSummaryInfo(reader *mscfb.Stream) (*SummaryInfo, error) {
propertySet, err := ReadPropertySet(reader)
if err != nil {
return nil, err
}
if propertySet.FmtID != nil && !bytes.Equal(propertySet.FmtID, fmtIdSummaryInfo) {
return nil, fmt.Errorf("invalid property set format id")
}
s.Properties = propertySet
return s, nil
}