diff --git a/.github/workflows/release-tauri.yml b/.github/workflows/release-tauri.yml index 55e5ac4c..c5f4099d 100644 --- a/.github/workflows/release-tauri.yml +++ b/.github/workflows/release-tauri.yml @@ -212,15 +212,17 @@ jobs: } "$($t.EnvName)=$dll" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 Write-Host "[ok] built $dll (exported $($t.EnvName))" - } - # bundle.resources 引用的是 src-tauri/openless-ime-payload/x64/OpenLessIme.dll - # (仓库里 commit 的是 0 字节占位让 mac 本地 build 也能 resolve)。 - # Windows CI 这里用真 x64 dll 覆盖占位,让 NSIS / MSI 包装的是真 dll。 - $payloadDir = Join-Path $appRoot 'src-tauri\openless-ime-payload\x64' - New-Item -ItemType Directory -Force -Path $payloadDir | Out-Null - Copy-Item -Force -Path $env:OPENLESS_IME_DLL_X64 -Destination (Join-Path $payloadDir 'OpenLessIme.dll') - Write-Host "[ok] copied real x64 dll into bundle.resources payload path" + # bundle.resources 引用的是 src-tauri/openless-ime-payload/{x64,x86}/OpenLessIme.dll + # (仓库里 commit 的是 0 字节占位让 mac 本地 build 也能 resolve)。 + # 这里用真 dll 覆盖占位,让 NSIS / MSI 都装上真文件;NSIS hook 的 regsvr32 + # 同时会把 64 / 32 位 COM 注册到 HKLM\Software\Classes\CLSID 的 + # KEY_WOW64_64KEY / KEY_WOW64_32KEY 两侧(windows_ime_profile.rs 都会查)。 + $payloadDir = Join-Path $appRoot "src-tauri\openless-ime-payload\$($t.Folder)" + New-Item -ItemType Directory -Force -Path $payloadDir | Out-Null + Copy-Item -Force -Path $dll -Destination (Join-Path $payloadDir 'OpenLessIme.dll') + Write-Host "[ok] copied real $($t.Folder) dll into bundle.resources payload path" + } # ── Windows tauri build:保持 bash shell,因为 PowerShell 调外部命令 # 会把 '{"bundle":...}' 的内部双引号吃掉、让 tauri 收到无效 JSON。 diff --git a/openless-all/app/src-tauri/installer.nsh b/openless-all/app/src-tauri/installer.nsh index e3eaf310..cefbcea6 100644 --- a/openless-all/app/src-tauri/installer.nsh +++ b/openless-all/app/src-tauri/installer.nsh @@ -5,25 +5,41 @@ ; "设置 → 权限"页面看到 "Windows 输入法后端:不可用"。 ; ; 这里的 hook 在 NSIS 安装/卸载流程里调 regsvr32 把 OpenLessIme.dll 注册到 HKLM。 -; bundle.resources 把 DLL 拷到 $INSTDIR\tsf-ime\OpenLessIme.dll +; bundle.resources 把 x64 / x86 DLL 拷到 $INSTDIR\tsf-ime\{x64,x86}\OpenLessIme.dll ; (resources map 的 target 必须避开 wxs fragment 已声明的 windows-ime\x64\ ; 路径,否则 MSI 包里同一路径会被两个 component 占用)。 ; tauri.conf.json 的 nsis.installMode = "perMachine" 让 NSIS 以管理员身份运行 ; (写 HKLM 必需)。 ; +; 必须同时注册 x64 + x86 两份 dll:windows_ime_profile.rs 的 +; inspect_windows_ime_registration() 会用 KEY_WOW64_64KEY 和 KEY_WOW64_32KEY 两次 +; 检查 HKLM CLSID InprocServer32,少了任何一边都会被判 RegistrationBroken。 +; - x64 用 $SYSDIR\regsvr32.exe (System32 = 64-bit on x64 Windows) +; - x86 用 $WINDIR\SysWOW64\regsvr32.exe (32-bit regsvr32 → 写 KEY_WOW64_32KEY) +; ; regsvr32 失败时不阻塞安装:用户仍可以靠 SendInput / 粘贴兜底完成上屏。 !macro NSIS_HOOK_POSTINSTALL - DetailPrint "Registering OpenLess TSF IME ..." - nsExec::ExecToLog '"$SYSDIR\regsvr32.exe" /s "$INSTDIR\tsf-ime\OpenLessIme.dll"' + DetailPrint "Registering OpenLess TSF IME (x64) ..." + nsExec::ExecToLog '"$SYSDIR\regsvr32.exe" /s "$INSTDIR\tsf-ime\x64\OpenLessIme.dll"' Pop $0 ${If} $0 != 0 - DetailPrint "OpenLess TSF IME registration failed (exit $0); fallback insertion paths still work." + DetailPrint "OpenLess TSF IME x64 registration failed (exit $0); fallback insertion paths still work." + ${EndIf} + + DetailPrint "Registering OpenLess TSF IME (x86) ..." + nsExec::ExecToLog '"$WINDIR\SysWOW64\regsvr32.exe" /s "$INSTDIR\tsf-ime\x86\OpenLessIme.dll"' + Pop $0 + ${If} $0 != 0 + DetailPrint "OpenLess TSF IME x86 registration failed (exit $0); fallback insertion paths still work." ${EndIf} !macroend !macro NSIS_HOOK_PREUNINSTALL - DetailPrint "Unregistering OpenLess TSF IME ..." - nsExec::ExecToLog '"$SYSDIR\regsvr32.exe" /s /u "$INSTDIR\tsf-ime\OpenLessIme.dll"' + DetailPrint "Unregistering OpenLess TSF IME (x86) ..." + nsExec::ExecToLog '"$WINDIR\SysWOW64\regsvr32.exe" /s /u "$INSTDIR\tsf-ime\x86\OpenLessIme.dll"' + Pop $0 + DetailPrint "Unregistering OpenLess TSF IME (x64) ..." + nsExec::ExecToLog '"$SYSDIR\regsvr32.exe" /s /u "$INSTDIR\tsf-ime\x64\OpenLessIme.dll"' Pop $0 !macroend diff --git a/openless-all/app/src-tauri/openless-ime-payload/x86/OpenLessIme.dll b/openless-all/app/src-tauri/openless-ime-payload/x86/OpenLessIme.dll new file mode 100644 index 00000000..e69de29b diff --git a/openless-all/app/src-tauri/tauri.conf.json b/openless-all/app/src-tauri/tauri.conf.json index 031f75e5..f61d699c 100644 --- a/openless-all/app/src-tauri/tauri.conf.json +++ b/openless-all/app/src-tauri/tauri.conf.json @@ -80,7 +80,8 @@ "icons/icon.ico" ], "resources": { - "openless-ime-payload/x64/OpenLessIme.dll": "tsf-ime/OpenLessIme.dll" + "openless-ime-payload/x64/OpenLessIme.dll": "tsf-ime/x64/OpenLessIme.dll", + "openless-ime-payload/x86/OpenLessIme.dll": "tsf-ime/x86/OpenLessIme.dll" }, "macOS": { "minimumSystemVersion": "12.0",