mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
一些修复与优化
This commit is contained in:
@@ -312,6 +312,8 @@ export class WcdbCore {
|
||||
case -2208: return '安全校验失败:目标文件哈希读取失败(-2208)'
|
||||
case -2209: return '安全校验失败:目标文件哈希不匹配(-2209)'
|
||||
case -2210: return '安全校验失败:签名无效(-2210)'
|
||||
case -2211: return '安全校验失败:主程序 EXE 哈希不匹配(-2211)'
|
||||
case -2212: return '安全校验失败:wcdb_api 模块哈希不匹配(-2212)'
|
||||
default: return `安全校验失败(错误码: ${code})`
|
||||
}
|
||||
}
|
||||
@@ -655,6 +657,12 @@ export class WcdbCore {
|
||||
|
||||
let protectionOk = false
|
||||
let protectionCode = -1
|
||||
let bestFailCode: number | null = null
|
||||
const scoreFailCode = (code: number): number => {
|
||||
if (code >= -2212 && code <= -2201) return 0 // manifest/signature/hash failures
|
||||
if (code === -102 || code === -101 || code === -1006) return 1
|
||||
return 2
|
||||
}
|
||||
for (const resPath of resourcePaths) {
|
||||
try {
|
||||
protectionCode = Number(this.wcdbInitProtection(resPath))
|
||||
@@ -662,6 +670,9 @@ export class WcdbCore {
|
||||
protectionOk = true
|
||||
break
|
||||
}
|
||||
if (bestFailCode === null || scoreFailCode(protectionCode) < scoreFailCode(bestFailCode)) {
|
||||
bestFailCode = protectionCode
|
||||
}
|
||||
this.writeLog(`[bootstrap] InitProtection rc=${protectionCode} path=${resPath}`, true)
|
||||
} catch (e) {
|
||||
this.writeLog(`[bootstrap] InitProtection exception path=${resPath}: ${String(e)}`, true)
|
||||
@@ -669,8 +680,9 @@ export class WcdbCore {
|
||||
}
|
||||
|
||||
if (!protectionOk) {
|
||||
lastDllInitError = this.formatInitProtectionError(protectionCode)
|
||||
this.writeLog(`[bootstrap] InitProtection failed finalCode=${protectionCode}`, true)
|
||||
const finalCode = bestFailCode ?? protectionCode
|
||||
lastDllInitError = this.formatInitProtectionError(finalCode)
|
||||
this.writeLog(`[bootstrap] InitProtection failed finalCode=${finalCode}`, true)
|
||||
return false
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
"build": {
|
||||
"appId": "com.WeFlow.app",
|
||||
"afterPack": "scripts/afterPack-sign-manifest.cjs",
|
||||
"afterSign": "scripts/afterPack-sign-manifest.cjs",
|
||||
"publish": {
|
||||
"provider": "github",
|
||||
"owner": "hicccc77",
|
||||
|
||||
Binary file not shown.
@@ -245,5 +245,7 @@ module.exports = async function afterPack(context) {
|
||||
console.log(`[wf-sign] manifest: ${manifestPath}`);
|
||||
console.log(`[wf-sign] signature: ${signaturePath}`);
|
||||
console.log(`[wf-sign] exe: ${manifest.targets[0].path}`);
|
||||
console.log(`[wf-sign] exe.sha256: ${manifest.targets[0].sha256}`);
|
||||
console.log(`[wf-sign] module: ${manifest.targets[1].path}`);
|
||||
console.log(`[wf-sign] module.sha256: ${manifest.targets[1].sha256}`);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user