Skip to content

[General] Handle Windows session end in native module processes #49539

Description

@crutkas

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions