diff --git a/src/service/windows-checked-stop-live.ts b/src/service/windows-checked-stop-live.ts index b53f2b98a0a..8b324bbd609 100644 --- a/src/service/windows-checked-stop-live.ts +++ b/src/service/windows-checked-stop-live.ts @@ -177,13 +177,13 @@ export const liveWindowsStopCommandRunner: WindowsStopCommandRunner = (program, /** * Status words of `schtasks /query /fo CSV /nh`. schtasks localizes the column from its .mui * resources, and the PowerShell fallback cannot start inside Part A's 1 s manager-state cap on a - * cold machine (#8863), so the words observed from shipped resources are read here: zh-CN from - * System32\zh-CN\schtasks.exe.mui, ko-KR from two machines. Any other word stays unknown and - * falls back to Get-ScheduledTask's locale-independent State enum. + * cold machine (#8863), so the words observed from shipped resources are read here: zh-CN, ja-JP + * and ko-KR from their System32 locale directories, ko-KR running/ready also from two machines. + * Any other word stays unknown and falls back to Get-ScheduledTask's locale-independent State enum. */ // A queued instance can launch after Part A. Only ready and disabled prove inactivity. -const TASK_CSV_ACTIVE = new Set(["running", "queued", "正在运行", "已排队", "실행 중", "대기"]); -const TASK_CSV_NOT_RUNNING = new Set(["ready", "disabled", "就绪", "已禁用", "준비", "사용 안 함"]); +const TASK_CSV_ACTIVE = new Set(["running", "queued", "正在运行", "已排队", "실행 중", "대기", "実行中", "キューに登録済み"]); +const TASK_CSV_NOT_RUNNING = new Set(["ready", "disabled", "就绪", "已禁用", "준비", "사용 안 함", "準備完了", "無効"]); export function parseTaskCsvState(csv: string): "running" | "not-running" | "unknown" { for (const line of csv.split(/\r?\n/)) { diff --git a/structure/ops/windows-checked-stop.md b/structure/ops/windows-checked-stop.md index cf1074c8b41..48906174f73 100644 --- a/structure/ops/windows-checked-stop.md +++ b/structure/ops/windows-checked-stop.md @@ -169,9 +169,9 @@ objects. The final manager-state probe treats both running and queued tasks as a [Task Scheduler permissions](https://learn.microsoft.com/en-us/windows/win32/taskschd/security-contexts-for-running-tasks) [Instance stop protocol](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tsch/b3572584-8727-441f-83e6-9b02101ea7f4) -The task's running state is read from `schtasks /query /fo CSV`. The status words observed from shipped zh-CN and -ko-KR resources are recognized there (#8863), because a cold `Get-ScheduledTask` takes 1.6 s to -4.9 s and cannot finish inside the 1 s cap. Any other localized word still falls back to it. +The task's running state is read from `schtasks /query /fo CSV`. The status words observed from shipped +zh-CN, ko-KR, and ja-JP resources are recognized there, because a cold `Get-ScheduledTask` takes +1.6 s to 4.9 s (#8863) and cannot finish inside the 1 s cap. Any other localized word still falls back to it. The instance stop maps an access-denied HRESULT to `denied`. A running WinSW service is only this home's manager when `sc qc` shows a `BINARY_PATH_NAME` naming this installation's WinSW executable, the same proof the guarded manager path uses: the service ID is fixed, so a successful `sc query` alone diff --git a/tests/windows/windows-checked-stop-live.test.ts b/tests/windows/windows-checked-stop-live.test.ts index 327cc15d419..c0fca700b7f 100644 --- a/tests/windows/windows-checked-stop-live.test.ts +++ b/tests/windows/windows-checked-stop-live.test.ts @@ -191,6 +191,22 @@ describe("capped command answers", () => { expect(programs).toEqual(["schtasks /query"]); }); + test.each([ + ["準備完了", "not-running"], + ["無効", "not-running"], + ["実行中", "running"], + ["キューに登録済み", "running"], + ])("ja-JP task state %s is read from the CSV without starting PowerShell", async (status, expected) => { + const deps = windowsCheckedStopLiveDeps({ + run: async (program, args) => { + expect(program).toBe("schtasks"); + expect(args).toEqual(["/query", "/tn", "opencodex-proxy", "/fo", "CSV", "/nh"]); + return result(0, `"\\opencodex-proxy","N/A","${status}"\r\n`); + }, + }); + expect(await deps.taskState(1_000)).toBe(expected); + }); + test("the helper must finish successfully and receive proof approval before reporting success", async () => { const sid = "S-1-5-21-100-200-300-1001"; const xml = buildWindowsTaskXml(undefined, windowsLauncherVbsPath(), undefined, sid)