- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5
Embed installer .jar within exe's resources #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR embeds the installer JAR file within the EXE's resources to enable proper code signing, replacing the previous approach where the JAR was appended to the end of the EXE file. The change introduces a new packager application for bundling and implements resource extraction in the bootstrap.
Key changes:
- Adds a new packager application to embed JAR files as resources in the EXE
- Implements embedded resource extraction and execution in the bootstrap
- Integrates Microsoft WIL library to simplify Windows API boilerplate code
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description | 
|---|---|
| src/EmbeddedResource.h/cpp | New classes for extracting embedded resources from EXE | 
| src/Bootstrap.h/cpp | Modified to extract and use embedded installer instead of appended JAR | 
| src/SystemHelper.h/cpp | Refactored to use WIL library helpers and const reference parameters | 
| packager/packager.cpp | New packager application for embedding JAR files into EXE resources | 
| Project files | Updated to include WIL library, new source files, and packager project | 
| #include <Windows.h> | ||
|  | ||
| namespace { | ||
| constexpr auto IDI_EMBEDDED_JAR = 201; | 
    
      
    
      Copilot
AI
    
    
    
      Jul 23, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resource ID constant IDI_EMBEDDED_JAR is duplicated. It should be defined in the shared resource.h file and included here to avoid magic numbers and maintain consistency.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
This is a prerequisite for signing the native .exe installer, previously the installer .jar was appended to the end of the .exe file. This means a signed .exe could have its .jar replaced with other code, allowing anyone to use our signed .exe to run their own code. We want to emebed the installer within the .exe to ensure that its covered by the code signature.
This PR introduces a new packager application that can be used by the Java installer build to generate a .exe with the jar installer bundled within the bootstrap .exe. This removes the need to recompile the native boostrap for each new installer build. The final .exe can then be signed.
The bootstrap now extracts the embeded jar into the temp directory before running it with java. I have also added the microsoft/wil library to handle a lot of the boiler plate.
Needs properly testing, especially on older Windows versions and with a signed exe.