[PR #14637] [MERGED] Launch elevated instances via shell:AppFolder #30174

Open
opened 2026-01-31 09:39:07 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14637
Author: @jboelter
Created: 1/5/2023
Status: Merged
Merged: 1/19/2023
Merged by: @undefined

Base: mainHead: bug/14501-elevate-dllpath


📝 Commits (9)

  • 62017c0 Launch elevated instances via shell:AppFolder
  • 145dd52 length() -> size()
  • 039307f make spell check happy
  • 9c794e6 make argc const to satisfy audit mode build
  • f69a69e add wargv to recognized words
  • 74c4b0c Minimized scope of changes and use WIL
  • 1aa94bb fix spelling
  • 405e89e simplification to only change elevate-shim
  • f94b4e9 make audit mode happy

📊 Changes

1 file changed (+64 additions, -9 deletions)

View changed files

📝 src/cascadia/ElevateShim/elevate-shim.cpp (+64 -9)

📄 Description

This uses shell:AppsFolder to launch elevated instances of the app via
ShellExecuteEx and runas in elevate-shim.exe. The app to launch is
discovered via the GetCurrentApplicationUserModelId API.

e.g. shell:AppsFolder\WindowsTerminalDev_8wekyb3d8bbwe!App

This will fallback to launching WindowsTerminal.exe if it fails to
discover the app user model id to launch.

This also fixes a bug in elevate-shim where the first argument of
WinMain was lost (e.g. new-tab).

Curiously, AppLogic::RunAsUwp() is never called and
AppLogic::IsUwp() is always false when running debug builds locally
(e.g. WindowsTerminalDev). It's not clear if this is an artifact of
development packages or something else.

Validation Steps Performed

Various manual debug/execution scenarios.

Verified the fallback path by running the unbundled app by extracting
the CascadiaPackage_0.0.1.0_x64.msix from the 'drop' build artifact.

Fixes #14501


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14637 **Author:** [@jboelter](https://github.com/jboelter) **Created:** 1/5/2023 **Status:** ✅ Merged **Merged:** 1/19/2023 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `bug/14501-elevate-dllpath` --- ### 📝 Commits (9) - [`62017c0`](https://github.com/microsoft/terminal/commit/62017c0f56ffdc4a632642154354de78d68844ee) Launch elevated instances via shell:AppFolder - [`145dd52`](https://github.com/microsoft/terminal/commit/145dd52f648890703b3b069927201103da008b6c) length() -> size() - [`039307f`](https://github.com/microsoft/terminal/commit/039307f6cca8beaba2f096727acde3c29219dca9) make spell check happy - [`9c794e6`](https://github.com/microsoft/terminal/commit/9c794e6fc4798e37bc4569898d3de050690f3eca) make argc const to satisfy audit mode build - [`f69a69e`](https://github.com/microsoft/terminal/commit/f69a69e3d70d855eef05f8fac744c093c8c1c685) add wargv to recognized words - [`74c4b0c`](https://github.com/microsoft/terminal/commit/74c4b0c50792845158dde09008b25924b641a35c) Minimized scope of changes and use WIL - [`1aa94bb`](https://github.com/microsoft/terminal/commit/1aa94bb3a5e3de36e344d14ae6eff313f5c15479) fix spelling - [`405e89e`](https://github.com/microsoft/terminal/commit/405e89e057922867d753548938b7a5bb81eccd8c) simplification to only change elevate-shim - [`f94b4e9`](https://github.com/microsoft/terminal/commit/f94b4e9d2a70117e61bf81eb4796f29cb8199a18) make audit mode happy ### 📊 Changes **1 file changed** (+64 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/ElevateShim/elevate-shim.cpp` (+64 -9) </details> ### 📄 Description This uses `shell:AppsFolder` to launch elevated instances of the app via `ShellExecuteEx` and `runas` in elevate-shim.exe. The app to launch is discovered via the `GetCurrentApplicationUserModelId` API. e.g. `shell:AppsFolder\WindowsTerminalDev_8wekyb3d8bbwe!App` This will fallback to launching `WindowsTerminal.exe` if it fails to discover the app user model id to launch. This also fixes a bug in elevate-shim where the first argument of WinMain was lost (e.g. `new-tab`). Curiously, `AppLogic::RunAsUwp()` is never called and `AppLogic::IsUwp()` is always false when running debug builds locally (e.g. WindowsTerminalDev). It's not clear if this is an artifact of development packages or something else. ## Validation Steps Performed Various manual debug/execution scenarios. Verified the fallback path by running the unbundled app by extracting the `CascadiaPackage_0.0.1.0_x64.msix` from the 'drop' build artifact. Fixes #14501 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:39:07 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30174