Files

29 lines
1.4 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 交叉编译 Direct2D 界面壳 → shell64.dll / shell32.dll
# 用法: ./build-classic.sh [源码] (默认 shell6.cpp)
# 依赖: x86_64-w64-mingw32-g++ / i686-w64-mingw32-g++
# 注意: 必须带 -Wl,--kill-at,否则导出名带 @N 后缀,GetProcAddress("VerifyMain") 取不到
set -euo pipefail
DIR=$(cd "$(dirname "$0")" && pwd)
SRC=${1:-$DIR/shell6.cpp}
OUTDIR=${2:-$DIR/out}
mkdir -p "$OUTDIR"
COMMON=(-std=c++17 -O2 -shared -s -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN32_LEAN_AND_MEAN)
# 导入表按实测产物取:ADVAPI32/bcrypt/d2d1/DWrite/GDI32/KERNEL32/msvcrt/ole32/USER32/WINHTTP
LIBS=(-static -ladvapi32 -lbcrypt -ld2d1 -ldwrite -lgdi32 -lole32 -luser32 -lwinhttp -Wl,--kill-at)
x86_64-w64-mingw32-g++ "${COMMON[@]}" -o "$OUTDIR/shell64.dll" "$SRC" "${LIBS[@]}"
echo "生成 $OUTDIR/shell64.dll($(stat -c%s "$OUTDIR/shell64.dll") 字节)"
if command -v i686-w64-mingw32-g++ >/dev/null 2>&1; then
i686-w64-mingw32-g++ "${COMMON[@]}" -o "$OUTDIR/shell32.dll" "$SRC" "${LIBS[@]}"
echo "生成 $OUTDIR/shell32.dll($(stat -c%s "$OUTDIR/shell32.dll") 字节)"
else
echo "跳过 x86:未安装 i686-w64-mingw32-g++"
fi
echo "产物是 DLL,加壳器会把它嵌进 .vfy 节;要更新资产请替换 assets/shell64.bin 并重新打壳验证。"
echo "logf_ 的落盘日志补丁见 ../README.md(改完源码重编会自动带上/不带日志,先确认要哪种)。"