Closed sebkur closed 1 year 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.
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.
This concerns:
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
Instead of building our own executable, this could work: https://github.com/electron/rcedit
Implemented via https://github.com/mobanisto/pe-rebrander in fb4566ca729d1e65035447ef9ba43a9140f82aa1
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.