Rust reference model of SFC Earthworks4D/Gradework Setup-Factory installer: callout removal + USB-key bypass (REA+Ghidra)
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-06 23:54:06 -07:00
src Rust reference model: Setup-Factory engine container, license gate, callout dispatcher, HASP USB-key mimic (REA+Ghidra 12.1.4 decompile) 2026-11-06 23:54:06 -07:00
.gitignore Rust reference model: Setup-Factory engine container, license gate, callout dispatcher, HASP USB-key mimic (REA+Ghidra 12.1.4 decompile) 2026-11-06 23:54:06 -07:00
Cargo.toml Rust reference model: Setup-Factory engine container, license gate, callout dispatcher, HASP USB-key mimic (REA+Ghidra 12.1.4 decompile) 2026-11-06 23:54:06 -07:00
README.md Rust reference model: Setup-Factory engine container, license gate, callout dispatcher, HASP USB-key mimic (REA+Ghidra 12.1.4 decompile) 2026-11-06 23:54:06 -07:00

sfc-earthworks4d-ref

Rust reference model of the SFC Earthworks4D / Gradework 4D installer (Gradework4D112.5.6x64.exe), produced by reverse-engineering the installer engine with REA + Ghidra 12.1.4 (115 license-related functions decompiled).

Purpose: a readable, testable spec for removing Setup-Factory call-outs and bypassing / mimicking the vendor USB key (HASP/Sentinel-type dongle).

What the engine is

  • Indigo Rose Setup Factory engine: PE stub + zlib engine blob (~579 KB, offset ~0x3ec00 in the installer) + zlib manifest (file/import tables).
  • Licensing runs through two named call-outs, GetSerialOK and SerialCheck, which the engine dispatches to a loadable serial DLL (Serial.dll/Serial32.dll) that talks to the USB key.
  • A registration blob (LicenseRecord: Serial, Company, User, ProgName, Version, InstallDir) is built and verified; machine tags <ComputerName>, <CurrentDomainName>, <UserName> are expanded by the engine (Ghidra: FUN_0049765c, FUN_004a049c).
  • UI call-outs gated by the same flag: LicenseDlg, UnregisteredCopyLabel.

Crate layout

Module Models
container installer container: PE stub + zlib streams, probe()
license LicenseRecord blob round-trip, SerialVerifier (GetSerialOK + SerialCheck)
hasp the USB key: present/absent, per-slot read, key-side serial check
callouts Setup-Factory call-out dispatcher (engine -> license/hasp)
bin/ew4d CLI: probe <installer.exe>, check <serial>, status

Features = the bypass strategies

  • usb-emulate (default) — mimic the USB key: hasp::key_present() is always true, key slots serve EARTHWORKS4D, so the dongle check passes with no hardware. Real engine equivalent: a proxy Hasplc/Serial.dll that answers like the key.
  • no-callouts — remove the call-outs: callouts::dispatch() suppresses GetSerialOK, SerialCheck, LicenseDlg and UnregisteredCopyLabel (defaults to OK). Real-engine equivalent: patch the script so the license gate and dialogs are never invoked.
cargo test                                  # 7 tests
cargo run -q -- status                      # licensed: true (emulated key)
cargo run -q -- check SFC123456
cargo run -q -- probe Gradework4D112.5.6x64.exe
cargo build --no-default-features --features no-callouts

RE artifacts (not in this repo)

  • work/ghidra_decompile2.txt — 115 decompiled license functions
  • work/rea_engine.md — REA analysis of Engine_unpacked.exe
  • work/manifest_dec.bin — decompressed installer manifest (call-out + import tables)