Skip to content

Conversation

@modmuss50
Copy link
Member

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.

@modmuss50 modmuss50 requested a review from Copilot July 23, 2025 20:16
Copy link

Copilot AI left a 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;
Copy link

Copilot AI Jul 23, 2025

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.

Copilot uses AI. Check for mistakes.
modmuss50 and others added 3 commits July 23, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants