View Single Post
  #6  
Old 08-04-2026, 13:09
BLACKFIRE69's Avatar
BLACKFIRE69 BLACKFIRE69 is offline
Registered User
 
Join Date: Mar 2019
Location: In the Hell
Posts: 688
Thanks: 481
Thanked 2,547 Times in 561 Posts
BLACKFIRE69 is on a distinguished road
Arrow

FXPacker API Interface
======================

Secure archive handling library designed for integration with Inno Setup.
Provides multi-layered protection with password-based access control (AES-256),
executable binding verification, Runtime executable state matching and
Host-state coupling synchronization.

Code:
> Support:
- Supports both standard distribution (external data file) and
  Single-EXE distribution (data file embedded directly inside the installer).

> Compatibility:
- Inno Setup v6.0 or later (Required)
- Inno Setup v6.5 or later (Required for Partial Safe Mode)

> Specifications:
- Version       : 3.0.0.0
- Author        : BLACKFIRE69
- Build         : 699CEA00
- Compatibility	: Inno Setup v6.x, v6.5 or later
- License       : Proprietary (See LICENSE file for details)

> Distribution:
- FXPackerAPI.dll — Core API library. Exposes all packing and unpacking
                    functions for direct integration into Inno Setup
                    pascal scripts.

- FXPackerCLI.exe — Command-line interface. Provides full packing
                    functionality via terminal commands. Suitable for
                    build pipeline and automation integration.

- FXPackerGUI.exe — Graphical interface. Provides full packing
                    functionality via a visual interface. Suitable for
                    manual archive creation and workflow configuration.
Code:
> Protection Layers:
- Layer 1 — Password-based access control (AES-256)
- Layer 2 — Executable binding verification
- Layer 3 — Runtime executable state matching and Host-state coupling synchronization.

> Modes:
- Safe Mode         : Full protection — all 3 layers active.
                      Standard distribution with an external data file.

- Partial Safe Mode : Embedded distribution — Designed to allow the data
                      file to be embedded directly into the installer (Single-EXE)
                      via Inno Setup compilation.

- Unsafe Mode       : Layer 1 only — password protection exclusively.
                      Anyone with the correct password can extract the
                      data file. Intended for initial template creation
                      in the Partial Safe workflow and debugging purposes only.
Code:
> Important:
- Safe and Partial Safe modes require the exact same executable that was
  present during the packing process. The correct password alone is not
  sufficient to extract the data file — the executable identity must also
  match. Only Unsafe mode allows extraction with the password alone.

> Features:
- Standard and Single-EXE (embedded) distribution modes
- Detailed logging support (API, CLI, and GUI)
- Automatic protection mode detection on extraction
- Inno Setup credential storage and retrieval
- Buffer, stream, and file input/output support
- Progress tracking for packing, extraction, and processing
- Detailed error reporting via FXGetLastError
- Cross-platform pointer and type conversion utilities

* Basic DataFile Creation

Code:
1. Open `Example.iss` and compile it (`MySetup.exe`). 

2. Generate Data File:

FXPackerCLI.exe ^
	-e:".\MySetup.exe" ^
	-p:"Secret123" ^
	-i:"inno_key_here" ^
	".\Resources\*" ^
	".\Img\*.png"
- innosetup-unpacking -

Code:
[Setup]
// Encryption
Encryption=True
Password=inno_key_here
//
Code:
function InitializeSetup(): Boolean;
begin
  Result := FXUnpackInit(ExpandConstant('{src}\Setup.dat'), 'Secret123');

  if not Result then
    ShowErr('Failed to initialize the setup. Error: ' + FXGetLastError());
end;

function CheckPassword(Password: String): Boolean;
begin
  Result := (Password = FXUnpackRefineStr(FXUnpackGetStoredInnoEncryptionKey));
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpPassword then
    WizardForm.PasswordEdit.Text := FXUnpackRefineStr(FXUnpackGetStoredInnoEncryptionKey)
  else
    WizardForm.PasswordEdit.Text := '';
end;

procedure InitializeWizard();
var
  Res: Boolean;
begin
  Res := FXUnpackExtractFile('button.png', ExpandConstant('{src}\_OutImg'));
end;

procedure DeinitializeSetup();
begin
  FXUnpackReleaseResources;
end;
* Partial Secure (Embedded Mode) - 3 Pass Workflow:

This mode allows the data file to be embedded directly into the installer (Single-EXE) via Inno Setup compilation.

Step-by-Step Workflow

# Pass 1: The Initial Template

Code:
1. Create Initial Archive: Open `FXPacker.exe`. Add your files and set a password. 
2. Enable 'Unsafe Mode': This allows the initial archive to be created without an EXE target.
3. Generate Data: Click 'Create Archive'. This creates your initial `Setup.dat`.
4. Compile Setup: Open `Example.iss` and compile it. 
   > Result: You now have a "Template EXE" (`MySetup.exe`).

code:
FXPackerCLI.exe ^
	--unsafe ^
	-p="@#123_Test"  ^
	-i="Jrsoftware"  ^
	".\Files\Img\*"
# Pass 2: Binding Step 1

Code:
5. Configure Packer: 
   - In `FXPacker.exe`, select the `MySetup.exe` you just created as the Target EXE.
   - Set the `Setup.dat` from Pass 1 as the Parent File.
6. Disable 'Unsafe Mode': Security must be active for this step.
7. Enable 'Partial Secure': This triggers the internal identity-binding logic.
8. Select 'Partial Step 1': Required for the first binding pass.
9. Update Data: Click 'Create Archive' to overwrite `Setup.dat`.
10. Compile Setup: Go back to Inno Setup and compile the script again.

code:
FXPackerCLI.exe ^
	--psafe  ^
	-s=1  ^
	-e="MySetup.exe"  ^
	-o="Setup.dat"  ^
	-p="@#123_Test"  ^
	-i="Jrsoftware"  ^
	".\Files\Img\*"
# Pass 3: Binding Step 2 (Final)

Code:
11. Configure Packer: 
    - Keep `MySetup.exe` as the Target EXE.
    - Use the updated `Setup.dat` from Pass 2 as the Parent File.
12. Select 'Partial Step 2': This performs the final verification wrap.
13. Finalize Data: Click 'Create Archive' to overwrite `Setup.dat` one last time.
14. Re-Compile: Go back to Inno Setup and compile the script for the final build.

code:
FXPackerCLI.exe ^
	--psafe  ^
	-s=2  ^
	-e="MySetup.exe"  ^
	-o="Setup.dat"  ^
	-p="@#123_Test"  ^
	-i="Jrsoftware"  ^
	".\Files\Img\*"
- innosetup-unpacking -

Code:
- Same as the 'Basic DataFile Creation'.
Code:
* Result:

You can now distribute just `MySetup.exe`. 
It contains the finalized, calibrated `Setup.dat` embedded internally. 
No external data file is needed!

* Security Note: 

If you change your installer script (code, icons, or version), 
you must repeat the binding steps to ensure the security handshake remains valid.

.
Attached Images
File Type: png 1.png (18.3 KB, 68 views)
File Type: png 2a.png (20.2 KB, 68 views)
File Type: png 2b.png (30.3 KB, 68 views)
File Type: png 3.png (21.0 KB, 68 views)
File Type: png 4.png (137.9 KB, 68 views)
File Type: png 5.png (106.3 KB, 68 views)
File Type: png 6.png (13.6 KB, 68 views)
Attached Files
File Type: 7z FXPacker v3.0 [All] + Examples.7z (1.78 MB, 11 views)
Reply With Quote
The Following 5 Users Say Thank You to BLACKFIRE69 For This Useful Post:
ADMIRAL (11-04-2026), Cesar82 (08-04-2026), Ele (14-04-2026), Razor12911 (09-04-2026), ScOOt3r (09-04-2026)