Compare commits
176 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29ea95a6b0 | ||
|
|
6fafb0150e | ||
|
|
de67fff731 | ||
|
|
7799783c9a | ||
|
|
c854565e30 | ||
|
|
52e9d37b93 | ||
|
|
e94cb34a25 | ||
|
|
f541e7105e | ||
|
|
4060e29c63 | ||
|
|
d913285523 | ||
|
|
d98d1193fc | ||
|
|
e23b406364 | ||
|
|
0b27fc39e6 | ||
|
|
704ca4eae2 | ||
|
|
1fc3cfee68 | ||
|
|
8fb446ad47 | ||
|
|
66ff661ff5 | ||
|
|
57e69080c9 | ||
|
|
d78f7a9303 | ||
|
|
47cb34d26b | ||
|
|
8354797406 | ||
|
|
87ae1c6a9b | ||
|
|
5fb7d43aff | ||
|
|
115c391191 | ||
|
|
c73fa4b0f6 | ||
|
|
f5894ac3c2 | ||
|
|
bcbeda5102 | ||
|
|
8891c305e3 | ||
|
|
c62f98db95 | ||
|
|
96bca43089 | ||
|
|
9ffd42d477 | ||
|
|
c57f051863 | ||
|
|
ab04874c11 | ||
|
|
481a47b638 | ||
|
|
df2ef04558 | ||
|
|
c3ad095553 | ||
|
|
3f2dbfbbd2 | ||
|
|
8eca70c338 | ||
|
|
ba7302a197 | ||
|
|
d15b0a0285 | ||
|
|
3796a5ef97 | ||
|
|
5a48376a77 | ||
|
|
61669a73d9 | ||
|
|
5a2385c66b | ||
|
|
d7721065dc | ||
|
|
025f2507f4 | ||
|
|
563fb3ff5c | ||
|
|
9646ec5edd | ||
|
|
cc990a1181 | ||
|
|
c4ddb7d351 | ||
|
|
ab0047a9b7 | ||
|
|
39ec10cbba | ||
|
|
65b6513207 | ||
|
|
beb4494534 | ||
|
|
983ff901f2 | ||
|
|
5d66473a4f | ||
|
|
ff1e04b957 | ||
|
|
53c4c6cbb8 | ||
|
|
47736603af | ||
|
|
b6e5a5e655 | ||
|
|
84018f5b61 | ||
|
|
592d3afe6d | ||
|
|
2bd2ec7a2e | ||
|
|
f25d2b3a86 | ||
|
|
886cea56f3 | ||
|
|
ed21efc003 | ||
|
|
c379cca2e5 | ||
|
|
efa04b4cd8 | ||
|
|
35a214603f | ||
|
|
3acc96cab1 | ||
|
|
14247fa75a | ||
|
|
6efec9d280 | ||
|
|
063253d5e7 | ||
|
|
f773604dec | ||
|
|
25d43354b3 | ||
|
|
b59ec5e78b | ||
|
|
f7ad935dfb | ||
|
|
1a210ae684 | ||
|
|
92c666692d | ||
|
|
761f0a78f4 | ||
|
|
0027a0af40 | ||
|
|
4f45cf1386 | ||
|
|
9dfa685fb1 | ||
|
|
40d2ef4f0a | ||
|
|
8e5a877997 | ||
|
|
d1b3f77feb | ||
|
|
a5b7234d6f | ||
|
|
398991f3c1 | ||
|
|
d01b93ae5f | ||
|
|
b31d9761fa | ||
|
|
1ba403db7b | ||
|
|
96cd135f82 | ||
|
|
c85cd4ac24 | ||
|
|
177546bab6 | ||
|
|
29e2c982d4 | ||
|
|
bc301f269a | ||
|
|
d09253e532 | ||
|
|
034079b441 | ||
|
|
22f0e2615f | ||
|
|
45bab578c4 | ||
|
|
e8de6f0ace | ||
|
|
13c2ce3f31 | ||
|
|
3bf9a3833a | ||
|
|
c035bf2d37 | ||
|
|
2b9ab05888 | ||
|
|
a8153dd8db | ||
|
|
ebe70a52d1 | ||
|
|
2282e72d03 | ||
|
|
5a590512bd | ||
|
|
6131181ea4 | ||
|
|
78946c11ea | ||
|
|
f59abe23c3 | ||
|
|
74412766fa | ||
|
|
39b0401c55 | ||
|
|
5f0e8d3d8e | ||
|
|
01ca13cccb | ||
|
|
6a9badd31b | ||
|
|
7db5d6a307 | ||
|
|
bb2049411b | ||
|
|
653ae777d5 | ||
|
|
ec803d63c8 | ||
|
|
412d80efe3 | ||
|
|
b1d662a5b1 | ||
|
|
12d9d59d85 | ||
|
|
b13e719ab3 | ||
|
|
451aea87aa | ||
|
|
d55cac80bf | ||
|
|
a1ecdc9bfa | ||
|
|
0e8c1cb0fd | ||
|
|
1c724280f5 | ||
|
|
9ff8246a9d | ||
|
|
2c45956030 | ||
|
|
1c267a55d5 | ||
|
|
f60bdc3dd4 | ||
|
|
030dfc2370 | ||
|
|
3295ea84a4 | ||
|
|
ef2041b919 | ||
|
|
4634085402 | ||
|
|
411140c3ea | ||
|
|
638cd1dd48 | ||
|
|
e3e6b23b7c | ||
|
|
ac5a3e7a65 | ||
|
|
106c316442 | ||
|
|
db229cf1bf | ||
|
|
94f66b812a | ||
|
|
a314106b7e | ||
|
|
8d72bc0ea4 | ||
|
|
1533c9315f | ||
|
|
70405045d7 | ||
|
|
3d623506a8 | ||
|
|
11df74c292 | ||
|
|
a935d69408 | ||
|
|
cffe0196e2 | ||
|
|
ac2a9deb75 | ||
|
|
282e0adfe2 | ||
|
|
ce60bcedb0 | ||
|
|
c9fd409650 | ||
|
|
8a908aa33f | ||
|
|
f9a5242e75 | ||
|
|
7dabcc00ed | ||
|
|
18f4e9db31 | ||
|
|
593ab6b014 | ||
|
|
656c33e942 | ||
|
|
4330338285 | ||
|
|
44c41d52b2 | ||
|
|
449a3f479f | ||
|
|
159a7c4947 | ||
|
|
30f442d774 | ||
|
|
e8685de7f7 | ||
|
|
4c08b591f1 | ||
|
|
16528888df | ||
|
|
738b5f5707 | ||
|
|
17343210c0 | ||
|
|
43aa2f5cd9 | ||
|
|
423cd20922 | ||
|
|
69d5ef36e2 |
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,8 +1,8 @@
|
||||
---
|
||||
name: Bug report
|
||||
name: 🐛 Bug report
|
||||
about: Report errors or unexpected behavior
|
||||
title: ''
|
||||
labels: ''
|
||||
labels: Issue-Bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
@@ -12,26 +12,26 @@ assignees: ''
|
||||
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.
|
||||
-->
|
||||
|
||||
# Environment
|
||||
## ℹ Computer information
|
||||
|
||||
```
|
||||
Windows build number: [run "ver" at a command prompt]
|
||||
PowerToys version:
|
||||
PowerToy module for which you are reporting the bug (if applicable):
|
||||
```
|
||||
- Windows build number: [run "winver"]
|
||||
- PowerToys version:
|
||||
- PowerToy module:
|
||||
|
||||
# Steps to reproduce
|
||||
## 📝 Provide detailed reproduction steps (if any)
|
||||
|
||||
<!-- A description of how to trigger this bug. -->
|
||||
1. …
|
||||
2. …
|
||||
3. …
|
||||
|
||||
# Expected behavior
|
||||
### ✔️ Expected result
|
||||
|
||||
<!-- A description of what you're expecting, possibly containing screenshots or reference material. -->
|
||||
_What is the expected result of the above steps?_
|
||||
|
||||
# Actual behavior
|
||||
### ❌ Actual result
|
||||
|
||||
<!-- What's actually happening? -->
|
||||
_What is the actual result of the above steps?_
|
||||
|
||||
# Screenshots
|
||||
## 📷 Screenshots
|
||||
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
_Are there any useful screenshots? WinKey+Shift+S and then just paste them directly into the form_
|
||||
|
||||
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: "\U0001F6A8 Microsoft Security Response Center (MSRC)"
|
||||
url: https://msrc.microsoft.com/create-report
|
||||
about: Report security bugs
|
||||
- name: "\U0001F4DA PowerToys user documentation"
|
||||
url: https://github.com/microsoft/PowerToys/wiki
|
||||
about: Documentation for users of PowerToys
|
||||
- name: "\U0001F4DA PowerToys dev documentation"
|
||||
url: https://github.com/microsoft/PowerToys/tree/master/doc/devdocs
|
||||
about: Documentation for people interested in developing for PowerToys
|
||||
@@ -1,10 +1,14 @@
|
||||
---
|
||||
name: Documentation Issue
|
||||
name: "\U0001F4DA Documentation Issue"
|
||||
about: Report issues in our documentation
|
||||
title: ''
|
||||
labels: ''
|
||||
labels: Issue-Docs
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Briefly describe which document needs to be corrected and why. -->
|
||||
|
||||
## 📝 Provide a description of requested docs changes
|
||||
|
||||
_What is the purpose and what should be changed?_
|
||||
|
||||
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,21 +1,16 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
name: "⭐ Feature request"
|
||||
about: Propose something new.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Summary of the new feature/enhancement
|
||||
## 📝 Provide a description of the new feature
|
||||
|
||||
<!--
|
||||
A clear and concise description of what the problem is that the new feature would solve.
|
||||
Describe why and how a user would use this new functionality (if applicable).
|
||||
-->
|
||||
_What is the expected behavior of the proposed feature? What is the scenario this woudl be used?_
|
||||
|
||||
# Proposed technical implementation details (optional)
|
||||
---
|
||||
|
||||
<!--
|
||||
A clear and concise description of what you want to happen.
|
||||
-->
|
||||
If you'd like to see this feature implemented, add a 👍 reaction to this post.
|
||||
|
||||
13
.github/pull_request_template.md
vendored
@@ -1,10 +1,7 @@
|
||||
<!-- 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)? -->
|
||||
## Summary of the Pull Request
|
||||
|
||||
<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? -->
|
||||
## References
|
||||
_What is this about?_
|
||||
|
||||
<!-- Please review the items on the PR checklist before submitting-->
|
||||
## PR Checklist
|
||||
* [ ] Applies to #xxx
|
||||
* [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/PowerToys) and sign the CLA
|
||||
@@ -12,8 +9,10 @@
|
||||
* [ ] Requires documentation to be updated
|
||||
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx
|
||||
|
||||
<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
|
||||
## Detailed Description of the Pull Request / Additional comments
|
||||
## Info on Pull Request
|
||||
|
||||
_What does this include?_
|
||||
|
||||
<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
|
||||
## Validation Steps Performed
|
||||
|
||||
_How does someone test & validate?_
|
||||
|
||||
3
.gitignore
vendored
@@ -340,4 +340,5 @@ src/common/Telemetry/*.etl
|
||||
|
||||
# Don't ignore MergeModules
|
||||
!**/MergeModules/Release/
|
||||
!**/MergeModules/Debug/
|
||||
!**/MergeModules/Debug/
|
||||
/src/modules/previewpane/SvgThumbnailProvider/$(SolutionDir)$(Platform)/$(Configuration)/modules/FileExplorerPreview/SvgThumbnailProvider.xml
|
||||
|
||||
10
.pipelines/build-bootstrapper.cmd
Normal file
@@ -0,0 +1,10 @@
|
||||
cd /D "%~dp0"
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
pushd .
|
||||
cd ..
|
||||
set SolutionDir=%cd%
|
||||
popd
|
||||
SET IsPipeline=1
|
||||
call msbuild ../src/bootstrapper/bootstrapper.vcxproj /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true /p:BuildProjectReferences=false /p:SolutionDir=%SolutionDir%\ || exit /b 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
cd /D "%~dp0"
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
call msbuild ../PowerToys.sln /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1
|
||||
call msbuild -m ../PowerToys.sln /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1
|
||||
SET PTRoot=..
|
||||
call "..\installer\PowerToysSetup\publish.cmd"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
parameters:
|
||||
configuration: 'Release'
|
||||
platform: ''
|
||||
additionalBuildArguments: '/p:CIBuild=true'
|
||||
additionalBuildArguments: '-m /p:CIBuild=true'
|
||||
|
||||
jobs:
|
||||
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
|
||||
|
||||
@@ -34,16 +34,28 @@ steps:
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
maximumCpuCount: true
|
||||
|
||||
# directly not doing WinAppDriver testing
|
||||
- task: VSTest@2
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
testAssemblyVer2: |
|
||||
**\PreviewPaneUnitTests.dll
|
||||
**\UnitTests-SvgPreviewHandler.dll
|
||||
**\UnitTests-PreviewHandlerCommon.dll
|
||||
**\powerpreviewTest.dll
|
||||
**\UnitTests-CommonLib.dll
|
||||
!**\*PowerToysTests.dll
|
||||
!**\*TestAdapter.dll
|
||||
!**\obj\**
|
||||
**\ImageResizer.Test.dll
|
||||
**\KeyboardManagerTest.dll
|
||||
**\Microsoft.Plugin.Program.UnitTests.dll
|
||||
**\PowerRenameUnitTests.dll
|
||||
**\UnitTests-CommonLib.dll
|
||||
**\PreviewPaneUnitTests.dll #this is the markdown tests
|
||||
**\UnitTests-PreviewHandlerCommon.dll
|
||||
**\UnitTests-SvgPreviewHandler.dll
|
||||
**\Wox.Test.dll
|
||||
**\powerpreviewTest.dll
|
||||
# Can't get working, says no tests
|
||||
# #**\Microsoft.PowerToys.Settings.UnitTest.exe
|
||||
# crashes CI
|
||||
#**\interop-tests.dll
|
||||
#**\UnitTests-FancyZones.dll
|
||||
|
||||
@@ -50,6 +50,8 @@ build:
|
||||
to: 'Build_Output'
|
||||
include:
|
||||
- 'action_runner.exe'
|
||||
- 'modules\ColorPicker\ColorPicker.dll'
|
||||
- 'modules\ColorPicker\ColorPicker.exe'
|
||||
- 'modules\ImageResizer\ar\ImageResizer.resources.dll'
|
||||
- 'modules\ImageResizer\bg\ImageResizer.resources.dll'
|
||||
- 'modules\ImageResizer\ca\ImageResizer.resources.dll'
|
||||
@@ -75,6 +77,7 @@ build:
|
||||
- 'modules\FileExplorerPreview\powerpreview.dll'
|
||||
- 'modules\FileExplorerPreview\PreviewHandlerCommon.dll'
|
||||
- 'modules\FileExplorerPreview\SvgPreviewHandler.dll'
|
||||
- 'modules\FileExplorerPreview\SVGThumbnailProvider.dll'
|
||||
- 'modules\ImageResizer\ImageResizer.exe'
|
||||
- 'modules\ImageResizer\ImageResizerExt.dll'
|
||||
- 'modules\KeyboardManager\KeyboardManager.dll'
|
||||
@@ -132,6 +135,17 @@ build:
|
||||
- 'PowerToysSetup-*.msi'
|
||||
signing_options:
|
||||
sign_inline: true # This does signing a soon as this command completes
|
||||
- !!buildcommand
|
||||
name: 'Build Power Toys Bootstrapper'
|
||||
command: '.pipelines\build-bootstrapper.cmd'
|
||||
artifacts:
|
||||
- from: 'x64/Release'
|
||||
to: 'Build_Installer_Output'
|
||||
include:
|
||||
- 'PowerToysSetup-*.exe'
|
||||
signing_options:
|
||||
sign_inline: true # This does signing a soon as this command completes
|
||||
|
||||
|
||||
#package:
|
||||
# commands:
|
||||
|
||||
28
NOTICE.md
@@ -1,6 +1,34 @@
|
||||
# NOTICES AND INFORMATION
|
||||
This software incorporates material from third parties.
|
||||
|
||||
## PowerToy: Color Picker
|
||||
|
||||
### Martin Chrzan's Color Picker
|
||||
|
||||
**Source**: https://github.com/martinchrzan/ColorPicker
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 martinchrzan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
## PowerToy: ImageResizer
|
||||
|
||||
### Brice Lams's Image Resizer License
|
||||
|
||||
1184
PowerToys.sln
55
README.md
@@ -8,7 +8,11 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
|
||||
## Build status
|
||||
|
||||
[](https://dev.azure.com/ms/PowerToys/_build?definitionId=219)
|
||||
| Branch | Status x64 |
|
||||
|---|---|
|
||||
| Master | [](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=master) |
|
||||
| Stable | [](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) |
|
||||
| Installer | [](https://github-private.visualstudio.com/microsoft/_build/latest?definitionId=61&branchName=master) |
|
||||
|
||||
## Current PowerToy Utilities
|
||||
|
||||
@@ -23,7 +27,7 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
|
||||
### File Explorer Add-ons (Preview Panes)
|
||||
|
||||
[<img align="left" src="./doc/images/overview/PowerPreview_small.PNG" />](https://aka.ms/PowerToysOverview_FileExplorerAddOns) [File Explorer](https://aka.ms/PowerToysOverview_FileExplorerAddOns) add-ons right now are just limited to Preview Pane additions for File Explorer. Preview Pane is an existing feature in the File Explorer. To enable it, you just click the View tab in the ribbon and then click "Preview Pane".
|
||||
[<img align="left" src="./doc/images/overview/PowerPreview_small.png" />](https://aka.ms/PowerToysOverview_FileExplorerAddOns) [File Explorer](https://aka.ms/PowerToysOverview_FileExplorerAddOns) add-ons right now are just limited to Preview Pane additions for File Explorer. Preview Pane is an existing feature in the File Explorer. To enable it, you just click the View tab in the ribbon and then click "Preview Pane".
|
||||
|
||||
PowerToys will now enable two types of files to be previewed: Markdown (.md) & SVG (.svg)
|
||||
<br>
|
||||
@@ -47,7 +51,7 @@ PowerToys will now enable two types of files to be previewed: Markdown (.md) & S
|
||||
|
||||
### PowerRename
|
||||
|
||||
[<img align="left" src="./doc/images/overview/PowerRename_small.PNG" />](https://aka.ms/PowerToysOverview_PowerRename) [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) is a Windows Shell Extension for advanced bulk renaming using search and replace or regular expressions. PowerRename allows simple search and replace or more advanced regular expression matching. While you type in the search and replace input fields, the preview area will show what the items will be renamed to. PowerRename then calls into the Windows Explorer file operations engine to perform the rename. This has the benefit of allowing the rename operation to be undone after PowerRename exits. This code is based on [Chris Davis's SmartRename](https://github.com/chrdavis/SmartRename).
|
||||
[<img align="left" src="./doc/images/overview/PowerRename_small.png" />](https://aka.ms/PowerToysOverview_PowerRename) [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) is a Windows Shell Extension for advanced bulk renaming using search and replace or regular expressions. PowerRename allows simple search and replace or more advanced regular expression matching. While you type in the search and replace input fields, the preview area will show what the items will be renamed to. PowerRename then calls into the Windows Explorer file operations engine to perform the rename. This has the benefit of allowing the rename operation to be undone after PowerRename exits. This code is based on [Chris Davis's SmartRename](https://github.com/chrdavis/SmartRename).
|
||||
<br>
|
||||
|
||||
### PowerToys Run
|
||||
@@ -56,10 +60,11 @@ PowerToys will now enable two types of files to be previewed: Markdown (.md) & S
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
### Shortcut Guide
|
||||
|
||||
[<img align="left" src="./doc/images/overview/Shortcut guide_small.png" />](https://aka.ms/PowerToysOverview_ShortcutGuide) [Windows key shortcut guide](https://aka.ms/PowerToysOverview_ShortcutGuide) appears when a user holds the Windows key down for more than one second and shows the available shortcuts for the current state of the desktop.
|
||||
[<img align="left" src="./doc/images/overview/ShortcutGuide_small.png" />](https://aka.ms/PowerToysOverview_ShortcutGuide) [Windows key shortcut guide](https://aka.ms/PowerToysOverview_ShortcutGuide) appears when a user holds the Windows key down for more than one second and shows the available shortcuts for the current state of the desktop.
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
@@ -72,9 +77,9 @@ PowerToys will now enable two types of files to be previewed: Markdown (.md) & S
|
||||
- Windows 10 1803 (build 17134) or later.
|
||||
- Have [.NET Core 3.1 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-3.1.4-windows-x64-installer). The installer will prompt this but we want to directly make people aware.
|
||||
|
||||
### Via Github with MSI [Recommended]
|
||||
### Via GitHub with MSI [Recommended]
|
||||
|
||||
Install from the [Microsoft PowerToys GitHub releases page][github-release-link]. Click on `Assets` to show the files available in the release and then click on `PowerToysSetup-0.18.2-x64.msi` to download the PowerToys installer.
|
||||
Install from the [Microsoft PowerToys GitHub releases page][github-release-link]. Click on `Assets` to show the files available in the release and then click on `PowerToysSetup-0.19.2-x64.msi` to download the PowerToys installer.
|
||||
|
||||
**Note:** After installing, you will have to start PowerToys for the first time. We will improve install experience this moving forward but due to a possible install dependency, we can't start after install currently.
|
||||
|
||||
@@ -107,8 +112,9 @@ choco upgrade powertoys
|
||||
|
||||
### Known issues
|
||||
|
||||
- [#2012 - Uninstalling with old control panel fails](https://github.com/microsoft/PowerToys/issues/2012): Please use the modern settings to uninstall. `Windows 10 Settings -> Apps -> Apps & features`
|
||||
- [#3384 - PowerToys Settings window is empty](https://github.com/microsoft/PowerToys/issues/3384): Workaround appears to be run as admin. We are proactively looking into this as a hotfix.
|
||||
- PT Run, Newly installed apps can't be found [#3553](https://github.com/microsoft/PowerToys/issues/3553). We will address this in 0.20.
|
||||
- PT Run, CPU / Memory, still investigating [#3208](https://github.com/microsoft/PowerToys/issues/3208). We have 2 leads and fixed one item.
|
||||
- WinKey remapping for PT Run can be quirky [#4578](https://github.com/microsoft/PowerToys/issues/4578)
|
||||
|
||||
### Processor support
|
||||
|
||||
@@ -120,26 +126,29 @@ We currently support the matrix below.
|
||||
|
||||
## What's Happening
|
||||
|
||||
### May 2020 Update
|
||||
### June 2020 Update
|
||||
|
||||
Our goals for 0.18 release cycle was three big items, PowerToys Run, Keyboard manager, and migrating to the new settings system. This is also the first time we'll test out the auto-updating system.
|
||||
Our goals for 0.19 release cycle had one big goal, add in stability / quality fixes. We've addressed over 100 issues across all our utilities. We've improved our installer experience and parts will start coming online in 0.19 and 0.20. In this release, it will be the last time during upgrade you'll see Windows Explorer flash on you. For 0.20, the .NET Core install experience much smoother.
|
||||
|
||||
Feedback is critical. We know there are areas for improvement on PT Run. We would love feedback so we can improve. We also would love to know if you want us to be more aggressive on auto-upgrading.
|
||||
We'd also stress feedback is critical. We know there are areas for improvement on PowerToys Run. We would love feedback so we can improve. We also would love to know if you want us to be more aggressive on auto-upgrading.
|
||||
|
||||
- We shipped [v0.18][github-release-link]!
|
||||
- New Utilities
|
||||
- PowerToys Run, our new application launcher (use alt-space to activate)
|
||||
- Keyboard manager, a quick easy way to remap your keyboard
|
||||
- Fixed [#243](https://github.com/microsoft/PowerToys/issues/243)'s setting issue
|
||||
- Improved performance on FancyZones [#1264](https://github.com/microsoft/PowerToys/issues/1264)
|
||||
- Lots of bug fixes!
|
||||
Lastly, we'd like to thank everyone who filed a bug, gave feedback or made a pull-request. The PowerToys team is extremely grateful to have the support of an amazing active community.
|
||||
|
||||
For [0.19](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F4), we are proactively working on:
|
||||
- We shipped [v0.19][github-release-link]!
|
||||
- Big push for PowerToys Run search quality fixes
|
||||
- PowerToys Run can now remap to any key shortcut (minus restricted ones such as WinKey+L)
|
||||
- Improved FancyZones on Virtual Desktops and multi-thread design
|
||||
- Installer after 0.19 will no longer restart Windows Explorer
|
||||
- Fixed [#2012 - Uninstalling with old control panel fails](https://github.com/microsoft/PowerToys/issues/2012)
|
||||
- Fixed [#3384 - PowerToys Settings window is empty](https://github.com/microsoft/PowerToys/issues/3384)
|
||||
- Over 100 bug fixes!
|
||||
|
||||
- Enable PT Run to be mapped to Win-Keys
|
||||
- Stability / tech debt fixes
|
||||
- Performance improvements with FancyZones
|
||||
- A testing utility for FancyZones to be sure we can test different window configurations.
|
||||
For [0.20](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F6), we are proactively working on:
|
||||
|
||||
- Stability
|
||||
- Start work on FZ Editor V2
|
||||
- Start work on OOBE improvements
|
||||
- Keyboard manager improvements
|
||||
|
||||
### Version 1.0 plan
|
||||
|
||||
|
||||
41
SECURITY.md
Normal file
@@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.2 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [definition](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
||||
@@ -44,4 +44,8 @@ Image Resizer is from Brice.
|
||||
|
||||
### [@chrdavis](https://github.com/chrdavis/) - Chris Davis
|
||||
|
||||
PowerRename is from Chris's SmartRename.
|
||||
PowerRename is from Chris's SmartRename and icon rendering for SVGs in File Explorer
|
||||
|
||||
### [@martinchrzan](https://github.com/martinchrzan/) - Martin Chrzan
|
||||
|
||||
Color Picker is from Martin.
|
||||
|
||||
@@ -30,7 +30,7 @@ General project organization:
|
||||
|
||||
Documentation for the project.
|
||||
|
||||
### The [`Wiki`](/wiki)
|
||||
### The [`Wiki`](https://github.com/microsoft/PowerToys/wiki)
|
||||
|
||||
The Wiki contains the current specs for the project.
|
||||
|
||||
@@ -156,4 +156,4 @@ This module has a setting to serve as an example for each of the currently imple
|
||||
- ColorPicker property
|
||||
- CustomAction property
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -1,50 +1,3 @@
|
||||
# PowerToys and running as Administrator
|
||||
# This file has been moved
|
||||
|
||||
## Too long, Didn't Read 😁
|
||||
|
||||
If you're running any application as an administrator (aka elevated) and PowerToys is not, a few things may not work correctly when the elevated applications are in focus or trying to interact with a PowerToys feature like FancyZones.
|
||||
|
||||
## Having PowerToys keep functioning properly
|
||||
|
||||
We understand users will run applications elevated. We do as well. We have two options for you when this scenario happens:
|
||||
|
||||
1. **Recommended:** PowerToys will prompt when we detect a process that is elevated. Go to PowerToys settings inside the General Tab and click "Relaunch as administrator".
|
||||
2. Enable "Always run as administrator" in the PowerToys settings.
|
||||
|
||||
## What is "Run as Administrator" / Elevated processes
|
||||
|
||||
This is when a process runs with "elevated" privileges. Typically this would be associated with the administrator accounts on a system.
|
||||
|
||||
Basically it runs with additional access to the operating system. Most things do not need run elevated. A common scenario would be needing to run certain PowerShell commands or edit the registry.
|
||||
|
||||
How do i know my application is "elevated"? If you see this prompt (User Access Control prompt), the application is requesting it:
|
||||
|
||||
![alt text][uac]
|
||||
|
||||
At times also, elevated terminals for instance, they will typically have the phrase "Administrator" appended to the title bar. Be warned, this isn't always the case it will be appended.
|
||||
|
||||
![alt text][elevatedWindow]
|
||||
|
||||
## When does PowerToys need this
|
||||
|
||||
PowerToys in itself does not. It only needs to be elevated when it has to interact with other applications that are running elevated. If those applications are in focus, PowerToys may not function unless it is elevated as well.
|
||||
|
||||
These are the two scenarios we will not work in:
|
||||
|
||||
1. Intercepting certain types of keyboard strokes
|
||||
2. Resizing / Moving windows
|
||||
|
||||
### PowerToys affected
|
||||
|
||||
1. FancyZones
|
||||
- Snapping a window into a zone
|
||||
- Moving the window to a different zone
|
||||
2. Shortcut guide
|
||||
- Display shortcut
|
||||
3. Keyboard remapper
|
||||
- key to key remapping
|
||||
- Global level shortcuts remapping
|
||||
- App-targeted shortcuts remapping
|
||||
|
||||
[uac]: ../images/runAsAdmin/uac.png "User access control (UAC)"
|
||||
[elevatedWindow]: ../images/runAsAdmin/elevatedWindows.png "Run as admin"
|
||||
[PowerToys and running as Administrator](https://aka.ms/powertoysDetectedElevatedHelp)
|
||||
|
||||
BIN
doc/images/overview/ColorPicker_large.png
Normal file
|
After Width: | Height: | Size: 184 KiB |
BIN
doc/images/overview/ColorPicker_small.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
doc/images/overview/FancyZones_large.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
doc/images/overview/ImageResizer_large.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 31 KiB |
BIN
doc/images/overview/KBM_large.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 18 KiB |
BIN
doc/images/overview/Original/ColorPicker.png
Normal file
|
After Width: | Height: | Size: 593 KiB |
BIN
doc/images/overview/Original/FancyZones.png
Normal file
|
After Width: | Height: | Size: 141 KiB |
BIN
doc/images/overview/Original/ImageResizer.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
doc/images/overview/Original/KBM.png
Normal file
|
After Width: | Height: | Size: 135 KiB |
BIN
doc/images/overview/Original/PowerLauncher.png
Normal file
|
After Width: | Height: | Size: 137 KiB |
BIN
doc/images/overview/Original/PowerPreview.png
Normal file
|
After Width: | Height: | Size: 237 KiB |
BIN
doc/images/overview/Original/PowerRename.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
doc/images/overview/Original/ShortcutGuide.png
Normal file
|
After Width: | Height: | Size: 256 KiB |
BIN
doc/images/overview/PT_large.png
Normal file
|
After Width: | Height: | Size: 111 KiB |
BIN
doc/images/overview/PT_small.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
doc/images/overview/PowerLauncher_large.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 25 KiB |
BIN
doc/images/overview/PowerPreview_large.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 31 KiB |
BIN
doc/images/overview/PowerPreview_small.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
doc/images/overview/PowerRename_large.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 20 KiB |
BIN
doc/images/overview/PowerRename_small.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 34 KiB |
BIN
doc/images/overview/ShortcutGuide_large.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
doc/images/overview/ShortcutGuide_small.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,15 +1,15 @@
|
||||
# Specs
|
||||
|
||||
All approved specs are inside the [Wiki](https://github.com/microsoft/PowerToys/wiki)
|
||||
All approved specs are inside the [Wiki spec section](https://github.com/microsoft/PowerToys/wiki/Specs)
|
||||
|
||||
## Spec process
|
||||
|
||||
1. A proposed item is either new or requesting additional design
|
||||
2. Spec is written inside the Specs folder and a PR happens with feedback.
|
||||
3. Once spec is signed off, we move it into the [Wiki](https://github.com/microsoft/PowerToys/wiki).
|
||||
3. Once spec is signed off, we move it into the [Wiki spec section](https://github.com/microsoft/PowerToys/wiki/Specs).
|
||||
|
||||
## Thought process behind this
|
||||
|
||||
We want a single wholistic for PowerToys. This includes both source code, docs, and specs. At the same time, we want to ensure items have pull requests and feedback. Since the wiki cannot do PR's, we will do the process above.
|
||||
|
||||
This process will allow specs to be image rich but not impact the primary repository's size as more items come online.
|
||||
This process will allow specs to be image rich but not impact the primary repository's size as more items come online.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<?define KeyboardManagerProjectName="KeyboardManager"?>
|
||||
<?define PowerRenameProjectName="PowerRename"?>
|
||||
<?define ShortcutGuideProjectName="ShortcutGuide"?>
|
||||
<?define ColorPickerProjectName="ColorPicker"?>
|
||||
|
||||
<?define RepoDir="$(var.ProjectDir)..\..\" ?>
|
||||
<?define BinX64Dir="$(var.RepoDir)x64\$(var.Configuration)\" ?>
|
||||
@@ -241,6 +242,9 @@
|
||||
<Directory Id="FileExplorerPreviewInstallFolder" Name="FileExplorerPreview" />
|
||||
<Directory Id="FancyZonesInstallFolder" Name="$(var.FancyZonesProjectName)" />
|
||||
<Directory Id="KeyboardManagerInstallFolder" Name="$(var.KeyboardManagerProjectName)" />
|
||||
<Directory Id="ColorPickerInstallFolder" Name="$(var.ColorPickerProjectName)">
|
||||
<Directory Id="ColorPickerResourcesFolder" Name="Resources"/>
|
||||
</Directory>
|
||||
<Directory Id="LauncherInstallFolder" Name="launcher">
|
||||
<Directory Id="AssetsFolder" Name="Assets" />
|
||||
<Directory Id="LauncherImagesFolder" Name="Images" />
|
||||
@@ -284,7 +288,9 @@
|
||||
<Directory Id="SettingsV2ViewsInstallFolder" Name="Views"/>
|
||||
<Directory Id="SettingsV2StylesInstallFolder" Name="Styles"/>
|
||||
<Directory Id="SettingsV2PropertiesInstallFolder" Name="Properties"/>
|
||||
<Directory Id="SettingsV2AssetsInstallFolder" Name="Assets"/>
|
||||
<Directory Id="SettingsV2AssetsInstallFolder" Name="Assets">
|
||||
<Directory Id="SettingsV2AssetsModulesInstallFolder" Name="Modules" />
|
||||
</Directory>
|
||||
<Directory Id="SettingsV2ControlsInstallFolder" Name="Controls"/>
|
||||
<Directory Id="SettingsV2XamlInstallFolder" Name="Microsoft.UI.Xaml">
|
||||
<Directory Id="SettingsV2XamlAssetsInstallFolder" Name="Assets" />
|
||||
@@ -355,9 +361,6 @@
|
||||
<Component Id="powertoysinterop_dll" Guid="B7DD2DF4-C8F2-46FA-9571-D6EF1588ADF3" Win64="yes">
|
||||
<File Id="PowerToysInterop.dll" KeyPath="yes" Checksum="yes" />
|
||||
</Component>
|
||||
<Component Id="osDetection_dll" Guid="AA370C25-4AC8-447B-A2FF-C99365C6BE67" Win64="yes">
|
||||
<File Source="$(var.BinX64Dir)os-detection.dll" KeyPath="yes" Checksum="yes" />
|
||||
</Component>
|
||||
<Component Id="vcredist_dlls" Guid="CBE26CB0-3AD0-4336-A7D6-503046BADEBC" Win64="yes">
|
||||
<!-- VCRuntime -->
|
||||
<?foreach File in vcruntime140.dll;vcruntime140_1.dll;concrt140.dll;msvcp140.dll;msvcp140_1.dll;msvcp140_2.dll;msvcp140_codecvt_ids.dll;vccorlib140.dll?>
|
||||
@@ -427,6 +430,23 @@
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="RuntimeVersion" Value="v4.0.30319" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="CodeBase" Value="file:///[FileExplorerPreviewInstallFolder]SvgPreviewHandler.dll" />
|
||||
</RegistryKey>
|
||||
<!-- Registry Key for Class Registration of Svg Thumbnail Provider -->
|
||||
<RegistryKey Root="HKCR" Key="CLSID\{36B27788-A8BB-4698-A756-DF9F11F64F84}">
|
||||
<RegistryValue Type="string" Value="SvgThumbnailProvider.SvgThumbnailProvider" />
|
||||
<RegistryValue Type="string" Name="DisplayName" Value="Svg Thumbnail Provider" />
|
||||
<RegistryValue Type="string" Name="AppID" Value="{CF142243-F059-45AF-8842-DBBE9783DB14}" />
|
||||
<RegistryValue Type="string" Key="Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value=""/>
|
||||
<RegistryValue Type="string" Key="InprocServer32" Value="mscoree.dll" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="Assembly" Value="SvgThumbnailProvider, Version=$(var.Version).0, Culture=neutral" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="SvgThumbnailProvider.SvgThumbnailProvider" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="ThreadingModel" Value="Both" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="CodeBase" Value="file:///[FileExplorerPreviewInstallFolder]SvgThumbnailProvider.dll" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Assembly" Value="SvgThumbnailProvider, Version=$(var.Version).0, Culture=neutral" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="SvgThumbnailProvider.SvgThumbnailProvider" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="RuntimeVersion" Value="v4.0.30319" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="CodeBase" Value="file:///[FileExplorerPreviewInstallFolder]SvgThumbnailProvider.dll" />
|
||||
</RegistryKey>
|
||||
<!-- Registry Key for Class Registration of Markdown Preview Handler -->
|
||||
<RegistryKey Root="HKCR" Key="CLSID\{45769bcc-e8fd-42d0-947e-02beef77a1f5}">
|
||||
<RegistryValue Type="string" Value="MarkdownPreviewHandler.MarkdownPreviewHandler" />
|
||||
@@ -460,6 +480,10 @@
|
||||
<RegistryKey Root="HKCR" Key=".svg\shellex">
|
||||
<RegistryValue Type="string" Key="{8895b1c6-b41f-4c1c-a562-0d564250836f}" Value="{ddee2b8a-6807-48a6-bb20-2338174ff779}" />
|
||||
</RegistryKey>
|
||||
<!-- Add file type association for Svg Thumbnail Provider -->
|
||||
<RegistryKey Root="HKCR" Key=".svg\shellex">
|
||||
<RegistryValue Type="string" Key="{E357FCCD-A995-4576-B01F-234630154E96}" Value="{36B27788-A8BB-4698-A756-DF9F11F64F84}" />
|
||||
</RegistryKey>
|
||||
<!-- Add file type association for Markdown Preview Handler -->
|
||||
<RegistryKey Root="HKCR" Key=".md\shellex">
|
||||
<RegistryValue Type="string" Key="{8895b1c6-b41f-4c1c-a562-0d564250836f}" Value="{45769bcc-e8fd-42d0-947e-02beef77a1f5}" />
|
||||
@@ -468,6 +492,10 @@
|
||||
<RegistryKey Root="HKLM" Key="Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION">
|
||||
<RegistryValue Type="integer" Name="prevhost.exe" Value="11000" />
|
||||
</RegistryKey>
|
||||
<!-- Update Key to use IE11 for dllhost.exe -->
|
||||
<RegistryKey Root="HKLM" Key="Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION">
|
||||
<RegistryValue Type="integer" Name="dllhost.exe" Value="11000" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
@@ -484,7 +512,8 @@
|
||||
<netfx:NativeImage Id="Interactivity" Platform="all" Priority="0"/>
|
||||
</File>
|
||||
<File Source="$(var.BinX64Dir)modules\$(var.ImageResizerProjectName)\Newtonsoft.Json.dll" />
|
||||
<File Source="$(var.BinX64Dir)modules\$(var.ImageResizerProjectName)\ImageResizerExt.dll" KeyPath="yes" />
|
||||
<File Source="$(var.BinX64Dir)modules\$(var.ImageResizerProjectName)\ImageResizerExt.dll" KeyPath="yes" />
|
||||
<File Id="ImageResizer_interop" Source="$(var.BinX64Dir)modules\$(var.ImageResizerProjectName)\PowerToysInterop.dll" />
|
||||
|
||||
<!-- VCRuntime -->
|
||||
<?foreach File in vcruntime140.dll;vcruntime140_1.dll;concrt140.dll;msvcp140.dll;msvcp140_1.dll;msvcp140_2.dll;msvcp140_codecvt_ids.dll;vccorlib140.dll?>
|
||||
@@ -562,6 +591,7 @@
|
||||
<File Source="$(var.BinX64Dir)modules\$(var.PowerRenameProjectName)\PowerRenameExt.dll" KeyPath="yes" />
|
||||
<RegistryKey Root="HKCR" Key="CLSID\{0440049F-D1DC-4E46-B27B-98393D79486B}">
|
||||
<RegistryValue Type="string" Value="PowerRename Shell Extension" />
|
||||
<RegistryValue Type="string" Name="ContextMenuOptIn" Value="" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Value="[PowerRenameInstallFolder]PowerRenameExt.dll" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="ThreadingModel" Value="Apartment" />
|
||||
</RegistryKey>
|
||||
@@ -583,6 +613,22 @@
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<DirectoryRef Id="ColorPickerInstallFolder" FileSource="$(var.BinX64Dir)modules\$(var.ColorPickerProjectName)">
|
||||
<Component Id="Module_ColorPicker" Guid="8A52A69E-37B2-4BEA-9D73-77763066052F" Win64="yes">
|
||||
<?foreach File in ColorPicker.dll;ColorPicker.exe;ColorPicker.exe.config;Microsoft.Bcl.AsyncInterfaces.dll;Microsoft.Expression.Interactions.dll;Microsoft.PowerToys.Settings.UI.Lib.dll;PowerToysInterop.dll;System.Buffers.dll;System.Memory.dll;System.Numerics.Vectors.dll;System.Text.Encodings.Web.dll;System.Text.Json.dll;System.Threading.Tasks.Extensions.dll;System.ValueTuple.dll;System.Windows.Interactivity.dll;Telemetry.dll;ManagedCommon.dll;System.Runtime.CompilerServices.Unsafe.dll?>
|
||||
<File Id="ColorPickerFile_$(var.File)" Source="$(var.BinX64Dir)modules\$(var.ColorPickerProjectName)\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<DirectoryRef Id="ColorPickerResourcesFolder" FileSource="$(var.BinX64Dir)modules\$(var.ColorPickerProjectName)\Resources">
|
||||
<Component Id="Module_ColorPicker_Resources" Guid="7544BD0F-1DB6-4C53-89D3-ADAD472FDCC1">
|
||||
<?foreach File in colorPicker.cur;icon.ico?>
|
||||
<File Id="ColorPickerFile_$(var.File)" Source="$(var.BinX64Dir)modules\$(var.ColorPickerProjectName)\Resources\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<DirectoryRef Id="FileExplorerPreviewInstallFolder" FileSource="$(var.RepoDir)\modules\FileExplorerPreview\">
|
||||
<Component Id="Module_PowerPreview" Guid="FF1700D5-1B07-4E07-9A62-4D206645EEA9" Win64="yes">
|
||||
<!-- Component to include PowerPreview Module Source dll's -->
|
||||
@@ -593,6 +639,8 @@
|
||||
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\Telemetry.dll" />
|
||||
<!-- File to include dll for Svg Preview Handler -->
|
||||
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\SvgPreviewHandler.dll" />
|
||||
<!-- File to include dll for Svg Preview Handler -->
|
||||
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\SvgThumbnailProvider.dll" />
|
||||
<!-- Files to include dll's for Markdown Preview Handler and it's dependencies -->
|
||||
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\MarkdownPreviewHandler.dll" />
|
||||
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\Markdig.Signed.dll" />
|
||||
@@ -650,6 +698,13 @@
|
||||
<File Id="Square44x44Logo" Source="$(var.BinX64Dir)SettingsUIRunner\Assets\Square44x44Logo.scale-200.png" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="SettingsV2AssetsModulesInstallFolder" FileSource="$(var.BinX64Dir)SettingsUIRunner\Assets\Modules">
|
||||
<Component Id="SettingsV2AssetsModules" Guid="A0B961A9-77D0-4223-88A9-E3B41BD9C329" Win64="yes">
|
||||
<?foreach File in ColorPicker.png;FancyZones.png;ImageResizer.png;KBM.png;PowerLauncher.png;PowerPreview.png;PowerRename.png;PT.png;ShortcutGuide.png?>
|
||||
<File Source="$(var.BinX64Dir)SettingsUIRunner\Assets\Modules\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="SettingsV2ControlsInstallFolder" FileSource="$(var.BinX64Dir)SettingsUIRunner\Controls">
|
||||
<Component Id="SettingsV2Controls" Guid="05C55C88-B59A-4450-A07C-EB7626E0781A" Win64="yes">
|
||||
<?foreach File in HotkeySettingsControl.xbf?>
|
||||
@@ -729,7 +784,6 @@
|
||||
<ComponentRef Id="License_rtf" />
|
||||
<ComponentRef Id="Notice_md" />
|
||||
<ComponentRef Id="powertoysinterop_dll" />
|
||||
<ComponentRef Id="osDetection_dll" />
|
||||
<ComponentRef Id="vcredist_dlls" />
|
||||
<ComponentRef Id="PowerToysSvgs" />
|
||||
<ComponentRef Id="Module_ShortcutGuide" />
|
||||
@@ -741,8 +795,11 @@
|
||||
<ComponentRef Id="Module_PowerPreview" />
|
||||
<ComponentRef Id="Module_PowerPreview_PerUserRegistry" />
|
||||
<ComponentRef Id="Module_KeyboardManager" />
|
||||
<ComponentRef Id="Module_ColorPicker" />
|
||||
<ComponentRef Id="Module_ColorPicker_Resources"/>
|
||||
<ComponentRef Id="SettingsV2" />
|
||||
<ComponentRef Id="SettingsV2Assets" />
|
||||
<ComponentRef Id="SettingsV2AssetsModules" />
|
||||
<ComponentRef Id="SettingsV2Controls" />
|
||||
<ComponentRef Id="SettingsV2Properties" />
|
||||
<ComponentRef Id="SettingsV2Styles" />
|
||||
@@ -781,7 +838,7 @@
|
||||
<ComponentGroup Id="LauncherComponents">
|
||||
<Component Id="launcherInstallComponent" Directory="LauncherInstallFolder" Guid="5E688DB4-C522-4268-BA54-ED1CDFFE9DB6">
|
||||
<File Source="$(var.BinX64Dir)modules\Launcher\Microsoft.Launcher.dll" />
|
||||
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;EntityFramework.SqlServer.dll;EntityFramework.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;Pinyin4Net.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;sni.dll;System.Data.SQLite.EF6.dll;PowerLauncher.runtimeconfig.json;SQLite.Interop.dll;System.Data.OleDb.dll;System.Data.SqlClient.dll;System.Data.SQLite.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;WindowsInput.dll;Wox.Core.dll;Wox.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.dll;PropertyChanged.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;MahApps.Metro.dll;ManagedCommon.dll?>
|
||||
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;EntityFramework.SqlServer.dll;EntityFramework.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;Pinyin4Net.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;sni.dll;System.Data.SQLite.EF6.dll;PowerLauncher.runtimeconfig.json;SQLite.Interop.dll;System.Data.OleDb.dll;System.Data.SqlClient.dll;System.Data.SQLite.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;WindowsInput.dll;Wox.Core.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.dll;PropertyChanged.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;MahApps.Metro.dll;ManagedCommon.dll?>
|
||||
<File Id="File_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\$(var.File)" />
|
||||
<?endforeach?>
|
||||
<File Source="$(var.BinX64Dir)SettingsUIRunner\Microsoft.PowerToys.Settings.UI.Lib.dll" />
|
||||
@@ -791,7 +848,7 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="launcherImagesComponent" Directory="LauncherImagesFolder" Guid="D254220C-1DD9-4C74-8810-1AAB2F940DE8">
|
||||
<?foreach File in app.png;app_error.png;Browser.png;calculator.png;cancel.png;close.png;cmd.png;color.png;copy.png;down.png;EXE.png;file.png;find.png;folder.png;history.png;image.png;Link.png;lock.png;logoff.png;ok.png;open.png;plugin.png;recyclebin.png;restart.png;search.png;settings.png;shutdown.png;sleep.png;up.png;update.png;warning.png?>
|
||||
<?foreach File in app.dark.png;app.light.png;app_error.dark.png;app_error.light.png;Browser.png;calculator.png;cancel.png;close.png;cmd.png;color.png;copy.png;down.png;EXE.png;file.png;find.png;folder.png;history.png;image.png;Link.png;lock.png;logoff.png;ok.png;open.png;plugin.png;recyclebin.png;restart.png;search.png;settings.png;shutdown.png;sleep.png;up.png;update.png;warning.png?>
|
||||
<File Id="File_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Images\$(var.File)" />
|
||||
<?endforeach?>
|
||||
<File Source="$(var.BinX64Dir)modules\launcher\Images\New Message.png" />
|
||||
@@ -809,8 +866,8 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="calculatorImagesComponent" Directory="CalculatorImagesFolder" Guid="07EC9232-CF9A-4CDB-8D8E-E79DC75096C0">
|
||||
<File Id="calculatorPluginImg_calculator_light" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator_light.png" />
|
||||
<File Id="calculatorPluginImg_calculator_dark" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator_dark.png" />
|
||||
<File Id="calculatorPluginImg_calculator_light" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator.light.png" />
|
||||
<File Id="calculatorPluginImg_calculator_dark" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator.dark.png" />
|
||||
</Component>
|
||||
<Component Id="calculatorLanguagesComponent" Directory="CalculatorLanguagesFolder" Guid="2D8019E7-664F-4529-9FAA-83C8DACF0732">
|
||||
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
|
||||
@@ -839,7 +896,7 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="FolderImagesComponent" Directory="FolderPluginImagesFolder" Guid="6C5226EB-E312-4768-B4D1-B1D3ACFCCBDF">
|
||||
<?foreach File in copy.png;deletefilefolder.png;file.png;folder.png;user.png?>
|
||||
<?foreach File in copy.dark.png;copy.light.png;delete.dark.png;delete.light.png;file.dark.png;file.light.png;folder.dark.png;folder.light.png;user.dark.png;user.light.png?>
|
||||
<File Id="FolderPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\Images\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
@@ -870,7 +927,7 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="ProgramImagesComponent" Directory="ProgramImagesFolder" Guid="30D357F5-406F-47D1-BEFE-6022746469B4">
|
||||
<?foreach File in cmd.png;disable.png;folder.png;program.png;user.png?>
|
||||
<?foreach File in app.dark.png;app.light.png;disable.light.png;disable.dark.png;folder.light.png;folder.dark.png;shell.light.png;shell.dark.png;user.light.png;user.dark.png?>
|
||||
<File Id="Program_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Program\Images\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
@@ -901,8 +958,9 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="ShellImagesComponent" Directory="ShellImagesFolder" Guid="15B5DBAE-E7C1-4BF7-A29E-6CE76242F8F4">
|
||||
<File Id="ShellPluginImg" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Shell\Images\shell.png" />
|
||||
<File Id="ShellPluginUserImg" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Shell\Images\user.png" />
|
||||
<?foreach File in shell.light.png;shell.dark.png;user.light.png;user.dark.png?>
|
||||
<File Id="Shell_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Shell\Images\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="ShellLanguagesComponent" Directory="ShellLanguagesFolder" Guid="4190F789-8A66-46AA-B920-C76CB29277D7">
|
||||
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
|
||||
@@ -931,7 +989,23 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="IndexerImagesComponent" Directory="IndexerImagesFolder" Guid="DB2E8D49-D104-425B-9616-952AC8CAB676">
|
||||
<File Id="IndexerPluginImg" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\Images\WindowsIndexerImg.bmp" />
|
||||
<?foreach File in indexer.dark.png;indexer.light.png;Warning.light.png;Warning.dark.png?>
|
||||
<File Id="Indexer_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\Images\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="IndexerLanguagesComponent" Directory="IndexerLanguagesFolder" Guid="4B5ED306-7DD5-4EA6-9DBB-CF054929182C">
|
||||
<?foreach LanguageFile in de.xaml;en.xaml;ja.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
|
||||
<!--NB: Ids can't contain hyphens-->
|
||||
<?if $(var.LanguageFile) = zh-cn.xaml?>
|
||||
<?define IdSafeLanguage = zh_cn.xaml?>
|
||||
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
|
||||
<?define IdSafeLanguage = zh_tw.xaml?>
|
||||
<?else?>
|
||||
<?define IdSafeLanguage = $(var.LanguageFile)?>
|
||||
<?endif?>
|
||||
<File Id="Indexer_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\Languages\$(var.LanguageFile)" />
|
||||
<?undef IdSafeLanguage?>
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="IndexerpinyindbComponent" Directory="IndexerpinyindbFolder" Guid="48DE333A-80F8-400A-87F4-244DF0A2DB05">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
@@ -946,7 +1020,8 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="WindowWalkerImagesComponent" Directory="WindowWalkerImagesFolder" Guid="3944A7F5-77F4-4979-9911-EDE709B2F509">
|
||||
<File Id="WindowWalkerIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Images\windowwalker.png" />
|
||||
<File Id="WindowWalkerDarkIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Images\windowwalker.dark.png" />
|
||||
<File Id="WindowWalkerLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Images\windowwalker.light.png" />
|
||||
</Component>
|
||||
<Component Id="WindowWalkerLanguagesComponent" Directory="WindowWalkerLanguagesFolder" Guid="7D9471D9-5C0A-4BD1-9A01-BAB65DD58834">
|
||||
<File Id="WindowWalkerLanguage" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Languages\en.xaml" />
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <ProjectTelemetry.h>
|
||||
|
||||
#include "../../src/common/updating/updating.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(
|
||||
@@ -14,7 +16,6 @@ TRACELOGGING_DEFINE_PROVIDER(
|
||||
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}";
|
||||
|
||||
// Creates a Scheduled Task to run at logon for the current user.
|
||||
@@ -563,52 +564,6 @@ LExit:
|
||||
return WcaFinalize(er);
|
||||
}
|
||||
|
||||
std::optional<std::wstring> getMsiPackageInstalledPath(const wchar_t* product_upgrade_code, const wchar_t* file_component)
|
||||
{
|
||||
constexpr size_t guid_length = 39;
|
||||
wchar_t product_ID[guid_length];
|
||||
if (const bool found = ERROR_SUCCESS == MsiEnumRelatedProductsW(product_upgrade_code, 0, 0, product_ID); !found)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (const bool installed = INSTALLSTATE_DEFAULT == MsiQueryProductStateW(product_ID); !installed)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
DWORD buf_size = MAX_PATH;
|
||||
wchar_t buf[MAX_PATH];
|
||||
if (ERROR_SUCCESS == MsiGetProductInfoW(product_ID, INSTALLPROPERTY_INSTALLLOCATION, buf, &buf_size) && buf_size)
|
||||
{
|
||||
return buf;
|
||||
}
|
||||
|
||||
DWORD package_path_size = 0;
|
||||
|
||||
if (ERROR_SUCCESS != MsiGetProductInfoW(product_ID, INSTALLPROPERTY_LOCALPACKAGE, nullptr, &package_path_size))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
std::wstring package_path(++package_path_size, L'\0');
|
||||
|
||||
if (ERROR_SUCCESS != MsiGetProductInfoW(product_ID, INSTALLPROPERTY_LOCALPACKAGE, package_path.data(), &package_path_size))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
package_path.resize(size(package_path) - 1); // trim additional \0 which we got from MsiGetProductInfoW
|
||||
|
||||
wchar_t path[256];
|
||||
DWORD path_size = 256;
|
||||
MsiGetComponentPathW(product_ID, file_component, path, &path_size);
|
||||
if (!path_size)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
PathCchRemoveFileSpec(path, path_size);
|
||||
return path;
|
||||
}
|
||||
|
||||
UINT __stdcall DetectPrevInstallPathCA(MSIHANDLE hInstall)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
@@ -617,7 +572,7 @@ UINT __stdcall DetectPrevInstallPathCA(MSIHANDLE hInstall)
|
||||
|
||||
try
|
||||
{
|
||||
if (auto install_path = getMsiPackageInstalledPath(POWERTOYS_UPGRADE_CODE, POWERTOYS_EXE_COMPONENT))
|
||||
if (auto install_path = updating::get_msi_package_installed_path())
|
||||
{
|
||||
MsiSetPropertyW(hInstall, L"INSTALLFOLDER", install_path->data());
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;..\..\$(PlatformShortName)\$(Configuration)\common.lib;..\..\$(PlatformShortName)\$(Configuration)\updating.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(WIX)sdk\$(WixPlatformToolset)\lib\x64;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\vs2017\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>CustomAction.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -82,7 +82,7 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;..\..\$(PlatformShortName)\$(Configuration)\common.lib;..\..\$(PlatformShortName)\$(Configuration)\updating.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(WIX)sdk\$(WixPlatformToolset)\lib\x64;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\vs2017\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>CustomAction.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -93,12 +93,12 @@
|
||||
<UACExecutionLevel>HighestAvailable</UACExecutionLevel>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(CIBuild)'!='true'">
|
||||
<ItemDefinitionGroup Condition="'$(CIBuild)'!='true'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CustomAction.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Version>0.19.0</Version>
|
||||
<Version>0.20.0</Version>
|
||||
<DefineConstants>Version=$(Version);</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
5
nuget.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<configuration>
|
||||
<config>
|
||||
<clear />
|
||||
</config>
|
||||
</configuration>
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <common/common.h>
|
||||
#include <common/updating/updating.h>
|
||||
#include <common/updating/http_client.h>
|
||||
#include <common/updating/dotnet_installation.h>
|
||||
|
||||
#include <winrt/Windows.ApplicationModel.h>
|
||||
#include <winrt/Windows.Storage.h>
|
||||
@@ -111,11 +112,18 @@ bool install_new_version_stage_2(std::wstring installer_path, std::wstring_view
|
||||
{
|
||||
// If it's not .msi, then it's our .exe installer
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC };
|
||||
sei.fMask = { SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE};
|
||||
sei.lpFile = installer_path.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpParameters = L"-silent";
|
||||
|
||||
success = ShellExecuteExW(&sei) == TRUE;
|
||||
// Wait for the install completion
|
||||
if (success)
|
||||
{
|
||||
WaitForSingleObject(sei.hProcess, INFINITE);
|
||||
CloseHandle(sei.hProcess);
|
||||
}
|
||||
}
|
||||
|
||||
std::error_code _;
|
||||
@@ -140,57 +148,6 @@ bool install_new_version_stage_2(std::wstring installer_path, std::wstring_view
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dotnet_is_installed()
|
||||
{
|
||||
auto runtimes = exec_and_read_output(LR"(dotnet --list-runtimes)");
|
||||
if (!runtimes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
const char DESKTOP_DOTNET_RUNTIME_STRING[] = "Microsoft.WindowsDesktop.App 3.1.";
|
||||
return runtimes->find(DESKTOP_DOTNET_RUNTIME_STRING) != std::string::npos;
|
||||
}
|
||||
|
||||
bool install_dotnet()
|
||||
{
|
||||
const wchar_t DOTNET_DESKTOP_DOWNLOAD_LINK[] = L"https://download.visualstudio.microsoft.com/download/pr/d8cf1fe3-21c2-4baf-988f-f0152996135e/0c00b94713ee93e7ad5b4f82e2b86607/windowsdesktop-runtime-3.1.4-win-x64.exe";
|
||||
const wchar_t DOTNET_DESKTOP_FILENAME[] = L"windowsdesktop-runtime-3.1.4-win-x64.exe";
|
||||
|
||||
auto dotnet_download_path = fs::temp_directory_path() / DOTNET_DESKTOP_FILENAME;
|
||||
winrt::Windows::Foundation::Uri download_link{ DOTNET_DESKTOP_DOWNLOAD_LINK };
|
||||
|
||||
const size_t max_attempts = 3;
|
||||
bool download_success = false;
|
||||
for (size_t i = 0; i < max_attempts; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
http::HttpClient client;
|
||||
client.download(download_link, dotnet_download_path).wait();
|
||||
download_success = true;
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// couldn't download
|
||||
}
|
||||
}
|
||||
if (!download_success)
|
||||
{
|
||||
MessageBoxW(nullptr,
|
||||
GET_RESOURCE_STRING(IDS_DOTNET_CORE_DOWNLOAD_FAILURE).c_str(),
|
||||
GET_RESOURCE_STRING(IDS_DOTNET_CORE_DOWNLOAD_FAILURE_TITLE).c_str(),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_NOASYNC };
|
||||
sei.lpFile = dotnet_download_path.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpParameters = L"/install /passive";
|
||||
return ShellExecuteExW(&sei) == TRUE;
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
int nArgs = 0;
|
||||
@@ -264,11 +221,18 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
}
|
||||
else if (action == L"-install_dotnet")
|
||||
{
|
||||
if (dotnet_is_installed())
|
||||
if (updating::dotnet_is_installed())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return !install_dotnet();
|
||||
const bool success = updating::install_dotnet();
|
||||
|
||||
MessageBoxW(nullptr,
|
||||
GET_RESOURCE_STRING(IDS_DOTNET_CORE_DOWNLOAD_FAILURE).c_str(),
|
||||
GET_RESOURCE_STRING(IDS_DOTNET_CORE_DOWNLOAD_FAILURE_TITLE).c_str(),
|
||||
MB_OK | MB_ICONERROR);
|
||||
|
||||
return !success;
|
||||
}
|
||||
else if (action == L"-uninstall_msi")
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -99,6 +99,7 @@
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -127,6 +128,7 @@
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -172,13 +174,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200514.2" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="action_runner.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\runner\msi_to_msix_upgrade.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
207
src/bootstrapper/bootstrapper.cpp
Normal file
@@ -0,0 +1,207 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
#include <fstream>
|
||||
|
||||
#include <common/common.h>
|
||||
#include <common/notifications.h>
|
||||
#include <common/RcResource.h>
|
||||
#include <common/updating/updating.h>
|
||||
#include <common/updating/dotnet_installation.h>
|
||||
#include <common/version.h>
|
||||
#include <common/appMutex.h>
|
||||
#include <common/processApi.h>
|
||||
|
||||
#include <wil/resource.h>
|
||||
|
||||
#include <winrt/base.h>
|
||||
#include "resource.h"
|
||||
#include <Msi.h>
|
||||
|
||||
#include <runner/action_runner_utils.h>
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
namespace
|
||||
{
|
||||
const wchar_t APPLICATION_ID[] = L"PowerToysInstaller";
|
||||
const wchar_t TOAST_TAG[] = L"PowerToysInstallerProgress";
|
||||
}
|
||||
|
||||
namespace localized_strings
|
||||
{
|
||||
const wchar_t INSTALLER_EXTRACT_ERROR[] = L"Couldn't extract MSI installer!";
|
||||
const wchar_t TOAST_TITLE[] = L"PowerToys Installation";
|
||||
const wchar_t EXTRACTING_INSTALLER[] = L"Extracting PowerToys MSI...";
|
||||
const wchar_t UNINSTALLING_PREVIOUS_VERSION[] = L"Uninstalling previous PowerToys version...";
|
||||
const wchar_t UNINSTALL_PREVIOUS_VERSION_ERROR[] = L"Couldn't uninstall previous PowerToys version!";
|
||||
const wchar_t INSTALLING_DOTNET[] = L"Installing dotnet...";
|
||||
const wchar_t DOTNET_INSTALL_ERROR[] = L"Couldn't install dotnet!";
|
||||
const wchar_t INSTALLING_NEW_VERSION[] = L"Installing new PowerToys version...";
|
||||
const wchar_t NEW_VERSION_INSTALLATION_DONE[] = L"PowerToys installation complete!";
|
||||
const wchar_t NEW_VERSION_INSTALLATION_ERROR[] = L"Couldn't install new PowerToys version.";
|
||||
}
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
std::optional<fs::path> extractEmbeddedInstaller()
|
||||
{
|
||||
auto executableRes = RcResource::create(IDR_BIN_MSIINSTALLER, L"BIN");
|
||||
if (!executableRes)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
auto installerPath = fs::temp_directory_path() / L"PowerToysBootstrappedInstaller-" PRODUCT_VERSION_STRING L".msi";
|
||||
return executableRes->saveAsFile(installerPath) ? std::make_optional(std::move(installerPath)) : std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<fs::path> extractIcon()
|
||||
{
|
||||
auto iconRes = RcResource::create(IDR_BIN_ICON, L"BIN");
|
||||
if (!iconRes)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
auto icoPath = fs::temp_directory_path() / L"PowerToysBootstrappedInstaller.ico";
|
||||
return iconRes->saveAsFile(icoPath) ? std::make_optional(std::move(icoPath)) : std::nullopt;
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
using namespace localized_strings;
|
||||
winrt::init_apartment();
|
||||
|
||||
// Try killing PowerToys and prevent future processes launch
|
||||
for (auto& handle : getProcessHandlesByName(L"PowerToys.exe", PROCESS_TERMINATE))
|
||||
{
|
||||
TerminateProcess(handle.get(), 0);
|
||||
}
|
||||
auto powerToysMutex = createAppMutex(POWERTOYS_MSI_MUTEX_NAME);
|
||||
|
||||
int n_cmd_args = 0;
|
||||
LPWSTR* cmd_arg_list = CommandLineToArgvW(GetCommandLineW(), &n_cmd_args);
|
||||
const bool silent = n_cmd_args > 1 && std::wstring_view{ L"-silent" } == cmd_arg_list[1];
|
||||
|
||||
auto instanceMutex = createAppMutex(POWERTOYS_BOOTSTRAPPER_MUTEX_NAME);
|
||||
if (!instanceMutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
notifications::set_application_id(APPLICATION_ID);
|
||||
|
||||
fs::path iconPath{ L"C:\\" };
|
||||
if (auto extractedIcon = extractIcon())
|
||||
{
|
||||
iconPath = std::move(*extractedIcon);
|
||||
}
|
||||
|
||||
notifications::register_application_id(TOAST_TITLE, iconPath.c_str());
|
||||
|
||||
auto removeShortcut = wil::scope_exit([&] {
|
||||
notifications::unregister_application_id();
|
||||
});
|
||||
|
||||
// Check if there's a newer version installed, and launch its installer if so.
|
||||
const VersionHelper myVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
|
||||
if (const auto installedVersion = updating::get_installed_powertoys_version(); installedVersion && *installedVersion >= myVersion)
|
||||
{
|
||||
auto msi_path = updating::get_msi_package_path();
|
||||
if (!msi_path.empty())
|
||||
{
|
||||
MsiSetInternalUI(INSTALLUILEVEL_FULL, nullptr);
|
||||
MsiInstallProductW(msi_path.c_str(), nullptr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::mutex progressLock;
|
||||
notifications::progress_bar_params progressParams;
|
||||
progressParams.progress = 0.0f;
|
||||
progressParams.progress_title = EXTRACTING_INSTALLER;
|
||||
notifications::toast_params params{ TOAST_TAG, false, std::move(progressParams) };
|
||||
notifications::show_toast_with_activations({}, TOAST_TITLE, {}, {}, std::move(params));
|
||||
|
||||
auto processToasts = wil::scope_exit([&] {
|
||||
run_message_loop(true, 2);
|
||||
});
|
||||
|
||||
// Worker thread to periodically increase progress and keep the progress toast from losing focus
|
||||
std::thread{ [&] {
|
||||
for (;; Sleep(3000))
|
||||
{
|
||||
std::scoped_lock lock{ progressLock };
|
||||
if (progressParams.progress == 1.f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
progressParams.progress = min(0.99f, progressParams.progress + 0.001f);
|
||||
notifications::update_progress_bar_toast(TOAST_TAG, progressParams);
|
||||
}
|
||||
} }.detach();
|
||||
|
||||
auto updateProgressBar = [&](const float value, const wchar_t* title) {
|
||||
std::scoped_lock lock{ progressLock };
|
||||
progressParams.progress = value;
|
||||
progressParams.progress_title = title;
|
||||
notifications::update_progress_bar_toast(TOAST_TAG, progressParams);
|
||||
};
|
||||
|
||||
const auto installerPath = extractEmbeddedInstaller();
|
||||
if (!installerPath)
|
||||
{
|
||||
notifications::show_toast(INSTALLER_EXTRACT_ERROR, TOAST_TITLE);
|
||||
return 1;
|
||||
}
|
||||
auto removeExtractedInstaller = wil::scope_exit([&] {
|
||||
std::error_code _;
|
||||
fs::remove(*installerPath, _);
|
||||
});
|
||||
|
||||
updateProgressBar(.25f, UNINSTALLING_PREVIOUS_VERSION);
|
||||
const auto package_path = updating::get_msi_package_path();
|
||||
if (!package_path.empty() && !updating::uninstall_msi_version(package_path))
|
||||
{
|
||||
notifications::show_toast(UNINSTALL_PREVIOUS_VERSION_ERROR, TOAST_TITLE);
|
||||
}
|
||||
|
||||
updateProgressBar(.5f, INSTALLING_DOTNET);
|
||||
if (!updating::dotnet_is_installed() && !updating::install_dotnet())
|
||||
{
|
||||
notifications::show_toast(DOTNET_INSTALL_ERROR, TOAST_TITLE);
|
||||
}
|
||||
|
||||
updateProgressBar(.75f, INSTALLING_NEW_VERSION);
|
||||
if (!silent)
|
||||
{
|
||||
MsiSetInternalUI(INSTALLUILEVEL_FULL, nullptr);
|
||||
}
|
||||
const bool installationDone = MsiInstallProductW(installerPath->c_str(), nullptr) == ERROR_SUCCESS;
|
||||
|
||||
updateProgressBar(1.f, installationDone ? NEW_VERSION_INSTALLATION_DONE : NEW_VERSION_INSTALLATION_ERROR);
|
||||
|
||||
if (!installationDone)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
auto newPTPath = updating::get_msi_package_installed_path();
|
||||
if (!newPTPath)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
// Do not launch PowerToys, if we're launched from the action_runner
|
||||
if (!silent)
|
||||
{
|
||||
*newPTPath += L"\\PowerToys.exe";
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NO_CONSOLE };
|
||||
sei.lpFile = newPTPath->c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpParameters = UPDATE_REPORT_SUCCESS;
|
||||
ShellExecuteExW(&sei);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
48
src/bootstrapper/bootstrapper.rc
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../common/version.h"
|
||||
|
||||
MAINICON ICON "../runner/svgs/icon.ico"
|
||||
IDR_BIN_ICON BIN "../runner/svgs/icon.ico"
|
||||
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DOTNET_CORE_DOWNLOAD_FAILURE "Couldn't download .NET Core Desktop Runtime 3.1.3, please install it manually."
|
||||
IDS_DOTNET_CORE_DOWNLOAD_FAILURE_TITLE "PowerToys installation error"
|
||||
END
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
PRODUCTVERSION PRODUCT_VERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
|
||||
BEGIN
|
||||
VALUE "CompanyName", COMPANY_NAME
|
||||
VALUE "FileDescription", FILE_DESCRIPTION
|
||||
VALUE "FileVersion", FILE_VERSION_STRING
|
||||
VALUE "InternalName", INTERNAL_NAME
|
||||
VALUE "LegalCopyright", COPYRIGHT_NOTE
|
||||
VALUE "OriginalFilename", ORIGINAL_FILENAME
|
||||
VALUE "ProductName", PRODUCT_NAME
|
||||
VALUE "ProductVersion", PRODUCT_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
|
||||
END
|
||||
END
|
||||
|
||||
#include "Generated Files\installer_resource.rc"
|
||||
141
src/bootstrapper/bootstrapper.vcxproj
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\installer\Version.props" />
|
||||
<Target Name="Generate Resource file" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<RCLines Include="IDR_BIN_MSIINSTALLER BIN "..\\..\\installer\\PowerToysSetup\\$(PlatformShortName)\\$(Configuration)\\PowerToysSetup-$(Version)-$(PlatformShortName).msi"" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="Generated Files\installer_resource.rc" Lines="@(RCLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{D194E3AA-F824-4CA9-9A58-034DD6B7D022}</ProjectGuid>
|
||||
<RootNamespace>bootstrapper</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>bootstrapper</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<TargetName>PowerToysSetup-$(Version)-$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>../;$(IncludePath)</IncludePath>
|
||||
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>../;$(IncludePath)</IncludePath>
|
||||
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>WindowsApp.lib;Msi.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>WindowsApp.lib;Msi.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="bootstrapper.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\common\common.vcxproj">
|
||||
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\common\updating\updating.vcxproj">
|
||||
<Project>{17da04df-e393-4397-9cf0-84dabe11032e}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\runner\updating.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="bootstrapper.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\runner\svgs\icon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
5
src/bootstrapper/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.200519.2" targetFramework="native" />
|
||||
</packages>
|
||||
19
src/bootstrapper/resource.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by bootstrapper.rc
|
||||
|
||||
//////////////////////////////
|
||||
// Non-localizable
|
||||
|
||||
#define FILE_DESCRIPTION "PowerToys Bootstrapper"
|
||||
#define INTERNAL_NAME "bootstrapper"
|
||||
#define ORIGINAL_FILENAME "bootstrapper.exe"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
|
||||
#define IDS_DOTNET_CORE_DOWNLOAD_FAILURE 101
|
||||
#define IDS_DOTNET_CORE_DOWNLOAD_FAILURE_TITLE 102
|
||||
|
||||
#define IDR_BIN_MSIINSTALLER 103
|
||||
#define IDR_BIN_ICON 104
|
||||
@@ -28,6 +28,7 @@ function Get-Dirty-Files-From-Git() {
|
||||
$result = New-Object System.Collections.Generic.List[string]
|
||||
$staged, $unstaged, $untracked | % {
|
||||
$_.Split(" ") |
|
||||
where {Test-Path $_ -PathType Leaf} |
|
||||
where {$sourceExtensions.Contains((Get-Item $_).Extension)} |
|
||||
foreach {$result.Add($_)}
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
@@ -12,5 +13,26 @@ namespace Microsoft.PowerToys.Telemetry.Events
|
||||
public class EventBase
|
||||
{
|
||||
public bool UTCReplace_AppSessionGuid => true;
|
||||
|
||||
private string _version;
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_version))
|
||||
{
|
||||
_version = GetVersionFromAssembly();
|
||||
}
|
||||
return _version;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetVersionFromAssembly()
|
||||
{
|
||||
// For consistency this should be formatted the same way as
|
||||
// https://github.com/microsoft/PowerToys/blob/710f92d99965109fd788d85ebf8b6b9e0ba1524a/src/common/common.cpp#L635
|
||||
var version = Assembly.GetExecutingAssembly()?.GetName()?.Version ?? new Version();
|
||||
return $"v{version.Major}.{version.Minor}.{version.Build}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
/// </summary>
|
||||
public class PowerToysTelemetry : TelemetryBase
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Name for ETW event.
|
||||
/// </summary>
|
||||
|
||||
40
src/common/RcResource.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "pch.h"
|
||||
#include "RcResource.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
std::optional<RcResource> RcResource::create(int resource_id, const std::wstring_view resource_class)
|
||||
{
|
||||
const HRSRC resHandle = FindResourceW(nullptr, MAKEINTRESOURCEW(resource_id), resource_class.data());
|
||||
if (!resHandle)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
const HGLOBAL memHandle = LoadResource(nullptr, resHandle);
|
||||
if (!memHandle)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
const size_t resSize = SizeofResource(nullptr, resHandle);
|
||||
if (!resSize)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
auto res = static_cast<const std::byte*>(LockResource(memHandle));
|
||||
if (!res)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
return RcResource{ res, resSize };
|
||||
}
|
||||
|
||||
bool RcResource::saveAsFile(const std::filesystem::path destination)
|
||||
{
|
||||
std::fstream installerFile{ destination, std::ios_base::binary | std::ios_base::out | std::ios_base::trunc };
|
||||
if (!installerFile.is_open())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
installerFile.write(reinterpret_cast<const char*>(_memory), _size);
|
||||
return true;
|
||||
}
|
||||
22
src/common/RcResource.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
#include <filesystem>
|
||||
|
||||
class RcResource
|
||||
{
|
||||
public:
|
||||
const std::byte* _memory = nullptr;
|
||||
size_t _size = 0;
|
||||
|
||||
static std::optional<RcResource> create(int resource_id, const std::wstring_view resource_class);
|
||||
bool saveAsFile(const std::filesystem::path destination);
|
||||
|
||||
private:
|
||||
RcResource() = delete;
|
||||
RcResource(const std::byte* memory, size_t size) :
|
||||
_memory{ memory }, _size{ size }
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -4,45 +4,7 @@
|
||||
#include <RestartManager.h>
|
||||
#include <Psapi.h>
|
||||
|
||||
std::vector<RM_UNIQUE_PROCESS> GetProcessInfoByName(const std::wstring& processName)
|
||||
{
|
||||
DWORD bytesReturned{};
|
||||
std::vector<DWORD> processIds{};
|
||||
processIds.resize(1024);
|
||||
DWORD processIdSize{ (DWORD)processIds.size() * sizeof(DWORD) };
|
||||
EnumProcesses(processIds.data(), processIdSize, &bytesReturned);
|
||||
while (bytesReturned == processIdSize)
|
||||
{
|
||||
processIdSize *= 2;
|
||||
processIds.resize(processIdSize / sizeof(DWORD));
|
||||
EnumProcesses(processIds.data(), processIdSize, &bytesReturned);
|
||||
}
|
||||
std::vector<RM_UNIQUE_PROCESS> pInfos{};
|
||||
for (const DWORD& processId : processIds)
|
||||
{
|
||||
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processId);
|
||||
if (hProcess)
|
||||
{
|
||||
wchar_t name[MAX_PATH];
|
||||
if (GetProcessImageFileName(hProcess, name, MAX_PATH) > 0)
|
||||
{
|
||||
if (processName == PathFindFileName(name))
|
||||
{
|
||||
FILETIME creationTime{};
|
||||
FILETIME exitTime{};
|
||||
FILETIME kernelTime{};
|
||||
FILETIME userTime{};
|
||||
if (GetProcessTimes(hProcess, &creationTime, &exitTime, &kernelTime, &userTime))
|
||||
{
|
||||
pInfos.push_back({ processId, creationTime });
|
||||
}
|
||||
}
|
||||
}
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
return pInfos;
|
||||
}
|
||||
#include "processApi.h"
|
||||
|
||||
void RestartProcess(const std::wstring& processName)
|
||||
{
|
||||
@@ -52,7 +14,18 @@ void RestartProcess(const std::wstring& processName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::vector<RM_UNIQUE_PROCESS> pInfo = GetProcessInfoByName(processName);
|
||||
auto processHandles = getProcessHandlesByName(processName, PROCESS_QUERY_INFORMATION);
|
||||
std::vector<RM_UNIQUE_PROCESS> pInfo;
|
||||
for (const auto& hProcess : processHandles)
|
||||
{
|
||||
FILETIME creationTime{};
|
||||
FILETIME _{};
|
||||
if (GetProcessTimes(hProcess.get(), &creationTime, &_, &_, &_))
|
||||
{
|
||||
pInfo.emplace_back(RM_UNIQUE_PROCESS{ GetProcessId(hProcess.get()), creationTime });
|
||||
}
|
||||
}
|
||||
|
||||
if (pInfo.empty() ||
|
||||
RmRegisterResources(sessionHandle, 0, nullptr, sizeof(pInfo), pInfo.data(), 0, nullptr) != ERROR_SUCCESS)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -99,6 +99,8 @@
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -119,20 +121,20 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<ResourceCompile Include="UnitTests-CommonLib.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UnitTests-CommonLib.rc" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -36,12 +36,12 @@
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UnitTests-CommonLib.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200514.2" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
|
||||
</packages>
|
||||
27
src/common/appMutex.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#include <string>
|
||||
|
||||
#include "wil/resource.h"
|
||||
#include <lmcons.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr inline wchar_t POWERTOYS_MSI_MUTEX_NAME[] = L"Local\\PowerToyRunMutex";
|
||||
constexpr inline wchar_t POWERTOYS_MSIX_MUTEX_NAME[] = L"Local\\PowerToyMSIXRunMutex";
|
||||
constexpr inline wchar_t POWERTOYS_BOOTSTRAPPER_MUTEX_NAME[] = L"PowerToysBootstrapperMutex";
|
||||
}
|
||||
|
||||
inline wil::unique_mutex_nothrow createAppMutex(std::wstring mutexName)
|
||||
{
|
||||
wchar_t username[UNLEN + 1];
|
||||
DWORD username_length = UNLEN + 1;
|
||||
GetUserNameW(username, &username_length);
|
||||
mutexName += username;
|
||||
wil::unique_mutex_nothrow result{ CreateMutexW(nullptr, TRUE, mutexName.c_str()) };
|
||||
|
||||
return GetLastError() == ERROR_ALREADY_EXISTS ? wil::unique_mutex_nothrow{} : std::move(result);
|
||||
}
|
||||
@@ -87,12 +87,15 @@
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\common.h" />
|
||||
<ClInclude Include="..\keyboard_layout.h" />
|
||||
<ClInclude Include="..\keyboard_layout_impl.h" />
|
||||
<ClInclude Include="..\os-detect.h" />
|
||||
<ClInclude Include="..\pch.h" />
|
||||
<ClInclude Include="..\two_way_pipe_message_ipc.h" />
|
||||
<ClInclude Include="..\two_way_pipe_message_ipc_impl.h" />
|
||||
@@ -100,6 +103,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common.cpp" />
|
||||
<ClCompile Include="..\keyboard_layout.cpp" />
|
||||
<ClCompile Include="..\os-detect.cpp" />
|
||||
<ClCompile Include="..\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
<ClInclude Include="..\pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\os-detect.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\keyboard_layout.cpp">
|
||||
@@ -47,6 +50,9 @@
|
||||
<ClCompile Include="..\pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\os-detect.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -268,13 +268,26 @@ RECT keep_rect_inside_rect(const RECT& small_rect, const RECT& big_rect)
|
||||
return result;
|
||||
}
|
||||
|
||||
int run_message_loop()
|
||||
int run_message_loop(const bool until_idle, const std::optional<uint32_t> timeout_seconds)
|
||||
{
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
bool stop = false;
|
||||
UINT_PTR timerId = 0;
|
||||
if (timeout_seconds.has_value())
|
||||
{
|
||||
timerId = SetTimer(nullptr, 0, *timeout_seconds * 1000, nullptr);
|
||||
}
|
||||
|
||||
while (!stop && GetMessageW(&msg, nullptr, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
stop = until_idle && !PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE);
|
||||
stop = stop || (msg.message == WM_TIMER && msg.wParam == timerId);
|
||||
}
|
||||
if (timeout_seconds.has_value())
|
||||
{
|
||||
KillTimer(nullptr, timerId);
|
||||
}
|
||||
return static_cast<int>(msg.wParam);
|
||||
}
|
||||
@@ -537,7 +550,7 @@ bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWOR
|
||||
CloseHandle(pi.hThread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
@@ -548,7 +561,7 @@ bool run_same_elevation(const std::wstring& file, const std::wstring& params, DW
|
||||
{
|
||||
executable_args += L" " + params;
|
||||
}
|
||||
|
||||
|
||||
STARTUPINFO si = { 0 };
|
||||
PROCESS_INFORMATION pi = { 0 };
|
||||
auto succeeded = CreateProcessW(file.c_str(),
|
||||
@@ -656,7 +669,7 @@ std::wstring get_module_filename(HMODULE mod)
|
||||
return { buffer, actual_length };
|
||||
}
|
||||
|
||||
std::wstring get_module_folderpath(HMODULE mod)
|
||||
std::wstring get_module_folderpath(HMODULE mod, const bool removeFilename)
|
||||
{
|
||||
wchar_t buffer[MAX_PATH + 1];
|
||||
DWORD actual_length = GetModuleFileNameW(mod, buffer, MAX_PATH);
|
||||
@@ -671,7 +684,10 @@ std::wstring get_module_folderpath(HMODULE mod)
|
||||
return long_filename;
|
||||
}
|
||||
|
||||
PathRemoveFileSpecW(buffer);
|
||||
if (removeFilename)
|
||||
{
|
||||
PathRemoveFileSpecW(buffer);
|
||||
}
|
||||
return { buffer, (UINT)lstrlenW(buffer) };
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ bool operator<(const RECT& lhs, const RECT& rhs);
|
||||
// Moves and/or resizes small_rect to fit inside big_rect.
|
||||
RECT keep_rect_inside_rect(const RECT& small_rect, const RECT& big_rect);
|
||||
// Initializes and runs windows message loop
|
||||
int run_message_loop();
|
||||
int run_message_loop(const bool until_idle = false, const std::optional<uint32_t> timeout_seconds = {});
|
||||
|
||||
std::optional<std::wstring> get_last_error_message(const DWORD dw);
|
||||
void show_last_error_message(LPCWSTR lpszFunction, DWORD dw);
|
||||
@@ -89,7 +89,7 @@ std::wstring get_process_path(HWND hwnd) noexcept;
|
||||
std::wstring get_product_version();
|
||||
|
||||
std::wstring get_module_filename(HMODULE mod = nullptr);
|
||||
std::wstring get_module_folderpath(HMODULE mod = nullptr);
|
||||
std::wstring get_module_folderpath(HMODULE mod = nullptr, const bool removeFilename = true);
|
||||
|
||||
// Get a string from the resource file
|
||||
std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wchar_t* fallback);
|
||||
@@ -135,6 +135,6 @@ struct overloaded : Ts...
|
||||
using Ts::operator()...;
|
||||
};
|
||||
template<class... Ts>
|
||||
overloaded(Ts...)->overloaded<Ts...>;
|
||||
overloaded(Ts...) -> overloaded<Ts...>;
|
||||
|
||||
#define POWER_LAUNCHER_PID_SHARED_FILE L"Local\\3cbfbad4-199b-4e2c-9825-942d5d3d3c74"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\installer\Version.props" />
|
||||
<Target Name="GenerateVersionData" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
@@ -89,6 +89,7 @@
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
@@ -103,6 +104,7 @@
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>inc;telemetry;..\..\deps\cpprestsdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -116,6 +118,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="animation.h" />
|
||||
<ClInclude Include="appMutex.h" />
|
||||
<ClInclude Include="async_message_queue.h" />
|
||||
<ClInclude Include="d2d_svg.h" />
|
||||
<ClInclude Include="d2d_text.h" />
|
||||
@@ -126,7 +129,9 @@
|
||||
<ClInclude Include="keyboard_layout.h" />
|
||||
<ClInclude Include="keyboard_layout_impl.h" />
|
||||
<ClInclude Include="notifications.h" />
|
||||
<ClInclude Include="os-detection\os-detect.h" />
|
||||
<ClInclude Include="processApi.h" />
|
||||
<ClInclude Include="RcResource.h" />
|
||||
<ClInclude Include="os-detect.h" />
|
||||
<ClInclude Include="RestartManagement.h" />
|
||||
<ClInclude Include="shared_constants.h" />
|
||||
<ClInclude Include="timeutil.h" />
|
||||
@@ -161,10 +166,11 @@
|
||||
<ClCompile Include="monitors.cpp" />
|
||||
<ClCompile Include="notifications.cpp" />
|
||||
<ClCompile Include="on_thread_executor.cpp" />
|
||||
<ClCompile Include="os-detection\os-detect.cpp" />
|
||||
<ClCompile Include="os-detect.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RcResource.cpp" />
|
||||
<ClCompile Include="RestartManagement.cpp" />
|
||||
<ClCompile Include="settings_helpers.cpp" />
|
||||
<ClCompile Include="settings_objects.cpp" />
|
||||
@@ -185,14 +191,14 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -111,7 +111,7 @@
|
||||
<ClInclude Include="two_way_pipe_message_ipc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="os-detection\os-detect.h">
|
||||
<ClInclude Include="os-detect.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RestartManagement.h">
|
||||
@@ -120,6 +120,15 @@
|
||||
<ClInclude Include="debug_control.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RcResource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="appMutex.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processApi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d2d_svg.cpp">
|
||||
@@ -189,12 +198,15 @@
|
||||
<ClCompile Include="two_way_pipe_message_ipc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="os-detection\os-detect.cpp">
|
||||
<ClCompile Include="os-detect.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RestartManagement.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RcResource.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
D2DWindow::D2DWindow()
|
||||
D2DWindow::D2DWindow(std::optional<std::function<std::remove_pointer_t<WNDPROC>>> _pre_wnd_proc) :
|
||||
pre_wnd_proc(std::move(_pre_wnd_proc))
|
||||
{
|
||||
static const WCHAR* class_name = L"PToyD2DPopup";
|
||||
WNDCLASS wc = {};
|
||||
@@ -36,6 +37,7 @@ void D2DWindow::show(UINT x, UINT y, UINT width, UINT height)
|
||||
}
|
||||
base_resize(width, height);
|
||||
render_empty();
|
||||
hidden = false;
|
||||
on_show();
|
||||
SetWindowPos(hwnd, HWND_TOPMOST, x, y, width, height, 0);
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
@@ -44,6 +46,7 @@ void D2DWindow::show(UINT x, UINT y, UINT width, UINT height)
|
||||
|
||||
void D2DWindow::hide()
|
||||
{
|
||||
hidden = true;
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
on_hide();
|
||||
}
|
||||
@@ -185,6 +188,11 @@ D2DWindow* D2DWindow::this_from_hwnd(HWND window)
|
||||
|
||||
LRESULT __stdcall D2DWindow::d2d_window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
auto self = this_from_hwnd(window);
|
||||
if (self && self->pre_wnd_proc.has_value())
|
||||
{
|
||||
(*self->pre_wnd_proc)(window, message, wparam, lparam);
|
||||
}
|
||||
switch (message)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
@@ -195,11 +203,12 @@ LRESULT __stdcall D2DWindow::d2d_window_proc(HWND window, UINT message, WPARAM w
|
||||
}
|
||||
case WM_MOVE:
|
||||
case WM_SIZE:
|
||||
this_from_hwnd(window)->base_resize((unsigned)lparam & 0xFFFF, (unsigned)lparam >> 16);
|
||||
// Fall through to call 'base_render()'
|
||||
self->base_resize((unsigned)lparam & 0xFFFF, (unsigned)lparam >> 16);
|
||||
[[fallthrough]];
|
||||
case WM_PAINT:
|
||||
this_from_hwnd(window)->base_render();
|
||||
self->base_render();
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return DefWindowProc(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
#include <string>
|
||||
#include "d2d_svg.h"
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
class D2DWindow
|
||||
{
|
||||
public:
|
||||
D2DWindow();
|
||||
D2DWindow(std::optional<std::function<std::remove_pointer_t<WNDPROC>>> pre_wnd_proc = std::nullopt);
|
||||
void show(UINT x, UINT y, UINT width, UINT height);
|
||||
void hide();
|
||||
void initialize();
|
||||
@@ -43,6 +46,7 @@ protected:
|
||||
void render_empty();
|
||||
|
||||
std::recursive_mutex mutex;
|
||||
bool hidden = true;
|
||||
bool initialized = false;
|
||||
HWND hwnd;
|
||||
UINT window_width, window_height;
|
||||
@@ -58,4 +62,6 @@ protected:
|
||||
winrt::com_ptr<ID2D1Factory6> d2d_factory;
|
||||
winrt::com_ptr<ID2D1Device5> d2d_device;
|
||||
winrt::com_ptr<ID2D1DeviceContext5> d2d_dc;
|
||||
|
||||
std::optional<std::function<std::remove_pointer_t<WNDPROC>>> pre_wnd_proc;
|
||||
};
|
||||
|
||||
@@ -46,8 +46,24 @@ namespace DPIAware
|
||||
UINT dpi_x, dpi_y;
|
||||
if (GetDpiForMonitor(monitor_handle, MDT_EFFECTIVE_DPI, &dpi_x, &dpi_y) == S_OK)
|
||||
{
|
||||
width = width * dpi_x / DEFAULT_DPI;
|
||||
height = height * dpi_y / DEFAULT_DPI;
|
||||
width = width * static_cast<int>(dpi_x) / DEFAULT_DPI;
|
||||
height = height * static_cast<int>(dpi_y) / DEFAULT_DPI;
|
||||
}
|
||||
}
|
||||
|
||||
void InverseConvert(HMONITOR monitor_handle, int& width, int& height)
|
||||
{
|
||||
if (monitor_handle == NULL)
|
||||
{
|
||||
const POINT ptZero = { 0, 0 };
|
||||
monitor_handle = MonitorFromPoint(ptZero, MONITOR_DEFAULTTOPRIMARY);
|
||||
}
|
||||
|
||||
UINT dpi_x, dpi_y;
|
||||
if (GetDpiForMonitor(monitor_handle, MDT_EFFECTIVE_DPI, &dpi_x, &dpi_y) == S_OK)
|
||||
{
|
||||
width = width * DEFAULT_DPI / static_cast<int>(dpi_x);
|
||||
height = height * DEFAULT_DPI / static_cast<int>(dpi_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace DPIAware
|
||||
HRESULT GetScreenDPIForWindow(HWND hwnd, UINT& dpi_x, UINT& dpi_y);
|
||||
HRESULT GetScreenDPIForPoint(POINT p, UINT& dpi_x, UINT& dpi_y);
|
||||
void Convert(HMONITOR monitor_handle, int& width, int& height);
|
||||
void InverseConvert(HMONITOR monitor_handle, int& width, int& height);
|
||||
void EnableDPIAwarenessForThisProcess();
|
||||
|
||||
enum AwarenessLevel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="..\..\..\installer\Version.props" />
|
||||
<!-- We don't have GenerateAssemblyInfo task until we use .net core, so we generate it with WriteLinesToFile -->
|
||||
@@ -76,10 +76,10 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -105,8 +105,8 @@
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net472" />
|
||||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -5,15 +5,14 @@ using namespace interop;
|
||||
|
||||
HotkeyManager::HotkeyManager()
|
||||
{
|
||||
keyboardEventCallback = gcnew KeyboardEventCallback(this, &HotkeyManager::KeyboardEventProc);
|
||||
keyboardEventCallback = gcnew KeyboardEventCallback(this, &HotkeyManager::KeyboardEventProc);
|
||||
isActiveCallback = gcnew IsActiveCallback(this, &HotkeyManager::IsActiveProc);
|
||||
filterKeyboardCallback = gcnew FilterKeyboardEvent(this, &HotkeyManager::FilterKeyboardProc);
|
||||
|
||||
keyboardHook = gcnew KeyboardHook(
|
||||
keyboardEventCallback,
|
||||
isActiveCallback,
|
||||
filterKeyboardCallback
|
||||
);
|
||||
filterKeyboardCallback);
|
||||
hotkeys = gcnew Dictionary<HOTKEY_HANDLE, HotkeyCallback ^>();
|
||||
pressedKeys = gcnew Hotkey();
|
||||
keyboardHook->Start();
|
||||
@@ -25,12 +24,20 @@ HotkeyManager::~HotkeyManager()
|
||||
}
|
||||
|
||||
// When all Shortcut keys are pressed, fire the HotkeyCallback event.
|
||||
void HotkeyManager::KeyboardEventProc(KeyboardEvent^ ev)
|
||||
void HotkeyManager::KeyboardEventProc(KeyboardEvent ^ ev)
|
||||
{
|
||||
// pressedKeys always stores the latest keyboard state
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
if (hotkeys->ContainsKey(pressedKeysHandle))
|
||||
{
|
||||
hotkeys[pressedKeysHandle]->Invoke();
|
||||
|
||||
// After invoking the hotkey send a dummy key to prevent Start Menu from activating
|
||||
INPUT dummyEvent[1] = {};
|
||||
dummyEvent[0].type = INPUT_KEYBOARD;
|
||||
dummyEvent[0].ki.wVk = 0xFF;
|
||||
dummyEvent[0].ki.dwFlags = KEYEVENTF_KEYUP;
|
||||
SendInput(1, dummyEvent, sizeof(INPUT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,22 +49,24 @@ bool HotkeyManager::IsActiveProc()
|
||||
}
|
||||
|
||||
// KeyboardEvent callback is only fired for relevant key events.
|
||||
bool HotkeyManager::FilterKeyboardProc(KeyboardEvent^ ev)
|
||||
bool HotkeyManager::FilterKeyboardProc(KeyboardEvent ^ ev)
|
||||
{
|
||||
auto oldHandle = GetHotkeyHandle(pressedKeys);
|
||||
|
||||
// Updating the pressed keys here so we know if the keypress event
|
||||
// should be propagated or not.
|
||||
UpdatePressedKeys(ev);
|
||||
// Updating the pressed keys here so we know if the keypress event should be propagated or not.
|
||||
pressedKeys->Win = (GetAsyncKeyState(VK_LWIN) & 0x8000) || (GetAsyncKeyState(VK_RWIN) & 0x8000);
|
||||
pressedKeys->Ctrl = GetAsyncKeyState(VK_CONTROL) & 0x8000;
|
||||
pressedKeys->Alt = GetAsyncKeyState(VK_MENU) & 0x8000;
|
||||
pressedKeys->Shift = GetAsyncKeyState(VK_SHIFT) & 0x8000;
|
||||
pressedKeys->Key = ev->key;
|
||||
|
||||
// Convert to hotkey handle
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
|
||||
// Check if the hotkey matches the pressed keys, and check if the pressed keys aren't duplicate
|
||||
// (there shouldn't be auto repeating hotkeys)
|
||||
if (hotkeys->ContainsKey(pressedKeysHandle) && oldHandle != pressedKeysHandle)
|
||||
// Check if any hotkey matches the pressed keys if the current key event is a key down event
|
||||
if ((ev->message == WM_KEYDOWN || ev->message == WM_SYSKEYDOWN) && hotkeys->ContainsKey(pressedKeysHandle))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,51 +92,3 @@ HOTKEY_HANDLE HotkeyManager::GetHotkeyHandle(Hotkey ^ hotkey)
|
||||
handle |= hotkey->Alt << 11;
|
||||
return handle;
|
||||
}
|
||||
|
||||
void HotkeyManager::UpdatePressedKey(DWORD code, bool replaceWith, unsigned char replaceWithKey)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case VK_LWIN:
|
||||
case VK_RWIN:
|
||||
pressedKeys->Win = replaceWith;
|
||||
break;
|
||||
case VK_CONTROL:
|
||||
case VK_LCONTROL:
|
||||
case VK_RCONTROL:
|
||||
pressedKeys->Ctrl = replaceWith;
|
||||
break;
|
||||
case VK_SHIFT:
|
||||
case VK_LSHIFT:
|
||||
case VK_RSHIFT:
|
||||
pressedKeys->Shift = replaceWith;
|
||||
break;
|
||||
case VK_MENU:
|
||||
case VK_LMENU:
|
||||
case VK_RMENU:
|
||||
pressedKeys->Alt = replaceWith;
|
||||
break;
|
||||
default:
|
||||
pressedKeys->Key = replaceWithKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void HotkeyManager::UpdatePressedKeys(KeyboardEvent ^ ev)
|
||||
{
|
||||
switch (ev->message)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
{
|
||||
UpdatePressedKey(ev->key, true, ev->key);
|
||||
}
|
||||
break;
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
{
|
||||
UpdatePressedKey(ev->key, false, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public
|
||||
public
|
||||
delegate void HotkeyCallback();
|
||||
|
||||
typedef unsigned short HOTKEY_HANDLE;
|
||||
typedef unsigned short HOTKEY_HANDLE;
|
||||
|
||||
public
|
||||
ref class HotkeyManager
|
||||
@@ -46,12 +46,9 @@ public
|
||||
IsActiveCallback ^ isActiveCallback;
|
||||
FilterKeyboardEvent ^ filterKeyboardCallback;
|
||||
|
||||
|
||||
void KeyboardEventProc(KeyboardEvent ^ ev);
|
||||
bool IsActiveProc();
|
||||
bool FilterKeyboardProc(KeyboardEvent ^ ev);
|
||||
HOTKEY_HANDLE GetHotkeyHandle(Hotkey ^ hotkey);
|
||||
void UpdatePressedKeys(KeyboardEvent ^ ev);
|
||||
void UpdatePressedKey(DWORD code, bool replaceWith, unsigned char replaceWithKey);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ KeyboardHook::KeyboardHook(
|
||||
IsActiveCallback ^ isActiveCallback,
|
||||
FilterKeyboardEvent ^ filterKeyboardEvent)
|
||||
{
|
||||
kbEventDispatch = gcnew Thread(gcnew ThreadStart(this, &KeyboardHook::DispatchProc));
|
||||
queue = gcnew Queue<KeyboardEvent ^>();
|
||||
this->keyboardEventCallback = keyboardEventCallback;
|
||||
this->isActiveCallback = isActiveCallback;
|
||||
this->filterKeyboardEvent = filterKeyboardEvent;
|
||||
@@ -24,44 +22,10 @@ KeyboardHook::KeyboardHook(
|
||||
|
||||
KeyboardHook::~KeyboardHook()
|
||||
{
|
||||
quit = true;
|
||||
|
||||
// Notify the DispatchProc thread so that it isn't stuck at the Wait step
|
||||
Monitor::Enter(queue);
|
||||
Monitor::Pulse(queue);
|
||||
Monitor::Exit(queue);
|
||||
|
||||
kbEventDispatch->Join();
|
||||
|
||||
// Unregister low level hook procedure
|
||||
UnhookWindowsHookEx(hookHandle);
|
||||
}
|
||||
|
||||
void KeyboardHook::DispatchProc()
|
||||
{
|
||||
Monitor::Enter(queue);
|
||||
quit = false;
|
||||
while (!quit)
|
||||
{
|
||||
if (queue->Count == 0)
|
||||
{
|
||||
Monitor::Wait(queue);
|
||||
continue;
|
||||
}
|
||||
auto nextEv = queue->Dequeue();
|
||||
|
||||
// Release lock while callback is being invoked
|
||||
Monitor::Exit(queue);
|
||||
|
||||
keyboardEventCallback->Invoke(nextEv);
|
||||
|
||||
// Re-aquire lock
|
||||
Monitor::Enter(queue);
|
||||
}
|
||||
|
||||
Monitor::Exit(queue);
|
||||
}
|
||||
|
||||
void KeyboardHook::Start()
|
||||
{
|
||||
hookProc = gcnew HookProcDelegate(this, &KeyboardHook::HookProc);
|
||||
@@ -85,8 +49,6 @@ void KeyboardHook::Start()
|
||||
throw std::exception("SetWindowsHookEx failed.");
|
||||
}
|
||||
}
|
||||
|
||||
kbEventDispatch->Start();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK KeyboardHook::HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
@@ -101,10 +63,7 @@ LRESULT CALLBACK KeyboardHook::HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
return CallNextHookEx(hookHandle, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
Monitor::Enter(queue);
|
||||
queue->Enqueue(ev);
|
||||
Monitor::Pulse(queue);
|
||||
Monitor::Exit(queue);
|
||||
keyboardEventCallback->Invoke(ev);
|
||||
return 1;
|
||||
}
|
||||
return CallNextHookEx(hookHandle, nCode, wParam, lParam);
|
||||
|
||||
@@ -33,16 +33,12 @@ public
|
||||
|
||||
private:
|
||||
delegate LRESULT HookProcDelegate(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
Thread ^ kbEventDispatch;
|
||||
Queue<KeyboardEvent ^> ^ queue;
|
||||
KeyboardEventCallback ^ keyboardEventCallback;
|
||||
IsActiveCallback ^ isActiveCallback;
|
||||
FilterKeyboardEvent ^ filterKeyboardEvent;
|
||||
bool quit;
|
||||
HHOOK hookHandle;
|
||||
HookProcDelegate ^ hookProc;
|
||||
|
||||
void DispatchProc();
|
||||
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "..\two_way_pipe_message_ipc.h"
|
||||
#include "..\common.h"
|
||||
#include "..\shared_constants.h"
|
||||
#include "..\os-detect.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
@@ -113,7 +114,12 @@ public
|
||||
static String^ GetProductVersion()
|
||||
{
|
||||
return gcnew String(get_product_version().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
static bool ShouldNewSettingsBeUsed()
|
||||
{
|
||||
return UseNewSettings();
|
||||
}
|
||||
};
|
||||
|
||||
public
|
||||
|
||||
@@ -96,6 +96,8 @@
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -130,7 +130,7 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
|
||||
keyboardLayoutMap[VK_HELP] = L"Help";
|
||||
keyboardLayoutMap[VK_LWIN] = L"Win (Left)";
|
||||
keyboardLayoutMap[VK_RWIN] = L"Win (Right)";
|
||||
keyboardLayoutMap[VK_APPS] = L"Menu";
|
||||
keyboardLayoutMap[VK_APPS] = L"Apps/Menu";
|
||||
keyboardLayoutMap[VK_SLEEP] = L"Sleep";
|
||||
keyboardLayoutMap[VK_NUMPAD0] = L"NumPad 0";
|
||||
keyboardLayoutMap[VK_NUMPAD1] = L"NumPad 1";
|
||||
@@ -204,7 +204,17 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
|
||||
keyboardLayoutMap[VK_OEM_CLEAR] = L"Clear";
|
||||
keyboardLayoutMap[0xFF] = L"Undefined";
|
||||
keyboardLayoutMap[CommonSharedConstants::VK_WIN_BOTH] = L"Win";
|
||||
// To do: Add IME key names
|
||||
keyboardLayoutMap[VK_KANA] = L"IME Kana";
|
||||
keyboardLayoutMap[VK_HANGEUL] = L"IME Hangeul";
|
||||
keyboardLayoutMap[VK_HANGUL] = L"IME Hangul";
|
||||
keyboardLayoutMap[VK_JUNJA] = L"IME Junja";
|
||||
keyboardLayoutMap[VK_FINAL] = L"IME Final";
|
||||
keyboardLayoutMap[VK_HANJA] = L"IME Hanja";
|
||||
keyboardLayoutMap[VK_KANJI] = L"IME Kanji";
|
||||
keyboardLayoutMap[VK_CONVERT] = L"IME Convert";
|
||||
keyboardLayoutMap[VK_NONCONVERT] = L"IME Non-Convert";
|
||||
keyboardLayoutMap[VK_ACCEPT] = L"IME Kana";
|
||||
keyboardLayoutMap[VK_MODECHANGE] = L"IME Mode Change";
|
||||
}
|
||||
|
||||
// Function to return the list of key codes in the order for the drop down. It creates it if it doesn't exist
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "common.h"
|
||||
#include "com_object_factory.h"
|
||||
#include "notifications.h"
|
||||
#include "winstore.h"
|
||||
|
||||
#include <unknwn.h>
|
||||
#include <winrt/base.h>
|
||||
@@ -11,35 +12,37 @@
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.UI.Notifications.h>
|
||||
#include <winrt/Windows.ApplicationModel.Background.h>
|
||||
|
||||
#include "winstore.h"
|
||||
#include <wil/com.h>
|
||||
#include <propvarutil.h>
|
||||
#include <propkey.h>
|
||||
#include <Shobjidl.h>
|
||||
|
||||
#include <winerror.h>
|
||||
#include <NotificationActivationCallback.h>
|
||||
|
||||
#include "notifications_winrt/handler_functions.h"
|
||||
#include <filesystem>
|
||||
|
||||
using namespace winrt::Windows::ApplicationModel::Background;
|
||||
using winrt::Windows::Data::Xml::Dom::XmlDocument;
|
||||
using winrt::Windows::UI::Notifications::ToastNotification;
|
||||
using winrt::Windows::UI::Notifications::ToastNotificationManager;
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::wstring_view TASK_NAME = L"PowerToysBackgroundNotificationsHandler";
|
||||
constexpr std::wstring_view TASK_ENTRYPOINT = L"PowerToysNotifications.BackgroundHandler";
|
||||
constexpr std::wstring_view APPLICATION_ID = L"PowerToys";
|
||||
constexpr std::wstring_view PACKAGED_APPLICATION_ID = L"PowerToys";
|
||||
constexpr std::wstring_view APPIDS_REGISTRY = LR"(Software\Classes\AppUserModelId\)";
|
||||
|
||||
constexpr std::wstring_view WIN32_AUMID = L"Microsoft.PowerToysWin32";
|
||||
std::wstring APPLICATION_ID;
|
||||
}
|
||||
|
||||
namespace localized_strings
|
||||
namespace localized_strings
|
||||
{
|
||||
constexpr std::wstring_view SNOOZE_BUTTON = L"Snooze";
|
||||
|
||||
constexpr std::wstring_view PT_UPDATE = L"PowerToys update";
|
||||
constexpr std::wstring_view DOWNLOAD_IN_PROGRESS = L"Downloading...";
|
||||
constexpr std::wstring_view DOWNLOAD_COMPLETE = L"Download complete";
|
||||
}
|
||||
|
||||
static DWORD loop_thread_id()
|
||||
@@ -119,6 +122,74 @@ void notifications::run_desktop_app_activator_loop()
|
||||
CoRevokeClassObject(token);
|
||||
}
|
||||
|
||||
bool notifications::register_application_id(const std::wstring_view appName, const std::wstring_view iconPath)
|
||||
{
|
||||
std::wstring aumidPath{ APPIDS_REGISTRY };
|
||||
aumidPath += APPLICATION_ID;
|
||||
wil::unique_hkey aumidKey;
|
||||
if (FAILED(RegCreateKeyW(HKEY_CURRENT_USER, aumidPath.c_str(), &aumidKey)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (FAILED(RegSetKeyValueW(aumidKey.get(),
|
||||
nullptr,
|
||||
L"DisplayName",
|
||||
REG_SZ,
|
||||
appName.data(),
|
||||
static_cast<DWORD>((size(appName) + 1) * sizeof(wchar_t)))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FAILED(RegSetKeyValueW(aumidKey.get(),
|
||||
nullptr,
|
||||
L"IconUri",
|
||||
REG_SZ,
|
||||
iconPath.data(),
|
||||
static_cast<DWORD>((size(iconPath) + 1) * sizeof(wchar_t)))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::wstring_view iconColor = L"FFDDDDDD";
|
||||
if (FAILED(RegSetKeyValueW(aumidKey.get(),
|
||||
nullptr,
|
||||
L"IconBackgroundColor",
|
||||
REG_SZ,
|
||||
iconColor.data(),
|
||||
static_cast<DWORD>((size(iconColor) + 1) * sizeof(wchar_t)))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void notifications::unregister_application_id()
|
||||
{
|
||||
std::wstring aumidPath{ APPIDS_REGISTRY };
|
||||
aumidPath += APPLICATION_ID;
|
||||
wil::unique_hkey registryRoot;
|
||||
RegOpenKeyW(HKEY_CURRENT_USER, aumidPath.c_str(), ®istryRoot);
|
||||
if (!registryRoot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RegDeleteTreeW(registryRoot.get(), nullptr);
|
||||
registryRoot.reset();
|
||||
RegOpenKeyW(HKEY_CURRENT_USER, APPIDS_REGISTRY.data(), ®istryRoot);
|
||||
if (!registryRoot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RegDeleteKeyW(registryRoot.get(), APPLICATION_ID.data());
|
||||
}
|
||||
|
||||
void notifications::set_application_id(const std::wstring_view appID)
|
||||
{
|
||||
APPLICATION_ID = appID;
|
||||
SetCurrentProcessExplicitAppUserModelID(APPLICATION_ID.c_str());
|
||||
}
|
||||
|
||||
void notifications::register_background_toast_handler()
|
||||
{
|
||||
if (!winstore::running_as_packaged())
|
||||
@@ -133,7 +204,7 @@ void notifications::register_background_toast_handler()
|
||||
BackgroundExecutionManager::RequestAccessAsync().get();
|
||||
|
||||
BackgroundTaskBuilder builder;
|
||||
ToastNotificationActionTrigger trigger{ APPLICATION_ID };
|
||||
ToastNotificationActionTrigger trigger{ PACKAGED_APPLICATION_ID };
|
||||
builder.SetTrigger(trigger);
|
||||
builder.TaskEntryPoint(TASK_ENTRYPOINT);
|
||||
builder.Name(TASK_NAME);
|
||||
@@ -154,10 +225,10 @@ void notifications::register_background_toast_handler()
|
||||
}
|
||||
}
|
||||
|
||||
void notifications::show_toast(std::wstring message, toast_params params)
|
||||
void notifications::show_toast(std::wstring message, std::wstring title, toast_params params)
|
||||
{
|
||||
// The toast won't be actually activated in the background, since it doesn't have any buttons
|
||||
show_toast_with_activations(std::move(message), {}, {}, std::move(params));
|
||||
show_toast_with_activations(std::move(message), std::move(title), {}, {}, std::move(params));
|
||||
}
|
||||
|
||||
inline void xml_escape(std::wstring data)
|
||||
@@ -191,34 +262,26 @@ inline void xml_escape(std::wstring data)
|
||||
data.swap(buffer);
|
||||
}
|
||||
|
||||
void notifications::show_toast_with_activations(std::wstring message, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params)
|
||||
void notifications::show_toast_with_activations(std::wstring message,
|
||||
std::wstring title,
|
||||
std::wstring_view background_handler_id,
|
||||
std::vector<action_t> actions,
|
||||
toast_params params)
|
||||
{
|
||||
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
|
||||
// https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
|
||||
|
||||
std::wstring toast_xml;
|
||||
toast_xml.reserve(2048);
|
||||
std::wstring title{ L"PowerToys" };
|
||||
if (winstore::running_as_packaged())
|
||||
{
|
||||
title += L" (Experimental)";
|
||||
}
|
||||
|
||||
toast_xml += LR"(<?xml version="1.0"?><toast><visual><binding template="ToastGeneric"><text>)";
|
||||
toast_xml += LR"(<?xml version="1.0"?><toast><visual><binding template="ToastGeneric"><text id="1">)";
|
||||
toast_xml += title;
|
||||
toast_xml += L"</text><text>";
|
||||
toast_xml += LR"(</text><text id="2">)";
|
||||
toast_xml += message;
|
||||
toast_xml += L"</text>";
|
||||
if (params.progress)
|
||||
if (params.progress_bar.has_value())
|
||||
{
|
||||
toast_xml += LR"(<progress title=")";
|
||||
toast_xml += localized_strings::PT_UPDATE;
|
||||
if (params.subtitle)
|
||||
{
|
||||
toast_xml += L" ";
|
||||
toast_xml += *params.subtitle;
|
||||
}
|
||||
toast_xml += LR"(" value="{progressValue}" valueStringOverride="{progressValueString}" status="{progressStatus}"/>)";
|
||||
toast_xml += LR"(<progress title="{progressTitle}" value="{progressValue}" valueStringOverride="{progressValueString}" status="" />)";
|
||||
}
|
||||
toast_xml += L"</binding></visual><actions>";
|
||||
for (size_t i = 0; i < size(actions); ++i)
|
||||
@@ -310,19 +373,19 @@ void notifications::show_toast_with_activations(std::wstring message, std::wstri
|
||||
toast_xml_doc.LoadXml(toast_xml);
|
||||
ToastNotification notification{ toast_xml_doc };
|
||||
|
||||
if (params.progress)
|
||||
if (params.progress_bar.has_value())
|
||||
{
|
||||
float progress = std::clamp(params.progress.value(), 0.0f, 1.0f);
|
||||
float progress = std::clamp(params.progress_bar->progress, 0.0f, 1.0f);
|
||||
winrt::Windows::Foundation::Collections::StringMap map;
|
||||
map.Insert(L"progressValue", std::to_wstring(progress));
|
||||
map.Insert(L"progressValueString", std::to_wstring(static_cast<int>(progress * 100)) + std::wstring(L"%"));
|
||||
map.Insert(L"progressStatus", localized_strings::DOWNLOAD_IN_PROGRESS);
|
||||
map.Insert(L"progressTitle", params.progress_bar->progress_title);
|
||||
winrt::Windows::UI::Notifications::NotificationData data(map);
|
||||
notification.Data(data);
|
||||
}
|
||||
|
||||
const auto notifier = winstore::running_as_packaged() ? ToastNotificationManager::ToastNotificationManager::CreateToastNotifier() :
|
||||
ToastNotificationManager::ToastNotificationManager::CreateToastNotifier(WIN32_AUMID);
|
||||
ToastNotificationManager::ToastNotificationManager::CreateToastNotifier(APPLICATION_ID);
|
||||
|
||||
// Set a tag-related params if it has a valid length
|
||||
if (params.tag.has_value() && params.tag->length() < 64)
|
||||
@@ -343,29 +406,18 @@ void notifications::show_toast_with_activations(std::wstring message, std::wstri
|
||||
notifier.Show(notification);
|
||||
}
|
||||
|
||||
void notifications::update_progress_bar_toast(std::wstring plaintext_message, toast_params params)
|
||||
void notifications::update_progress_bar_toast(std::wstring_view tag, progress_bar_params params)
|
||||
{
|
||||
if (!params.progress.has_value())
|
||||
{
|
||||
return;
|
||||
}
|
||||
const auto notifier = winstore::running_as_packaged() ?
|
||||
ToastNotificationManager::ToastNotificationManager::CreateToastNotifier() :
|
||||
ToastNotificationManager::ToastNotificationManager::CreateToastNotifier(APPLICATION_ID);
|
||||
|
||||
const auto notifier = winstore::running_as_packaged() ? ToastNotificationManager::ToastNotificationManager::CreateToastNotifier() :
|
||||
ToastNotificationManager::ToastNotificationManager::CreateToastNotifier(WIN32_AUMID);
|
||||
|
||||
float progress = std::clamp(params.progress.value(), 0.0f, 1.0f);
|
||||
float progress = std::clamp(params.progress, 0.0f, 1.0f);
|
||||
winrt::Windows::Foundation::Collections::StringMap map;
|
||||
map.Insert(L"progressValue", std::to_wstring(progress));
|
||||
map.Insert(L"progressValueString", std::to_wstring(static_cast<int>(progress * 100)) + std::wstring(L"%"));
|
||||
map.Insert(L"progressStatus", progress < 1 ? localized_strings::DOWNLOAD_IN_PROGRESS : localized_strings::DOWNLOAD_COMPLETE);
|
||||
map.Insert(L"progressTitle", params.progress_title);
|
||||
|
||||
|
||||
winrt::Windows::UI::Notifications::NotificationData data(map);
|
||||
std::wstring tag = L"";
|
||||
if (params.tag.has_value() && params.tag->length() < 64)
|
||||
{
|
||||
tag = *params.tag;
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Notifications::NotificationUpdateResult res = notifier.Update(data, tag);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,13 @@ namespace notifications
|
||||
{
|
||||
constexpr inline const wchar_t TOAST_ACTIVATED_LAUNCH_ARG[] = L"-ToastActivated";
|
||||
|
||||
void set_application_id(const std::wstring_view appID);
|
||||
void register_background_toast_handler();
|
||||
|
||||
void run_desktop_app_activator_loop();
|
||||
|
||||
bool register_application_id(const std::wstring_view appName, const std::wstring_view iconPath);
|
||||
void unregister_application_id();
|
||||
|
||||
struct snooze_duration
|
||||
{
|
||||
std::wstring label;
|
||||
@@ -39,17 +42,22 @@ namespace notifications
|
||||
bool context_menu = false;
|
||||
};
|
||||
|
||||
struct progress_bar_params
|
||||
{
|
||||
std::wstring_view progress_title;
|
||||
float progress = 0.f;
|
||||
};
|
||||
|
||||
struct toast_params
|
||||
{
|
||||
std::optional<std::wstring_view> tag;
|
||||
bool resend_if_scheduled = true;
|
||||
std::optional<float> progress;
|
||||
std::optional<std::wstring_view> subtitle;
|
||||
std::optional<progress_bar_params> progress_bar;
|
||||
};
|
||||
|
||||
using action_t = std::variant<link_button, background_activated_button, snooze_button>;
|
||||
|
||||
void show_toast(std::wstring plaintext_message, toast_params params = {});
|
||||
void show_toast_with_activations(std::wstring plaintext_message, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {});
|
||||
void update_progress_bar_toast(std::wstring plaintext_message, toast_params params);
|
||||
void show_toast(std::wstring plaintext_message, std::wstring title, toast_params params = {});
|
||||
void show_toast_with_activations(std::wstring plaintext_message, std::wstring title, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {});
|
||||
void update_progress_bar_toast(std::wstring_view tag, progress_bar_params params);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -163,6 +163,8 @@
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -183,7 +185,7 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\notifications_winrt\notifications.vcxproj">
|
||||
@@ -197,7 +199,7 @@
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200514.2" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
@@ -158,13 +158,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200514.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200514.2" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
|
||||
</packages>
|
||||