mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
commit32c13cead4Author: Jiří Polášek <me@jiripolasek.com> Date: Mon Dec 1 20:24:54 2025 +0100 CmdPal: Remove fallbacks from the home page when there's no query (#44005) This PR stops fallback commands from showing on the homepage when there’s no query, with the reasons detailed in the linked issue. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #44004 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit33808fdb9cAuthor: Jiří Polášek <me@jiripolasek.com> Date: Mon Dec 1 20:23:48 2025 +0100 CmdPal: Hide RDC fallback item by default (#43994) This fixes few nits with RDC extension: - hides the RDC fallback item from the home page when there’s no query; - fixes MSTSC process working directory (must physically exists or be an empty string) <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commitf510be4c53Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Dec 1 22:29:21 2025 +0800 Build(deps): Bump actions/checkout from 3 to 6 (#43838) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 6. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/releases">actions/checkout's releases</a>.</em></p> <blockquote> <h2>v6.0.0</h2> <h2>What's Changed</h2> <ul> <li>Update README to include Node.js 24 support details and requirements by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2248">actions/checkout#2248</a></li> <li>Persist creds to a separate file by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2286">actions/checkout#2286</a></li> <li>v6-beta by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2298">actions/checkout#2298</a></li> <li>update readme/changelog for v6 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2311">actions/checkout#2311</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/checkout/compare/v5.0.0...v6.0.0">https://github.com/actions/checkout/compare/v5.0.0...v6.0.0</a></p> <h2>v6-beta</h2> <h2>What's Changed</h2> <p>Updated persist-credentials to store the credentials under <code>$RUNNER_TEMP</code> instead of directly in the local git config.</p> <p>This requires a minimum Actions Runner version of <a href="https://github.com/actions/runner/releases/tag/v2.329.0">v2.329.0</a> to access the persisted credentials for <a href="https://docs.github.com/en/actions/tutorials/use-containerized-services/create-a-docker-container-action">Docker container action</a> scenarios.</p> <h2>v5.0.1</h2> <h2>What's Changed</h2> <ul> <li>Port v6 cleanup to v5 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2301">actions/checkout#2301</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/checkout/compare/v5...v5.0.1">https://github.com/actions/checkout/compare/v5...v5.0.1</a></p> <h2>v5.0.0</h2> <h2>What's Changed</h2> <ul> <li>Update actions checkout to use node 24 by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2226">actions/checkout#2226</a></li> <li>Prepare v5.0.0 release by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2238">actions/checkout#2238</a></li> </ul> <h2>⚠️ Minimum Compatible Runner Version</h2> <p><strong>v2.327.1</strong><br /> <a href="https://github.com/actions/runner/releases/tag/v2.327.1">Release Notes</a></p> <p>Make sure your runner is updated to this version or newer to use this release.</p> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/checkout/compare/v4...v5.0.0">https://github.com/actions/checkout/compare/v4...v5.0.0</a></p> <h2>v4.3.1</h2> <h2>What's Changed</h2> <ul> <li>Port v6 cleanup to v4 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2305">actions/checkout#2305</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/checkout/compare/v4...v4.3.1">https://github.com/actions/checkout/compare/v4...v4.3.1</a></p> <h2>v4.3.0</h2> <h2>What's Changed</h2> <ul> <li>docs: update README.md by <a href="https://github.com/motss"><code>@motss</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1971">actions/checkout#1971</a></li> <li>Add internal repos for checking out multiple repositories by <a href="https://github.com/mouismail"><code>@mouismail</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1977">actions/checkout#1977</a></li> <li>Documentation update - add recommended permissions to Readme by <a href="https://github.com/benwells"><code>@benwells</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2043">actions/checkout#2043</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/blob/main/CHANGELOG.md">actions/checkout's changelog</a>.</em></p> <blockquote> <h1>Changelog</h1> <h2>V6.0.0</h2> <ul> <li>Persist creds to a separate file by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2286">actions/checkout#2286</a></li> <li>Update README to include Node.js 24 support details and requirements by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2248">actions/checkout#2248</a></li> </ul> <h2>V5.0.1</h2> <ul> <li>Port v6 cleanup to v5 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2301">actions/checkout#2301</a></li> </ul> <h2>V5.0.0</h2> <ul> <li>Update actions checkout to use node 24 by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2226">actions/checkout#2226</a></li> </ul> <h2>V4.3.1</h2> <ul> <li>Port v6 cleanup to v4 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2305">actions/checkout#2305</a></li> </ul> <h2>V4.3.0</h2> <ul> <li>docs: update README.md by <a href="https://github.com/motss"><code>@motss</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1971">actions/checkout#1971</a></li> <li>Add internal repos for checking out multiple repositories by <a href="https://github.com/mouismail"><code>@mouismail</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1977">actions/checkout#1977</a></li> <li>Documentation update - add recommended permissions to Readme by <a href="https://github.com/benwells"><code>@benwells</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2043">actions/checkout#2043</a></li> <li>Adjust positioning of user email note and permissions heading by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2044">actions/checkout#2044</a></li> <li>Update README.md by <a href="https://github.com/nebuk89"><code>@nebuk89</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2194">actions/checkout#2194</a></li> <li>Update CODEOWNERS for actions by <a href="https://github.com/TingluoHuang"><code>@TingluoHuang</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2224">actions/checkout#2224</a></li> <li>Update package dependencies by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2236">actions/checkout#2236</a></li> </ul> <h2>v4.2.2</h2> <ul> <li><code>url-helper.ts</code> now leverages well-known environment variables by <a href="https://github.com/jww3"><code>@jww3</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1941">actions/checkout#1941</a></li> <li>Expand unit test coverage for <code>isGhes</code> by <a href="https://github.com/jww3"><code>@jww3</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1946">actions/checkout#1946</a></li> </ul> <h2>v4.2.1</h2> <ul> <li>Check out other refs/* by commit if provided, fall back to ref by <a href="https://github.com/orhantoy"><code>@orhantoy</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1924">actions/checkout#1924</a></li> </ul> <h2>v4.2.0</h2> <ul> <li>Add Ref and Commit outputs by <a href="https://github.com/lucacome"><code>@lucacome</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1180">actions/checkout#1180</a></li> <li>Dependency updates by <a href="https://github.com/dependabot"><code>@dependabot</code></a>- <a href="https://redirect.github.com/actions/checkout/pull/1777">actions/checkout#1777</a>, <a href="https://redirect.github.com/actions/checkout/pull/1872">actions/checkout#1872</a></li> </ul> <h2>v4.1.7</h2> <ul> <li>Bump the minor-npm-dependencies group across 1 directory with 4 updates by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1739">actions/checkout#1739</a></li> <li>Bump actions/checkout from 3 to 4 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1697">actions/checkout#1697</a></li> <li>Check out other refs/* by commit by <a href="https://github.com/orhantoy"><code>@orhantoy</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1774">actions/checkout#1774</a></li> <li>Pin actions/checkout's own workflows to a known, good, stable version. by <a href="https://github.com/jww3"><code>@jww3</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1776">actions/checkout#1776</a></li> </ul> <h2>v4.1.6</h2> <ul> <li>Check platform to set archive extension appropriately by <a href="https://github.com/cory-miller"><code>@cory-miller</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1732">actions/checkout#1732</a></li> </ul> <h2>v4.1.5</h2> <ul> <li>Update NPM dependencies by <a href="https://github.com/cory-miller"><code>@cory-miller</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1703">actions/checkout#1703</a></li> <li>Bump github/codeql-action from 2 to 3 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1694">actions/checkout#1694</a></li> <li>Bump actions/setup-node from 1 to 4 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1696">actions/checkout#1696</a></li> <li>Bump actions/upload-artifact from 2 to 4 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1695">actions/checkout#1695</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="1af3b93b68"><code>1af3b93</code></a> update readme/changelog for v6 (<a href="https://redirect.github.com/actions/checkout/issues/2311">#2311</a>)</li> <li><a href="71cf2267d8"><code>71cf226</code></a> v6-beta (<a href="https://redirect.github.com/actions/checkout/issues/2298">#2298</a>)</li> <li><a href="069c695914"><code>069c695</code></a> Persist creds to a separate file (<a href="https://redirect.github.com/actions/checkout/issues/2286">#2286</a>)</li> <li><a href="ff7abcd0c3"><code>ff7abcd</code></a> Update README to include Node.js 24 support details and requirements (<a href="https://redirect.github.com/actions/checkout/issues/2248">#2248</a>)</li> <li><a href="08c6903cd8"><code>08c6903</code></a> Prepare v5.0.0 release (<a href="https://redirect.github.com/actions/checkout/issues/2238">#2238</a>)</li> <li><a href="9f265659d3"><code>9f26565</code></a> Update actions checkout to use node 24 (<a href="https://redirect.github.com/actions/checkout/issues/2226">#2226</a>)</li> <li><a href="08eba0b27e"><code>08eba0b</code></a> Prepare release v4.3.0 (<a href="https://redirect.github.com/actions/checkout/issues/2237">#2237</a>)</li> <li><a href="631c7dc4f8"><code>631c7dc</code></a> Update package dependencies (<a href="https://redirect.github.com/actions/checkout/issues/2236">#2236</a>)</li> <li><a href="8edcb1bdb4"><code>8edcb1b</code></a> Update CODEOWNERS for actions (<a href="https://redirect.github.com/actions/checkout/issues/2224">#2224</a>)</li> <li><a href="09d2acae67"><code>09d2aca</code></a> Update README.md (<a href="https://redirect.github.com/actions/checkout/issues/2194">#2194</a>)</li> <li>Additional commits viewable in <a href="https://github.com/actions/checkout/compare/v3...v6">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit4d3c223402Author: Jiří Polášek <me@jiripolasek.com> Date: Mon Dec 1 02:32:30 2025 +0100 CmdPal: Fix grid views (#43991) This PR fixes the crash due to binding to a trimmed property. For this it converts runtime bindings on GridView to use `{x:Bind}` so this issue can't happen in the future. - Fixes a crash related to the `Visibility` property in gallery/grid views when trimmed during AOT builds. - Fixes ShowTitle and ShowSubtitle properties, they are now taken into account in a view. - Improves UI layout, removes some margins and maches the corner radius of the item contaienr with the item content in the gallery view. - Refactores gallery and grid views to move logic from the view to the view model so we can x:Bind to them. - Replaces `{Binding}` with `{x:Bind}` to improve performance and enable compile-time binding validation. - Properties related to grids are splatted on to the common `IGridPropertiesViewModel` interface. Subclassing would add extra overhead without substential benefit. - Adds new samples to showcase various grid view configurations. A) Gallery view (with title and subtitle) <img width="909" height="583" alt="image" src="https://github.com/user-attachments/assets/b807e7a8-412f-4817-8121-e3470c49e0c0" /> B) Gallery view (only title) <img width="903" height="582" alt="image" src="https://github.com/user-attachments/assets/b619d63f-04d0-42f2-9207-de256dc5e481" /> C) Gallery view (no title or subtitle) <img width="900" height="583" alt="image" src="https://github.com/user-attachments/assets/c48cd1fc-8f51-40c1-8bce-607916e9f742" /> D) Small icons <img width="907" height="582" alt="image" src="https://github.com/user-attachments/assets/8327da0a-fa45-443f-b52c-f0f1edd7b861" /> E) Medium icons (with labels) <img width="914" height="588" alt="image" src="https://github.com/user-attachments/assets/dee9fab1-54e8-45f8-96d7-502b121a6ac2" /> F) Medium icons (no labels) <img width="915" height="588" alt="image" src="https://github.com/user-attachments/assets/a32e8af2-6cb1-4106-91db-ca396253c0a3" /> <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43973 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit1ba5a258e9Author: Jiří Polášek <me@jiripolasek.com> Date: Sun Nov 30 01:59:58 2025 +0100 CmdPal: Add custom search engine option to Web Search extension (#43941) This PR allows user to customize a search query in Command Palette's Web Search built-in extension. This will also solve a problem with some browser that doesn't handle argument in form "? <query>" as it will allow user to specify the complete URI. - Introduces a new text box in Web Search extension settings for specifying a custom search engine URI - If the text box is non-empty, the provided URI is used for queries - If left empty, the extension defaults to previous behavior, sending queries in the format "? query" <img width="825" height="566" alt="image" src="https://github.com/user-attachments/assets/fbf3d3a5-ebfe-4c16-a5f1-0d044b6f9047" /> <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43940 - [x] Closes: #42867 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit8aea589b01Author: Jiří Polášek <me@jiripolasek.com> Date: Sun Nov 30 00:36:55 2025 +0100 CmdPal: Align spellchecker and naming to .NET guidelines (#43974) - Add command-line parameter value (icf) - Unify file and class name casing to match .NET naming conventions (RDP -> Rdp as Url, Dns, Xml) -- fixes IRDP spellchecking error - Rename IRdpConnectionManager to IRdpConnectionsManager (*s) to match the class name <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commitafd9d4cc3cAuthor: Clint Rutkas <clint@rutkas.com> Date: Sat Nov 29 15:11:17 2025 -0800 Update PowerToys download links to version 0.96.1 (#43965) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commitbc0a760affAuthor: Jiří Polášek <me@jiripolasek.com> Date: Sat Nov 29 23:23:24 2025 +0100 CmdPal: Add mini dev center (#43939) This PR introduces a small ribbon to the CmdPal for app developers. The dev ribbon is dynamically added to the main window in local (non-CI) builds. It shows the number of logged errors and warnings, the current build configuration (Debug or Release), and whether it’s built with AOT. The flyout shows the latest errors and warnings and lets you quickly access the logs. <img width="985" height="589" alt="image" src="https://github.com/user-attachments/assets/6528b02b-b4b4-4968-91bf-e67a29f86415" /> <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43318 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit06afe09973Author: Michael Jolley <mike@baldbeardedbuilder.com> Date: Sat Nov 29 13:07:19 2025 -0600 CmdPal: New Remote Desktop built-in extension (#43090) This PR introduces a new built-in extension for Remote Desktop users. It allows you to view past RDP connections, save predefined connections, and connect to any of them. Or start a new RDP connection. https://github.com/user-attachments/assets/6a5041a6-5741-4df0-a305-da7166f962e1 Closes #38305 --------- Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Jiří Polášek <me@jiripolasek.com> commit0de60445eaAuthor: Jiří Polášek <me@jiripolasek.com> Date: Thu Nov 27 16:31:10 2025 +0100 CmdPal: Use Shell API to determine the default browser in WebSearch (#43339) This PR introduces a new method for determining the default browser using the Windows Shell API. The new provider selects the browser associated with the HTTPS protocol (falling back to HTTP if necessary). The original implementation is retained as a fallback for now, and the codebase is prepared for future extensions (e.g., manual default-browser selection). As a flyby, it also fixes an issue where commands continued showing the previous browser name if the user changed their default browser while the Command Palette was running. Fixed default browser selection in the Web Search built-in extension. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #42343 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit47d4a65223Author: Jiří Polášek <me@jiripolasek.com> Date: Thu Nov 27 16:24:47 2025 +0100 CmdPal: Add option to return to home automatically after a delay (#43551) This PR replaces the Go home when activated setting with a new Automatically return home option. This allows users to specify how long the Command Palette should wait after being dismissed before automatically returning to the home page. It also introduces migration logic to transition from the old setting to the new one. <img width="1337" height="762" alt="image" src="https://github.com/user-attachments/assets/c649ef03-b3ee-40ba-ac67-485bc40efa73" /> <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43355 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit1b72c0b969Author: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Thu Nov 27 17:22:59 2025 +0800 Update check-spelling expect list (#43925) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> Spell no complain commit9160c82fc2Author: Pratyush Nalam <github@code.pratyushnalam.com> Date: Thu Nov 27 05:15:06 2025 +0530 Update Command Palette's Learn More string to be consistent with other utilities (#43898) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> In the PowerToys "What's new" window, every utility has the text "Learn more about <utility name>" next to the "Settings" button. Examples below: <img width="247" height="38" alt="learnmore-fancyzones" src="https://github.com/user-attachments/assets/fecdeb4b-e01c-438d-8d11-c056e613768e" /> <img width="258" height="40" alt="learnmore-textextractor" src="https://github.com/user-attachments/assets/ffb0c801-5b89-46d1-b493-b57287303e65" /> The only exception is the Command Palette utility which just says "Learn more". <img width="152" height="32" alt="learnmore-cmdpal" src="https://github.com/user-attachments/assets/232c11cd-b621-46eb-87f1-d3fc708d6286" /> This is an inconsistency and this PR fixes that string. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43897 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit452e0dcf51Author: Mike Hall <mikehall@microsoft.com> Date: Wed Nov 26 14:08:34 2025 +0000 Module Loader tool for rapid testing of modules (#43813) ModuleLoader tool, a stand-alone Win32 executable for testing of PowerToy modules without needing branch builds. sample output from running the tool is below: .\ModuleLoader.exe .\powertoys.cursorwrap.dll PowerToys Module Loader v1.0 ============================= Loading module: .\powertoys.cursorwrap.dll Detected module name: cursorwrap Loading settings... Trying settings path: C:\Users\mikehall\AppData\Local\Microsoft\PowerToys\cursorwrap\settings.json Settings file loaded (315 characters) Settings loaded successfully. Loading module DLL... Module instance created successfully Module DLL loaded successfully. Module key: CursorWrap Module name: CursorWrap Applying settings to module... Settings applied. Registering module hotkeys... Module reports 1 legacy hotkey(s) Registering hotkey 0: Win+Alt+U - OK Hotkeys registered: 1 Enabling module... Module enabled. ============================= Module is now running! ============================= Module Status: - Name: CursorWrap - Key: CursorWrap - Enabled: Yes - Hotkeys: 1 registered Registered Hotkeys: Win+Alt+U Press Ctrl+C to exit. You can press the module's hotkey to toggle its functionality. Note that this doesn't integrate with Powertoys settings UI - this is purely to test Powertoys module functionality. - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx See details above. ModuleLoader tested on Windows 11, Surface Laptop 7 Pro. commit2c9a9e9fcaAuthor: Jiří Polášek <me@jiripolasek.com> Date: Mon Nov 24 23:57:10 2025 +0100 CmdPal: Improve Command Palette behavior in "Last position" mode (#43543) This PR improves Command Palette behavior in “Last position” mode: - Correctly handles DPI changes between monitors. - Ensures the window is always visible — if it’s fully off-screen or has less than 100px visible on any axis, it is re-centered. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43398 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit09c8c1d79aAuthor: leileizhang <leilzh@microsoft.com> Date: Mon Nov 24 10:42:35 2025 +0800 [Hot Fix] Fix Image Resizer not working on Win10 (#43763) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Windows 10 can’t launch the app using the Sparse Package. Remove the app manifest so that Image Resizer can start properly on Windows 10. We will figure out how to support Sparse Packages on Windows 10 in the next release. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43747 #43734 #43722 #43759 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit95c8a83f79Author: leileizhang <leilzh@microsoft.com> Date: Mon Nov 24 10:08:12 2025 +0800 [Hotfix] Remove the properties in Prompt Execution Settings for OpenAI (#43766) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Remove the properties in Prompt Execution Settings for OpenAI, as the new models may not support them. Will try to expose them in the UI so users can add them on their own in the next release. <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit2830ea919cAuthor: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Mon Nov 24 09:51:27 2025 +0800 Advanced Paste: Adjust model parameter to make the result longer (#43768) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Adjust model parameter to make the result longer <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit725ad21952Author: Dave Rayment <dave.rayment@gmail.com> Date: Mon Nov 24 01:12:54 2025 +0000 [Awake] Fix issue with timed mode not expiring correctly (#43785) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Resolves an issue with the timed mode's expiry not completing correctly. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43775 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> This was because of my recent change to the timed mode. The `Subscribe` method on the `Observable` interval accidentally wired the completion logic to the **Error** handler instead of the **Completion** handler because of the use of a discard `_` instead of an empty parameter list `()`. As a result of the incorrect overload being called, Awake stayed in the Timed state despite the timer reaching zero. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> Confirmed that the timed mode times out and exits upon expiry. commitebc3a139c5Author: Erik Anderson <erik.anderson@microsoft.com> Date: Fri Nov 21 02:34:34 2025 -0800 Fix typo in AI settings card description (#43757) The word "cloud" does not use a vowel sound, so the preceding word should be "A" instead of "An". - [X] Closes: #43756 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [X] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx Co-authored-by: Erik Anderson <erikan@ntdev.microsoft.com> commit28dba2633eAuthor: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com> Date: Thu Nov 20 15:22:40 2025 -0800 [Light Switch][Dev Docs] Clarify LightSwitchService and LightSwitchStateManager roles (#43748) Updated LightSwitch module documentation to clarify the role of LightSwitchService and LightSwitchStateManager. --------- Co-authored-by: Niels Laute <niels.laute@live.nl> commit9fbd3de3a2Author: Jiří Polášek <me@jiripolasek.com> Date: Thu Nov 20 16:23:42 2025 +0100 CmdPal: Add native debugging launch profile to launchSettings.json (#43718) See title. I’m too lazy to open the dialog and then revert the change later. <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit4a0d9912aeAuthor: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Thu Nov 20 09:57:29 2025 +0800 Advanced Paste: No cache for foundry local model list (#43716) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Cache of the downloaded model will make the newly added model only work after running of powertoys, this disable the cache, so just downloaded model will take effect immediately <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> Validated locally commit15c79a0176Author: Dave Rayment <dave.rayment@gmail.com> Date: Wed Nov 19 08:50:25 2025 +0000 [Settings] Fix inconsistent description text for the mouse tools (#43651) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Change some of the mouse utilities' descriptions from declarative to imperative, to match best practice and to be consistent with the other descriptions. <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> - Confirmed the changed descriptions were updated in Settings. commit97d46efec2Author: Dave Rayment <dave.rayment@gmail.com> Date: Wed Nov 19 08:49:40 2025 +0000 [Settings] Fix Dashboard toggle glitches and sorting UI (#43626) Fixes two UI bugs in the Settings Dashboard: module list glitching when toggling modules, and incorrect sort menu checkmarks. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43624 - [x] Closes: #43625 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> When enabling or disabling a module from the "Utilities" list, the entire list would flicker and redraw, causing other toggles to glitch. This made it appear as if multiple modules were being affected by a single change. **Root cause** The `AllModules` ObservableCollection was being completely cleared and re-populated on every change, forcing the UI to destroy and recreate all list items. **Fix** Refactored collection updates to modify items in-place: - Introduced `_moduleItems` master list, built once during initialization. - `RefreshModuleList()` now updates properties without clearing collections - `SortModuleList()` uses `ObservableCollection.Move()` instead of `Clear()`/`Add()` The checkmark in the "Sort by" menu would not update correctly when changing sort order, sometimes showing the incorrect item checked, or even both at once. **Root cause** The `IsChecked` prop on the `ToggleMenuFlyoutItem` is bound to `DashboardSortOrder`, but the binding was not updating because the ViewModel didn't raise a property change notification when the sort order was changed. **Fix** Added `OnPropertyChanged(nameof(DashboardSortOrder))` in `SortModuleList()`. 1. Renamed `GetShortcutModules()` to `RefreshShortcutModules()`. The original name implied a getter, but the routine actually affects state by rebuilding the shortcut and action lists, violating the Command-Query Separation principle. 2. Added an `_isUpdatingFromUI` flag as a defensive measure against circular updates when a UI toggle is changed. 3. Separation of concerns for operations on the modules list. Building, sorting and refreshing it are separated. 4. Added comments and XML doc headers for new methods. Included brief description of GPO locking behaviour. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> - Verified that toggling modules in the list no longer causes the list to flicker or for other toggles to glitch. - Confirmed that the sort order checkmarks update correctly and reflect the current sort order. - Tested GPO policy settings are still queried as before. - Checked sort behaviour is unaffected. *Sorting UI* https://github.com/user-attachments/assets/3484bf63-2946-4460-83a5-361fa7e41c82 *Toggle behaviour* https://github.com/user-attachments/assets/1fae5429-6fa3-4431-80f3-0907dab4f326 --------- Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> commit46242b384eAuthor: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Wed Nov 19 16:25:52 2025 +0800 96 release change log (#43330) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> --------- Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com> Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Co-authored-by: Jiří Polášek <me@jiripolasek.com> Co-authored-by: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com> Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Co-authored-by: leileizhang <leilzh@microsoft.com> Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: niels9001 <9866362+niels9001@users.noreply.github.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Dave Rayment <dave.rayment@gmail.com> Co-authored-by: Gleb Khmyznikov <gleb.khmyznikov@gmail.com> Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Juju Anselum J <106316316+anselumjuju@users.noreply.github.com> Co-authored-by: Dustin L. Howett <duhowett@microsoft.com> Co-authored-by: Leon Zandman <leon@wirwar.com> Co-authored-by: Leon Zandman <lzandman@rdw.nl> Co-authored-by: moooyo <42196638+moooyo@users.noreply.github.com> Co-authored-by: Yu Leng <yuleng@microsoft.com> Co-authored-by: Mike Griese <migrie@microsoft.com> Co-authored-by: Michael Jolley <mike@baldbeardedbuilder.com> Co-authored-by: Mario Hewardt <marioh@microsoft.com> Co-authored-by: Alex Mihaiuc <69110671+foxmsft@users.noreply.github.com> Co-authored-by: Mike Hall <mikehall@microsoft.com> Co-authored-by: Trevor <ngo.trev.95@gmail.com> commit84be261581Author: Niels Laute <niels.laute@live.nl> Date: Tue Nov 18 19:19:38 2025 -0800 Logo change for Azure Inference (#43686) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit5a8095b704Author: Niels Laute <niels.laute@live.nl> Date: Tue Nov 18 18:32:14 2025 -0800 Loc bug (#43685) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit417c1a6b98Author: Niels Laute <niels.laute@live.nl> Date: Tue Nov 18 16:21:14 2025 -0800 Update FoundryLocal.svg (#43682) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit2593149d22Author: leileizhang <leilzh@microsoft.com> Date: Tue Nov 18 14:22:03 2025 +0800 Fix OOBE Mouse Utilities crash by correcting localization key (#43664) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> - The OOBE Mouse Utilities page crashed when selected because the TextBlock with x:Uid="Oobe_MouseUtils_MousePointerCrosshairs" tried to bind a Description property that doesn’t exist. - Updated Resources.resw so the string entry is named Oobe_MouseUtils_MousePointerCrosshairs_Description.Text, matching the markdown description control instead of the TextBlock. - With the correct resource key, the XAML loader no longer resolves an invalid property and navigation succeeds. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43663 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit0b50c38fe1Author: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Tue Nov 18 12:59:52 2025 +0800 Advanced Paste: Refresh environment if foundry is not present (#43662) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> As title <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> [12:55:29.6763496] [Info] FoundryClient.cs::CreateAsync::23 [FoundryClient] First attempt failed, refreshing PATH and retrying [12:55:29.6766491] [Info] FoundryClient.cs::RefreshEnvironmentPath::225 [FoundryClient] Refreshing PATH environment variable from system [12:55:29.6768710] [Info] FoundryClient.cs::RefreshEnvironmentPath::266 [FoundryClient] Updating process PATH with latest system values [12:55:29.6769080] [Info] FoundryClient.cs::TryCreateClientAsync::33 [FoundryClient] Creating Foundry Local client [12:55:29.6769312] [Info] FoundryClient.cs::TryCreateClientAsync::45 [FoundryClient] Starting Foundry service using manager.StartServiceAsync() [12:55:29.9807668] [Info] FoundryClient.cs::TryCreateClientAsync::48 [FoundryClient] Foundry service started successfully Verified, fist launch successfully commit840808b465Author: Niels Laute <niels.laute@live.nl> Date: Tue Nov 18 03:28:40 2025 +0100 [AP] Adding a single scrollviewer and fixing hidden tabstop (#43660) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43655 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commitb50df36b70Author: Jiří Polášek <me@jiripolasek.com> Date: Tue Nov 18 03:00:37 2025 +0100 Setup: Hide apps in PowerToys.SpareApps package from Start Menu (#43650) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> This PR updates the Appx manifest for PowerToys.SpareApps to hide the apps from the Start Menu, as they lack proper visual elements like icons and text. <!-- Please review the items on the PR checklist before submitting--> - [x] Closes: #43647 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commitb94593ef73Author: Jiří Polášek <me@jiripolasek.com> Date: Tue Nov 18 00:55:14 2025 +0100 Settings: Add ScrollViewer to Command Palette page in PowerToys Settings (#43649) commit7a01d56179Author: Mario Hewardt <marioh@microsoft.com> Date: Mon Nov 17 07:26:42 2025 -0800 Updates version for standalone release (#43645) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Updates the version for standalone release <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit130e9a0a68Author: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Mon Nov 17 12:55:22 2025 +0800 cmdpal: Fix launch by button in settings not work (#43634) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Shell does not know it's a protocol, so add protocol to it. <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> Locally verified commit34c37f2d38Author: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Mon Nov 17 09:48:32 2025 +0800 Add not signed dll (#43631) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> This dll is not signed, will fail the pipeline <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit47aed03c03Author: Niels Laute <niels.laute@live.nl> Date: Sun Nov 16 15:13:40 2025 +0100 [AP] Loc fix (#43617) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit6423c7693dAuthor: Niels Laute <niels.laute@live.nl> Date: Sun Nov 16 15:02:38 2025 +0100 [CmdPal] Settings page refresh (#43487) - Refreshed the CmdPal page. - CmdPal can now also be activated from this page by clicking a button - Added a Preview InfoBar for FL in AP <img width="1384" height="1067" alt="image" src="https://github.com/user-attachments/assets/f670e13b-5b4a-4f6a-bcb0-e1dc357afb1e" /> <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> --------- Co-authored-by: vanzue <vanzue@outlook.com> commit3e14d50f65Author: Kai Tao <69313318+vanzue@users.noreply.github.com> Date: Sun Nov 16 15:26:05 2025 +0800 Advanced paste: Add more error handle for foundry local (#43600) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Foundry local sdk will not run models that is not in catalog, when catalog removes some, the old ones will fail executing, so add error hint for users to re-configure the models in settings. <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> <img width="864" height="216" alt="image" src="https://github.com/user-attachments/assets/654207b3-ff50-4888-a638-82136216de7b" /> commitdb7c9e180eAuthor: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com> Date: Sat Nov 15 08:08:20 2025 -0500 [Light Switch] Removed logs from every tick, only logging key events. (#43572) Title commitbcc3ded280Author: Michael Jolley <mike@baldbeardedbuilder.com> Date: Sat Nov 15 07:07:52 2025 -0600 CmdPal: Adding page Id to OpenPage telemetry event (#43584) @niels9001 requested this. As the name says commit24a3cdd486Author: Mario Hewardt <marioh@microsoft.com> Date: Fri Nov 14 17:36:31 2025 -0800 Fixes regressions introduced with GIF support (#43589) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> - Switches default recording format back to MP4 - Fixes framerate issues between the two formats - Fixes file path names <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [x ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> - Switches default recording format back to MP4 - Fixes framerate issues between the two formats - Fixes file path names - <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> Manual testing commit1884e6abc1Author: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Date: Fri Nov 14 16:56:23 2025 +0800 Remove unused properties in AP (#43564) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> This pull request removes legacy provider configuration migration logic and associated data structures from the Advanced Paste AI provider settings. The changes simplify the codebase by eliminating support for legacy provider configuration snapshots and related migration methods, focusing configuration management on the current provider model. - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> --------- Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com> commitad4b553bb1Author: leileizhang <leilzh@microsoft.com> Date: Fri Nov 14 16:15:15 2025 +0800 Remove all AdvancedPaste stored keys during uninstall (#43563) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> Remove all AdvancedPaste stored keys during uninstall <!-- Please review the items on the PR checklist before submitting--> - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> commit193d9aacbeAuthor: Dustin L. Howett <duhowett@microsoft.com> Date: Thu Nov 13 17:59:21 2025 -0600 BugReportTool: replace cziplib with tar.exe (#41127) BugReportTool is the last consumer in the PowerToys repo of cziplib, a library we use to produce ZIP files. This pull request replaces cziplib with a simple CreateProcess call that spawns `tar.exe`, which comes with Windows as of RS4 and can produce ZIP files! I've tested this by producing a bug report archive and attempting to open it with File Explorer. It works fine. We have taken every precaution to ensure that we do not allow any attacker-controlled input to tar's command line. We are *not* using `system()`, and we are not opening up a vector through which a nefarious caller can perform shell injection. We do not pass filenames to tar except that of the final archive. We do not pass directory names to tar; we rely on the current directory instead.
1798 lines
59 KiB
C++
1798 lines
59 KiB
C++
#include "pch.h"
|
|
#include "resource.h"
|
|
#include "RcResource.h"
|
|
#include <ProjectTelemetry.h>
|
|
#include <spdlog/sinks/base_sink.h>
|
|
#include <filesystem>
|
|
#include <string_view>
|
|
|
|
#include "../../src/common/logger/logger.h"
|
|
#include "../../src/common/utils/gpo.h"
|
|
#include "../../src/common/utils/MsiUtils.h"
|
|
#include "../../src/common/utils/modulesRegistry.h"
|
|
#include "../../src/common/updating/installer.h"
|
|
#include "../../src/common/version/version.h"
|
|
#include "../../src/common/Telemetry/EtwTrace/EtwTrace.h"
|
|
#include "../../src/common/utils/package.h"
|
|
#include "../../src/common/utils/clean_video_conference.h"
|
|
|
|
#include <winrt/Windows.ApplicationModel.h>
|
|
#include <winrt/Windows.Foundation.h>
|
|
#include <winrt/Windows.Management.Deployment.h>
|
|
#include <winrt/Windows.Security.Credentials.h>
|
|
|
|
#include <wtsapi32.h>
|
|
#include <processthreadsapi.h>
|
|
#include <UserEnv.h>
|
|
#include <winnt.h>
|
|
|
|
using namespace std;
|
|
|
|
HINSTANCE DLL_HANDLE = nullptr;
|
|
|
|
TRACELOGGING_DEFINE_PROVIDER(
|
|
g_hProvider,
|
|
"Microsoft.PowerToys",
|
|
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
|
TraceLoggingOptionProjectTelemetry());
|
|
|
|
const DWORD USERNAME_DOMAIN_LEN = DNLEN + UNLEN + 2; // Domain Name + '\' + User Name + '\0'
|
|
const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0'
|
|
|
|
static const wchar_t *POWERTOYS_EXE_COMPONENT = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}";
|
|
static const wchar_t *POWERTOYS_UPGRADE_CODE = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}";
|
|
|
|
constexpr inline const wchar_t *DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
|
constexpr inline const wchar_t *DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
|
|
|
#define TraceLoggingWriteWrapper(provider, eventName, ...) \
|
|
if (isDataDiagnosticEnabled()) \
|
|
{ \
|
|
trace.UpdateState(true); \
|
|
TraceLoggingWrite(provider, eventName, __VA_ARGS__); \
|
|
trace.Flush(); \
|
|
trace.UpdateState(false); \
|
|
}
|
|
|
|
static Shared::Trace::ETWTrace trace{L"PowerToys_Installer"};
|
|
|
|
inline bool isDataDiagnosticEnabled()
|
|
{
|
|
HKEY key{};
|
|
if (RegOpenKeyExW(HKEY_CURRENT_USER,
|
|
DataDiagnosticsRegKey,
|
|
0,
|
|
KEY_READ,
|
|
&key) != ERROR_SUCCESS)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
DWORD isDataDiagnosticsEnabled = 0;
|
|
DWORD size = sizeof(isDataDiagnosticsEnabled);
|
|
|
|
if (RegGetValueW(
|
|
HKEY_CURRENT_USER,
|
|
DataDiagnosticsRegKey,
|
|
DataDiagnosticsRegValueName,
|
|
RRF_RT_REG_DWORD,
|
|
nullptr,
|
|
&isDataDiagnosticsEnabled,
|
|
&size) != ERROR_SUCCESS)
|
|
{
|
|
RegCloseKey(key);
|
|
return false;
|
|
}
|
|
RegCloseKey(key);
|
|
|
|
return isDataDiagnosticsEnabled == 1;
|
|
}
|
|
|
|
HRESULT getInstallFolder(MSIHANDLE hInstall, std::wstring &installationDir)
|
|
{
|
|
DWORD len = 0;
|
|
wchar_t _[1];
|
|
MsiGetPropertyW(hInstall, L"CustomActionData", _, &len);
|
|
len += 1;
|
|
installationDir.resize(len);
|
|
HRESULT hr = MsiGetPropertyW(hInstall, L"CustomActionData", installationDir.data(), &len);
|
|
if (installationDir.length())
|
|
{
|
|
installationDir.resize(installationDir.length() - 1);
|
|
}
|
|
ExitOnFailure(hr, "Failed to get INSTALLFOLDER property.");
|
|
LExit:
|
|
return hr;
|
|
}
|
|
|
|
BOOL IsLocalSystem()
|
|
{
|
|
HANDLE hToken;
|
|
UCHAR bTokenUser[sizeof(TOKEN_USER) + 8 + 4 * SID_MAX_SUB_AUTHORITIES];
|
|
PTOKEN_USER pTokenUser = (PTOKEN_USER)bTokenUser;
|
|
ULONG cbTokenUser;
|
|
SID_IDENTIFIER_AUTHORITY siaNT = SECURITY_NT_AUTHORITY;
|
|
PSID pSystemSid;
|
|
BOOL bSystem;
|
|
|
|
// open process token
|
|
if (!OpenProcessToken(GetCurrentProcess(),
|
|
TOKEN_QUERY,
|
|
&hToken))
|
|
return FALSE;
|
|
|
|
// retrieve user SID
|
|
if (!GetTokenInformation(hToken, TokenUser, pTokenUser,
|
|
sizeof(bTokenUser), &cbTokenUser))
|
|
{
|
|
CloseHandle(hToken);
|
|
return FALSE;
|
|
}
|
|
|
|
CloseHandle(hToken);
|
|
|
|
// allocate LocalSystem well-known SID
|
|
if (!AllocateAndInitializeSid(&siaNT, 1, SECURITY_LOCAL_SYSTEM_RID,
|
|
0, 0, 0, 0, 0, 0, 0, &pSystemSid))
|
|
return FALSE;
|
|
|
|
// compare the user SID from the token with the LocalSystem SID
|
|
bSystem = EqualSid(pTokenUser->User.Sid, pSystemSid);
|
|
|
|
FreeSid(pSystemSid);
|
|
|
|
return bSystem;
|
|
}
|
|
|
|
BOOL ImpersonateLoggedInUserAndDoSomething(std::function<bool(HANDLE userToken)> action)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
HANDLE hUserToken = NULL;
|
|
DWORD dwSessionId;
|
|
ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId);
|
|
auto rv = WTSQueryUserToken(dwSessionId, &hUserToken);
|
|
|
|
if (rv == 0)
|
|
{
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "Failed to query user token");
|
|
}
|
|
|
|
HANDLE hUserTokenDup;
|
|
if (DuplicateTokenEx(hUserToken, TOKEN_ALL_ACCESS, NULL, SECURITY_IMPERSONATION_LEVEL::SecurityImpersonation, TOKEN_TYPE::TokenPrimary, &hUserTokenDup) == 0)
|
|
{
|
|
CloseHandle(hUserToken);
|
|
CloseHandle(hUserTokenDup);
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "Failed to duplicate user token");
|
|
}
|
|
|
|
if (ImpersonateLoggedOnUser(hUserTokenDup))
|
|
{
|
|
if (!action(hUserTokenDup))
|
|
{
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "Failed to execute action");
|
|
}
|
|
|
|
RevertToSelf();
|
|
CloseHandle(hUserToken);
|
|
CloseHandle(hUserTokenDup);
|
|
}
|
|
else
|
|
{
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "Failed to duplicate user token");
|
|
}
|
|
|
|
LExit:
|
|
return SUCCEEDED(hr);
|
|
}
|
|
|
|
static std::filesystem::path GetUserPowerShellModulesPath()
|
|
{
|
|
PWSTR myDocumentsBlockPtr;
|
|
|
|
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &myDocumentsBlockPtr)))
|
|
{
|
|
const std::wstring myDocuments{myDocumentsBlockPtr};
|
|
CoTaskMemFree(myDocumentsBlockPtr);
|
|
return std::filesystem::path(myDocuments) / "PowerShell" / "Modules";
|
|
}
|
|
else
|
|
{
|
|
CoTaskMemFree(myDocumentsBlockPtr);
|
|
return {};
|
|
}
|
|
}
|
|
|
|
UINT __stdcall LaunchPowerToysCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder, path, args;
|
|
std::wstring commandLine;
|
|
|
|
hr = WcaInitialize(hInstall, "LaunchPowerToys");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
ExitOnFailure(hr, "Failed to get installFolder.");
|
|
|
|
path = installationFolder;
|
|
path += L"\\PowerToys.exe";
|
|
|
|
args = L"--dont-elevate";
|
|
|
|
commandLine = L"\"" + path + L"\" ";
|
|
commandLine += args;
|
|
|
|
BOOL isSystemUser = IsLocalSystem();
|
|
|
|
if (isSystemUser)
|
|
{
|
|
|
|
auto action = [&commandLine](HANDLE userToken)
|
|
{
|
|
STARTUPINFO startupInfo = { 0 };
|
|
startupInfo.cb = sizeof(STARTUPINFO);
|
|
startupInfo.wShowWindow = SW_SHOWNORMAL;
|
|
PROCESS_INFORMATION processInformation;
|
|
|
|
PVOID lpEnvironment = NULL;
|
|
CreateEnvironmentBlock(&lpEnvironment, userToken, FALSE);
|
|
|
|
CreateProcessAsUser(
|
|
userToken,
|
|
NULL,
|
|
commandLine.data(),
|
|
NULL,
|
|
NULL,
|
|
FALSE,
|
|
CREATE_DEFAULT_ERROR_MODE | CREATE_UNICODE_ENVIRONMENT,
|
|
lpEnvironment,
|
|
NULL,
|
|
&startupInfo,
|
|
&processInformation);
|
|
|
|
if (!CloseHandle(processInformation.hProcess))
|
|
{
|
|
return false;
|
|
}
|
|
if (!CloseHandle(processInformation.hThread))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
if (!ImpersonateLoggedInUserAndDoSomething(action))
|
|
{
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "ImpersonateLoggedInUserAndDoSomething failed");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
STARTUPINFO startupInfo = { 0 };
|
|
startupInfo.cb = sizeof(STARTUPINFO);
|
|
startupInfo.wShowWindow = SW_SHOWNORMAL;
|
|
|
|
PROCESS_INFORMATION processInformation;
|
|
|
|
// Start the resizer
|
|
CreateProcess(
|
|
NULL,
|
|
commandLine.data(),
|
|
NULL,
|
|
NULL,
|
|
TRUE,
|
|
0,
|
|
NULL,
|
|
NULL,
|
|
&startupInfo,
|
|
&processInformation);
|
|
|
|
if (!CloseHandle(processInformation.hProcess))
|
|
{
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "Failed to close process handle");
|
|
}
|
|
if (!CloseHandle(processInformation.hThread))
|
|
{
|
|
hr = E_ABORT;
|
|
ExitOnFailure(hr, "Failed to close thread handle");
|
|
}
|
|
}
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall CheckGPOCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
|
|
hr = WcaInitialize(hInstall, "CheckGPOCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
LPWSTR currentScope = nullptr;
|
|
hr = WcaGetProperty(L"InstallScope", ¤tScope);
|
|
|
|
if (std::wstring{currentScope} == L"perUser")
|
|
{
|
|
if (powertoys_gpo::getDisablePerUserInstallationValue() == powertoys_gpo::gpo_rule_configured_enabled)
|
|
{
|
|
PMSIHANDLE hRecord = MsiCreateRecord(0);
|
|
MsiRecordSetString(hRecord, 0, TEXT("The system administrator has disabled per-user installation."));
|
|
MsiProcessMessage(hInstall, static_cast<INSTALLMESSAGE>(INSTALLMESSAGE_ERROR + MB_OK), hRecord);
|
|
hr = E_ABORT;
|
|
}
|
|
}
|
|
|
|
LExit:
|
|
UINT er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
// We've deprecated Video Conference Mute. This Custom Action cleans up any stray registry entry for the driver dll.
|
|
UINT __stdcall CleanVideoConferenceRegistryCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "CleanVideoConferenceRegistry");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
clean_video_conference();
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall ApplyModulesRegistryChangeSetsCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder;
|
|
bool failedToApply = false;
|
|
|
|
hr = WcaInitialize(hInstall, "ApplyModulesRegistryChangeSets");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
ExitOnFailure(hr, "Failed to get installFolder.");
|
|
|
|
for (const auto &changeSet : getAllOnByDefaultModulesChangeSets(installationFolder))
|
|
{
|
|
if (!changeSet.apply())
|
|
{
|
|
Logger::error(L"Couldn't apply registry changeSet");
|
|
failedToApply = true;
|
|
}
|
|
}
|
|
|
|
if (!failedToApply)
|
|
{
|
|
Logger::info(L"All registry changeSets applied successfully");
|
|
}
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UnApplyModulesRegistryChangeSetsCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder;
|
|
|
|
hr = WcaInitialize(hInstall, "UndoModulesRegistryChangeSets"); // original func name is too long
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
ExitOnFailure(hr, "Failed to get installFolder.");
|
|
for (const auto &changeSet : getAllModulesChangeSets(installationFolder))
|
|
{
|
|
changeSet.unApply();
|
|
}
|
|
|
|
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
|
|
|
ExitOnFailure(hr, "Failed to extract msix");
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
const wchar_t *DSC_CONFIGURE_PSD1_NAME = L"Microsoft.PowerToys.Configure.psd1";
|
|
const wchar_t *DSC_CONFIGURE_PSM1_NAME = L"Microsoft.PowerToys.Configure.psm1";
|
|
|
|
UINT __stdcall InstallDSCModuleCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder;
|
|
|
|
hr = WcaInitialize(hInstall, "InstallDSCModuleCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
ExitOnFailure(hr, "Failed to get installFolder.");
|
|
|
|
{
|
|
const auto baseModulesPath = GetUserPowerShellModulesPath();
|
|
if (baseModulesPath.empty())
|
|
{
|
|
hr = E_FAIL;
|
|
ExitOnFailure(hr, "Unable to determine Powershell modules path");
|
|
}
|
|
|
|
const auto modulesPath = baseModulesPath / L"Microsoft.PowerToys.Configure" / (get_product_version(false) + L".0");
|
|
|
|
std::error_code errorCode;
|
|
std::filesystem::create_directories(modulesPath, errorCode);
|
|
if (errorCode)
|
|
{
|
|
hr = E_FAIL;
|
|
ExitOnFailure(hr, "Unable to create Powershell modules folder");
|
|
}
|
|
|
|
for (const auto *filename : {DSC_CONFIGURE_PSD1_NAME, DSC_CONFIGURE_PSM1_NAME})
|
|
{
|
|
std::filesystem::copy_file(std::filesystem::path(installationFolder) / "DSCModules" / filename, modulesPath / filename, std::filesystem::copy_options::overwrite_existing, errorCode);
|
|
|
|
if (errorCode)
|
|
{
|
|
hr = E_FAIL;
|
|
ExitOnFailure(hr, "Unable to copy Powershell modules file");
|
|
}
|
|
}
|
|
}
|
|
|
|
LExit:
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
er = ERROR_SUCCESS;
|
|
Logger::info(L"DSC module was installed!");
|
|
}
|
|
else
|
|
{
|
|
er = ERROR_INSTALL_FAILURE;
|
|
Logger::error(L"Couldn't install DSC module!");
|
|
}
|
|
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UninstallDSCModuleCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "UninstallDSCModuleCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
{
|
|
const auto baseModulesPath = GetUserPowerShellModulesPath();
|
|
if (baseModulesPath.empty())
|
|
{
|
|
hr = E_FAIL;
|
|
ExitOnFailure(hr, "Unable to determine Powershell modules path");
|
|
}
|
|
|
|
const auto powerToysModulePath = baseModulesPath / L"Microsoft.PowerToys.Configure";
|
|
const auto versionedModulePath = powerToysModulePath / (get_product_version(false) + L".0");
|
|
|
|
std::error_code errorCode;
|
|
|
|
for (const auto *filename : {DSC_CONFIGURE_PSD1_NAME, DSC_CONFIGURE_PSM1_NAME})
|
|
{
|
|
std::filesystem::remove(versionedModulePath / filename, errorCode);
|
|
|
|
if (errorCode)
|
|
{
|
|
hr = E_FAIL;
|
|
ExitOnFailure(hr, "Unable to delete DSC file");
|
|
}
|
|
}
|
|
|
|
for (const auto *modulePath : {&versionedModulePath, &powerToysModulePath})
|
|
{
|
|
std::filesystem::remove(*modulePath, errorCode);
|
|
|
|
if (errorCode)
|
|
{
|
|
hr = E_FAIL;
|
|
ExitOnFailure(hr, "Unable to delete DSC folder");
|
|
}
|
|
}
|
|
}
|
|
|
|
LExit:
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
er = ERROR_SUCCESS;
|
|
Logger::info(L"DSC module was uninstalled!");
|
|
}
|
|
else
|
|
{
|
|
er = ERROR_INSTALL_FAILURE;
|
|
Logger::error(L"Couldn't uninstall DSC module!");
|
|
}
|
|
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall InstallEmbeddedMSIXCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "InstallEmbeddedMSIXCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
if (auto msix = RcResource::create(IDR_BIN_MSIX_HELLO_PACKAGE, L"BIN", DLL_HANDLE))
|
|
{
|
|
Logger::info(L"Extracted MSIX");
|
|
// TODO: Use to activate embedded MSIX
|
|
const auto msix_path = std::filesystem::temp_directory_path() / "hello_package.msix";
|
|
if (!msix->saveAsFile(msix_path))
|
|
{
|
|
ExitOnFailure(hr, "Failed to save msix");
|
|
}
|
|
Logger::info(L"Saved MSIX");
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
using namespace winrt::Windows::Foundation;
|
|
|
|
Uri msix_uri{msix_path.wstring()};
|
|
PackageManager pm;
|
|
auto result = pm.AddPackageAsync(msix_uri, nullptr, DeploymentOptions::None).get();
|
|
if (!result)
|
|
{
|
|
ExitOnFailure(hr, "Failed to AddPackage");
|
|
}
|
|
|
|
Logger::info(L"MSIX[s] were installed!");
|
|
}
|
|
else
|
|
{
|
|
ExitOnFailure(hr, "Failed to extract msix");
|
|
}
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UninstallEmbeddedMSIXCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
using namespace winrt::Windows::Foundation;
|
|
// TODO: This must be replaced with the actual publisher and package name
|
|
const wchar_t package_name[] = L"46b35c25-b593-48d5-aeb1-d3e9c3b796e9";
|
|
const wchar_t publisher[] = L"CN=yuyoyuppe";
|
|
PackageManager pm;
|
|
|
|
hr = WcaInitialize(hInstall, "UninstallEmbeddedMSIXCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
for (const auto &p : pm.FindPackagesForUser({}, package_name, publisher))
|
|
{
|
|
auto result = pm.RemovePackageAsync(p.Id().FullName()).get();
|
|
if (result)
|
|
{
|
|
Logger::info(L"MSIX was uninstalled!");
|
|
}
|
|
else
|
|
{
|
|
Logger::error(L"Couldn't uninstall MSIX!");
|
|
}
|
|
}
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall InstallPackageIdentityMSIXCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
LPWSTR customActionData = nullptr;
|
|
std::wstring installFolderPath;
|
|
std::wstring installScope;
|
|
std::wstring msixPath;
|
|
std::wstring data;
|
|
size_t delimiterPos;
|
|
bool isMachineLevel = false;
|
|
|
|
hr = WcaInitialize(hInstall, "InstallPackageIdentityMSIXCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
hr = WcaGetProperty(L"CustomActionData", &customActionData);
|
|
ExitOnFailure(hr, "Failed to get CustomActionData property");
|
|
|
|
// Parse CustomActionData: "[INSTALLFOLDER];[InstallScope]"
|
|
data = customActionData;
|
|
delimiterPos = data.find(L';');
|
|
installFolderPath = data.substr(0, delimiterPos);
|
|
installScope = data.substr(delimiterPos + 1);
|
|
|
|
// Check if this is a machine-level installation
|
|
if (installScope == L"perMachine")
|
|
{
|
|
isMachineLevel = true;
|
|
}
|
|
|
|
Logger::info(L"Installing PackageIdentity MSIX - perUser: {}", !isMachineLevel);
|
|
|
|
// Construct path to PackageIdentity MSIX
|
|
msixPath = installFolderPath;
|
|
msixPath += L"PowerToysSparse.msix";
|
|
|
|
if (std::filesystem::exists(msixPath))
|
|
{
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
using namespace winrt::Windows::Foundation;
|
|
|
|
try
|
|
{
|
|
|
|
std::wstring externalLocation = installFolderPath; // External content location (PowerToys install folder)
|
|
Uri externalUri{ externalLocation }; // External location URI for sparse package content
|
|
Uri packageUri{ msixPath }; // The MSIX file URI
|
|
|
|
PackageManager packageManager;
|
|
|
|
if (isMachineLevel)
|
|
{
|
|
// Machine-level installation
|
|
|
|
StagePackageOptions stageOptions;
|
|
stageOptions.ExternalLocationUri(externalUri);
|
|
|
|
auto stageResult = packageManager.StagePackageByUriAsync(packageUri, stageOptions).get();
|
|
|
|
uint32_t stageErrorCode = static_cast<uint32_t>(stageResult.ExtendedErrorCode());
|
|
if (stageErrorCode == 0)
|
|
{
|
|
std::wstring packageFamilyName = L"Microsoft.PowerToys.SparseApp_8wekyb3d8bbwe";
|
|
|
|
try
|
|
{
|
|
auto provisionResult = packageManager.ProvisionPackageForAllUsersAsync(packageFamilyName).get();
|
|
uint32_t provisionErrorCode = static_cast<uint32_t>(provisionResult.ExtendedErrorCode());
|
|
|
|
if (provisionErrorCode != 0)
|
|
{
|
|
Logger::error(L"Machine-level provisioning failed: 0x{:08X}", provisionErrorCode);
|
|
}
|
|
}
|
|
catch (const winrt::hresult_error& ex)
|
|
{
|
|
Logger::error(L"Provisioning exception: HRESULT 0x{:08X}", static_cast<uint32_t>(ex.code()));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Logger::error(L"Package staging failed: 0x{:08X}", stageErrorCode);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AddPackageOptions addOptions;
|
|
addOptions.ExternalLocationUri(externalUri);
|
|
|
|
auto addResult = packageManager.AddPackageByUriAsync(packageUri, addOptions).get();
|
|
|
|
if (!addResult.IsRegistered())
|
|
{
|
|
uint32_t errorCode = static_cast<uint32_t>(addResult.ExtendedErrorCode());
|
|
Logger::error(L"Per-user installation failed: 0x{:08X}", errorCode);
|
|
}
|
|
}
|
|
}
|
|
catch (const std::exception& ex)
|
|
{
|
|
Logger::error(L"PackageIdentity MSIX installation failed - Exception: {}",
|
|
winrt::to_hstring(ex.what()).c_str());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Logger::error(L"PackageIdentity MSIX not found: " + msixPath);
|
|
}
|
|
|
|
LExit:
|
|
ReleaseStr(customActionData);
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UninstallPackageIdentityMSIXCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
using namespace winrt::Windows::Foundation;
|
|
|
|
LPWSTR installScope = nullptr;
|
|
bool isMachineLevel = false;
|
|
|
|
PackageManager pm;
|
|
|
|
hr = WcaInitialize(hInstall, "UninstallPackageIdentityMSIXCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
// Check if this was a machine-level installation
|
|
hr = WcaGetProperty(L"InstallScope", &installScope);
|
|
if (SUCCEEDED(hr) && installScope && wcscmp(installScope, L"perMachine") == 0)
|
|
{
|
|
isMachineLevel = true;
|
|
}
|
|
|
|
Logger::info(L"Uninstalling PackageIdentity MSIX - perUser: {}", !isMachineLevel);
|
|
|
|
try
|
|
{
|
|
std::wstring packageFamilyName = L"Microsoft.PowerToys.SparseApp_8wekyb3d8bbwe";
|
|
|
|
if (isMachineLevel)
|
|
{
|
|
// Machine-level uninstallation: deprovision + remove for all users
|
|
|
|
// First deprovision the package
|
|
try
|
|
{
|
|
auto deprovisionResult = pm.DeprovisionPackageForAllUsersAsync(packageFamilyName).get();
|
|
if (deprovisionResult.IsRegistered())
|
|
{
|
|
Logger::warn(L"Machine-level deprovisioning completed with warnings");
|
|
}
|
|
}
|
|
catch (const winrt::hresult_error& ex)
|
|
{
|
|
Logger::warn(L"Machine-level deprovisioning failed: HRESULT 0x{:08X}", static_cast<uint32_t>(ex.code()));
|
|
}
|
|
|
|
// Then remove packages for all users
|
|
auto packages = pm.FindPackagesForUserWithPackageTypes({}, packageFamilyName, PackageTypes::Main);
|
|
for (const auto& package : packages)
|
|
{
|
|
try
|
|
{
|
|
auto machineResult = pm.RemovePackageAsync(package.Id().FullName(), RemovalOptions::RemoveForAllUsers).get();
|
|
if (machineResult.IsRegistered())
|
|
{
|
|
uint32_t errorCode = static_cast<uint32_t>(machineResult.ExtendedErrorCode());
|
|
Logger::error(L"Machine-level removal failed: 0x{:08X} - {}", errorCode, machineResult.ErrorText());
|
|
}
|
|
}
|
|
catch (const winrt::hresult_error& ex)
|
|
{
|
|
Logger::error(L"Machine-level removal exception: HRESULT 0x{:08X}", static_cast<uint32_t>(ex.code()));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Per-user uninstallation: standard removal
|
|
|
|
auto packages = pm.FindPackagesForUserWithPackageTypes({}, packageFamilyName, PackageTypes::Main);
|
|
for (const auto& package : packages)
|
|
{
|
|
auto userResult = pm.RemovePackageAsync(package.Id().FullName()).get();
|
|
if (userResult.IsRegistered())
|
|
{
|
|
uint32_t errorCode = static_cast<uint32_t>(userResult.ExtendedErrorCode());
|
|
Logger::error(L"Per-user removal failed: 0x{:08X} - {}", errorCode, userResult.ErrorText());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (const std::exception& ex)
|
|
{
|
|
std::string errorMsg = "Failed to uninstall PackageIdentity MSIX: " + std::string(ex.what());
|
|
Logger::error(errorMsg);
|
|
// Don't fail the entire uninstallation if PackageIdentity fails
|
|
Logger::warn(L"Continuing uninstallation despite PackageIdentity MSIX error");
|
|
}
|
|
|
|
LExit:
|
|
ReleaseStr(installScope);
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall RemoveWindowsServiceByName(std::wstring serviceName)
|
|
{
|
|
SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
|
|
|
|
if (!hSCManager)
|
|
{
|
|
return ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
SC_HANDLE hService = OpenService(hSCManager, serviceName.c_str(), SERVICE_STOP | DELETE);
|
|
if (!hService)
|
|
{
|
|
CloseServiceHandle(hSCManager);
|
|
return ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
SERVICE_STATUS ss;
|
|
if (ControlService(hService, SERVICE_CONTROL_STOP, &ss))
|
|
{
|
|
Sleep(1000);
|
|
while (QueryServiceStatus(hService, &ss))
|
|
{
|
|
if (ss.dwCurrentState == SERVICE_STOP_PENDING)
|
|
{
|
|
Sleep(1000);
|
|
}
|
|
else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
BOOL deleteResult = DeleteService(hService);
|
|
CloseServiceHandle(hService);
|
|
CloseServiceHandle(hSCManager);
|
|
|
|
if (!deleteResult)
|
|
{
|
|
return ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
}
|
|
|
|
UINT __stdcall UnsetAdvancedPasteAPIKeyCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
try
|
|
{
|
|
hr = WcaInitialize(hInstall, "UnsetAdvancedPasteAPIKey");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
winrt::Windows::Security::Credentials::PasswordVault vault;
|
|
|
|
auto hasPrefix = [](std::wstring_view value, wchar_t const* prefix) {
|
|
std::wstring_view prefixView{ prefix };
|
|
return value.compare(0, prefixView.size(), prefixView) == 0;
|
|
};
|
|
|
|
const wchar_t* resourcePrefixes[] = {
|
|
L"https://platform.openai.com/api-keys",
|
|
L"https://azure.microsoft.com/products/ai-services/openai-service",
|
|
L"https://azure.microsoft.com/products/ai-services/ai-inference",
|
|
L"https://console.mistral.ai/account/api-keys",
|
|
L"https://ai.google.dev/",
|
|
};
|
|
|
|
const wchar_t* usernamePrefixes[] = {
|
|
L"PowerToys_AdvancedPaste_",
|
|
};
|
|
|
|
auto credentials = vault.RetrieveAll();
|
|
for (auto const& credential : credentials)
|
|
{
|
|
bool shouldRemove = false;
|
|
|
|
std::wstring resource{ credential.Resource() };
|
|
for (auto const prefix : resourcePrefixes)
|
|
{
|
|
if (hasPrefix(resource, prefix))
|
|
{
|
|
shouldRemove = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!shouldRemove)
|
|
{
|
|
std::wstring username{ credential.UserName() };
|
|
for (auto const prefix : usernamePrefixes)
|
|
{
|
|
if (hasPrefix(username, prefix))
|
|
{
|
|
shouldRemove = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!shouldRemove)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
try
|
|
{
|
|
vault.Remove(credential);
|
|
}
|
|
catch (...)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
catch (...)
|
|
{
|
|
}
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UninstallCommandNotFoundModuleCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder;
|
|
std::string command;
|
|
|
|
hr = WcaInitialize(hInstall, "UninstallCommandNotFoundModule");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
ExitOnFailure(hr, "Failed to get installFolder.");
|
|
|
|
#ifdef _M_ARM64
|
|
command = "powershell.exe";
|
|
command += " ";
|
|
command += "-NoProfile -NonInteractive -NoLogo -WindowStyle Hidden -ExecutionPolicy Unrestricted";
|
|
command += " -Command ";
|
|
command += "\"[Environment]::SetEnvironmentVariable('PATH', [Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [Environment]::GetEnvironmentVariable('PATH', 'User'), 'Process');";
|
|
command += "pwsh.exe -NoProfile -NonInteractive -NoLogo -WindowStyle Hidden -ExecutionPolicy Unrestricted -File '" + winrt::to_string(installationFolder) + "\\WinUI3Apps\\Assets\\Settings\\Scripts\\DisableModule.ps1" + "'\"";
|
|
#else
|
|
command = "pwsh.exe";
|
|
command += " ";
|
|
command += "-NoProfile -NonInteractive -NoLogo -WindowStyle Hidden -ExecutionPolicy Unrestricted -File \"" + winrt::to_string(installationFolder) + "\\WinUI3Apps\\Assets\\Settings\\Scripts\\DisableModule.ps1" + "\"";
|
|
#endif
|
|
|
|
system(command.c_str());
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UpgradeCommandNotFoundModuleCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder;
|
|
std::string command;
|
|
|
|
hr = WcaInitialize(hInstall, "UpgradeCommandNotFoundModule");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
ExitOnFailure(hr, "Failed to get installFolder.");
|
|
|
|
command = "pwsh.exe";
|
|
command += " ";
|
|
command += "-NoProfile -NonInteractive -NoLogo -WindowStyle Hidden -ExecutionPolicy Unrestricted -File \"" + winrt::to_string(installationFolder) + "\\WinUI3Apps\\Assets\\Settings\\Scripts\\UpgradeModule.ps1" + "\"";
|
|
|
|
system(command.c_str());
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UninstallServicesCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "UninstallServicesCA");
|
|
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
hr = RemoveWindowsServiceByName(L"PowerToys.MWB.Service");
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
// Removes all Scheduled Tasks in the PowerToys folder and deletes the folder afterwards.
|
|
// Based on the Task Scheduler Displaying Task Names and State example:
|
|
// https://learn.microsoft.com/windows/desktop/TaskSchd/displaying-task-names-and-state--c---/
|
|
UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
ITaskService *pService = nullptr;
|
|
ITaskFolder *pTaskFolder = nullptr;
|
|
IRegisteredTaskCollection *pTaskCollection = nullptr;
|
|
ITaskFolder *pRootFolder = nullptr;
|
|
LONG numTasks = 0;
|
|
|
|
hr = WcaInitialize(hInstall, "RemoveScheduledTasksCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
Logger::info(L"RemoveScheduledTasksCA Initialized.");
|
|
|
|
// COM and Security Initialization is expected to have been done by the MSI.
|
|
// It couldn't be done in the DLL, anyway.
|
|
// ------------------------------------------------------
|
|
// Create an instance of the Task Service.
|
|
hr = CoCreateInstance(CLSID_TaskScheduler,
|
|
nullptr,
|
|
CLSCTX_INPROC_SERVER,
|
|
IID_ITaskService,
|
|
reinterpret_cast<void **>(&pService));
|
|
ExitOnFailure(hr, "Failed to create an instance of ITaskService: %x", hr);
|
|
|
|
// Connect to the task service.
|
|
hr = pService->Connect(_variant_t(), _variant_t(), _variant_t(), _variant_t());
|
|
ExitOnFailure(hr, "ITaskService::Connect failed: %x", hr);
|
|
|
|
// ------------------------------------------------------
|
|
// Get the PowerToys task folder.
|
|
hr = pService->GetFolder(_bstr_t(L"\\PowerToys"), &pTaskFolder);
|
|
if (FAILED(hr))
|
|
{
|
|
// Folder doesn't exist. No need to delete anything.
|
|
Logger::info(L"The PowerToys scheduled task folder wasn't found. Nothing to delete.");
|
|
hr = S_OK;
|
|
ExitFunction();
|
|
}
|
|
|
|
// -------------------------------------------------------
|
|
// Get the registered tasks in the folder.
|
|
hr = pTaskFolder->GetTasks(TASK_ENUM_HIDDEN, &pTaskCollection);
|
|
ExitOnFailure(hr, "Cannot get the registered tasks: %x", hr);
|
|
|
|
hr = pTaskCollection->get_Count(&numTasks);
|
|
for (LONG i = 0; i < numTasks; i++)
|
|
{
|
|
// Delete all the tasks found.
|
|
// If some tasks can't be deleted, the folder won't be deleted later and the user will still be notified.
|
|
IRegisteredTask *pRegisteredTask = nullptr;
|
|
hr = pTaskCollection->get_Item(_variant_t(i + 1), &pRegisteredTask);
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
BSTR taskName = nullptr;
|
|
hr = pRegisteredTask->get_Name(&taskName);
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
hr = pTaskFolder->DeleteTask(taskName, 0);
|
|
if (FAILED(hr))
|
|
{
|
|
Logger::error(L"Cannot delete the {} task: {}", taskName, hr);
|
|
}
|
|
SysFreeString(taskName);
|
|
}
|
|
else
|
|
{
|
|
Logger::error(L"Cannot get the registered task name: {}", hr);
|
|
}
|
|
pRegisteredTask->Release();
|
|
}
|
|
else
|
|
{
|
|
Logger::error(L"Cannot get the registered task item at index={}: {}", i + 1, hr);
|
|
}
|
|
}
|
|
|
|
// ------------------------------------------------------
|
|
// Get the pointer to the root task folder and delete the PowerToys subfolder.
|
|
hr = pService->GetFolder(_bstr_t(L"\\"), &pRootFolder);
|
|
ExitOnFailure(hr, "Cannot get Root Folder pointer: %x", hr);
|
|
hr = pRootFolder->DeleteFolder(_bstr_t(L"PowerToys"), 0);
|
|
pRootFolder->Release();
|
|
ExitOnFailure(hr, "Cannot delete the PowerToys folder: %x", hr);
|
|
|
|
Logger::info(L"Deleted the PowerToys Task Scheduler folder.");
|
|
|
|
LExit:
|
|
if (pService)
|
|
{
|
|
pService->Release();
|
|
}
|
|
if (pTaskFolder)
|
|
{
|
|
pTaskFolder->Release();
|
|
}
|
|
if (pTaskCollection)
|
|
{
|
|
pTaskCollection->Release();
|
|
}
|
|
|
|
if (!SUCCEEDED(hr))
|
|
{
|
|
PMSIHANDLE hRecord = MsiCreateRecord(0);
|
|
MsiRecordSetString(hRecord, 0, TEXT("Failed to remove the PowerToys folder from the scheduled task. These can be removed manually later."));
|
|
MsiProcessMessage(hInstall, static_cast<INSTALLMESSAGE>(INSTALLMESSAGE_WARNING + MB_OK), hRecord);
|
|
}
|
|
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogInstallSuccessCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogInstallSuccessCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"Install_Success",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogInstallCancelCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogInstallCancelCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"Install_Cancel",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogInstallFailCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogInstallFailCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"Install_Fail",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogUninstallSuccessCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogUninstallSuccessCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"UnInstall_Success",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogUninstallCancelCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogUninstallCancelCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"UnInstall_Cancel",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogUninstallFailCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogUninstallFailCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"UnInstall_Fail",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogRepairCancelCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogRepairCancelCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"Repair_Cancel",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TelemetryLogRepairFailCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "TelemetryLogRepairFailCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
TraceLoggingWriteWrapper(
|
|
g_hProvider,
|
|
"Repair_Fail",
|
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall DetectPrevInstallPathCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "DetectPrevInstallPathCA");
|
|
MsiSetPropertyW(hInstall, L"PREVIOUSINSTALLFOLDER", L"");
|
|
|
|
LPWSTR currentScope = nullptr;
|
|
hr = WcaGetProperty(L"InstallScope", ¤tScope);
|
|
|
|
try
|
|
{
|
|
if (auto install_path = GetMsiPackageInstalledPath(std::wstring{currentScope} == L"perUser"))
|
|
{
|
|
MsiSetPropertyW(hInstall, L"PREVIOUSINSTALLFOLDER", install_path->data());
|
|
}
|
|
}
|
|
catch (...)
|
|
{
|
|
}
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall InstallCmdPalPackageCA(MSIHANDLE hInstall)
|
|
{
|
|
using namespace winrt::Windows::Foundation;
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
std::wstring installationFolder;
|
|
|
|
hr = WcaInitialize(hInstall, "InstallCmdPalPackage");
|
|
hr = getInstallFolder(hInstall, installationFolder);
|
|
|
|
try
|
|
{
|
|
auto msix = package::FindMsixFile(installationFolder + L"\\WinUI3Apps\\CmdPal\\", false);
|
|
auto dependencies = package::FindMsixFile(installationFolder + L"\\WinUI3Apps\\CmdPal\\Dependencies\\", true);
|
|
|
|
if (!msix.empty())
|
|
{
|
|
auto msixPath = msix[0];
|
|
|
|
if (!package::RegisterPackage(msixPath, dependencies))
|
|
{
|
|
Logger::error(L"Failed to install CmdPal package");
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
}
|
|
}
|
|
catch (std::exception &e)
|
|
{
|
|
std::string errorMessage{"Exception thrown while trying to install CmdPal package: "};
|
|
errorMessage += e.what();
|
|
Logger::error(errorMessage);
|
|
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall UnRegisterCmdPalPackageCA(MSIHANDLE hInstall)
|
|
{
|
|
using namespace winrt::Windows::Foundation;
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "UnRegisterCmdPalPackageCA");
|
|
|
|
try
|
|
{
|
|
// Packages to unregister
|
|
std::wstring packageToRemoveDisplayName {L"Microsoft.CommandPalette"};
|
|
|
|
if (!package::UnRegisterPackage(packageToRemoveDisplayName))
|
|
{
|
|
Logger::error(L"Failed to unregister package: " + packageToRemoveDisplayName);
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
}
|
|
catch (std::exception &e)
|
|
{
|
|
std::string errorMessage{"Exception thrown while trying to unregister the CmdPal package: "};
|
|
errorMessage += e.what();
|
|
Logger::error(errorMessage);
|
|
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
|
|
UINT __stdcall UnRegisterContextMenuPackagesCA(MSIHANDLE hInstall)
|
|
{
|
|
using namespace winrt::Windows::Foundation;
|
|
using namespace winrt::Windows::Management::Deployment;
|
|
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
hr = WcaInitialize(hInstall, "UnRegisterContextMenuPackagesCA"); // original func name is too long
|
|
|
|
try
|
|
{
|
|
// Packages to unregister
|
|
const std::vector<std::wstring> packagesToRemoveDisplayName{{L"PowerRenameContextMenu"}, {L"ImageResizerContextMenu"}, {L"FileLocksmithContextMenu"}, {L"NewPlusContextMenu"}};
|
|
|
|
for (auto const &package : packagesToRemoveDisplayName)
|
|
{
|
|
if (!package::UnRegisterPackage(package))
|
|
{
|
|
Logger::error(L"Failed to unregister package: " + package);
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
}
|
|
}
|
|
catch (std::exception &e)
|
|
{
|
|
std::string errorMessage{"Exception thrown while trying to unregister sparse packages: "};
|
|
errorMessage += e.what();
|
|
Logger::error(errorMessage);
|
|
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
|
|
UINT __stdcall CleanImageResizerRuntimeRegistryCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "CleanImageResizerRuntimeRegistryCA");
|
|
|
|
try
|
|
{
|
|
const wchar_t* CLSID_STR = L"{51B4D7E5-7568-4234-B4BB-47FB3C016A69}";
|
|
const wchar_t* exts[] = { L".bmp", L".dib", L".gif", L".jfif", L".jpe", L".jpeg", L".jpg", L".jxr", L".png", L".rle", L".tif", L".tiff", L".wdp" };
|
|
|
|
auto deleteKeyRecursive = [](HKEY root, const std::wstring &path) {
|
|
RegDeleteTreeW(root, path.c_str());
|
|
};
|
|
|
|
// InprocServer32 chain root CLSID
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" + std::wstring(CLSID_STR));
|
|
// DragDrop handler
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\Directory\\ShellEx\\DragDropHandlers\\ImageResizer");
|
|
// Extensions
|
|
for (auto ext : exts)
|
|
{
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\SystemFileAssociations\\" + std::wstring(ext) + L"\\ShellEx\\ContextMenuHandlers\\ImageResizer");
|
|
}
|
|
// Sentinel
|
|
RegDeleteTreeW(HKEY_CURRENT_USER, L"Software\\Microsoft\\PowerToys\\ImageResizer");
|
|
}
|
|
catch (...)
|
|
{
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall CleanFileLocksmithRuntimeRegistryCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "CleanFileLocksmithRuntimeRegistryCA");
|
|
try
|
|
{
|
|
const wchar_t* CLSID_STR = L"{84D68575-E186-46AD-B0CB-BAEB45EE29C0}";
|
|
auto deleteKeyRecursive = [](HKEY root, const std::wstring& path) {
|
|
RegDeleteTreeW(root, path.c_str());
|
|
};
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" + std::wstring(CLSID_STR));
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\AllFileSystemObjects\\ShellEx\\ContextMenuHandlers\\FileLocksmithExt");
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\Drive\\ShellEx\\ContextMenuHandlers\\FileLocksmithExt");
|
|
RegDeleteTreeW(HKEY_CURRENT_USER, L"Software\\Microsoft\\PowerToys\\FileLocksmith");
|
|
}
|
|
catch (...)
|
|
{
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall CleanPowerRenameRuntimeRegistryCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "CleanPowerRenameRuntimeRegistryCA");
|
|
try
|
|
{
|
|
const wchar_t* CLSID_STR = L"{0440049F-D1DC-4E46-B27B-98393D79486B}";
|
|
auto deleteKeyRecursive = [](HKEY root, const std::wstring& path) {
|
|
RegDeleteTreeW(root, path.c_str());
|
|
};
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" + std::wstring(CLSID_STR));
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\AllFileSystemObjects\\ShellEx\\ContextMenuHandlers\\PowerRenameExt");
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\Directory\\background\\ShellEx\\ContextMenuHandlers\\PowerRenameExt");
|
|
RegDeleteTreeW(HKEY_CURRENT_USER, L"Software\\Microsoft\\PowerToys\\PowerRename");
|
|
}
|
|
catch (...)
|
|
{
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall CleanNewPlusRuntimeRegistryCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "CleanNewPlusRuntimeRegistryCA");
|
|
try
|
|
{
|
|
const wchar_t* CLSID_STR = L"{FF90D477-E32A-4BE8-8CC5-A502A97F5401}";
|
|
auto deleteKeyRecursive = [](HKEY root, const std::wstring& path) {
|
|
RegDeleteTreeW(root, path.c_str());
|
|
};
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" + std::wstring(CLSID_STR));
|
|
deleteKeyRecursive(HKEY_CURRENT_USER, L"Software\\Classes\\Directory\\background\\ShellEx\\ContextMenuHandlers\\NewPlusShellExtensionWin10");
|
|
RegDeleteTreeW(HKEY_CURRENT_USER, L"Software\\Microsoft\\PowerToys\\NewPlus");
|
|
}
|
|
catch (...)
|
|
{
|
|
er = ERROR_INSTALL_FAILURE;
|
|
}
|
|
er = er == ERROR_SUCCESS ? (SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE) : er;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
hr = WcaInitialize(hInstall, "TerminateProcessesCA");
|
|
|
|
std::vector<DWORD> processes;
|
|
const size_t maxProcesses = 4096;
|
|
DWORD bytes = maxProcesses * sizeof(processes[0]);
|
|
processes.resize(maxProcesses);
|
|
|
|
if (!EnumProcesses(processes.data(), bytes, &bytes))
|
|
{
|
|
return 1;
|
|
}
|
|
processes.resize(bytes / sizeof(processes[0]));
|
|
|
|
std::array<std::wstring_view, 42> processesToTerminate = {
|
|
L"PowerToys.PowerLauncher.exe",
|
|
L"PowerToys.Settings.exe",
|
|
L"PowerToys.AdvancedPaste.exe",
|
|
L"PowerToys.Awake.exe",
|
|
L"PowerToys.FancyZones.exe",
|
|
L"PowerToys.FancyZonesEditor.exe",
|
|
L"PowerToys.FileLocksmithUI.exe",
|
|
L"PowerToys.MouseJumpUI.exe",
|
|
L"PowerToys.ColorPickerUI.exe",
|
|
L"PowerToys.AlwaysOnTop.exe",
|
|
L"PowerToys.RegistryPreview.exe",
|
|
L"PowerToys.Hosts.exe",
|
|
L"PowerToys.PowerRename.exe",
|
|
L"PowerToys.ImageResizer.exe",
|
|
L"PowerToys.LightSwitchService.exe",
|
|
L"PowerToys.GcodeThumbnailProvider.exe",
|
|
L"PowerToys.BgcodeThumbnailProvider.exe",
|
|
L"PowerToys.PdfThumbnailProvider.exe",
|
|
L"PowerToys.MonacoPreviewHandler.exe",
|
|
L"PowerToys.MarkdownPreviewHandler.exe",
|
|
L"PowerToys.StlThumbnailProvider.exe",
|
|
L"PowerToys.SvgThumbnailProvider.exe",
|
|
L"PowerToys.GcodePreviewHandler.exe",
|
|
L"PowerToys.BgcodePreviewHandler.exe",
|
|
L"PowerToys.QoiPreviewHandler.exe",
|
|
L"PowerToys.PdfPreviewHandler.exe",
|
|
L"PowerToys.QoiThumbnailProvider.exe",
|
|
L"PowerToys.SvgPreviewHandler.exe",
|
|
L"PowerToys.Peek.UI.exe",
|
|
L"PowerToys.MouseWithoutBorders.exe",
|
|
L"PowerToys.MouseWithoutBordersHelper.exe",
|
|
L"PowerToys.MouseWithoutBordersService.exe",
|
|
L"PowerToys.CropAndLock.exe",
|
|
L"PowerToys.EnvironmentVariables.exe",
|
|
L"PowerToys.WorkspacesSnapshotTool.exe",
|
|
L"PowerToys.WorkspacesLauncher.exe",
|
|
L"PowerToys.WorkspacesLauncherUI.exe",
|
|
L"PowerToys.WorkspacesEditor.exe",
|
|
L"PowerToys.WorkspacesWindowArranger.exe",
|
|
L"Microsoft.CmdPal.UI.exe",
|
|
L"PowerToys.ZoomIt.exe",
|
|
L"PowerToys.exe",
|
|
};
|
|
|
|
for (const auto procID : processes)
|
|
{
|
|
if (!procID)
|
|
{
|
|
continue;
|
|
}
|
|
wchar_t processName[MAX_PATH] = L"<unknown>";
|
|
|
|
HANDLE hProcess{OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE, procID)};
|
|
if (!hProcess)
|
|
{
|
|
continue;
|
|
}
|
|
HMODULE hMod;
|
|
DWORD cbNeeded;
|
|
|
|
if (!EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded))
|
|
{
|
|
CloseHandle(hProcess);
|
|
continue;
|
|
}
|
|
GetModuleBaseNameW(hProcess, hMod, processName, sizeof(processName) / sizeof(wchar_t));
|
|
|
|
for (const auto processToTerminate : processesToTerminate)
|
|
{
|
|
if (processName == processToTerminate)
|
|
{
|
|
const DWORD timeout = 500;
|
|
auto windowEnumerator = [](HWND hwnd, LPARAM procIDPtr) -> BOOL
|
|
{
|
|
auto targetProcID = *reinterpret_cast<const DWORD *>(procIDPtr);
|
|
DWORD windowProcID = 0;
|
|
GetWindowThreadProcessId(hwnd, &windowProcID);
|
|
if (windowProcID == targetProcID)
|
|
{
|
|
DWORD_PTR _{};
|
|
SendMessageTimeoutA(hwnd, WM_CLOSE, 0, 0, SMTO_BLOCK, timeout, &_);
|
|
}
|
|
return TRUE;
|
|
};
|
|
EnumWindows(windowEnumerator, reinterpret_cast<LPARAM>(&procID));
|
|
Sleep(timeout);
|
|
TerminateProcess(hProcess, 0);
|
|
break;
|
|
}
|
|
}
|
|
CloseHandle(hProcess);
|
|
}
|
|
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
UINT __stdcall SetBundleInstallLocationCA(MSIHANDLE hInstall)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
UINT er = ERROR_SUCCESS;
|
|
|
|
// Declare all variables at the beginning to avoid goto issues
|
|
std::wstring customActionData;
|
|
std::wstring installationFolder;
|
|
std::wstring bundleUpgradeCode;
|
|
std::wstring installScope;
|
|
bool isPerUser = false;
|
|
size_t pos1 = std::wstring::npos;
|
|
size_t pos2 = std::wstring::npos;
|
|
std::vector<HKEY> keysToTry;
|
|
|
|
hr = WcaInitialize(hInstall, "SetBundleInstallLocationCA");
|
|
ExitOnFailure(hr, "Failed to initialize");
|
|
|
|
// Parse CustomActionData: "installFolder;upgradeCode;installScope"
|
|
hr = getInstallFolder(hInstall, customActionData);
|
|
ExitOnFailure(hr, "Failed to get CustomActionData.");
|
|
|
|
pos1 = customActionData.find(L';');
|
|
if (pos1 == std::wstring::npos)
|
|
{
|
|
hr = E_INVALIDARG;
|
|
ExitOnFailure(hr, "Invalid CustomActionData format - missing first semicolon");
|
|
}
|
|
|
|
pos2 = customActionData.find(L';', pos1 + 1);
|
|
if (pos2 == std::wstring::npos)
|
|
{
|
|
hr = E_INVALIDARG;
|
|
ExitOnFailure(hr, "Invalid CustomActionData format - missing second semicolon");
|
|
}
|
|
|
|
installationFolder = customActionData.substr(0, pos1);
|
|
bundleUpgradeCode = customActionData.substr(pos1 + 1, pos2 - pos1 - 1);
|
|
installScope = customActionData.substr(pos2 + 1);
|
|
|
|
isPerUser = (installScope == L"perUser");
|
|
|
|
// Use the appropriate registry based on install scope
|
|
HKEY targetKey = isPerUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
|
|
const wchar_t* keyName = isPerUser ? L"HKCU" : L"HKLM";
|
|
|
|
WcaLog(LOGMSG_STANDARD, "SetBundleInstallLocationCA: Searching for Bundle in %ls registry", keyName);
|
|
|
|
HKEY uninstallKey;
|
|
LONG openResult = RegOpenKeyExW(targetKey, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, KEY_READ | KEY_ENUMERATE_SUB_KEYS, &uninstallKey);
|
|
if (openResult != ERROR_SUCCESS)
|
|
{
|
|
WcaLog(LOGMSG_STANDARD, "SetBundleInstallLocationCA: Failed to open uninstall key, error: %ld", openResult);
|
|
goto LExit;
|
|
}
|
|
|
|
DWORD index = 0;
|
|
wchar_t subKeyName[256];
|
|
DWORD subKeyNameSize = sizeof(subKeyName) / sizeof(wchar_t);
|
|
|
|
while (RegEnumKeyExW(uninstallKey, index, subKeyName, &subKeyNameSize, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
|
|
{
|
|
HKEY productKey;
|
|
if (RegOpenKeyExW(uninstallKey, subKeyName, 0, KEY_READ | KEY_WRITE, &productKey) == ERROR_SUCCESS)
|
|
{
|
|
wchar_t upgradeCode[256];
|
|
DWORD upgradeCodeSize = sizeof(upgradeCode);
|
|
DWORD valueType;
|
|
|
|
if (RegQueryValueExW(productKey, L"BundleUpgradeCode", nullptr, &valueType,
|
|
reinterpret_cast<LPBYTE>(upgradeCode), &upgradeCodeSize) == ERROR_SUCCESS)
|
|
{
|
|
// Remove brackets from registry upgradeCode for comparison (bundleUpgradeCode doesn't have brackets)
|
|
std::wstring regUpgradeCode = upgradeCode;
|
|
if (!regUpgradeCode.empty() && regUpgradeCode.front() == L'{' && regUpgradeCode.back() == L'}')
|
|
{
|
|
regUpgradeCode = regUpgradeCode.substr(1, regUpgradeCode.length() - 2);
|
|
}
|
|
|
|
if (_wcsicmp(regUpgradeCode.c_str(), bundleUpgradeCode.c_str()) == 0)
|
|
{
|
|
// Found matching Bundle, set InstallLocation
|
|
LONG setResult = RegSetValueExW(productKey, L"InstallLocation", 0, REG_SZ,
|
|
reinterpret_cast<const BYTE*>(installationFolder.c_str()),
|
|
static_cast<DWORD>((installationFolder.length() + 1) * sizeof(wchar_t)));
|
|
|
|
if (setResult == ERROR_SUCCESS)
|
|
{
|
|
WcaLog(LOGMSG_STANDARD, "SetBundleInstallLocationCA: InstallLocation set successfully");
|
|
}
|
|
else
|
|
{
|
|
WcaLog(LOGMSG_STANDARD, "SetBundleInstallLocationCA: Failed to set InstallLocation, error: %ld", setResult);
|
|
}
|
|
|
|
RegCloseKey(productKey);
|
|
RegCloseKey(uninstallKey);
|
|
goto LExit;
|
|
}
|
|
}
|
|
RegCloseKey(productKey);
|
|
}
|
|
|
|
index++;
|
|
subKeyNameSize = sizeof(subKeyName) / sizeof(wchar_t);
|
|
}
|
|
|
|
RegCloseKey(uninstallKey);
|
|
|
|
LExit:
|
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
|
return WcaFinalize(er);
|
|
}
|
|
|
|
void initSystemLogger()
|
|
{
|
|
static std::once_flag initLoggerFlag;
|
|
std::call_once(initLoggerFlag, []()
|
|
{
|
|
WCHAR temp_path[MAX_PATH];
|
|
auto ret = GetTempPath(MAX_PATH, temp_path);
|
|
|
|
if (ret)
|
|
{
|
|
Logger::init("PowerToysMSI", std::wstring{ temp_path } + L"\\PowerToysMSIInstaller", L"");
|
|
} });
|
|
}
|
|
|
|
// DllMain - Initialize and cleanup WiX custom action utils.
|
|
extern "C" BOOL WINAPI DllMain(__in HINSTANCE hInst, __in ULONG ulReason, __in LPVOID)
|
|
{
|
|
switch (ulReason)
|
|
{
|
|
case DLL_PROCESS_ATTACH:
|
|
WcaGlobalInitialize(hInst);
|
|
initSystemLogger();
|
|
TraceLoggingRegister(g_hProvider);
|
|
DLL_HANDLE = hInst;
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
TraceLoggingUnregister(g_hProvider);
|
|
WcaGlobalFinalize();
|
|
break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|