修正客户端完整性校验:补齐 CRC 后处理脚本并回绑 90CN.dll 指纹
问题:上一提交把 boundDll 指纹改成 1230336/F6DDA534…,但配套的 90CN.dll 未交付到客户端目录,服务端启动即被 verifyClientArtifacts 拦下 (client dll: size mismatch: 1230848 != 1230336),日志表现为空壳。 本次改动: - 新增 client-patch/tools/patch_dll_crc.py,实现仓库中缺失的 DLL 自校验 槽位回填(magic 0xC0DEC0DE + offset + 全文件 CRC32,跳过自身 4 字节), 附带 verify 子命令可回读校验 - 新增 client-patch/tools/build_90cn.bat / .ps1,一键编译 + 打 CRC + 输出指纹 - client_build_id.go 指纹回绑到本次实际构建产物: 1215488 / 30E41FF583893E611E6975DF96246E1320B042F7B33A32503C987F211D1776F5 验证:重编 DNF90Server.exe 后裸跑,完整性校验通过,PVF 加载完成, dnfbridge 正常监听 :7001,game_ports=31,admin http 127.0.0.1:18111。
This commit is contained in:
1 parent
c58168406b
commit
2ca06e113a
4 files changed
+257
-2
No files matched your search
@@ -0,0 +1,96 @@
|
||||
# 90CN.dll one-click build script.
|
||||
#
|
||||
# 1. locate MSBuild (Build Tools / VS 2019 / VS 2022)
|
||||
# 2. build Release|Win32 from client-patch/90CN.vcxproj
|
||||
# 3. write the self-integrity CRC32 into the fresh DLL (patch_dll_crc.py)
|
||||
# 4. print the size + SHA-256 that client_build_id.go must carry
|
||||
#
|
||||
# Usage (from anywhere):
|
||||
# powershell -ExecutionPolicy Bypass -File build_90cn.ps1
|
||||
# powershell -ExecutionPolicy Bypass -File build_90cn.ps1 -SkipCrc
|
||||
#
|
||||
# The output DLL lands in client-patch\Release\90CN.dll and is copied to
|
||||
# ..\out\90CN.dll for convenience.
|
||||
|
||||
param(
|
||||
[switch]$SkipCrc,
|
||||
[string]$Configuration = "Release",
|
||||
[string]$Platform = "Win32"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$projectDir = Split-Path -Parent $here
|
||||
$vcxproj = Join-Path $projectDir "90CN.vcxproj"
|
||||
|
||||
function Find-MSBuild {
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
if (Test-Path $vswhere) {
|
||||
$path = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild `
|
||||
-find "MSBuild\**\Bin\MSBuild.exe" | Select-Object -First 1
|
||||
if ($path) { return $path }
|
||||
}
|
||||
$candidates = @(
|
||||
"C:\VS\BuildTools\MSBuild\Current\Bin\MSBuild.exe",
|
||||
"${env:ProgramFiles}\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe",
|
||||
"${env:ProgramFiles}\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe",
|
||||
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe",
|
||||
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
|
||||
)
|
||||
foreach ($c in $candidates) { if (Test-Path $c) { return $c } }
|
||||
return $null
|
||||
}
|
||||
|
||||
if (-not (Test-Path $vcxproj)) { throw "vcxproj not found: $vcxproj" }
|
||||
|
||||
$msbuild = Find-MSBuild
|
||||
if (-not $msbuild) {
|
||||
throw @"
|
||||
MSBuild not found.
|
||||
|
||||
Install the free "Build Tools for Visual Studio" and tick:
|
||||
- 使用 C++ 的桌面开发 (Desktop development with C++)
|
||||
- MSVC v142 - VS 2019 C++ x64/x86 生成工具
|
||||
- Windows 10 SDK
|
||||
|
||||
Download: https://aka.ms/vs/17/release/vs_BuildTools.exe
|
||||
"@
|
||||
}
|
||||
|
||||
Write-Host "[1/4] MSBuild : $msbuild"
|
||||
Write-Host "[2/4] building $Configuration|$Platform ..."
|
||||
|
||||
& $msbuild $vcxproj /nologo /v:minimal /m `
|
||||
/p:Configuration=$Configuration /p:Platform=$Platform
|
||||
if ($LASTEXITCODE -ne 0) { throw "build failed (exit $LASTEXITCODE)" }
|
||||
|
||||
$dll = Join-Path $projectDir "$Configuration\90CN.dll"
|
||||
if (-not (Test-Path $dll)) { throw "build succeeded but $dll is missing" }
|
||||
|
||||
if (-not $SkipCrc) {
|
||||
Write-Host "[3/4] patching self-integrity CRC ..."
|
||||
$python = (Get-Command python -ErrorAction SilentlyContinue).Source
|
||||
if (-not $python) { $python = (Get-Command py -ErrorAction SilentlyContinue).Source }
|
||||
if (-not $python) { throw "python not found; run with -SkipCrc or install Python" }
|
||||
& $python (Join-Path $here "patch_dll_crc.py") patch $dll
|
||||
if ($LASTEXITCODE -ne 0) { throw "CRC patch/verify failed" }
|
||||
} else {
|
||||
Write-Host "[3/4] CRC patch skipped (-SkipCrc)"
|
||||
}
|
||||
|
||||
$outDir = Join-Path (Split-Path -Parent $projectDir) "out"
|
||||
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||
Copy-Item $dll (Join-Path $outDir "90CN.dll") -Force
|
||||
|
||||
$size = (Get-Item $dll).Length
|
||||
$sha = (Get-FileHash $dll -Algorithm SHA256).Hash
|
||||
|
||||
Write-Host "[4/4] done"
|
||||
Write-Host ""
|
||||
Write-Host " dll : $dll"
|
||||
Write-Host " size : $size"
|
||||
Write-Host " sha256: $sha"
|
||||
Write-Host ""
|
||||
Write-Host "Update server/internal/services/dnfbridge/client_build_id.go with:"
|
||||
Write-Host " boundDllBytes = int64($size)"
|
||||
Write-Host " boundDllSHA256 = `"$sha`""
|
||||
Reference in new issue
Block a user