winres

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package winres makes the Windows resources of planck-client.exe and planck-host.exe and checks a built exe for them.

MyGo's Windows backend gives its window class icon resource 1 (LoadIconW(instance, 1)), and go build links the .syso files of a main package. So each command keeps rsrc_windows_amd64.syso, made by Generate from assets/planck-windows.ico and internal/version (go run ./scripts/winres generate). The file also holds the version resource that Explorer's Details tab and SmartScreen show.

Index

Constants

View Source
const SysoName = "rsrc_windows_amd64.syso"

SysoName is the file go build links into a windows/amd64 build.

Variables

View Source
var IconSizes = []int{16, 20, 24, 32, 40, 48, 64, 128, 256}

IconSizes are the sizes the shell asks for at 100 % to 200 % scale: 16, 20, 24 for the small icon, 32, 40, 48 for the big one and the taskbar, and 64 to 256 for Explorer. The .ico must have each of them.

View Source
var Targets = []struct {
	Dir string
	Exe Exe
}{
	{"cmd/planck-client", Exe{Name: "planck-client", Description: "Planck"}},
	{"cmd/planck-host", Exe{Name: "planck-host", Description: "Planck Host"}},
}

Targets are the shipped commands, by the folder of their main package.

Functions

func Generate

func Generate(icoPath string, exe Exe, version string) ([]byte, error)

Generate returns the amd64 .syso file for the icon, the exe and the version.

Types

type Exe

type Exe struct {
	// Name is the file name without .exe, such as planck-client.
	Name        string
	Description string
}

Exe describes one executable for its version resource.

type Info

type Info struct {
	Version string
	Strings map[string]string
}

Info is what a version resource says about a file.

func Check

func Check(path string) ([]int, Info, error)

Check reads the resources of a PE file. It returns the sizes of icon group 1 and the version resource, and fails when the group misses one of IconSizes or an image it lists, or when there is no version resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL