Skip to content

Commit

Permalink
Generate RT_GROUP_ICON id before ICON ids
Browse files Browse the repository at this point in the history
This ensures the group icon always has a consistent ID that can be used by the application to find the icon, even when the ico file itself contains a different number of resolution variations.
  • Loading branch information
tmm1 authored and akavel committed Dec 10, 2020
1 parent 96a5f1b commit 67980f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rsrc/rsrc.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ func addIcon(out *coff.Coff, fname string, newid func() uint16) (io.Closer, erro
Type: 1, // magic num.
Count: uint16(len(icons)),
}}
gid := newid()
for _, icon := range icons {
id := newid()
r := io.NewSectionReader(f, int64(icon.ImageOffset), int64(icon.BytesInRes))
out.AddResource(coff.RT_ICON, id, r)
group.Entries = append(group.Entries, _GRPICONDIRENTRY{icon.IconDirEntryCommon, id})
}
id := newid()
out.AddResource(coff.RT_GROUP_ICON, id, group)
out.AddResource(coff.RT_GROUP_ICON, gid, group)
// TODO(akavel): reintroduce the Printlns in package main after Embed returns
// fmt.Println("Icon ", fname, " ID: ", id)
}
Expand Down

0 comments on commit 67980f0

Please sign in to comment.