diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 378a8ec..a951b78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Check out git repository uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - name: Install Node.js uses: actions/setup-node@v4 @@ -32,51 +32,20 @@ jobs: run: | VERSION=${GITHUB_REF_NAME#v} echo "Syncing package.json version to $VERSION" - npm version $VERSION --no-git-tag-version + npm version $VERSION --no-git-tag-version --allow-same-version - name: Build Frontend & Type Check run: | npx tsc npx vite build - - name: Build Changelog - id: build_changelog - uses: mikepenz/release-changelog-builder-action@v4 - with: - outputFile: "release-notes.md" - configurationJson: | - { - "template": "# v${{ github.ref_name }} 更新日志\n\n{{CHANGELOG}}\n\n---\n> 此更新由系统自动构建", - "categories": [ - { - "title": "## 新功能", - "filter": { "pattern": "^feat.*:.*", "flags": "i" } - }, - { - "title": "## 修复", - "filter": { "pattern": "^fix.*:.*", "flags": "i" } - }, - { - "title": "## 性能与维护", - "filter": { "pattern": "^(chore|docs|perf|refactor|ci|style|test).*:.*", "flags": "i" } - } - ], - "ignore_labels": [], - "commitMode": true, - "empty_summary": "## 更新详情\n- 常规代码优化与维护" - } - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check Changelog Content + - name: Inject Configuration shell: bash run: | - echo "=== RELEASE NOTES CONTENT START ===" - cat release-notes.md - echo "=== RELEASE NOTES CONTENT END ===" + npm pkg set build.releaseInfo.releaseNotes="修复了一些已知问题" - name: Package and Publish env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - npx electron-builder --publish always -c.releaseInfo.releaseNotesFile=release-notes.md \ No newline at end of file + npx electron-builder --publish always \ No newline at end of file diff --git a/electron/services/keyService.ts b/electron/services/keyService.ts index 8b51c8d..08f730a 100644 --- a/electron/services/keyService.ts +++ b/electron/services/keyService.ts @@ -33,6 +33,7 @@ export class KeyService { private ReadProcessMemory: any = null private MEMORY_BASIC_INFORMATION: any = null private TerminateProcess: any = null + private QueryFullProcessImageNameW: any = null // User32 private EnumWindows: any = null @@ -194,6 +195,7 @@ export class KeyService { this.OpenProcess = this.kernel32.func('OpenProcess', 'HANDLE', ['uint32', 'bool', 'uint32']) this.CloseHandle = this.kernel32.func('CloseHandle', 'bool', ['HANDLE']) this.TerminateProcess = this.kernel32.func('TerminateProcess', 'bool', ['HANDLE', 'uint32']) + this.QueryFullProcessImageNameW = this.kernel32.func('QueryFullProcessImageNameW', 'bool', ['HANDLE', 'uint32', this.koffi.out('uint16*'), this.koffi.out('uint32*')]) this.VirtualQueryEx = this.kernel32.func('VirtualQueryEx', 'uint64', ['HANDLE', 'uint64', this.koffi.out(this.koffi.pointer(this.MEMORY_BASIC_INFORMATION)), 'uint64']) this.ReadProcessMemory = this.kernel32.func('ReadProcessMemory', 'bool', ['HANDLE', 'uint64', 'void*', 'uint64', this.koffi.out(this.koffi.pointer('uint64'))]) @@ -310,7 +312,46 @@ export class KeyService { } } + private async getProcessExecutablePath(pid: number): Promise { + if (!this.ensureKernel32()) return null + // 0x1000 = PROCESS_QUERY_LIMITED_INFORMATION + const hProcess = this.OpenProcess(0x1000, false, pid) + if (!hProcess) return null + + try { + const sizeBuf = Buffer.alloc(4) + sizeBuf.writeUInt32LE(1024, 0) + const pathBuf = Buffer.alloc(1024 * 2) + + const ret = this.QueryFullProcessImageNameW(hProcess, 0, pathBuf, sizeBuf) + if (ret) { + const len = sizeBuf.readUInt32LE(0) + return pathBuf.toString('ucs2', 0, len * 2) + } + return null + } catch (e) { + console.error('获取进程路径失败:', e) + return null + } finally { + this.CloseHandle(hProcess) + } + } + private async findWeChatInstallPath(): Promise { + // 0. 优先尝试获取正在运行的微信进程路径 + try { + const pid = await this.findWeChatPid() + if (pid) { + const runPath = await this.getProcessExecutablePath(pid) + if (runPath && existsSync(runPath)) { + console.log('发现正在运行的微信进程,使用路径:', runPath) + return runPath + } + } + } catch (e) { + console.error('尝试获取运行中微信路径失败:', e) + } + // 1. Registry - Uninstall Keys const uninstallKeys = [ 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall', diff --git a/package-lock.json b/package-lock.json index a38e504..ba9957a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8537,12 +8537,6 @@ "sherpa-onnx-win-x64": "^1.12.23" } }, - "node_modules/sherpa-onnx-node/node_modules/sherpa-onnx-darwin-x64": { - "optional": true - }, - "node_modules/sherpa-onnx-node/node_modules/sherpa-onnx-linux-arm64": { - "optional": true - }, "node_modules/sherpa-onnx-win-ia32": { "version": "1.12.23", "resolved": "https://registry.npmmirror.com/sherpa-onnx-win-ia32/-/sherpa-onnx-win-ia32-1.12.23.tgz", diff --git a/resources/wcdb_api.dll b/resources/wcdb_api.dll index de0b445..753d734 100644 Binary files a/resources/wcdb_api.dll and b/resources/wcdb_api.dll differ