-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest.go
67 lines (54 loc) · 1.3 KB
/
manifest.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"github.com/tc-hib/winres"
"github.com/tc-hib/winres/version"
"image"
"log"
"os"
)
func setup_syso() {
// First create an empty resource set
rs := winres.ResourceSet{}
// Make an icon group from a png file
f, err := os.Open("./resources/gh_icon.png")
if err != nil {
log.Fatalln(err)
}
defer f.Close()
img, _, err := image.Decode(f)
if err != nil {
log.Fatalln(err)
}
f.Close()
icon, _ := winres.NewIconFromResizedImage(img, nil)
// Add the icon to the resource set, as "APPICON"
rs.SetIcon(winres.Name("APPICON"), icon)
// Make a VersionInfo structure
vi := version.Info{
FileVersion: [4]uint16{1, 0, 0, 0},
ProductVersion: [4]uint16{1, 0, 0, 1},
}
vi.Set(0, version.ProductName, "GeneHacker")
vi.Set(0, version.ProductVersion, "v1.0.0.0")
// Add the VersionInfo to the resource set
rs.SetVersionInfo(vi)
// Add a manifest
rs.SetManifest(winres.AppManifest{
/*
THIS IS FOR ADMINISTRATOR
*/
// ExecutionLevel: winres.RequireAdministrator,
// DPIAwareness: DPIPerMonitorV2,
UseCommonControlsV6: true,
})
// Create an object file for amd64
out, err := os.Create("rsrc_windows_amd64.syso")
defer out.Close()
if err != nil {
log.Fatalln(err)
}
err = rs.WriteObject(out, winres.ArchAMD64)
if err != nil {
log.Fatalln(err)
}
}