microsoft / microsoft/PowerToys

[General] Handle Windows session end in native module processes

Open
#49,539 0 comments 0 reactions 0 assignees View on GitHub
Issue-Bug Needs-Triage Product-Always On Top Product-CropAndLock Product-FancyZones Product-General Product-Grab And Move Product-Keyboard Manager Product-Shortcut Guide Product-Workspaces Product-ZoomIt
Dominant language
C
Stars
139k
Forks
8.6k
PR merge metrics
PR metrics pending

Description

### Microsoft PowerToys version

Main after PR #48363

### Installation method

Dev build in Visual Studio

### Area(s) with issue?

General

### Steps to reproduce

PR #48363 fixes `APPLICATION_HANG_QUIESCE` for the always-on PowerToys runner and adds `handle_stateless_session_end_message` for processes that have no unsaved user state.

Several native module processes also own top-level or message-only windows and run independent message loops without handling `WM_QUERYENDSESSION` / `WM_ENDSESSION`. During shutdown, sign-out, or restart, those processes can remain blocked in `GetMessage` until Windows' quiesce timeout force-terminates them.

Track an inventory and per-module rollout here. Known candidates include FancyZones, Always On Top, Keyboard Manager Engine, Workspaces Window Arranger, Measure Tool, Crop And Lock, Grab And Move, ZoomIt SelectRectangle, Shortcut Guide, and the notifications COM activator. Each module must review its teardown behavior independently. The shared helper is only appropriate when the process has no unsaved state; stateful modules need their own save/permission behavior.

### ✔️ Expected Behavior

Affected modules respond immediately to `WM_QUERYENDSESSION`, unwind promptly on `WM_ENDSESSION(TRUE)`, and preserve any required user state or child-process cleanup. Shutdown, sign-out, and restart should not produce `APPLICATION_HANG_QUIESCE` reports for these module processes.

### ❌ Actual Behavior

The runner is addressed by PR #48363, but module-owned windows are not yet migrated and may still time out during the Windows session-end handshake.

### Additional Information

This is intentionally separate from PR #48363 so module-specific state and teardown semantics can be reviewed in focused changes. Related issue #41260 tracks the same failure class for Command Palette extensions.

### Other Software

N/A

Contributor guide

Open the contributing guide

Research direction

Start by reviewing PR #48363 and the listed candidate modules: FancyZones, Always On Top, Keyboard Manager Engine, Workspaces Window Arranger, Measure Tool, Crop And Lock, Grab And Move, ZoomIt SelectRectangle, Shortcut Guide, and the notifications COM activator. Trace each process's window and message-loop teardown behavior, then verify that session shutdown, sign-out, and restart complete without APPLICATION_HANG_QUIESCE while required state and child-process cleanup are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.