feat(protect): 32 位程序也能用 DuiLib 多皮肤壳
问题:x86 一直固定用 classic 壳(Direct2D 单皮肤),选了 dark/light/industrial 等皮肤照样出经典界面 —— 界面上那句「DuiLib 皮肤只做了 64 位构建,32 位程序 固定用经典壳」就是这个限制的说明。预览图按选择显示,产物却是另一套界面。 根因不是技术不可行,是 DuiLib 的 payload DLL 只编了 x64 一份 (assets/shell64_dui.bin),AssetsThemed 里 x86 分支没有对应资产。 做法 - 装 i686-w64-mingw32 工具链,用同一份不修改的 DuiLib 源码编 32 位 libduilib32.a (排除 UIWebBrowser/UIRichEdit/UIActiveX/UIFlash,stb_image.c 按 C 编) - 用 shell9_v6.cpp 编出 shell32_dui.dll(1,018K,PE32 i386), 落在 assets/shell32_dui.bin - AssetsThemed 的 x86 分支:theme != classic → shell32_dui.bin - 新增 shell/duilib/build-duilib32.sh 记录完整构建方式(含老 DuiLib 的补丁清单) - 前端 zh/en 文案改为「32 位与 64 位共用同一套皮肤,效果一致」 验证(wine32 + Xvfb) - packthemed 打 32 位样本:theme=dark → .vfy size=1050997(DuiLib), theme=classic → .vfy size=337487(经典壳),差 700K 说明取的确实是不同 payload - 两个产物分别启动截图:dark 是深灰 + 4 个 tab(登录/注册/卡密充值/忘记密码) + 皮肤化标题栏;classic 是圆角卡片 + 单页「登录以继续」。界面完全不同, 确认 32 位真的换到 DuiLib 了 注意:assets 是 //go:embed 进 cmd/packthemed 和主服务的,改完必须重编 (CI 会做;本地验证要手动 go build ./cmd/packthemed)。
This commit is contained in:
BIN
Binary file not shown.
@@ -18,14 +18,14 @@ import (
|
||||
"verification-platform-backend/internal/model"
|
||||
)
|
||||
|
||||
//go:embed assets/blob64.bin assets/blob32.bin assets/shell64.bin assets/shell32.bin assets/shell64_dui.bin
|
||||
//go:embed assets/blob64.bin assets/blob32.bin assets/shell64.bin assets/shell32.bin assets/shell64_dui.bin assets/shell32_dui.bin
|
||||
var assets embed.FS
|
||||
|
||||
const (
|
||||
hdrSize = 48
|
||||
crcOff = 36
|
||||
secName = ".load"
|
||||
legacySec = ".vfy" // 旧产物用 .vfy,检测时一并识别(新产物一律写 .load)
|
||||
legacySec = ".vfy" // 旧产物用 .vfy,检测时一并识别(新产物一律写 .load)
|
||||
shellVer = 8
|
||||
secAttrib = 0x60000020 // CODE | EXECUTE | READ
|
||||
)
|
||||
@@ -71,18 +71,21 @@ func Assets(arch string) (blob, dll []byte, err error) {
|
||||
return AssetsThemed(arch, "classic")
|
||||
}
|
||||
|
||||
// AssetsThemed 按主题取壳:DuiLib 版只有 x64,x86 仍回落到 classic
|
||||
// AssetsThemed 按主题取壳。DuiLib 壳 x64 / x86 各有一份构建
|
||||
// (shell64_dui.bin / shell32_dui.bin),两边的皮肤完全一致。
|
||||
func AssetsThemed(arch, theme string) (blob, dll []byte, err error) {
|
||||
var bp, dp string
|
||||
switch arch {
|
||||
case "x64":
|
||||
bp, dp = "assets/blob64.bin", "assets/shell64.bin"
|
||||
// DuiLib 壳只有 64 位构建
|
||||
if theme != "" && theme != "classic" {
|
||||
dp = "assets/shell64_dui.bin"
|
||||
}
|
||||
case "x86":
|
||||
bp, dp = "assets/blob32.bin", "assets/shell32.bin"
|
||||
if theme != "" && theme != "classic" {
|
||||
dp = "assets/shell32_dui.bin"
|
||||
}
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("不支持的架构: %s", arch)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| 资产 | 说明 |
|
||||
|---|---|
|
||||
| `backend/internal/protect/assets/shell64_dui.bin` | x64 DuiLib 壳(7 套皮肤:dark/light/industrial/compact/split/card/terminal) |
|
||||
| `backend/internal/protect/assets/shell32_dui.bin` | x86 DuiLib 壳(同一套皮肤;用 `shell/duilib/build-duilib32.sh` 编) |
|
||||
| `backend/internal/protect/assets/shell64.bin`、`shell32.bin` | classic(Direct2D 单皮肤)壳 |
|
||||
| `backend/internal/protect/assets/shell_smali.tgz` | Android 壳(smali 源码,加壳时由 apktool 合并进 APK) |
|
||||
| `shell/duilib/shell9_v6.cpp` + `skins_v4.h` | DuiLib 壳的完整源码(XML 皮肤在头文件里) |
|
||||
|
||||
@@ -2664,7 +2664,7 @@
|
||||
"themeDark": "Dark · card key login",
|
||||
"themeLight": "Light · office style",
|
||||
"themeIndustrial": "Industrial blue · device licensing",
|
||||
"themeHint": "DuiLib skins are 64-bit builds only; 32-bit programs fall back to the classic shell automatically.",
|
||||
"themeHint": "After choosing, encrypt in the cloud and the produced shell renders with this skin. 32-bit and 64-bit programs share the same set of skins.",
|
||||
"themeCompact": "Compact banner · single row",
|
||||
"themeSplit": "Split · brand sidebar",
|
||||
"themeCard": "Wide card · two columns",
|
||||
|
||||
@@ -2683,7 +2683,7 @@
|
||||
"themeDark": "深色 · 卡密登录",
|
||||
"themeLight": "浅色 · 办公风",
|
||||
"themeIndustrial": "工业蓝 · 设备授权",
|
||||
"themeHint": "DuiLib 皮肤只做了 64 位构建,32 位程序固定用经典壳(服务端会自动回落)。选好后云端加密,产物验证弹窗就按这套皮肤渲染。",
|
||||
"themeHint": "选好后云端加密,产物验证弹窗就按这套皮肤渲染。32 位与 64 位程序共用同一套皮肤,效果一致。",
|
||||
"themeCompact": "极简横幅 · 单行激活",
|
||||
"themeSplit": "左右分栏 · 品牌竖栏",
|
||||
"themeCard": "宽扁卡片 · 双列说明",
|
||||
|
||||
Vendored
+3
-14
@@ -14,6 +14,9 @@ import type {
|
||||
ParamValueZeroOrMore,
|
||||
ParamValueZeroOrOne,
|
||||
} from 'vue-router'
|
||||
import type {
|
||||
_ExtractParamParserType,
|
||||
} from 'vue-router/experimental'
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface TypesConfig {
|
||||
@@ -304,13 +307,6 @@ declare module 'vue-router/auto-routes' {
|
||||
Record<never, never>,
|
||||
| never
|
||||
>,
|
||||
'/admin/logs': RouteRecordInfo<
|
||||
'/admin/logs',
|
||||
'/admin/logs',
|
||||
Record<never, never>,
|
||||
Record<never, never>,
|
||||
| '/admin/logs/'
|
||||
>,
|
||||
'/admin/logs/': RouteRecordInfo<
|
||||
'/admin/logs/',
|
||||
'/admin/logs',
|
||||
@@ -928,13 +924,6 @@ declare module 'vue-router/auto-routes' {
|
||||
views:
|
||||
| never
|
||||
}
|
||||
'src/pages/admin/logs.vue': {
|
||||
routes:
|
||||
| '/admin/logs'
|
||||
| '/admin/logs/'
|
||||
views:
|
||||
| 'default'
|
||||
}
|
||||
'src/pages/admin/logs/index.vue': {
|
||||
routes:
|
||||
| '/admin/logs/'
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# 交叉编译 32 位 DuiLib 多皮肤壳 → shell32_dui.dll(x86 对应 shell64_dui.dll)
|
||||
# 用法: DUILIB_DIR=/path/to/duilib ./build-duilib32.sh [源码] [输出目录]
|
||||
#
|
||||
# 与 64 位同源、同皮肤、同交互,只是工具链换成 i686。
|
||||
#
|
||||
# 前置:
|
||||
# 1. apt install g++-mingw-w64-i686
|
||||
# 2. 编 32 位 libduilib.a(见本文件末尾的说明,老 DuiLib 需要那几处改动)
|
||||
#
|
||||
# 产物拷进 backend/internal/protect/assets/shell32_dui.bin,
|
||||
# 然后 **必须重编 cmd/packthemed 与主服务**(资产是 //go:embed 进去的,
|
||||
# 不重编的话改了半天什么都没变,字节数一模一样)。
|
||||
set -euo pipefail
|
||||
|
||||
DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
SRC=${1:-$DIR/shell9_v6.cpp}
|
||||
DUILIB_DIR=${DUILIB_DIR:-/root/work/duilib-src}
|
||||
OUTDIR=${2:-$DIR/out}
|
||||
LIBDUILIB=${LIBDUILIB:-$OUTDIR/libduilib32.a}
|
||||
|
||||
[ -f "$LIBDUILIB" ] || {
|
||||
echo "缺少 $LIBDUILIB(32 位 libduilib.a)。"
|
||||
echo "先按下面步骤编:"
|
||||
echo " 1) 用 i686-w64-mingw32-g++ -c 逐个编 $DUILIB_DIR/DuiLib 下的 cpp,"
|
||||
echo " 排除 UIWebBrowser / UIRichEdit / UIActiveX / UIFlash"
|
||||
echo " (前三个 mingw 没有对应头,UIFlash 要 atlcomcli.h)"
|
||||
echo " 2) stb_image.c 必须用 i686-w64-mingw32-gcc 按 C 编(header-only,"
|
||||
echo " 否则链接时 stbi_load_from_memory 未定义)"
|
||||
echo " 3) i686-w64-mingw32-ar rcs libduilib32.a *.o"
|
||||
exit 1
|
||||
}
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
i686-w64-mingw32-g++ -std=c++17 -O2 -shared -s \
|
||||
-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN32_LEAN_AND_MEAN \
|
||||
-I"$DUILIB_DIR/shim" -I"$DUILIB_DIR" -I"$DUILIB_DIR/DuiLib" \
|
||||
-I"$DUILIB_DIR/DuiLib/Core" -I"$DUILIB_DIR/DuiLib/Control" \
|
||||
-I"$DUILIB_DIR/DuiLib/Layout" -I"$DUILIB_DIR/DuiLib/Utils" \
|
||||
-include "$DUILIB_DIR/shim/compat.h" -fpermissive -w \
|
||||
-o "$OUTDIR/shell32_dui.dll" "$SRC" "$LIBDUILIB" \
|
||||
-static -lcomctl32 -lgdiplus -lole32 -loleaut32 -luuid -lshlwapi -limm32 \
|
||||
-lwinmm -lversion -lgdi32 -luser32 -lwinhttp -ladvapi32 -lbcrypt -Wl,--kill-at
|
||||
|
||||
echo "生成 $OUTDIR/shell32_dui.dll($(stat -c%s "$OUTDIR/shell32_dui.dll") 字节)"
|
||||
echo "下一步:cp 到 backend/internal/protect/assets/shell32_dui.bin,再 go build ./cmd/packthemed"
|
||||
Reference in New Issue
Block a user