-
Notifications
You must be signed in to change notification settings - Fork 0
Sidecar Helper Architecture English
English · 繁體中文
Under Windows' security model, unprivileged applications cannot interact with elevated anti-cheat games or send window messages across User Interface Privilege Isolation (UIPI) boundaries to modern packaged apps like Windows 11 Notepad.
ImeModePersistence (v1.5.0+) introduces the Sidecar Helper architecture, which bridges these barriers without requiring the main application to run as administrator, without DLL injection, and without synthetic keystroke simulation. This achieves three critical goals:
- Seamlessly pinning and switching input languages for elevated / anti-cheat games like Helldivers 2.
- Persisting native/alphanumeric IME modes across modern WinUI windows (Windows 11 Notepad).
- 100% compliance with Microsoft Store security policies for certified store distribution.
This technical document details the design principles, security boundaries, and implementation details of this architecture.
Introduced in Windows Vista, UIPI (User Interface Privilege Isolation) isolates processes based on their Integrity Level (IL):
- Low-IL: Browser sandboxes.
- Medium-IL: Normal user desktop apps and Microsoft Store (MSIX) applications.
- High-IL: Processes run as Administrator and full-screen games launching kernel anti-cheat drivers (e.g. Helldivers 2 with nProtect GameGuard).
When ImeModePersistence runs as a normal user application (Medium-IL), even though it can discover the foreground window class (class:stingray_window) via standard Win32 APIs, attempts to deliver window messages:
-
PostMessage(hwnd, WM_INPUTLANGCHANGEREQUEST, 0, hkl)(Keyboard layout switch) -
SendMessage(imeWnd, WM_IME_CONTROL, IMC_SETCONVERSIONMODE, ...)(Native / Alphanumeric mode toggle)
are silently dropped and rejected by the Windows kernel with ERROR_ACCESS_DENIED.
Rather than forcing the entire application to autostart as Administrator (which creates a permanent high-privilege attack surface and triggers antivirus heuristics), we decouple privileges using a dedicated Sidecar Helper:
+-------------------------------------------------------------+
| Main GUI App (ImeModePersistence.exe) |
| - Privilege: Medium-IL (Normal user / Store MSIX container)|
| - Role: Tray UI, Focus tracking, Rules, State management |
+-------------------------------------------------------------+
│
Named Pipe IPC (\\.\pipe\ImeModePersistence.Sidecar)
Strict SDDL: Interactive User & Administrators Only
│
▼
+-------------------------------------------------------------+
| Elevated Helper (ImeModePersistence.exe --helper <pid>) |
| - Privilege: High-IL (Spawned on-demand via standard UAC) |
| - Role: Relays Win32 messages across UIPI to High-IL apps |
| - Watchdog Thread: Monitors parent PID; exits immediately |
+-------------------------------------------------------------+
│
Standard Win32 Window Messages (Crosses UIPI)
│
▼
+-------------------------------------------------------------+
| Target Window (Helldivers 2 / Windows 11 Modern Notepad) |
+-------------------------------------------------------------+
-
On-Demand Launch: The user clicks "Enable WinUI/Admin support..." in the tray menu. The app invokes
ShellExecuteExWwith therunasverb to spawnImeModePersistence.exe --helper <parent_pid>, presenting a standard Windows UAC prompt. -
Secure Named Pipe IPC:
- Pipe name:
\\.\pipe\ImeModePersistence.Sidecar - SDDL:
D:(A;;GA;;;BA)(A;;GA;;;IU)S:(ML;;NW;;;ME) - Strictly restricts connections to the local Interactive User and Builtin Administrators, preventing unauthorized cross-session or network access.
- Pipe name:
-
Synchronous Duplex Message Protocol: Uses
PIPE_TYPE_MESSAGE | PIPE_WAITto guarantee precise byte alignment and eliminate overlapped I/O races. -
Lifecycle Watchdog:
- The Helper runs an independent watchdog thread waiting on
{ hParentProcess, hShutdownEvent }. - If the parent application exits, crashes, or the user turns off the helper from the tray menu, the helper unblocks immediately and terminates cleanly without leaving orphan background processes.
- The Helper runs an independent watchdog thread waiting on
Players are rightfully cautious about third-party software triggering anti-cheat bans (GameGuard, EAC, BattlEye, Vanguard). The Sidecar Helper remains completely safe because it strictly adheres to zero-intrusion principles:
| Technique | Used by Game Cheats | Used by ImeModePersistence | Safety Rationale |
|---|---|---|---|
Process Memory Read/Write (ReadProcessMemory, WriteProcessMemory) |
Yes | ❌ None | Never inspects or modifies game memory. |
DLL Injection / Remote Threads (CreateRemoteThread, SetWindowsHookEx) |
Yes | ❌ None | Never injects foreign code into the game process. |
Synthetic Keystrokes (SendInput, keybd_event) |
Yes | ❌ None | Never synthesises virtual key presses (avoids bot / macro flags). |
Global Keystroke Logging (WH_KEYBOARD_LL, GetAsyncKeyState) |
Yes | ❌ None | Never sniffs user keystrokes. |
Standard Win32 Messages (WM_INPUTLANGCHANGEREQUEST, WM_IME_CONTROL) |
No | ✅ Sole mechanism | Identical to the standard OS notification dispatched when pressing Win+Space. Anti-cheat and the IME framework treat this as standard window manager notifications. |
The Microsoft Store enforces rigorous safety and packaging constraints:
- Microsoft Store manifests (
AppxManifest.xml) strictly prohibit declaringrequireAdministrator. The main application must always launch asasInvoker. - ImeModePersistence runs 100% compliant in the Store app container.
- Store policies require that elevated operations must be explicitly initiated by the user through standard OS consent prompts (UAC), rather than via silent elevation or privilege-escalation exploits.
- The Sidecar Helper is spawned only upon explicit user selection in the tray menu via
ShellExecuteEx(runas), satisfying all Store security reviews.
- Some legacy tools copied binaries into
%Temp%or%LocalAppData%before elevating, introducing Local Privilege Escalation (LPE) and file hijacking risks. - ImeModePersistence elevates directly against its authentic registered module path (
autostart::module_path()), eliminating code-tampering vectors.
With the Sidecar Helper architecture, ImeModePersistence achieves the ideal balance between maximum user security and low-level input reliability:
- 🎮 Gamers: Enjoy seamless English layout locking in anti-cheat games without running the main utility elevated.
- 📝 Everyday Users: Prevent unwanted Chinese mode resets across modern Windows 11 WinUI apps.
- 🛡️ Security-First: 0 injection, 0 key simulation, open-source auditability, and validated by both the Microsoft Store and OpenSSF.
ImeModePersistence · 下載 / Releases · 問題回報 / Issues · README · 設計筆記 / Design notes · MIT
本 Wiki 是操作說明;實作理由與被否決的做法記在設計筆記。發佈的檔案未經簽章。 This wiki is the how-to; implementation reasoning and rejected approaches live in the design notes. Released files are unsigned.
繁體中文
English
简体中文
日本語
한국어