Skip to content

v1.1.6 — Real-Time Input Pipeline Overhaul, Desktop Station Isolation & Privilege Separation

Choose a tag to compare

@tirthsaraiya29 tirthsaraiya29 released this 06 Nov 07:12
· 144 commits to main since this release

Executive Summary

Tether v1.1.6 is a major reliability, precision, and security release centered on a complete re-engineering of the remote input and session execution subsystems.

Prior builds could experience intermittent input drops, stuck modifier states, or ERROR_ACCESS_DENIED injection failures across Windows session boundaries and high-integrity windows (such as Task Manager and UAC prompts). Version 1.1.6 eliminates these friction points by introducing a dedicated STA injection worker thread bound directly to the active interactive desktop (WinSta0\Default), linked token elevation for administrator sessions, multi-tier injection fallbacks, sub-pixel movement accumulation, unified touch gesture state machines, and fine-grained Windows privilege separation.


Key Highlights

  • Desktop Window Station Isolation (WinSta0\Default): Dedicated STA input injection thread eliminates thread detachment and Win32 access denials (ERROR_ACCESS_DENIED / 5).
  • UIPI Elimination via Elevated Linked Tokens: The Session 0 communication service now inspects TokenLinkedToken to execute Tether.SessionHelper at high integrity, unlocking input control across elevated administrative applications and security surfaces.
  • Sub-Pixel Motion Accumulators: Smooth micro-movements across trackpad drag, two-finger scrolling, and AirMouse gyroscope sensor streams prevent rounding truncation and cursor stutter.
  • Unified Android Gesture Engine: Replaced competing Compose gesture recognizers with a single-pass touch-slop hysteresis state machine supporting seamless drags, two-finger scrolling, single/double taps, and right clicks.
  • IME Sentinel Buffer: Eliminates silent Backspace dropouts across soft virtual keyboards (e.g., Gboard, Samsung Keyboard).
  • Least-Privilege Desktop UI Architecture: Desktop UI runs standard user-level by default and utilizes modular, on-demand UAC elevation (RunElevatedSelf) only when committing credentials or restarting services.

Detailed Changes by Subsystem

1. Windows Input Subsystem (Tether.SessionHelper)

  • Dedicated Real-Time STA Worker Thread:
    • Created Tether.InputInjectorThread with AboveNormal priority and strict FIFO dispatch using an asynchronous bounded channel (Channel<byte[]> with 2048 frame capacity and DropOldest backpressure).
    • Removed thread-pool dispatch to eliminate out-of-order race conditions, named-pipe message tearing, and thread-switching latency.
  • Window Station & Desktop Attachment:
    • Explicitly binds the process and worker thread to WinSta0 and OpenInputDesktop via SetProcessWindowStation and SetThreadDesktop.
    • Implemented automatic desktop re-probing and recovery upon Win32 errors 5 (ERROR_ACCESS_DENIED), 6 (ERROR_INVALID_HANDLE), or 1400 (ERROR_INVALID_WINDOW_HANDLE).
  • Multi-Tier Injection Fallbacks:
    • In addition to user32!SendInput, automated fallbacks to user32!mouse_event, user32!keybd_event, and user32!SetCursorPos (with GetCursorPos) dynamically bypass User Interface Privilege Isolation (UIPI) or transient desktop lockouts.
  • Sub-Millisecond Lock State Detection:
    • Replaced expensive ~17.5ms system-wide Process.GetProcessesByName("LogonUI") polling on high-frequency packets with OpenInputDesktop(DESKTOP_READOBJECTS) and GetUserObjectInformation, cached with a 150ms TTL to sustain 120 Hz input rates.
    • Added session-scoped LogonUI.exe verification to eliminate false-positive input suppression from lingering background processes after workstation unlock.
  • Extended Key Lifecycle & Navigation Fixes:
    • Explicitly flags KEYEVENTF_EXTENDEDKEY on both down and up transitions for navigation keys (Arrow keys, Delete, Home, End, PageUp, PageDown, Windows Key), resolving logically stuck keys.
    • Mapped newline characters in Unicode streams to native VK_RETURN dispatch.
    • Added ReleaseAllHeld() fail-safe release for all tracked buttons and keys on pipe disconnection.
  • High-DPI PerMonitorV2 Manifest:
    • Embedded application manifest declaring PerMonitorV2 DPI awareness to ensure 1:1 pixel coordinate parity across high-DPI displays.

2. Windows Service & IPC Transport (Tether.CommunicationService)

  • Session 0 Linked Token Elevation:
    • In HardwareExecutor, inspected TokenLinkedToken during CreateProcessAsUser to launch Tether.SessionHelper under the administrator's high-integrity token when available.
    • Eliminates UIPI blocking across Task Manager, elevated shells, and administrative dialogs.
  • Atomic Named-Pipe Frame Serialization:
    • Replaced fragmented multi-part writes in InputForwarder with atomic [length(4)][payload] buffer frames, eliminating IPC message boundary corruption.
    • Added background connection polling to promptly detect silent client terminations and recycle stale pipe server instances.
  • Session Helper Lifecycle & De-duplication:
    • In SessionHelperDaemon, audited active console session processes to identify and terminate hung or orphaned helpers (>20s without pipe connection), preventing IPC connection deadlocks.
    • Corrected cross-session permission validation in IsTrustedServerProcess using process table auditing instead of restricted limited-information handles.

3. Android Companion (com.tether.phone)

  • Sub-Pixel Precision Accumulators (RemoteInputEngine.kt):
    • Implemented fractional accumulators for trackpad drag, two-finger scroll drag, and AirMouse gyroscope sensor feeds.
    • Prevents micro-movements from rounding down to zero, providing smooth, continuous cursor glide even at slow physical speeds.
    • Accumulators reset immediately on finger lift (resetAccumulators()).
  • Serialized Click Lane:
    • Added clickLane (Dispatchers.IO.limitedParallelism(1)) to sequence button down/delay/up phases, preventing rapid tap sequences from interleaving into malformed packet streams.
  • Unified Gesture State Machine (RemoteInputScreen.kt):
    • Consolidated conflicting pointerInput drag and detectTapGestures listeners into a single-pass event scope with touch-slop hysteresis.
    • Delivers distinct detection for single-finger drag, two-finger vertical scroll, single-tap left click, double-tap left click, and two-finger right click.
  • IME Sentinel Buffer for Soft Keyboards:
    • Introduced a zero-width space (\u200B) sentinel buffer in textBuffer to intercept IME deleteSurroundingText(1, 0) calls, ensuring Backspace works on Gboard, Samsung Keyboard, and other modern mobile keyboards.
  • Input Pump Resiliency & Stream Hygiene (TetherLanService.kt):
    • Corrected startInputPump() to verify job activity (isActive) instead of instance reference nullity.
    • Triggered input pump initialization on pinned-key network reconnects.
    • Flushes stale input frames from inputFrameChannel upon link disconnection and reconnection to eliminate buffered replay bursts.
    • Offloaded AirMouse gyroscope sensor sampling to a dedicated background HandlerThread.

4. Windows Desktop UI (Tether.DesktopUI)

  • Privilege Separation Architecture:
    • Removed requirement for the main application to run as Administrator continuously.
    • Added RunElevatedSelf helper to prompt for UAC elevation on-demand only when writing to HKLM registry paths or stopping/starting Windows services.
  • Centralized Service Control (ServiceControl.cs):
    • Implemented native Win32 Service Control Manager (SCM) interactions (advapi32.dll) to query, stop, and restart TetherCommService with timeouts and fallback to standalone executable execution.
  • Initial Telemetry Synchronization:
    • Desktop UI now issues a TELEMETRY_SYNC_REQUESTED event on startup to query current device connection state immediately.
  • Credential Vault UX:
    • Added Enter key handler to password input for immediate vault submission.
    • Host automatically releases held modifiers on UI disconnect.

5. Web & Documentation (index.html)

  • Visual Identity & Design System:
    • Modernized color hierarchy following the 70/25/5 rule with neutral dark background, steel-tinted surfaces (#0f151b), and vibrant signal green (#3ddc97) strictly reserved for active connection indicators.
  • SEO & Social Sharing:
    • Added OpenGraph meta tags (og:title, og:description, og:type) and embedded an SVG favicon.
  • Interactive UI & Performance:
    • Added responsive mobile navigation drawer with accessible ARIA state transitions.
    • Added performant, one-shot IntersectionObserver scroll-reveal animations respecting prefers-reduced-motion.
    • Added scroll-dependent header backdrop shadow.

6. Packaging & Deployment (installer/Tether.iss)

  • Version Bump: Updated version identifier to 1.1.6.
  • Standard User Execution: Removed mandatory runas administrative elevation verb from post-install launch task, running the UI under standard user context in compliance with Windows application guidelines.

Upgrade & Installation Guide

Windows

  1. Download and run Tether-Setup-1.1.6.exe.
  2. Follow installer prompts. The installer will register the background communication service (TetherCommService), register the credential provider (TetherCredentialProvider.dll), and configure necessary Windows Firewall rules.
  3. The Desktop UI launches automatically without requiring global administrative permissions.

Android

  1. Install or update to Tether-1.1.6.apk (Android 12+ required).
  2. Connect to the same local Wi-Fi or LAN as your Windows PC.
  3. Pair using the QR code or link code; existing paired credentials will automatically reconnect.

Git Commit Summary (since ae3d18e)

5af1430 Bumped version to 1.1.6
c38cf8f fix(input): resolve input failure via desktop attachment, token elevation, and sub-pixel accumulation
72ad827 fix(input): resolve input pipeline failures across IPC, gesture handling, and session state
7c842a4 refactor: stabilize input handling, restart logic, and vault commit
6f83f9a style(web): improve home page SEO, layout, and interactions