tc-hib / go-winres Goto Github PK
View Code? Open in Web Editor NEWCommand line tool for adding Windows resources to executable files
License: BSD Zero Clause License
Command line tool for adding Windows resources to executable files
License: BSD Zero Clause License
Hi,
Love this project and how easy it makes embedding Windows resources.
I might be hitting some really obscure Windows bug, but for some reason my 256px icon embedded with go-winres is not being displayed at full resolution (ie. when using (Extra) Large icons in Explorer).
You can see the comparisons with go-winres
here in Explorer using Extra Large icons:
My winres/
folder here: https://github.com/optix2000/totsugeki/tree/v0.2.0/winres
Running Windows 10.0.19043.1110
I've even tried adding all the "required" sizes (16px, 32px, 48px, 256px) to no avail. https://github.com/optix2000/totsugeki/tree/16xicon/winres
Is there some limitation or option that needs to be set for the 256px icon to be used at full resolution?
Will this feature be supported in the future?
I tried using go winres extract, but some files encountered errors:
[RT_VERSION] [# 1] [0804] Unhandled code page
Some files will succeed, but the following error will occur when patching to a new PE file:
Not enough room to add. rsrc section header
Would you like show me the format?
Hello,
I am cross-building a windows binary from linux. I used go-winres to generate rsrc files, but I didn't find a way to get it included in the executable.
I tried to put the files both in the project root as well as in the same directory than the main, but it didn't work.
Am I missing something?
The documentation mentions that go build automatically embeds in the executable
, but I didn't find any reference or documentation about this behavior or how it's supposed to work. Could you please give some additional references?
This is how I compile the binary for windows:
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build -o ./bin/main.exe ./cmd/main.go
And my json file (it's a bit messy because I tried many things, but still nothing works):
{
"RT_GROUP_ICON": {
"APP": {
"0000": "../assets/icon.png"
},
"IDI_ICON1": {
"0409": "../assets/icon.png"
}
},
"RT_MANIFEST": {
"#1": {
"0409": {
"description": "Project name"
}
}
},
"RT_VERSION": {
"#1": {
"0000": {
"info": {
"0409": {
"ProductName": "Project name"
}
}
}
}
}
}
icon.png error
Im doing all like in readme, but there is no resources.
Video of what im doing
My go version is go1.20.4 windows/amd64
This causes Window to display 0.0.0.0
under "Details > File Version". For some reason --product-version
"works", even though it doesn't set fixed.product_version
either (checked via resource hacker)
Hi, I use go-winres in own Go Qt UI project. I added an icon for the app, and the icon display anywhere but task bar. How to fix that?
If create lnk file for binary file, the icon will be display. But if run binary directly the icon will not be display.
My res config for icon:
"RT_GROUP_ICON": {
"APP": {
"0000": [
"icon.png",
"icon.png",
"icon.png",
"icon.png"
]
},
"#42": {
"0409": "icon.ico",
"040C": "icon.ico"
},
"MAINICON": {
"0409": "icon.ico"
},
"OTHER": {
"0000": "icon.ico"
}
}
Result:
I have a git repository which contains 2 applications and git tag
produces this:
helm-chart/0.1.0
helm-chart/0.1.1
syntax/v0.1.0
v1.0.0
and git describe --tags
outputs this: helm-chart/0.1.1-28-gdeef00fd5
which is not indented.
However, if go-winres would implement a git-tag filter, like git describe --tags --match 'v*'
, the correct tag would be returned: v1.0.0-40-gdeef00fd5
Hi,
I've just installed your tool with "go get github.com/tc-hib/go-winres@latest".
I'm trying to generate resources with "simply" command this way:
go-winres simply --product-version=git-tag --file-version=git-tag --file-description="MKey process" --icon=winres/#1_0409.ico
But when I compile de .exe file, It takes correctly the file description and ico but it shows "git-tag" texts as Product Version and "0.0.0.0" as File-Version.
If I generate the res file with go-winres make --product-version=git-tag --file-version=git-tag
it works fine. What could I be doing wrong with the Simply command?
allow to pass a root directory where the application starts looking for all of its files.
default value would be .
(current directory)
go run github.com/tc-hib/go-winres@latest make --product-version=git-tag --in-dir "./cmd/my-application"
would then start tro look for winres/winres.json
in ./cmd/my-application
(= ./cmd/my-application/winres/winres.json
)
--out-dir
would allow to put the resulting files in the specified directory and not in the current working directory.
By default it might be set to .
as well.
go run github.com/tc-hib/go-winres@latest make --product-version=git-tag --in-dir "./cmd/my-application" --out-dir "./cmd/my-application"
would put the resulting files into --out-dir
cd /d %~dp0
attrib VERSION|find "A "&&call :newVer
attrib winres\*|find "A "&&call :newWinres
goto :EOF
:newVer
attrib -a VERSION
set /p VERSION=<VERSION
git tag v%VERSION%-lw
git push origin --tags
:newWinres
attrib -a winres\*
go-winres make --product-version=git-tag --file-version=git-tag
I have tried:
hModule, err := GetModuleHandle(nil)
hIcon, hModule = _LoadImage(mh, syscall.UTF16PtrFromString("APP"), 0, 0, 0)
hIcon, hModule = _LoadImage(mh, MakeIntResource(42), 0, 0, 0)
But both fail with The specified resource type cannot be found in the image file.
The winres.json file contains:
"RT_GROUP_ICON": {
"APP": {
"0000": "icon_256.png",
]
},
"#42": {
"0000": "icon_256.png"
}
},
does the go-winres make
support arm64 Architect?
processorArchitecture | Specifies the processor. Valid values include x86, amd64, arm and arm64. Optional.
Hello,
I'm trying to compile a program for Windows/amd64 using this module and it works fine to add an icon and manifest with the go-winres patch
command on a small test version of my app.
I get not enough room to add .rsrc section header
when doing the same compilation on the definitive version of the same app that is much larger. I dont understand why the header size would be different and i can't find a relatable solution on internet.
I tried adding the --delete
option but it didn't change anything.
Any idea of the reason I could have this strange behaviour?
Thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.