Skip to content

ahnshy/WinSFXMaker

Repository files navigation

πŸ“¦ WinSFXMaker

SelF eXtract Maker for Windows.
βœ… Tested on Windows 10 / Visual Studio 2013 (Minimum build WindowsXP)

πŸ“– Overview

WinSFXMaker is a very super simple install-sheild GUI tool for creating self-extracting (SFX) executables on Windows. It allows users to bundle ZIP archives into standalone .exe files that automatically extract and optionally run an installer or other program.

πŸ”‘ Key Features

  • βœ… Easy-to-use SFX archive generator
  • βœ… Custom post-extraction command support
  • βœ… Lightweight and dependency-free portable exe binary.
  • βœ… Intuitive GUI with file pickers
  • βœ… ZIP file bundling into a Windows EXE
  • βœ… Custom post-extraction execution (e.g., launch installer.exe)
  • βœ… Logging support via log4cpp
  • βœ… Resource management using SFXTemplate and res/

πŸ› οΈ Stacks

C++14 log4cpp minizip MFC

βš™οΈ Dev Environment

  • Platform: Windows (32-bit / 64-bit)
  • Language: C+ +ISO 14 with MFC and GDI+

🧩 Build Requirements

  • Visual Studio 2013 (v120 toolset)
  • MFC (Microsoft Foundation Classes)
  • Windows SDK

πŸ“ Source Tree

/
β”œβ”€β”€ Dialog/                # Dialog UI logic
β”œβ”€β”€ Helper/                # Utility functions
β”œβ”€β”€ SFXTemplate/           # Template EXE and metadata
β”œβ”€β”€ UI/                    # Icons and GUI resources
β”œβ”€β”€ ZipArchive/            # ZIP compression/decompression (minizip-based)
β”œβ”€β”€ log4cpp/               # Integrated log4cpp source
β”œβ”€β”€ res/                   # Resource files (icons, templates, etc.)
β”œβ”€β”€ WinSFXMaker.*          # Core application logic
└── README.md              # Project documentation

πŸ“€ How to build (Visual Studio 2013 on Windows 10)

  1. Clone the repository:

    git clone https://github.com/ahnshy/WinSFXMaker.git
    cd WinSFXMaker
  2. Open the solution:

    • Launch WinSFXMaker.sln in Visual Studio 2013 or later
  3. Choose build config:

    • Select Release or Debug mode
    • Choose x64 or Win32 platform
  4. Build:

    • Build ALL_BUILD or the WinSFXMaker target

πŸš€ How to Use

  1. Launch WinSFXMaker.exe
  2. Select the input ZIP file (e.g., setup.zip)
  3. Specify output EXE file name (e.g., installer.exe)
  4. Enter post-extraction command (e.g., setup.exe)
  5. Click "Create SFX" to generate a standalone installer

🧰 CLI Mode

You can generate SFX files without the GUI by using command-line arguments.

βœ… Basic Usage

WinSFXMaker.exe [options]

🧩 Options

Option Description
-p, --path <path> Folder path to compress (required)
-o, --output <file> Output SFX file path (auto-generated if omitted)
-i, --icon <file> Icon file (.ico)
-r, --run <file> File to run after extraction (relative or absolute path)
-v, --version <version> Version string (e.g., "1.0.0.0")
-n, --name <name> Product name
-c, --copyright <text> Copyright info
-d, --description <text> File description
-s, --silent Run with no console output (Silent mode)
-h, --help Show help

πŸ§ͺ Examples

1) Basic

WinSFXMaker.exe -p "C:\MyApp"

Compresses C:\MyApp and creates C:\MyApp\MyApp.exe

2) Specify output path

WinSFXMaker.exe -p "C:\MyApp" -o "C:\Output\Setup.exe"

3) Run a file after extraction

WinSFXMaker.exe -p "C:\MyApp" -r "MyApp.exe"

Automatically runs MyApp.exe after extracting

4) Run a file in a subfolder

WinSFXMaker.exe -p "C:\MyApp" -r "bin\Release\MyApp.exe"

Automatically runs bin\Release\MyApp.exe after extracting

5) Absolute-path run target

WinSFXMaker.exe -p "C:\MyApp" -r "C:\MyApp\bin\Release\MyApp.exe"

The run target is automatically stored as a relative path (bin\Release\MyApp.exe) when possible

6) Include icon & version metadata

WinSFXMaker.exe -p "C:\MyApp" -o "C:\Output\Setup.exe" -i "app.ico" -r "Setup.exe" -v "1.0.0.0" -n "My Application" -c "Copyright 2024" -d "My App Installer"

7) Silent mode (for automated builds)

WinSFXMaker.exe -p "C:\MyApp" -r "Setup.exe" -s

Runs without console output

8) Show help

WinSFXMaker.exe --help

πŸ–₯️ Sample CLI Output

WinSFXMaker - CLI Mode
======================
Input Path:  C:\MyApp
Output File: C:\MyApp\MyApp.exe
Icon:        C:\icons\app.ico
Run After:   Setup.exe

Compressing files...
Preparing template...
Applying icon...
Applying version info...
Creating SFX file...

SFX file created successfully!
Output: C:\MyApp\MyApp.exe



🧱 SFX File Layout

Internal structure of the generated SFX file:

[EXE Template] + [ZIP Data] + [ZIP Size (8 bytes)] + [Run-File Info (optional)]

If run-file info exists:

[EXE Template] + [ZIP Data] + [ZIP Size (8 bytes)] + [RUNA Marker (4 bytes)] + [Path Length (4 bytes)] + [Path String] + [END! Marker (4 bytes)]



🧾 Log Files

When the program runs, it creates a log file next to the executable.

  • WinSFXMaker.exe β†’ WinSFXMaker.log
  • MySetup.exe (generated SFX) β†’ MySetup.log

πŸ“„ Log Format

[2024-12-25 12:34:56.789] [INFO] === WinSFXMaker Started ===
[2024-12-25 12:34:57.123] [INFO] Selected input path: C:\MyApp
[2024-12-25 12:34:58.456] [INFO] Create SFX button clicked
[2024-12-25 12:34:59.789] [INFO] SFX file created successfully: C:\Output\Setup.exe



πŸ“Œ Notes

  • Ensure your post-extraction executable exists inside the ZIP archive
  • Some commands may require elevated privileges (UAC prompt)
  • You can customize the icon and stub using the res/ folder

πŸ’» [Preview]

image image image image

πŸ” Acknowledgements

  • Product Design and Developed by ahnshy

  • Built with:

    • Microsoft Win32 / MFC & GDI+
    • log4cpp for logging
    • minizip for archive management
  • Inspired by traditional SFX packaging workflows

πŸ“ License

This project includes components like log4cpp and minizip, which are licensed under their respective open-source licenses.
Please verify usage rights before redistribution.

log4cpp LGPL 2.1 (Lesser General Public License v2.1)
minizip zlib/libpng License

About

SelF eXtract Maker for windows. (WinSFXMaker is a very super simple install-sheild GUI tool for creating self-extracting (SFX) executables on Windows.)

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors