mobanisto / pinpit-gradle-plugin

Platform Independent Native Packaging and Installer Toolkit
Apache License 2.0
50 stars 1 forks source link

Modfify Windows launcher with icon (rebrand) #6

Closed sebkur closed 1 year ago

sebkur commented 2 years ago

See https://github.com/openjdk/jdk/blob/master/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/ExecutableRebrander.java for what's happening when packaging using JPackage.

sebkur commented 2 years ago

In particular there's some native code executed with source in IconSwap.cpp.

Maybe we can compile this to a standalone .exe program and execute that using wine on Linux and natively on Windows.

sebkur commented 2 years ago

It would probably be even better to use a library such as https://github.com/imcdonagh/image4j for reading the ICO files and then manipulating the EXE cross-platform in Java code. However, I'm not sure how much secret sauce is contained in the UpdateResource() library call that the native code seems to do in order to put the icon into the exe.

sebnuc commented 2 years ago

This concerns:

pinpit-exe-properties

sebnuc commented 2 years ago

In ExecutableRebrander we have rebrandExecutable() which uses WinInstaller.template to update resources in the exe using UpdateResource(). It is defined like this with the uppercase placeholders being replaced:

FIXEDFILEINFO_FileVersion=FIXEDFILEINFO_FILE_VERSION
FIXEDFILEINFO_ProductVersion=FIXEDFILEINFO_FILE_VERSION
CompanyName=COMPANY_NAME
FileDescription=Installer of FILE_DESCRIPTION
FileVersion=FILE_VERSION
InternalName=INTERNAL_NAME
LegalCopyright=LEGAL_COPYRIGHT
OriginalFilename=ORIGINAL_FILENAME
ProductName=PRODUCT_NAME Installer
ProductVersion=FILE_VERSION
sebkur commented 2 years ago

Instead of building our own executable, this could work: https://github.com/electron/rcedit

sebkur commented 1 year ago

Implemented via https://github.com/mobanisto/pe-rebrander in fb4566ca729d1e65035447ef9ba43a9140f82aa1