mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-03 10:56:36 +01:00
Compare commits
326 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b90363a041 | ||
|
|
de870c843e | ||
|
|
9c32e32097 | ||
|
|
f61db8ed3f | ||
|
|
9e1711cbb9 | ||
|
|
c941b5333c | ||
|
|
8d934df0c0 | ||
|
|
2f0937951a | ||
|
|
a676537e26 | ||
|
|
b071220b6c | ||
|
|
dafc1e0c7d | ||
|
|
5a07579b73 | ||
|
|
0148669e98 | ||
|
|
75ace74d37 | ||
|
|
1ef4c43382 | ||
|
|
c1e9f2de6a | ||
|
|
55b36d44fa | ||
|
|
d2201cbb79 | ||
|
|
934949725b | ||
|
|
57972c6653 | ||
|
|
0f6428eed0 | ||
|
|
6e89ef62e4 | ||
|
|
b266e336b5 | ||
|
|
e135153c45 | ||
|
|
28cae124d1 | ||
|
|
94d8b4a122 | ||
|
|
ce835418cb | ||
|
|
3aa7a52c21 | ||
|
|
2bc3480396 | ||
|
|
7893f387d5 | ||
|
|
00187269de | ||
|
|
b3833fcf1a | ||
|
|
923972dd49 | ||
|
|
f19bad3761 | ||
|
|
b5cc24fcff | ||
|
|
d414d52156 | ||
|
|
85c0eaa598 | ||
|
|
d409a71000 | ||
|
|
0a716c253b | ||
|
|
13fd6bd6e1 | ||
|
|
b0f0940534 | ||
|
|
dc284d9cbb | ||
|
|
0a86360948 | ||
|
|
e49900f927 | ||
|
|
5e301133ff | ||
|
|
5b684cca9a | ||
|
|
3d36779e19 | ||
|
|
eaf54ca525 | ||
|
|
25f93e8b94 | ||
|
|
7328aa7df5 | ||
|
|
d75dd71848 | ||
|
|
3d5c790fb6 | ||
|
|
5af88de27b | ||
|
|
997a7bc60f | ||
|
|
bfbd7b53a1 | ||
|
|
1dec80902d | ||
|
|
0478d99aac | ||
|
|
db9677bb4a | ||
|
|
0e32edb603 | ||
|
|
82e1be2839 | ||
|
|
ab8bec8866 | ||
|
|
3b8fa8b4ce | ||
|
|
c4cb3df306 | ||
|
|
efd5c33a92 | ||
|
|
f589103f5d | ||
|
|
19175e9bde | ||
|
|
3137aaa660 | ||
|
|
cfda69a120 | ||
|
|
1027b7de72 | ||
|
|
fb1888f01f | ||
|
|
f61e9d389f | ||
|
|
936b02865f | ||
|
|
cbd3516fc4 | ||
|
|
c2d6f740a1 | ||
|
|
305a04ce69 | ||
|
|
fdd7d6afa4 | ||
|
|
1a51f77fce | ||
|
|
8ea8db7994 | ||
|
|
cd906b0a6f | ||
|
|
85fa644aca | ||
|
|
839d3f89d8 | ||
|
|
52a06b5cdc | ||
|
|
5065239266 | ||
|
|
13426eac50 | ||
|
|
c5f90272d1 | ||
|
|
e0d6c2a4cd | ||
|
|
3c76942799 | ||
|
|
4ff888b2b0 | ||
|
|
a0eaf077de | ||
|
|
726f94e2a2 | ||
|
|
19771b171c | ||
|
|
b4223967e8 | ||
|
|
e57283460a | ||
|
|
78edaf5edc | ||
|
|
91f0d40d1a | ||
|
|
dacccf1415 | ||
|
|
8fcb76e300 | ||
|
|
24906e6fa5 | ||
|
|
570065175c | ||
|
|
e84a293642 | ||
|
|
41559d8742 | ||
|
|
6e898ae52d | ||
|
|
288d929477 | ||
|
|
807fbd4d89 | ||
|
|
6ce47e5cd9 | ||
|
|
712d5fbfa7 | ||
|
|
8d3380b388 | ||
|
|
c9855a2671 | ||
|
|
c887f0ce5b | ||
|
|
64ee0015d1 | ||
|
|
1b598ad87e | ||
|
|
c9f536c635 | ||
|
|
742f4fe36d | ||
|
|
fc34c05a2f | ||
|
|
84055a420b | ||
|
|
e5ec08ff9d | ||
|
|
06267f5a03 | ||
|
|
824bec2784 | ||
|
|
cb81f7b057 | ||
|
|
ce43b10b5b | ||
|
|
0349383d08 | ||
|
|
777e1dc48c | ||
|
|
fe8727bd94 | ||
|
|
6a531ca57c | ||
|
|
1d9c15b1cc | ||
|
|
fc4ac803aa | ||
|
|
870f1095cd | ||
|
|
4e969a3701 | ||
|
|
0a603449ad | ||
|
|
d51640c2f0 | ||
|
|
be8695777c | ||
|
|
eb825ae619 | ||
|
|
40a4a6a1a8 | ||
|
|
07dfa6f296 | ||
|
|
cb52cb2549 | ||
|
|
26b73b0745 | ||
|
|
fead0c5ad9 | ||
|
|
c3652786ff | ||
|
|
3bd6c363de | ||
|
|
48b6654ad2 | ||
|
|
2075f9fa71 | ||
|
|
96fdb6169a | ||
|
|
6d47a5477a | ||
|
|
d3b80b26e3 | ||
|
|
3ede1a0b53 | ||
|
|
aebd7657ef | ||
|
|
15938a12be | ||
|
|
f2cfd90c46 | ||
|
|
f3a55d96f5 | ||
|
|
392ca87dab | ||
|
|
ff48421e4f | ||
|
|
f6579184a2 | ||
|
|
c0c68f6acd | ||
|
|
f2fd376363 | ||
|
|
9999a2b126 | ||
|
|
2817bf4d62 | ||
|
|
845bb466c6 | ||
|
|
f64df97652 | ||
|
|
9c6b2c3e81 | ||
|
|
83e8799610 | ||
|
|
80f8c0399b | ||
|
|
f6b5840e0e | ||
|
|
b5dec2e935 | ||
|
|
79bb68d784 | ||
|
|
976116a012 | ||
|
|
64c51a49a0 | ||
|
|
cc0b808962 | ||
|
|
9b567f9ba3 | ||
|
|
9a36b005a1 | ||
|
|
2390368d03 | ||
|
|
64106cba82 | ||
|
|
69cb20e1cd | ||
|
|
2a7bf7fb5b | ||
|
|
dc744f236e | ||
|
|
9724afd9ec | ||
|
|
34e7467d16 | ||
|
|
7eccb6fc7a | ||
|
|
0445e89747 | ||
|
|
953ab958d5 | ||
|
|
5e13152c73 | ||
|
|
8c98c7df29 | ||
|
|
cedc4f710e | ||
|
|
13d61bd866 | ||
|
|
c6c9839208 | ||
|
|
2ff439dc47 | ||
|
|
dad8cbecc1 | ||
|
|
8f8b200f24 | ||
|
|
8dec9d5fe9 | ||
|
|
e671c913ab | ||
|
|
9d46fae865 | ||
|
|
315caaba1c | ||
|
|
7af4ffe341 | ||
|
|
8bf730baae | ||
|
|
0b3826d2dd | ||
|
|
d055ba1c3b | ||
|
|
649e7e103d | ||
|
|
bcdfb212fc | ||
|
|
947bf10c2f | ||
|
|
2e48b583c0 | ||
|
|
55dc5dc19d | ||
|
|
04c80915e5 | ||
|
|
be36b4aac1 | ||
|
|
2ce16bcdb7 | ||
|
|
1683f191a9 | ||
|
|
70d93a0bfc | ||
|
|
6514712054 | ||
|
|
e0a1b478a1 | ||
|
|
be5d58c849 | ||
|
|
e4f9c02d11 | ||
|
|
b8d720d06f | ||
|
|
5c1713f274 | ||
|
|
913615f1c2 | ||
|
|
9e8b0d2807 | ||
|
|
0b5749d491 | ||
|
|
23a9fa40e7 | ||
|
|
38b0d427f8 | ||
|
|
e02977edc0 | ||
|
|
24d7232559 | ||
|
|
e4ea8d2abd | ||
|
|
ebd1a6406b | ||
|
|
d1ee9ebbd9 | ||
|
|
5079ee67c3 | ||
|
|
9592fab414 | ||
|
|
f36858d074 | ||
|
|
1b8bb7c445 | ||
|
|
f499ff81f2 | ||
|
|
e80c7b6b45 | ||
|
|
f3babcb46e | ||
|
|
95e82ca359 | ||
|
|
8888739867 | ||
|
|
db6e9b6962 | ||
|
|
a0832d3fb6 | ||
|
|
1c77887629 | ||
|
|
dcd0ca8daa | ||
|
|
304981fcf2 | ||
|
|
f1bb533321 | ||
|
|
2c49df4be3 | ||
|
|
90502f7553 | ||
|
|
18f5c7f691 | ||
|
|
649606f32e | ||
|
|
0f54cc147e | ||
|
|
7781f41ebf | ||
|
|
2d2cb22806 | ||
|
|
ac10c988b9 | ||
|
|
83de1686c0 | ||
|
|
145347f7ae | ||
|
|
b8b6dbe791 | ||
|
|
d21201e996 | ||
|
|
dc35fc450b | ||
|
|
c4140dd38b | ||
|
|
ba2ef23414 | ||
|
|
3781d1e06b | ||
|
|
082a78bd92 | ||
|
|
7bfd0823db | ||
|
|
013ffe1626 | ||
|
|
b2006f2466 | ||
|
|
7d8931696d | ||
|
|
e88812458e | ||
|
|
ada42f6e94 | ||
|
|
34c3b50b48 | ||
|
|
63c36d0dbf | ||
|
|
bd80bb6bb3 | ||
|
|
8f98866d71 | ||
|
|
26bf05dd7e | ||
|
|
b815718c26 | ||
|
|
d7994ca67d | ||
|
|
b95a1fb604 | ||
|
|
b04bb2ef8d | ||
|
|
066aeec1e6 | ||
|
|
d6e46d73b5 | ||
|
|
7b767df0b5 | ||
|
|
ed36447bdf | ||
|
|
0f90af3c7d | ||
|
|
f50a8e5252 | ||
|
|
1d8ca28152 | ||
|
|
6c4129d02a | ||
|
|
9b4574ad06 | ||
|
|
4543b32bef | ||
|
|
ff69f6ed7f | ||
|
|
92a2b83bc8 | ||
|
|
30b65028fe | ||
|
|
4b72b291ef | ||
|
|
59ebe30b72 | ||
|
|
814f6213fa | ||
|
|
dce3ee440b | ||
|
|
b87d14cd61 | ||
|
|
5c10c78595 | ||
|
|
a793cf4ac2 | ||
|
|
010732108c | ||
|
|
296d103f68 | ||
|
|
1f590c45be | ||
|
|
48b816fb36 | ||
|
|
d11b5b3e02 | ||
|
|
8f8787b2e0 | ||
|
|
7581802498 | ||
|
|
371523d756 | ||
|
|
1456be9feb | ||
|
|
62f57b134a | ||
|
|
84127d7a80 | ||
|
|
8fc3f1ccbd | ||
|
|
c946f10d0c | ||
|
|
e03ef0b739 | ||
|
|
55b92ab263 | ||
|
|
fbc625478b | ||
|
|
4da8aab44f | ||
|
|
d9fd967c48 | ||
|
|
ab86fc9a5e | ||
|
|
8fb095e2f4 | ||
|
|
2fe84b7510 | ||
|
|
46ef13dd0f | ||
|
|
49b56d9b52 | ||
|
|
cff654ae69 | ||
|
|
7abb4072b5 | ||
|
|
d91fd0027a | ||
|
|
8f17f7297d | ||
|
|
aa8c31e79b | ||
|
|
cfc768caa9 | ||
|
|
c48bd9b840 | ||
|
|
c09919055a | ||
|
|
d35f1ea802 | ||
|
|
cfbf3cd4b3 | ||
|
|
a46103fc8c | ||
|
|
d032956124 | ||
|
|
ff93b38d23 | ||
|
|
5b02ee5169 | ||
|
|
aa770689f5 |
14
.gitattributes
vendored
14
.gitattributes
vendored
@@ -1 +1,15 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
*.cs text eol=crlf
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
*.rc diff
|
||||
|
||||
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -14,9 +14,10 @@ Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issu
|
||||
|
||||
## ℹ Computer information
|
||||
|
||||
- Windows build number: [run "winver"]
|
||||
- PowerToys version:
|
||||
- PowerToy module:
|
||||
- PowerToy Utility:
|
||||
- Running PowerToys as Admin:
|
||||
- Windows build number: [run "winver"]
|
||||
|
||||
## 📝 Provide detailed reproduction steps (if any)
|
||||
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: "\U0001F4F7 VideoConference"
|
||||
url: https://github.com/microsoft/PowerToys/issues/6246
|
||||
about: Report Bug for the VideoConference Power Toy
|
||||
- name: "\U0001F6A8 Microsoft Security Response Center (MSRC)"
|
||||
url: https://msrc.microsoft.com/create-report
|
||||
about: Report security bugs
|
||||
@@ -9,3 +12,4 @@ contact_links:
|
||||
- name: "\U0001F4DA PowerToys dev documentation"
|
||||
url: https://github.com/microsoft/PowerToys/tree/master/doc/devdocs
|
||||
about: Documentation for people interested in developing for PowerToys
|
||||
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -9,7 +9,7 @@ assignees: ''
|
||||
|
||||
## 📝 Provide a description of the new feature
|
||||
|
||||
_What is the expected behavior of the proposed feature? What is the scenario this woudl be used?_
|
||||
_What is the expected behavior of the proposed feature? What is the scenario this would be used?_
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ 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
|
||||
call msbuild ../installer/PowerToysBootstrapper/PowerToysBootstrapper.sln /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1
|
||||
|
||||
|
||||
29
.pipelines/build-localization.cmd
Normal file
29
.pipelines/build-localization.cmd
Normal file
@@ -0,0 +1,29 @@
|
||||
@echo off
|
||||
rem This script will fail to run unless you have the appropriate permissions
|
||||
|
||||
cd /D "%~dp0"
|
||||
|
||||
echo Preparing localization build...
|
||||
|
||||
setlocal
|
||||
|
||||
rem In this sample, the repo root is identical to the script directory path. Adjust the value of the RepoRoot variable accordingly based on your environment.
|
||||
rem Again, ensure the RepoRoot variable is set to the real repo root location, otherwise the localization toolset wouldn't work as intended.
|
||||
rem Note that the resolved %~dp0 ends with \.
|
||||
set RepoRootWithoutBackslash=%~dp0..
|
||||
set RepoRoot=%RepoRootWithoutBackslash%\
|
||||
set OutDir=%RepoRoot%out
|
||||
set NUGET_PACKAGES=%RepoRoot%packages
|
||||
set LocalizationXLocPkgVer=2.0.0
|
||||
|
||||
echo Running localization build...
|
||||
|
||||
set XLocPath=%NUGET_PACKAGES%\Localization.XLoc.%LocalizationXLocPkgVer%
|
||||
set LocProjectDirectory=%RepoRootWithoutBackslash%
|
||||
|
||||
rem Run the localization tool on all LocProject.json files in the src directory and it's subdirectories (directory format must not end with \)
|
||||
dotnet "%XLocPath%\tools\netcore\Microsoft.Localization.XLoc.dll" /f "%LocProjectDirectory%"
|
||||
|
||||
echo Localization build finished with exit code '%errorlevel%'.
|
||||
|
||||
exit /b %errorlevel%
|
||||
@@ -10,8 +10,10 @@ jobs:
|
||||
BuildConfiguration: ${{ parameters.configuration }}
|
||||
BuildPlatform: ${{ parameters.platform }}
|
||||
pool: { vmImage: windows-2019 }
|
||||
|
||||
timeoutInMinutes: 120
|
||||
strategy:
|
||||
maxParallel: 10
|
||||
steps:
|
||||
- template: build-powertoys-steps.yml
|
||||
parameters:
|
||||
additionalBuildArguments: ${{ parameters.additionalBuildArguments }}
|
||||
additionalBuildArguments: ${{ parameters.additionalBuildArguments }}
|
||||
|
||||
@@ -16,7 +16,7 @@ steps:
|
||||
displayName: Ensure VSTest Platform
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: Restore NuGet packages
|
||||
displayName: Restore NuGet packages for PowerToys.sln
|
||||
inputs:
|
||||
command: restore
|
||||
feedsToUse: config
|
||||
@@ -25,7 +25,7 @@ steps:
|
||||
restoreDirectory: '$(Build.SourcesDirectory)\packages'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build solution **\PowerToys.sln'
|
||||
displayName: 'Build PowerToys.sln'
|
||||
inputs:
|
||||
solution: '**\PowerToys.sln'
|
||||
vsVersion: 16.0
|
||||
@@ -34,28 +34,73 @@ steps:
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
maximumCpuCount: true
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: Restore NuGet packages for PowerToysSetup.sln
|
||||
inputs:
|
||||
command: restore
|
||||
feedsToUse: config
|
||||
configPath: NuGet.config
|
||||
restoreSolution: installer\PowerToysSetup.sln
|
||||
restoreDirectory: '$(Build.SourcesDirectory)\installer\packages'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build PowerToysSetup.sln'
|
||||
inputs:
|
||||
solution: '**\installer\PowerToysSetup.sln'
|
||||
vsVersion: 16.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
maximumCpuCount: true
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: Restore NuGet packages for PowerToysBootstrapper.sln
|
||||
inputs:
|
||||
command: restore
|
||||
feedsToUse: config
|
||||
configPath: NuGet.config
|
||||
restoreSolution: installer\PowerToysBootstrapper\PowerToysBootstrapper.sln
|
||||
restoreDirectory: '$(Build.SourcesDirectory)\installer\PowerToysBootstrapper\packages'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build PowerToysBootstrapper.sln'
|
||||
inputs:
|
||||
solution: '**\installer\PowerToysBootstrapper\PowerToysBootstrapper.sln'
|
||||
vsVersion: 16.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
maximumCpuCount: true
|
||||
|
||||
|
||||
# directly not doing WinAppDriver testing
|
||||
- task: VSTest@2
|
||||
displayName: 'Run .Net Core Tests'
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
testAssemblyVer2: |
|
||||
!**\*PowerToysTests.dll
|
||||
!**\*TestAdapter.dll
|
||||
**\Microsoft.Plugin.Program.UnitTests.dll
|
||||
**\Microsoft.Plugin.Calculator.UnitTest.dll
|
||||
**\Microsoft.Plugin.Uri.UnitTests.dll
|
||||
**\Wox.Test.dll
|
||||
**\*Microsoft.PowerToys.Settings.UI.UnitTests.dll
|
||||
!**\obj\**
|
||||
# .NetFramework assemblies
|
||||
- task: VSTest@2
|
||||
displayName: 'Run .Net Framework Tests'
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
testAssemblyVer2: |
|
||||
**\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
|
||||
!**\obj\**
|
||||
# **\PowerRenameUnitTests.dll
|
||||
@@ -20,6 +20,7 @@ package_sources:
|
||||
nuget:
|
||||
feeds:
|
||||
'Nuget': 'https://api.nuget.org/v3/index.json'
|
||||
'Toolset': 'https://msazure.pkgs.visualstudio.com/_packaging/Toolset/nuget/v3/index.json'
|
||||
'PipelineBuildSupplement': 'https://msazure.pkgs.visualstudio.com/_packaging/PipelineBuildSupplement/nuget/v3/index.json'
|
||||
|
||||
restore:
|
||||
@@ -33,6 +34,9 @@ restore:
|
||||
- !!defaultcommand
|
||||
name: 'Restore Installer'
|
||||
command: '.pipelines\restore-installer.cmd'
|
||||
- !!defaultcommand
|
||||
name: 'Restore Localization packages'
|
||||
command: '.pipelines\restore-localization.cmd'
|
||||
|
||||
|
||||
build:
|
||||
@@ -139,12 +143,24 @@ build:
|
||||
name: 'Build Power Toys Bootstrapper'
|
||||
command: '.pipelines\build-bootstrapper.cmd'
|
||||
artifacts:
|
||||
- from: 'x64/Release'
|
||||
- to: 'Symbols'
|
||||
include:
|
||||
- 'installer\PowerToysBootstrapper\x64\Release\PowerToysSetup-*.pdb'
|
||||
- from: 'installer\PowerToysBootstrapper\x64\Release'
|
||||
to: 'Build_Installer_Output'
|
||||
include:
|
||||
- 'PowerToysSetup-*.exe'
|
||||
signing_options:
|
||||
sign_inline: true # This does signing a soon as this command completes
|
||||
# Localize the files after the build procedure to avoid existing localized files from getting overwritten. To be moved before the Build PowerToys step once the lcl files have been checked in. Tracked at https://github.com/microsoft/PowerToys/issues/6046
|
||||
- !!buildcommand
|
||||
name: 'Localize Power Toys'
|
||||
command: '.pipelines\build-localization.cmd'
|
||||
artifacts:
|
||||
- from: 'out\loc'
|
||||
to: 'loc'
|
||||
include:
|
||||
- '**/*'
|
||||
|
||||
|
||||
#package:
|
||||
|
||||
32
.pipelines/restore-localization.cmd
Normal file
32
.pipelines/restore-localization.cmd
Normal file
@@ -0,0 +1,32 @@
|
||||
@echo off
|
||||
|
||||
cd /D "%~dp0"
|
||||
|
||||
echo Installing nuget packages
|
||||
|
||||
setlocal
|
||||
|
||||
rem In this sample, the repo root is identical to the script directory path. Adjust the value of the RepoRoot variable accordingly based on your environment.
|
||||
rem Again, ensure the RepoRoot variable is set to the real repo root location, otherwise the localization toolset wouldn't work as intended.
|
||||
rem Note that the resolved %~dp0 ends with \.
|
||||
set RepoRoot=%~dp0..\
|
||||
set OutDir=%RepoRoot%out
|
||||
set NUGET_PACKAGES=%RepoRoot%packages
|
||||
set LocalizationXLocPkgVer=2.0.0
|
||||
|
||||
nuget install Localization.XLoc -Version %LocalizationXLocPkgVer% -OutputDirectory "%NUGET_PACKAGES%" -NonInteractive -Verbosity detailed
|
||||
if "%errorlevel%" neq "0" (
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
nuget install LSBuild.XLoc -OutputDirectory "%NUGET_PACKAGES%" -NonInteractive -Verbosity detailed
|
||||
if "%errorlevel%" neq "0" (
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
nuget install Localization.Languages -OutputDirectory "%NUGET_PACKAGES%" -NonInteractive -Verbosity detailed
|
||||
if "%errorlevel%" neq "0" (
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
exit /b %errorlevel%
|
||||
@@ -43,10 +43,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{4574
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "interface", "interface", "{3BB8493E-D18E-4485-A320-CB40F90F55AE}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\modules\interface\lowlevel_keyboard_event_data.h = src\modules\interface\lowlevel_keyboard_event_data.h
|
||||
src\modules\interface\powertoy_module_interface.h = src\modules\interface\powertoy_module_interface.h
|
||||
src\modules\interface\powertoy_system_menu.h = src\modules\interface\powertoy_system_menu.h
|
||||
src\modules\interface\win_hook_event_data.h = src\modules\interface\win_hook_event_data.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "settings", "src\settings\settings.vcxproj", "{07C389E3-6BC8-41CF-923E-307B1265FA2D}"
|
||||
@@ -189,6 +186,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Launcher", "src\m
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher", "src\modules\launcher\PowerLauncher\PowerLauncher.csproj", "{F97E5003-F263-4D4A-A964-0F1F3C82DEF2}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{03276A39-D4E9-417C-8FFD-200B0EE5E871} = {03276A39-D4E9-417C-8FFD-200B0EE5E871}
|
||||
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {FDB3555B-58EF-4AE6-B5F1-904719637AB4}
|
||||
{59BD9891-3837-438A-958D-ADC7F91F6F7E} = {59BD9891-3837-438A-958D-ADC7F91F6F7E}
|
||||
{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}
|
||||
@@ -233,13 +231,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Lib", "src\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UnitTest", "src\core\Microsoft.PowerToys.Settings.UnitTest\Microsoft.PowerToys.Settings.UnitTest.csproj", "{A80355C2-780D-4245-BD80-25B8DE698EE3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interop", "src\common\interop\interop.vcxproj", "{F055103B-F80B-4D0C-BF48-057C55620033}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common-md-flag", "src\common\common-md-flag\common-md-flag.vcxproj", "{985B3F2F-CEED-4C0A-A249-69257E719145}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "interop-tests", "src\common\interop-tests\interop-tests.csproj", "{437AD818-3F1F-4CA5-A79B-25233A157026}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Interop.Tests", "src\common\interop-tests\Microsoft.Interop.Tests.csproj", "{437AD818-3F1F-4CA5-A79B-25233A157026}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Folder", "src\modules\launcher\Plugins\Microsoft.Plugin.Folder\Microsoft.Plugin.Folder.csproj", "{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}"
|
||||
EndProject
|
||||
@@ -263,7 +259,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPickerUI", "src\module
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "colorpicker", "colorpicker", "{1D78B84B-CA39-406C-98F4-71F7EC266CC0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bootstrapper", "src\bootstrapper\bootstrapper.vcxproj", "{D194E3AA-F824-4CA9-9A58-034DD6B7D022}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Uri", "src\modules\launcher\Plugins\Microsoft.Plugin.Uri\Microsoft.Plugin.Uri.csproj", "{03276A39-D4E9-417C-8FFD-200B0EE5E871}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Uri.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.Uri.UnitTests\Microsoft.Plugin.Uri.UnitTests.csproj", "{B81FB7B6-D30E-428F-908A-41422EFC1172}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.UnitTests", "src\core\Microsoft.PowerToys.Settings.UI.UnitTests\Microsoft.PowerToys.Settings.UI.UnitTests.csproj", "{0F85E674-34AE-443D-954C-8321EB8B93B1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Calculator.UnitTest", "src\modules\launcher\Plugins\Microsoft.Plugin.Calculator.UnitTest\Microsoft.Plugin.Calculator.UnitTest.csproj", "{632BBE62-5421-49EA-835A-7FFA4F499BD6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -467,10 +469,6 @@ Global
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.Build.0 = Debug|x64
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.ActiveCfg = Release|x64
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.Build.0 = Release|x64
|
||||
{A80355C2-780D-4245-BD80-25B8DE698EE3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A80355C2-780D-4245-BD80-25B8DE698EE3}.Debug|x64.Build.0 = Debug|x64
|
||||
{A80355C2-780D-4245-BD80-25B8DE698EE3}.Release|x64.ActiveCfg = Release|x64
|
||||
{A80355C2-780D-4245-BD80-25B8DE698EE3}.Release|x64.Build.0 = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.Build.0 = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.ActiveCfg = Release|x64
|
||||
@@ -523,8 +521,22 @@ Global
|
||||
{BA58206B-1493-4C75-BFEA-A85768A1E156}.Debug|x64.Build.0 = Debug|x64
|
||||
{BA58206B-1493-4C75-BFEA-A85768A1E156}.Release|x64.ActiveCfg = Release|x64
|
||||
{BA58206B-1493-4C75-BFEA-A85768A1E156}.Release|x64.Build.0 = Release|x64
|
||||
{D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Release|x64.ActiveCfg = Release|x64
|
||||
{03276A39-D4E9-417C-8FFD-200B0EE5E871}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{03276A39-D4E9-417C-8FFD-200B0EE5E871}.Debug|x64.Build.0 = Debug|x64
|
||||
{03276A39-D4E9-417C-8FFD-200B0EE5E871}.Release|x64.ActiveCfg = Release|x64
|
||||
{03276A39-D4E9-417C-8FFD-200B0EE5E871}.Release|x64.Build.0 = Release|x64
|
||||
{B81FB7B6-D30E-428F-908A-41422EFC1172}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B81FB7B6-D30E-428F-908A-41422EFC1172}.Debug|x64.Build.0 = Debug|x64
|
||||
{B81FB7B6-D30E-428F-908A-41422EFC1172}.Release|x64.ActiveCfg = Release|x64
|
||||
{B81FB7B6-D30E-428F-908A-41422EFC1172}.Release|x64.Build.0 = Release|x64
|
||||
{0F85E674-34AE-443D-954C-8321EB8B93B1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0F85E674-34AE-443D-954C-8321EB8B93B1}.Debug|x64.Build.0 = Debug|x64
|
||||
{0F85E674-34AE-443D-954C-8321EB8B93B1}.Release|x64.ActiveCfg = Release|x64
|
||||
{0F85E674-34AE-443D-954C-8321EB8B93B1}.Release|x64.Build.0 = Release|x64
|
||||
{632BBE62-5421-49EA-835A-7FFA4F499BD6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{632BBE62-5421-49EA-835A-7FFA4F499BD6}.Debug|x64.Build.0 = Debug|x64
|
||||
{632BBE62-5421-49EA-835A-7FFA4F499BD6}.Release|x64.ActiveCfg = Release|x64
|
||||
{632BBE62-5421-49EA-835A-7FFA4F499BD6}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -584,7 +596,6 @@ Global
|
||||
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||
{A7D5099E-F0FD-4BF3-8522-5A682759F915} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||
{A80355C2-780D-4245-BD80-25B8DE698EE3} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||
{985B3F2F-CEED-4C0A-A249-69257E719145} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||
{437AD818-3F1F-4CA5-A79B-25233A157026} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||
@@ -599,6 +610,10 @@ Global
|
||||
{655C9AF2-18D3-4DA6-80E4-85504A7722BA} = {1D78B84B-CA39-406C-98F4-71F7EC266CC0}
|
||||
{BA58206B-1493-4C75-BFEA-A85768A1E156} = {1D78B84B-CA39-406C-98F4-71F7EC266CC0}
|
||||
{1D78B84B-CA39-406C-98F4-71F7EC266CC0} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
|
||||
{03276A39-D4E9-417C-8FFD-200B0EE5E871} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
|
||||
{B81FB7B6-D30E-428F-908A-41422EFC1172} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
|
||||
{0F85E674-34AE-443D-954C-8321EB8B93B1} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||
{632BBE62-5421-49EA-835A-7FFA4F499BD6} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||
|
||||
204
README.md
204
README.md
@@ -16,72 +16,88 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
|
||||
## Current PowerToy Utilities
|
||||
|
||||
### Color Picker
|
||||
|
||||
[<img align="left" src="https://aka.ms/powerToysColorPickerImageSmall" />](https://aka.ms/PowerToysOverview_ColorPicker) [ColorPicker](https://aka.ms/PowerToysOverview_ColorPicker) is a simple and quick system-wide color picker with <kbd>Win</kbd>+<kbd>Shift</kbd>+<kbd>C</kbd>. Color Picker allows to pick colors from any currently running application and automatically copies the HEX or RGB values to your clipboard. This code is based on [Martin Chrzan's Color Picker](https://github.com/martinchrzan/ColorPicker).
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
### FancyZones
|
||||
|
||||
[<img align="left" src="./doc/images/overview/FancyZones_small.png" />](https://aka.ms/PowerToysOverview_FancyZones) [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) is a window manager that makes it easy to create complex window layouts and quickly position windows into those layouts.
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
[<img align="left" src="https://aka.ms/powerToysFancyZoneImageSmall" />](https://aka.ms/PowerToysOverview_FancyZones) [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) is a window manager that makes it easy to create complex window layouts and quickly position windows into those layouts.
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
### File Explorer Add-ons (Preview Panes)
|
||||
### File Explorer Add-ons
|
||||
|
||||
[<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="https://aka.ms/powerToysPowerPreviewImageSmall" />](https://aka.ms/PowerToysOverview_FileExplorerAddOns) [File Explorer](https://aka.ms/PowerToysOverview_FileExplorerAddOns) add-ons will enable SVG icon rendering and Preview Pane additions for File Explorer.
|
||||
|
||||
PowerToys will now enable two types of files to be previewed: Markdown (.md) & SVG (.svg)
|
||||
<br>
|
||||
<br>
|
||||
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/>
|
||||
<br/>
|
||||
|
||||
### Image Resizer
|
||||
|
||||
[<img align="left" src="./doc/images/overview/ImageResizer_small.png" />](https://aka.ms/PowerToysOverview_ImageResizer) [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) is a Windows Shell Extension for quickly resizing images. With a simple right click from File Explorer, resize one or many images instantly. This code is based on [Brice Lambson's Image Resizer](https://github.com/bricelam/ImageResizer).
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
[<img align="left" src="https://aka.ms/powerToysImageResizerImageSmall" />](https://aka.ms/PowerToysOverview_ImageResizer) [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) is a Windows Shell Extension for quickly resizing images. With a simple right click from File Explorer, resize one or many images instantly. This code is based on [Brice Lambson's Image Resizer](https://github.com/bricelam/ImageResizer).
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
### Keyboard Manager
|
||||
|
||||
[<img align="left" src="./doc/images/overview/KBM_small.png" />](https://aka.ms/PowerToysOverview_KeyboardManager) [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) allows you to customize the keyboard to be more productive by remapping keys and creating your own keyboard shortcuts. This PowerToy requires Windows 10 1903 (build 18362) or later.
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
[<img align="left" src="https://aka.ms/powerToysKBMImageSmall" />](https://aka.ms/PowerToysOverview_KeyboardManager) [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) allows you to customize the keyboard to be more productive by remapping keys and creating your own keyboard shortcuts. This PowerToy requires Windows 10 1903 (build 18362) or later.
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
### 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).
|
||||
<br>
|
||||
[<img align="left" src="https://aka.ms/powerToysPowerRenameImageSmall" />](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
|
||||
|
||||
[<img align="left" src="./doc/images/overview/PowerLauncher_small.png" />](https://aka.ms/PowerToysOverview_PowerToysRun) [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) is a new toy in PowerToys that can help you search and launch your app instantly with a simple alt-space and start typing! It is open source and modular for additional plugins. Window Walker is now inside too! This PowerToy requires Windows 10 1903 (build 18362) or later.
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
[<img align="left" src="https://aka.ms/powerToysPowerLauncherImageSmall" />](https://aka.ms/PowerToysOverview_PowerToysRun) [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) is a new toy in PowerToys that can help you search and launch your app instantly with a simple <kbd>Alt</kbd>+<kbd>Space</kbd> and start typing! It is open source and modular for additional plugins. Window Walker is now inside too! This PowerToy requires Windows 10 1903 (build 18362) or later.
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
### Shortcut Guide
|
||||
|
||||
[<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>
|
||||
<br>
|
||||
<br>
|
||||
[<img align="left" src="https://aka.ms/powerToysShortcutGuideImageSmall" />](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/>
|
||||
<br/>
|
||||
|
||||
### Video Conference Mute (Experimental)
|
||||
|
||||
[<img align="left" src="https://aka.ms/powerToysVideoConferenceImageSmall" />](https://aka.ms/PowerToysOverview_VideoConference) [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) is a quick and easy way to do a global "mute" of both your microphone and webcam via <kbd>Win</kbd>+<kbd>N</kbd>. Just set your webcam in the target application to the PowerToys VideoConference camera.
|
||||
|
||||
**Note:** This is only included in the [pre-release version of PowerToys installer][github-prerelease-link]. This PowerToy requires Windows 10 1903 (build 18362) or later.
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
## Installing and running Microsoft PowerToys
|
||||
|
||||
**Requirements**
|
||||
#### Requirements
|
||||
- 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.
|
||||
- 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 should handle this but we want to directly make people aware.
|
||||
|
||||
### Via GitHub with MSI [Recommended]
|
||||
#### 0.18 users for updating via notifications
|
||||
|
||||
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.
|
||||
- We adjusted how upgrading works in 0.20. In 0.19 we accounted for this upcoming change but if you are going from 0.18 to 0.21, please directly use the installer file.
|
||||
|
||||
**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.
|
||||
### Via GitHub with EXE [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.21.1-x64.exe` to download the PowerToys installer.
|
||||
|
||||
This is our preferred method.
|
||||
|
||||
@@ -94,27 +110,11 @@ WinGet install powertoys
|
||||
|
||||
### Other install methods
|
||||
|
||||
#### Via Chocolatey (Unofficial)
|
||||
|
||||
Download and upgrade PowerToys from [Chocolatey](https://chocolatey.org). If you have any issues when installing/upgrading the package please go to the [package page](https://chocolatey.org/packages/powertoys) and follow the [Chocolatey triage process](https://chocolatey.org/docs/package-triage-process)
|
||||
|
||||
To install PowerToys, run the following command from the command line / PowerShell:
|
||||
|
||||
```powershell
|
||||
choco install powertoys
|
||||
```
|
||||
|
||||
To upgrade PowerToys, run the following command from the command line / PowerShell:
|
||||
|
||||
```powershell
|
||||
choco upgrade powertoys
|
||||
```
|
||||
There are [community driven install methods](./doc/unofficalInstallMethods.md) such as Chocolatey and Scoop. If these are your perferred install solutions, this will have the install instructions.
|
||||
|
||||
### Known issues
|
||||
|
||||
- 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)
|
||||
- Color Picker at times won't work when PT is running elevated - [#5348](https://github.com/microsoft/PowerToys/issues/5348). We are currently working on a fix now for this.
|
||||
|
||||
### Processor support
|
||||
|
||||
@@ -126,33 +126,83 @@ We currently support the matrix below.
|
||||
|
||||
## What's Happening
|
||||
|
||||
### June 2020 Update
|
||||
### August 2020 Update
|
||||
|
||||
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.
|
||||
Our goals for 0.21 release cycle was to focus on stability, localization and quality of life improvements for both the development team and our end users.
|
||||
|
||||
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.
|
||||
One of the longer term goal items we have made progress on is the Out of Box experience / initial onboarding experience (OOBE) improvements.[@Niels9001](https://github.com/niels9001/) created a [wicked awesome proof of concept of what the OOBE experience could be](https://github.com/microsoft/PowerToys/issues/1285#issuecomment-679268558). We are pretty stoked about this since it handles one an important item, critical shortcut default adjustments.
|
||||
|
||||
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.
|
||||
#### Highlights from August
|
||||
|
||||
- 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!
|
||||
- We shipped [v0.21][github-release-link]!
|
||||
- [Video conference muting first public release][vidConfOverview]
|
||||
|
||||
For [0.20](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F6), we are proactively working on:
|
||||
**PT Run:**
|
||||
- Removed need for space in action keywords. This means you now can type `>ipconfig`
|
||||
- Icon caches fixed and now has colored icons
|
||||
- Improved font rendering via ClearType (Shout out to [@AnuthaDev](https://github.com/AnuthaDev) doing the heavy lifting here)
|
||||
- Result speed improvements
|
||||
- URLs are supported
|
||||
- Fixed bugs including calculating bugs
|
||||
|
||||
**FancyZone:**
|
||||
- <kbd>Win</kbd>+<kbd>Arrow key</kbd> is directional based on zone rect
|
||||
- Fixed bugs
|
||||
|
||||
**Runner:**
|
||||
- Fixed toast notifications running elevated from non-admin account
|
||||
|
||||
**Shortcut Guide:**
|
||||
- Improved vkey catching which will fix some use cases of it not showing up
|
||||
|
||||
**SVG in File Explorer:**
|
||||
- Embedded image tags will now render in Explorer
|
||||
|
||||
**Color Picker:**
|
||||
- Fixed bug where it would launch via false positive keystrokes
|
||||
|
||||
**Accessibility:**
|
||||
- Settings, PT Run and KBM undergoing improvements
|
||||
|
||||
**Localization:**
|
||||
- Pipeline is now setup and will be doing a full E2E pass on all utilities shortly.
|
||||
|
||||
**Dev quality of life improvements:**
|
||||
- Continued warning count reduction. This release ~80 removed
|
||||
- StyleCop enabled E2E
|
||||
- FxCop starting to be added in E2E
|
||||
|
||||
#### New experiential PowerToys utility - Video conference muting:
|
||||
|
||||
**Note:** This is only included in the [pre-release version of PowerToys installer][github-prerelease-link]. This PowerToy requires Windows 10 1903 (build 18362) or later.
|
||||
|
||||
Back in the June timeframe, we started prototyping an idea. With COVID-19, we're all multi-tasking and trying to make the best of everything and being able to quickly mute while on a conference call is critical regardless of where you are on your computer and what application has focus.
|
||||
|
||||
The utility will mute not just your audio but your video as well with a single keystroke. You can do audio, video both. We knew this would impact our roadmap and goals but felt extremely strong that this is the right decision. We're all multi-tasking and trying to make the best of everything and being able to quickly mute while on a conference call is critical regardless of where you are on your computer.
|
||||
|
||||
We know we have some issues and we have a [master tracking issue - #6246](https://github.com/microsoft/PowerToys/issues/6246). We know a certain laptops currently the video forwarding does not work and are proactively working on fixing this.
|
||||
|
||||
To use:
|
||||
|
||||
- Set your camera to the PowerToys Video driver in the target application
|
||||
- <kbd>Win</kbd>+<kbd>N</kbd> to toggle both Audio and Video at the same time
|
||||
- <kbd>Win</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> to toggle video
|
||||
- <kbd>Win</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> to toggle microphone
|
||||
|
||||
For a more information, head over to the [Video conference mute overview][vidConfOverview]
|
||||
|
||||
### What is being planned for 0.23
|
||||
|
||||
For [0.23](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F12), we are proactively working on:
|
||||
|
||||
- Stability
|
||||
- Start work on FZ Editor V2
|
||||
- Start work on OOBE improvements
|
||||
- Keyboard manager improvements
|
||||
- Localization
|
||||
- Improve interactions with elevated windows and keeping most of the PT utilities non-elevated so we still have a 'shell' like experience
|
||||
- OOBE work
|
||||
|
||||
### Version 1.0 plan
|
||||
### PowerToys roadmap
|
||||
|
||||
Our plan for all the [goals and utilities for v1.0 detailed over here in the wiki][v1].
|
||||
Our [prioritized roadmap][roadmap] of features and utilites that the core team is focusing on..
|
||||
|
||||
## Developer Guidance
|
||||
|
||||
@@ -183,5 +233,7 @@ The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has
|
||||
[oss-CLA]: https://cla.opensource.microsoft.com
|
||||
[oss-conduct-code]: CODE_OF_CONDUCT.md
|
||||
[github-release-link]: https://github.com/microsoft/PowerToys/releases/
|
||||
[v1]: https://github.com/microsoft/PowerToys/wiki/Version-1.0-Strategy
|
||||
[github-prerelease-link]: https://github.com/microsoft/PowerToys/releases/tag/v0.22.0-Experimental
|
||||
[roadmap]: https://github.com/microsoft/PowerToys/wiki/Roadmap
|
||||
[privacyLink]: http://go.microsoft.com/fwlink/?LinkId=521839
|
||||
[vidConfOverview]: https://aka.ms/PowerToysOverview_VideoConference
|
||||
|
||||
14
community.md
14
community.md
@@ -14,6 +14,9 @@ Niels has helped drive large sums of our update toward a new [consistent and mod
|
||||
|
||||
Rafael has helped do the [upgrade from CppWinRT 1.x to 2.0](https://github.com/microsoft/PowerToys/issues/1907). He directly provided feedback to the CppWinRT team for bugs from this migration as well.
|
||||
|
||||
### [@royvou](https://github.com/royvou)
|
||||
Roy has helped out contributing a features to PowerToys Run
|
||||
|
||||
## Open source projects
|
||||
|
||||
As PowerToys creates new utilities, some will be based off existing technology. We'll continue to do our best to contribute back to these projects but their efforts were the base of some of our projects. We want to be sure their work is directly recognized.
|
||||
@@ -49,3 +52,14 @@ PowerRename is from Chris's SmartRename and icon rendering for SVGs in File Expl
|
||||
### [@martinchrzan](https://github.com/martinchrzan/) - Martin Chrzan
|
||||
|
||||
Color Picker is from Martin.
|
||||
|
||||
<!--
|
||||
@alekhyareddy28
|
||||
@jyuwono
|
||||
@laviusmotileng-ms
|
||||
@ryanbodrug-microsoft
|
||||
@saahmedm
|
||||
@somil55
|
||||
@traies
|
||||
@udit3333
|
||||
-->
|
||||
|
||||
@@ -121,6 +121,12 @@ When you'd like the team to take a look, (even if the work is not yet fully-comp
|
||||
|
||||
Once your code has been reviewed and approved by the requisite number of team members, it will be merged into the master branch. Once merged, your PR will be automatically closed.
|
||||
|
||||
### How can I become a collaborateur on the PowerToys team
|
||||
|
||||
Be a great community member. Just help out a lot and make useful additions, filing bugs/suggestions, help develop fixes and features, code reviews, and always, docs. Lets continue to make the PowerToys repository a great spot to learn and make a great set of utilities.
|
||||
|
||||
When the time comes, Microsoft will reach out and help make you a formal team member. Just make sure they can reach out to you :)
|
||||
|
||||
---
|
||||
|
||||
## Thank you
|
||||
|
||||
@@ -11,9 +11,6 @@ public:
|
||||
virtual void enable() = 0;
|
||||
virtual void disable() = 0;
|
||||
virtual bool is_enabled() = 0;
|
||||
virtual intptr_t signal_event(const wchar_t* name, intptr_t data) = 0;
|
||||
virtual void register_system_menu_helper(PowertoySystemMenuIface* helper) = 0;
|
||||
virtual void signal_system_menu_action(const wchar_t* name) = 0;
|
||||
virtual void destroy() = 0;
|
||||
};
|
||||
|
||||
@@ -28,7 +25,6 @@ The PowerToys runner will, for each PowerToy DLL:
|
||||
|
||||
On the received object, the runner will call:
|
||||
- [`get_name()`](#get_name) to get the name of the PowerToy,
|
||||
- [`get_events()`](#get_events) to get the list of the events the PowerToy wants to subscribe to,
|
||||
- [`enable()`](#enable) to initialize the PowerToy.
|
||||
|
||||
While running, the runner might call the following methods between create_powertoy()
|
||||
@@ -37,9 +33,6 @@ and destroy():
|
||||
- [`get_config()`](#get_config) to get the available configuration settings,
|
||||
- [`set_config()`](#set_config) to set settings after they have been edited in the Settings editor,
|
||||
- [`call_custom_action()`](#call_custom_action) when the user selects a custom action in the Settings editor,
|
||||
- [`signal_event()`](#signal_event) to send an event the PowerToy registered to.
|
||||
- [`register_system_menu_helper()`](#register_system_menu_helper) to pass object, responsible for handling customized system menus, to module.
|
||||
- [`signal_system_menu_action()`](#signal_system_menu_action) to send an event when action is taken on system menu item.
|
||||
|
||||
When terminating, the runner will:
|
||||
- call [`disable()`](#disable),
|
||||
@@ -75,18 +68,6 @@ virtual const wchar_t* get_name()
|
||||
|
||||
Returns the name of the PowerToy, it will be cached by the runner.
|
||||
|
||||
## get_events
|
||||
|
||||
```cpp
|
||||
virtual const wchar_t** get_events()
|
||||
```
|
||||
|
||||
Returns a null-terminated table of the names of the events the PowerToy wants to subscribe to. Available events:
|
||||
* ll_keyboard
|
||||
* win_hook_event
|
||||
|
||||
A nullptr can be returned to signal that the PowerToy does not want to subscribe to any event.
|
||||
|
||||
## get_config
|
||||
|
||||
```
|
||||
@@ -140,38 +121,6 @@ Disables the PowerToy, should free as much memory as possible.
|
||||
|
||||
Returns the PowerToy state.
|
||||
|
||||
## signal_event
|
||||
|
||||
```cpp
|
||||
virtual intptr_t signal_event(const wchar_t* name, intptr_t data) = 0;
|
||||
```
|
||||
|
||||
Handle event. Only the events the PowerToy subscribed to will be signaled.
|
||||
The data argument and return value meaning are event-specific:
|
||||
* ll_keyboard: see [`lowlevel_keyboard_event_data.h`](./lowlevel_keyboard_event_data.h).
|
||||
* win_hook_event: see [`win_hook_event_data.h`](./win_hook_event_data.h)
|
||||
|
||||
Please note that some of the events are currently being signalled from a separate thread.
|
||||
|
||||
## register_system_menu_helper
|
||||
|
||||
```cpp
|
||||
virtual void register_system_menu_helper(PowertoySystemMenuIface* helper) = 0;
|
||||
```
|
||||
|
||||
Register helper class to handle all system menu items related actions. Creation, deletion
|
||||
and all other actions taken on system menu item will be handled by provided class.
|
||||
Module will be informed when action is taken on any item created on request of the module.
|
||||
|
||||
## signal_system_menu_action
|
||||
|
||||
```cpp
|
||||
virtual void signal_system_menu_action(const wchar_t* name) = 0;
|
||||
```
|
||||
|
||||
Runner invokes this API when action is taken on item created on request from the module.
|
||||
Item name is passed as an argument, so that module can distinguish between different menu items.
|
||||
|
||||
## destroy
|
||||
|
||||
```cpp
|
||||
@@ -179,62 +128,7 @@ Item name is passed as an argument, so that module can distinguish between diffe
|
||||
```
|
||||
Destroy the PowerToy and free all memory.
|
||||
|
||||
## Powertoys system menu helper interface
|
||||
|
||||
Interface for helper class responsible for handling all system menu related actions.
|
||||
```cpp
|
||||
class PowertoySystemMenuIface {
|
||||
public:
|
||||
struct ItemInfo {
|
||||
std::wstring name{};
|
||||
bool enable{ false };
|
||||
bool checkBox{ false };
|
||||
};
|
||||
virtual void SetConfiguration(PowertoyModuleIface* module, const std::vector<ItemInfo>& config) = 0;
|
||||
virtual void ProcessSelectedItem(PowertoyModuleIface* module, HWND window, const wchar_t* itemName) = 0;
|
||||
};
|
||||
```
|
||||
|
||||
## ItemInfo
|
||||
|
||||
```cpp
|
||||
struct ItemInfo {
|
||||
std::wstring name{};
|
||||
bool enable{ false };
|
||||
bool checkBox{ false };
|
||||
};
|
||||
```
|
||||
|
||||
Structure containing all relevant information for system menu item: name (and hotkey if available), item
|
||||
status at creation (enabled/disabled) and whether check box will appear next to item name when action is taken.
|
||||
|
||||
## SetConfiguration
|
||||
|
||||
```cpp
|
||||
virtual void SetConfiguration(PowertoyModuleIface* module, const std::vector<ItemInfo>& config) = 0;
|
||||
```
|
||||
|
||||
Module should use this interface to inform system menu helper class which custom system menu items to create.
|
||||
|
||||
## ProcessSelectedItem
|
||||
|
||||
```cpp
|
||||
virtual void ProcessSelectedItem(PowertoyModuleIface* module, HWND window, const wchar_t* itemName) = 0;
|
||||
```
|
||||
|
||||
Process action taken on specific system menu item.
|
||||
|
||||
# Code organization
|
||||
|
||||
### [`powertoy_module_interface.h`](/src/modules/interface/powertoy_module_interface.h)
|
||||
Contains the PowerToys interface definition.
|
||||
|
||||
### [`powertoy_system_menu.h`](/src/modules/interface/powertoy_system_module.h)
|
||||
Contains the PowerToys system menu helper interface definition.
|
||||
|
||||
### [`lowlevel_keyboard_event_data.h`](/src/modules/interface/lowlevel_keyboard_event_data.h)
|
||||
Contains the `LowlevelKeyboardEvent` structure that's passed to `signal_event` for `ll_keyboard` events.
|
||||
|
||||
### [`win_hook_event_data.h`](/src/modules/interface/win_hook_event_data.h)
|
||||
Contains the `WinHookEvent` structure that's passed to `signal_event` for `win_hook_event` events.
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ Contains the source code of the PowerToys installer.
|
||||
|
||||
### The [`src`](/src) folder
|
||||
|
||||
Contains the source code of the PowerToys runner and of all of the PowerToys modules. **This is where the most of the magic happens.**
|
||||
Contains the source code of the PowerToys runner and of all of the PowerToys modules. **This is where most of the magic happens.**
|
||||
|
||||
### The [`tools`](/tools) folder
|
||||
|
||||
@@ -52,12 +52,19 @@ Various tools used by PowerToys. Includes the Visual Studio 2019 project templat
|
||||
|
||||
1. Windows 10 April 2018 Update (version 1803) or newer
|
||||
2. Visual Studio Community/Professional/Enterprise 2019
|
||||
3. Run the command below in cmd/terminal to install all the workloads and components for VS.<br />
|
||||
**Note:** the script assumes VS is installed and Community edition. Please update path accordingly if Professional/Enterprise.
|
||||
3. Run the command below in cmd/terminal to install all the workloads and components for VS.
|
||||
|
||||
```shell
|
||||
cd "%ProgramFiles(x86)%\Microsoft Visual Studio\2019"
|
||||
SET targetFolder="\"
|
||||
IF EXIST Enterprise\NUL (SET targetFolder=Enterprise)
|
||||
IF EXIST Professional\NUL (SET targetFolder=Professional)
|
||||
IF EXIST Community\NUL (SET targetFolder=Community)
|
||||
|
||||
ECHO %targetFolder%
|
||||
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" ^
|
||||
modify --installpath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\community" ^
|
||||
modify --installpath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\%targetFolder%" ^
|
||||
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
|
||||
--add Microsoft.VisualStudio.Workload.ManagedDesktop ^
|
||||
--add Microsoft.VisualStudio.Workload.Universal ^
|
||||
@@ -73,7 +80,11 @@ modify --installpath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\community
|
||||
- The PowerToys binaries will be in your repo under `x64\Release`.
|
||||
- If you want to copy the `PowerToys.exe` binary to a different location, you'll also need to copy the `modules` and the `svgs` folders.
|
||||
|
||||
## Building the Installer (.MSI)
|
||||
## Building the Installers
|
||||
|
||||
Our installer is two parts, an EXE and an MSI. The EXE contains the MSI and handles more complex install logic.
|
||||
- The EXE installs all prerequisites and installs PowerToys via the MSI. Also has additional features, such as silent installation flags
|
||||
- The MSI installs PowerToys.
|
||||
|
||||
### Prerequisites Building the Installer (.MSI)
|
||||
|
||||
@@ -85,6 +96,15 @@ modify --installpath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\community
|
||||
- From the `installer` folder open `PowerToysSetup.sln` in Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`, from the `Build` menu choose `Build Solution`.
|
||||
- The resulting `PowerToysSetup.msi` installer will be available in the `installer\PowerToysSetup\x64\Release\` folder.
|
||||
|
||||
### Compiling Bootstraper Installer (.EXE)
|
||||
|
||||
- MSI Installer needs to be built in release mode
|
||||
- Build `PowerToysBootstrapper` solution (`installer\PowerToysBootstrapper\`)
|
||||
|
||||
#### Supported arguments for EXE installer:
|
||||
|
||||
Head over to the wiki to get the [full list of supported installer arguments][installerArgWiki].
|
||||
|
||||
## Debugging
|
||||
|
||||
The following configuration issue only applies if the user is a member of the Administrators group.
|
||||
@@ -98,8 +118,8 @@ To run and debug PowerToys from Visual Studio when the user is a member of the A
|
||||
|
||||
## How to create new PowerToys
|
||||
|
||||
See the instructions on [how to install the PowerToys Module project template](tools/project_template). <br />
|
||||
Specifications for the [PowerToys settings API](doc/specs/PowerToys-settings.md).
|
||||
See the instructions on [how to install the PowerToys Module project template](/tools/project_template). <br />
|
||||
Specifications for the [PowerToys settings API](/doc/devdocs/settings.md).
|
||||
|
||||
## Implementation details
|
||||
|
||||
@@ -127,7 +147,7 @@ The common lib, as the name suggests, contains code shared by multiple PowerToys
|
||||
|
||||
WebView project for editing the PowerToys settings.
|
||||
|
||||
The html portion of the project that is shown in the WebView is contained in [`settings-html`](/src/settings/settings-heml).
|
||||
The html portion of the project that is shown in the WebView is contained in [`settings-html`](/src/settings/settings-html).
|
||||
Instructions on how build a new version and update this project are in the [Web project for the Settings UI](./settings-web.md).
|
||||
|
||||
While developing, it's possible to connect the WebView to the development server running in localhost by setting the `_DEBUG_WITH_LOCALHOST` flag to `1` and following the instructions near it in `./main.cpp`.
|
||||
@@ -157,3 +177,5 @@ This module has a setting to serve as an example for each of the currently imple
|
||||
- CustomAction property
|
||||
|
||||

|
||||
|
||||
[installerArgWiki]: https://github.com/microsoft/PowerToys/wiki/Installer-arguments-for-exe
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
# Shared hooks
|
||||
|
||||
To minimize the performance impact on the machine only `runner` installs global hooks, passing the events to registered callbacks in each PowerToy module.
|
||||
|
||||
When a PowerToy module is loaded, the `runner` calls the [`get_events()`](/src/modules/interface/powertoy_module_interface.h#L40) method to get a NULL-terminated array of NULL-terminated strings with the names of the events that the PowerToy wants to subscribe to. A `const wchar_t*` string is provided for each of the event names.
|
||||
|
||||
Events are signalled by the `runner` calling the [`signal_event(name, data)`](/src/modules/interface/powertoy_module_interface.h#L53) method of the PowerToy module. The `name` parameter contains the NULL-terminated name of the event. The `data` parameter and the method return value are specific for each event.
|
||||
|
||||
Currently supported hooks:
|
||||
* `"ll_keyboard"` - [Low Level Keyboard Hook](#low-level-keyboard-hook)
|
||||
* `"win_hook_event"` - [Windows Event Hook](#windows-event-hook)
|
||||
|
||||
## Low Level Keyboard Hook
|
||||
|
||||
This event is signaled whenever the user presses or releases a key on the keyboard. To subscribe to this event, add `"ll_keyboard"` to the table returned by the `get_events()` method.
|
||||
|
||||
The PowerToys runner installs low-level keyboard hook using `SetWindowsHookEx(WH_KEYBOARD_LL, ...)`. See [this MSDN page](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644985(v%3Dvs.85)) for details.
|
||||
|
||||
When a keyboard event is signaled and `ncCode` equals `HC_ACTION`, the `wParam` and `lParam` event parameters are passed to all subscribed clients in the [`LowlevelKeyboardEvent`](/src/modules/interface/lowlevel_keyboard_event_data.h#L38-L41) struct.
|
||||
|
||||
The `intptr_t data` event argument is a pointer to the `LowlevelKeyboardEvent` struct.
|
||||
|
||||
A non-zero return value from any of the subscribed PowerToys will cause the runner hook proc to return 1, thus swallowing the keyboard event.
|
||||
|
||||
Example usage, that makes Windows ignore the L key:
|
||||
|
||||
```c++
|
||||
virtual const wchar_t** get_events() override {
|
||||
static const wchar_t* events[2] = { ll_keyboard,
|
||||
nullptr };
|
||||
return events;
|
||||
}
|
||||
|
||||
virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override {
|
||||
if (wcscmp(name, ll_keyboard) == 0) {
|
||||
auto& event = *(reinterpret_cast<LowlevelKeyboardEvent*>(data));
|
||||
// The L key has vkCode of 0x4C, see:
|
||||
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
||||
if (event.wParam == WM_KEYDOWN && event.lParam->vkCode == 0x4C) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Windows Event Hook
|
||||
|
||||
This event is signaled for [a range of events](https://docs.microsoft.com/pl-pl/windows/win32/winauto/event-constants). To subscribe to this event, add `"win_hook_event"` to the table returned by the `get_events()` method. See [this MSDN doc](https://docs.microsoft.com/pl-pl/windows/win32/api/winuser/nf-winuser-setwineventhook) for details.
|
||||
|
||||
The `intptr_t data` event argument is a pointer to the [`WinHookEvent`](/src/modules/interface/win_hook_event_data.h#L43-L50) struct.
|
||||
|
||||
The return value of the event handler is ignored.
|
||||
|
||||
Example usage, that detects a window being resized:
|
||||
|
||||
```c++
|
||||
virtual const wchar_t** get_events() override {
|
||||
static const wchar_t* events[2] = { win_hook_event,
|
||||
nullptr };
|
||||
return events;
|
||||
}
|
||||
|
||||
virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override {
|
||||
if (wcscmp(name, win_hook_event) == 0) {
|
||||
auto& event = *(reinterpret_cast<WinHookEvent*>(data));
|
||||
switch (event.event) {
|
||||
case EVENT_SYSTEM_MOVESIZESTART:
|
||||
size_start(event.hwnd);
|
||||
break;
|
||||
case EVENT_SYSTEM_MOVESIZEEND:
|
||||
size_end(event.hwnd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Taking too long to process the events has negative impact on the whole system performance. To address this, the events are signaled from a different thread, not from the event hook callback itself.
|
||||
@@ -7,6 +7,6 @@
|
||||
## Formatting
|
||||
|
||||
- We use [`.clang-format`](https://github.com/microsoft/PowerToys/blob/master/.clang-format) style file to enable automatic code formatting. You can [easily format source files from Visual Studio](https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/). For example, `CTRL+K CTRL+D` formats the current document.
|
||||
- If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke [`format_sources`](https://github.com/microsoft/PowerToys/blob/master/format_sources.ps1) powershell script from command line. It gets a list of all currently modified files from `git` and invokes clang-format on them.
|
||||
- If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke [`format_sources`](https://github.com/microsoft/PowerToys/blob/master/src/codeAnalysis/format_sources.ps1) powershell script from command line. It gets a list of all currently modified files from `git` and invokes clang-format on them.
|
||||
Please note that you should also have `clang-format.exe` in `%PATH%` for it to work. The script can infer the path of `clang-format.exe` version which is shipped with Visual Studio at `%VCINSTALLDIR%\Tools\Llvm\bin\`, if you launch it from the *Native Tools Command Prompt for VS*.
|
||||
- CI doesn't enforce code formatting yet, since we're gradually applying code formatting to the codebase, but please adhere to our formatting style for any new code.
|
||||
- CI doesn't enforce code formatting yet, since we're gradually applying code formatting to the codebase, but please adhere to our formatting style for any new code.
|
||||
|
||||
23
doc/devdocs/tools.md
Normal file
23
doc/devdocs/tools.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Tools
|
||||
|
||||
## [Monitor info report](tools\monitor_info_report)
|
||||
|
||||
A small diagnostic tool which helps identifying WinAPI bugs related to the physical monitor detection. When launched, it creates a log file like this:
|
||||
|
||||
```
|
||||
GetSystemMetrics = 2
|
||||
GetMonitorInfo OK
|
||||
EnumDisplayDevices OK:
|
||||
DeviceID = \\?\DISPLAY#VSCBD34#5&25664547&0&UID4355#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
|
||||
DeviceKey = \Registry\Machine\System\CurrentControlSet\Control\Class\{4d36e96e-e325-11ce-bfc1-08002be10318}\0002
|
||||
DeviceName = \\.\DISPLAY1\Monitor0
|
||||
DeviceString = Generic PnP Monitor
|
||||
GetMonitorInfo OK
|
||||
EnumDisplayDevices OK:
|
||||
DeviceID = \\?\DISPLAY#ENC2682#5&25664547&0&UID4357#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
|
||||
DeviceKey = \Registry\Machine\System\CurrentControlSet\Control\Class\{4d36e96e-e325-11ce-bfc1-08002be10318}\0003
|
||||
DeviceName = \\.\DISPLAY2\Monitor0
|
||||
DeviceString = Generic PnP Monitor
|
||||
EnumDisplayMonitors OK
|
||||
```
|
||||
and also duplicates the info to `stdout`.
|
||||
BIN
doc/images/overview/Original/VideoConference.png
Normal file
BIN
doc/images/overview/Original/VideoConference.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
BIN
doc/images/overview/VideoConference_large.png
Normal file
BIN
doc/images/overview/VideoConference_large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
BIN
doc/images/overview/VideoConference_small.png
Normal file
BIN
doc/images/overview/VideoConference_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
37
doc/unofficalInstallMethods.md
Normal file
37
doc/unofficalInstallMethods.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Unoffical community driven install methods
|
||||
|
||||
These are community driven alternative install methods to Windows Package Manager (WinGet) and GitHub. The PowerToys teams does not update or manage these install methods.
|
||||
|
||||
These will be listed in alphabetical order.
|
||||
|
||||
## Chocolatey
|
||||
|
||||
Download and upgrade PowerToys from [Chocolatey](https://chocolatey.org). If you have any issues when installing/upgrading the package please go to the [package page](https://chocolatey.org/packages/powertoys) and follow the [Chocolatey triage process](https://chocolatey.org/docs/package-triage-process)
|
||||
|
||||
To install PowerToys, run the following command from the command line / PowerShell:
|
||||
|
||||
```powershell
|
||||
choco install powertoys
|
||||
```
|
||||
|
||||
To upgrade PowerToys, run the following command from the command line / PowerShell:
|
||||
|
||||
```powershell
|
||||
choco upgrade powertoys
|
||||
```
|
||||
|
||||
## Scoop
|
||||
|
||||
Download and update PowerToys from [Scoop](https://scoop.sh).
|
||||
|
||||
To install PowerToys, run the following command from the command line / PowerShell:
|
||||
|
||||
```powershell
|
||||
scoop install powertoys
|
||||
```
|
||||
|
||||
To update PowerToys, run the following command from the command line / PowerShell:
|
||||
|
||||
```powershell
|
||||
scoop update powertoys
|
||||
```
|
||||
37
installer/PowerToysBootstrapper/PowerToysBootstrapper.sln
Normal file
37
installer/PowerToysBootstrapper/PowerToysBootstrapper.sln
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30320.27
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "updating", "..\..\src\common\updating\updating.vcxproj", "{17DA04DF-E393-4397-9CF0-84DABE11032E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\src\common\common.vcxproj", "{74485049-C722-400F-ABE5-86AC52D929B3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bootstrapper", "bootstrapper\bootstrapper.vcxproj", "{D194E3AA-F824-4CA9-9A58-034DD6B7D022}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.Build.0 = Debug|x64
|
||||
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.ActiveCfg = Release|x64
|
||||
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.Build.0 = Release|x64
|
||||
{74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.Build.0 = Debug|x64
|
||||
{74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.ActiveCfg = Release|x64
|
||||
{74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.Build.0 = Release|x64
|
||||
{D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Debug|x64.Build.0 = Debug|x64
|
||||
{D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Release|x64.ActiveCfg = Release|x64
|
||||
{D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B288A538-1B79-4782-A737-14CD9CF07F58}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
14
installer/PowerToysBootstrapper/bootstrapper/LocProject.json
Normal file
14
installer/PowerToysBootstrapper/bootstrapper/LocProject.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Projects": [
|
||||
{
|
||||
"LanguageSet": "Azure_Languages",
|
||||
"LocItems": [
|
||||
{
|
||||
"SourceFile": "installer\\PowerToysBootstrapper\\bootstrapper\\Resources.resx",
|
||||
"CopyOption": "LangIDOnName",
|
||||
"OutputPath": "installer\\PowerToysBootstrapper\\bootstrapper"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
67
installer/PowerToysBootstrapper/bootstrapper/Resources.resx
Normal file
67
installer/PowerToysBootstrapper/bootstrapper/Resources.resx
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="DOTNET_CORE_DOWNLOAD_FAILURE" xml:space="preserve">
|
||||
<value>Couldn't download .NET Core Desktop Runtime 3.1, please install it manually.</value>
|
||||
</data>
|
||||
<data name="DOTNET_CORE_DOWNLOAD_FAILURE_TITLE" xml:space="preserve">
|
||||
<value>PowerToys installation error</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,12 +1,9 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../../../common/version.h"
|
||||
#include "../../../src/common/version.h"
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_LAUNCHER_NAME L"Color Picker"
|
||||
IDS_LAUNCHER_SETTINGS_DESC L"This feature requires Windows 10 version 1903 or higher"
|
||||
END
|
||||
MAINICON ICON "../../../src/runner/svgs/icon.ico"
|
||||
IDR_BIN_ICON BIN "../../../src/runner/svgs/icon.ico"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
@@ -40,3 +37,5 @@ BEGIN
|
||||
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
|
||||
END
|
||||
END
|
||||
|
||||
#include "Generated Files\installer_resource.rc"
|
||||
@@ -1,10 +1,5 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
#include <fstream>
|
||||
#include "pch.h"
|
||||
#include "Generated Files/resource.h"
|
||||
|
||||
#include <common/common.h>
|
||||
#include <common/notifications.h>
|
||||
@@ -15,11 +10,6 @@
|
||||
#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>
|
||||
|
||||
@@ -69,11 +59,100 @@ std::optional<fs::path> extractIcon()
|
||||
return iconRes->saveAsFile(icoPath) ? std::make_optional(std::move(icoPath)) : std::nullopt;
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
enum class CmdArgs
|
||||
{
|
||||
silent,
|
||||
noFullUI,
|
||||
noStartPT,
|
||||
skipDotnetInstall,
|
||||
showHelp
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::unordered_map<std::wstring_view, CmdArgs> knownArgs = {
|
||||
{ L"--help", CmdArgs::showHelp },
|
||||
{ L"--no_full_ui", CmdArgs::noFullUI },
|
||||
{ L"--silent", CmdArgs::silent },
|
||||
{ L"--no_start_pt", CmdArgs::noStartPT },
|
||||
{ L"--skip_dotnet_install", CmdArgs::skipDotnetInstall }
|
||||
};
|
||||
}
|
||||
|
||||
std::unordered_set<CmdArgs> parseCmdArgs(const int nCmdArgs, LPWSTR* argList)
|
||||
{
|
||||
std::unordered_set<CmdArgs> result;
|
||||
for (size_t i = 1; i < nCmdArgs; ++i)
|
||||
{
|
||||
if (auto it = knownArgs.find(argList[i]); it != end(knownArgs))
|
||||
{
|
||||
result.emplace(it->second);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int bootstrapper()
|
||||
{
|
||||
using namespace localized_strings;
|
||||
winrt::init_apartment();
|
||||
|
||||
int nCmdArgs = 0;
|
||||
LPWSTR* argList = CommandLineToArgvW(GetCommandLineW(), &nCmdArgs);
|
||||
const auto cmdArgs = parseCmdArgs(nCmdArgs, argList);
|
||||
std::wostringstream oss;
|
||||
if (cmdArgs.contains(CmdArgs::showHelp))
|
||||
{
|
||||
oss << "Supported arguments:\n\n";
|
||||
for (auto [arg, _] : knownArgs)
|
||||
{
|
||||
oss << arg << '\n';
|
||||
}
|
||||
MessageBoxW(nullptr, oss.str().c_str(), L"Help", MB_OK | MB_ICONINFORMATION);
|
||||
return 0;
|
||||
}
|
||||
if (!cmdArgs.contains(CmdArgs::noFullUI))
|
||||
{
|
||||
MsiSetInternalUI(INSTALLUILEVEL_FULL, nullptr);
|
||||
}
|
||||
if (cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
if (is_process_elevated())
|
||||
{
|
||||
MsiSetInternalUI(INSTALLUILEVEL_NONE, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// MSI fails to run in silent mode due to a suppressed UAC w/o elevation, so we restart elevated
|
||||
std::wstring params;
|
||||
for (int i = 1; i < nCmdArgs; ++i)
|
||||
{
|
||||
params += argList[i];
|
||||
if (i != nCmdArgs - 1)
|
||||
{
|
||||
params += L' ';
|
||||
}
|
||||
}
|
||||
const auto processHandle = run_elevated(argList[0], params.c_str());
|
||||
if (!processHandle)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (WaitForSingleObject(processHandle, 3600000) == WAIT_OBJECT_0)
|
||||
{
|
||||
DWORD exitCode = 0;
|
||||
GetExitCodeProcess(processHandle, &exitCode);
|
||||
return exitCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Couldn't install using the completely silent mode in an hour, use basic UI.
|
||||
TerminateProcess(processHandle, 0);
|
||||
MsiSetInternalUI(INSTALLUILEVEL_BASIC, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try killing PowerToys and prevent future processes launch
|
||||
for (auto& handle : getProcessHandlesByName(L"PowerToys.exe", PROCESS_TERMINATE))
|
||||
{
|
||||
@@ -81,16 +160,12 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
}
|
||||
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);
|
||||
notifications::override_application_id(APPLICATION_ID);
|
||||
|
||||
fs::path iconPath{ L"C:\\" };
|
||||
if (auto extractedIcon = extractIcon())
|
||||
@@ -111,7 +186,6 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
auto msi_path = updating::get_msi_package_path();
|
||||
if (!msi_path.empty())
|
||||
{
|
||||
MsiSetInternalUI(INSTALLUILEVEL_FULL, nullptr);
|
||||
MsiInstallProductW(msi_path.c_str(), nullptr);
|
||||
return 0;
|
||||
}
|
||||
@@ -122,27 +196,37 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
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));
|
||||
if (!cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
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)
|
||||
if (!cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
// Worker thread to periodically increase progress and keep the progress toast from losing focus
|
||||
std::thread{ [&] {
|
||||
for (;; Sleep(3000))
|
||||
{
|
||||
break;
|
||||
std::scoped_lock lock{ progressLock };
|
||||
if (progressParams.progress == 1.f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
progressParams.progress = std::min(0.99f, progressParams.progress + 0.001f);
|
||||
notifications::update_progress_bar_toast(TOAST_TAG, progressParams);
|
||||
}
|
||||
progressParams.progress = min(0.99f, progressParams.progress + 0.001f);
|
||||
notifications::update_progress_bar_toast(TOAST_TAG, progressParams);
|
||||
}
|
||||
} }.detach();
|
||||
} }.detach();
|
||||
}
|
||||
|
||||
auto updateProgressBar = [&](const float value, const wchar_t* title) {
|
||||
if (cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::scoped_lock lock{ progressLock };
|
||||
progressParams.progress = value;
|
||||
progressParams.progress_title = title;
|
||||
@@ -152,7 +236,10 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
const auto installerPath = extractEmbeddedInstaller();
|
||||
if (!installerPath)
|
||||
{
|
||||
notifications::show_toast(INSTALLER_EXTRACT_ERROR, TOAST_TITLE);
|
||||
if (!cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
notifications::show_toast(INSTALLER_EXTRACT_ERROR, TOAST_TITLE);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
auto removeExtractedInstaller = wil::scope_exit([&] {
|
||||
@@ -162,46 +249,80 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
|
||||
updateProgressBar(.25f, UNINSTALLING_PREVIOUS_VERSION);
|
||||
const auto package_path = updating::get_msi_package_path();
|
||||
if (!package_path.empty() && !updating::uninstall_msi_version(package_path))
|
||||
if (!package_path.empty() && !updating::uninstall_msi_version(package_path) && !cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
notifications::show_toast(UNINSTALL_PREVIOUS_VERSION_ERROR, TOAST_TITLE);
|
||||
}
|
||||
|
||||
updateProgressBar(.5f, INSTALLING_DOTNET);
|
||||
if (!updating::dotnet_is_installed() && !updating::install_dotnet())
|
||||
const bool installDotnet = !cmdArgs.contains(CmdArgs::skipDotnetInstall);
|
||||
if (installDotnet)
|
||||
{
|
||||
notifications::show_toast(DOTNET_INSTALL_ERROR, TOAST_TITLE);
|
||||
updateProgressBar(.5f, INSTALLING_DOTNET);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (installDotnet &&
|
||||
!updating::dotnet_is_installed() &&
|
||||
!updating::install_dotnet(cmdArgs.contains(CmdArgs::silent)) &&
|
||||
!cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
notifications::show_toast(DOTNET_INSTALL_ERROR, TOAST_TITLE);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
MessageBoxW(nullptr, L".NET Core installation", L"Unknown exception encountered!", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
updateProgressBar(.75f, INSTALLING_NEW_VERSION);
|
||||
if (!silent)
|
||||
{
|
||||
MsiSetInternalUI(INSTALLUILEVEL_FULL, nullptr);
|
||||
}
|
||||
const bool installationDone = MsiInstallProductW(installerPath->c_str(), nullptr) == ERROR_SUCCESS;
|
||||
|
||||
// Always skip dotnet install, because we should've installed it from here earlier
|
||||
std::wstring msiProps = L"SKIPDOTNETINSTALL=1 ";
|
||||
const bool installationDone = MsiInstallProductW(installerPath->c_str(), msiProps.c_str()) == 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)
|
||||
|
||||
if (!cmdArgs.contains(CmdArgs::noStartPT) && !cmdArgs.contains(CmdArgs::silent))
|
||||
{
|
||||
auto newPTPath = updating::get_msi_package_installed_path();
|
||||
if (!newPTPath)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
*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;
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
try
|
||||
{
|
||||
return bootstrapper();
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
MessageBoxA(nullptr, ex.what(), "Unhandled stdexception encountered!", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
catch (winrt::hresult_error const& ex)
|
||||
{
|
||||
winrt::hstring message = ex.message();
|
||||
MessageBoxW(nullptr, message.c_str(), L"Unhandled winrt exception encountered!", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
auto lastErrorMessage = get_last_error_message(GetLastError());
|
||||
std::wstring message = lastErrorMessage ? std::move(*lastErrorMessage) : L"";
|
||||
MessageBoxW(nullptr, message.c_str(), L"Unknown exception encountered!", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
<?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" />
|
||||
<Import Project="..\..\..\src\Version.props" />
|
||||
<Target Name="Generate Resource file" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<RCLines Include="IDR_BIN_MSIINSTALLER BIN "..\\..\\installer\\PowerToysSetup\\$(PlatformShortName)\\$(Configuration)\\PowerToysSetup-$(Version)-$(PlatformShortName).msi"" />
|
||||
<RCLines Include="IDR_BIN_MSIINSTALLER BIN "..\\PowerToysSetup\\$(PlatformShortName)\\$(Configuration)\\PowerToysSetup-$(Version)-$(PlatformShortName).msi"" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="Generated Files\installer_resource.rc" Lines="@(RCLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
@@ -18,6 +17,9 @@
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)..\..\tools\build\convert-resx-to-rc.ps1 . resource.base.h resource.h bootstrapper.base.rc bootstrapper.rc 105" />
|
||||
</Target>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{D194E3AA-F824-4CA9-9A58-034DD6B7D022}</ProjectGuid>
|
||||
@@ -76,6 +78,9 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>../../../src/</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -94,6 +99,9 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>../../../src/</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -103,39 +111,41 @@
|
||||
</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>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\runner\updating.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="bootstrapper.rc" />
|
||||
<None Include="bootstrapper.base.rc" />
|
||||
<ResourceCompile Include="Generated Files/bootstrapper.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\runner\svgs\icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\common\common.vcxproj">
|
||||
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\common\updating\updating.vcxproj">
|
||||
<Project>{17da04df-e393-4397-9cf0-84dabe11032e}</Project>
|
||||
</ProjectReference>
|
||||
</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')" />
|
||||
<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')" />
|
||||
</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'))" />
|
||||
<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'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,5 +1,4 @@
|
||||
<?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>
|
||||
1
installer/PowerToysBootstrapper/bootstrapper/pch.cpp
Normal file
1
installer/PowerToysBootstrapper/bootstrapper/pch.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "pch.h"
|
||||
16
installer/PowerToysBootstrapper/bootstrapper/pch.h
Normal file
16
installer/PowerToysBootstrapper/bootstrapper/pch.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
#include <fstream>
|
||||
#include <wil/resource.h>
|
||||
#include <Msi.h>
|
||||
|
||||
#include <unordered_set>
|
||||
#include <tuple>
|
||||
#include <sstream>
|
||||
@@ -12,8 +12,5 @@
|
||||
// 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
|
||||
@@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureNuGetPackageBuildImports" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\WiX.3.11.2\build\wix.props" Condition="Exists('..\packages\WiX.3.11.2\build\wix.props')" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\src\Version.props" />
|
||||
<PropertyGroup>
|
||||
<DefineConstants>Version=$(Version);</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
<Property Id="INSTALLSTARTMENUSHORTCUT" Value="1"/>
|
||||
<Property Id="CREATESCHEDULEDTASK" Value="1"/>
|
||||
<Property Id="WixShellExecTarget" Value="[#action_runner.exe]" />
|
||||
|
||||
<Property Id="SKIPDOTNETINSTALL" Value="0"/>
|
||||
|
||||
<Property Id ="EXISTINGPOWERRENAMEEXTPATH">
|
||||
<RegistrySearch Id="ExistingExtPath" Root="HKCR" Key="CLSID\{0440049F-D1DC-4E46-B27B-98393D79486B}\InprocServer32" Type="raw"/>
|
||||
</Property>
|
||||
@@ -96,7 +97,7 @@
|
||||
</Custom>
|
||||
|
||||
<Custom Action="InstallDotNet" After="InstallFinalize">
|
||||
NOT Installed
|
||||
NOT Installed and (SKIPDOTNETINSTALL = 0)
|
||||
</Custom>
|
||||
|
||||
<Custom Action="TerminateProcesses" Before="InstallValidate" />
|
||||
@@ -275,6 +276,11 @@
|
||||
<Directory Id="IndexerLanguagesFolder" Name="Languages" />
|
||||
<Directory Id="IndexerpinyindbFolder" Name="pinyindb" />
|
||||
</Directory>
|
||||
<Directory Id="UriPluginFolder" Name="Microsoft.Plugin.Uri">
|
||||
<Directory Id="UriImagesFolder" Name="Images" />
|
||||
<Directory Id="UriLanguagesFolder" Name="Languages" />
|
||||
<Directory Id="UripinyindbFolder" Name="pinyindb" />
|
||||
</Directory>
|
||||
<Directory Id="WindowWalkerPluginFolder" Name="Microsoft.Plugin.WindowWalker">
|
||||
<Directory Id="WindowWalkerImagesFolder" Name="Images" />
|
||||
<Directory Id="WindowWalkerLanguagesFolder" Name="Languages" />
|
||||
@@ -415,52 +421,52 @@
|
||||
<!-- Added a separate component for Per-User registry changes -->
|
||||
<!-- Registry Key for Class Registration of Svg Preview Handler -->
|
||||
<RegistryKey Root="HKCR" Key="CLSID\{ddee2b8a-6807-48a6-bb20-2338174ff779}">
|
||||
<RegistryValue Type="string" Value="SvgPreviewHandler.SvgPreviewHandler" />
|
||||
<RegistryValue Type="string" Value="Microsoft.PowerToys.PreviewHandler.Svg.SvgPreviewHandler" />
|
||||
<RegistryValue Type="string" Name="DisplayName" Value="Svg Preview Handler" />
|
||||
<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="SvgPreviewHandler, Version=$(var.Version).0, Culture=neutral" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="SvgPreviewHandler.SvgPreviewHandler" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="Microsoft.PowerToys.PreviewHandler.Svg.SvgPreviewHandler" />
|
||||
<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]SvgPreviewHandler.dll" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Assembly" Value="SvgPreviewHandler, Version=$(var.Version).0, Culture=neutral" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="SvgPreviewHandler.SvgPreviewHandler" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="Microsoft.PowerToys.PreviewHandler.Svg.SvgPreviewHandler" />
|
||||
<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" Value="Microsoft.PowerToys.ThumbnailHandler.Svg.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="Class" Value="Microsoft.PowerToys.ThumbnailHandler.Svg.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="Class" Value="Microsoft.PowerToys.ThumbnailHandler.Svg.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" />
|
||||
<RegistryValue Type="string" Value="Microsoft.PowerToys.PreviewHandler.Markdown.MarkdownPreviewHandler" />
|
||||
<RegistryValue Type="string" Name="DisplayName" Value="Markdown Preview Handler" />
|
||||
<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="MarkdownPreviewHandler, Version=$(var.Version).0, Culture=neutral" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="MarkdownPreviewHandler.MarkdownPreviewHandler" />
|
||||
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="Microsoft.PowerToys.PreviewHandler.Markdown.MarkdownPreviewHandler" />
|
||||
<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]MarkdownPreviewHandler.dll" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Assembly" Value="MarkdownPreviewHandler, Version=$(var.Version).0, Culture=neutral" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="MarkdownPreviewHandler.MarkdownPreviewHandler" />
|
||||
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="Microsoft.PowerToys.PreviewHandler.Markdown.MarkdownPreviewHandler" />
|
||||
<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]MarkdownPreviewHandler.dll" />
|
||||
</RegistryKey>
|
||||
@@ -660,7 +666,7 @@
|
||||
<File Source="$(var.BinX64Dir)SettingsUIRunner\Microsoft.PowerToys.Settings.UI.Runner.exe"/>
|
||||
<File Source="$(var.BinX64Dir)SettingsUIRunner\Microsoft.PowerToys.Settings.UI.exe"/>
|
||||
<!-- dll -->
|
||||
<?foreach File in concrt140_app.dll;Microsoft.Bcl.AsyncInterfaces.dll;Microsoft.PowerToys.Settings.UI.Lib.dll;Microsoft.PowerToys.Settings.UI.Runner.dll;Microsoft.Toolkit.dll;Microsoft.Toolkit.Uwp.dll;Microsoft.Toolkit.Uwp.UI.dll;Microsoft.Toolkit.Win32.UI.XamlHost.dll;Microsoft.Toolkit.Win32.UI.XamlHost.Managed.dll;Microsoft.Toolkit.Wpf.UI.Controls.dll;Microsoft.Toolkit.Wpf.UI.XamlHost.dll;Microsoft.UI.Xaml.dll;Microsoft.Xaml.Interactions.dll;Microsoft.Xaml.Interactivity.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;PowerToysInterop.dll;System.Runtime.CompilerServices.Unsafe.dll;System.Runtime.dll;System.Text.Encodings.Web.dll;System.Text.Json.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;Telemetry.dll;ManagedCommon.dll?>
|
||||
<?foreach File in concrt140_app.dll;Microsoft.Bcl.AsyncInterfaces.dll;Microsoft.PowerToys.Settings.UI.Lib.dll;Microsoft.PowerToys.Settings.UI.Runner.dll;Microsoft.Toolkit.dll;Microsoft.Toolkit.Uwp.dll;Microsoft.Toolkit.Uwp.UI.dll;Microsoft.Toolkit.Win32.UI.XamlHost.dll;Microsoft.Toolkit.Win32.UI.XamlHost.Managed.dll;Microsoft.Toolkit.Wpf.UI.Controls.dll;Microsoft.Toolkit.Wpf.UI.XamlHost.dll;Microsoft.UI.Xaml.dll;Microsoft.Xaml.Interactions.dll;Microsoft.Xaml.Interactivity.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;PowerToysInterop.dll;System.Runtime.CompilerServices.Unsafe.dll;System.Text.Encodings.Web.dll;System.Text.Json.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;Telemetry.dll;ManagedCommon.dll?>
|
||||
<File Id="SettingsV2_$(var.File)" Source="$(var.BinX64Dir)SettingsUIRunner\$(var.File)" />
|
||||
<?endforeach?>
|
||||
<!-- json -->
|
||||
@@ -838,7 +844,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.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;Wox.Core.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.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" />
|
||||
@@ -868,20 +874,6 @@
|
||||
<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" />
|
||||
</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?>
|
||||
<!--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="File_calc_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Languages\$(var.LanguageFile)" />
|
||||
<?undef IdSafeLanguage?>
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="calculatorpinyindbComponent" Directory="CalculatorpinyindbFolder" Guid="D5527670-BE9A-4AA9-9D36-1249F2184B5B">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
@@ -896,24 +888,10 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="FolderImagesComponent" Directory="FolderPluginImagesFolder" Guid="6C5226EB-E312-4768-B4D1-B1D3ACFCCBDF">
|
||||
<?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?>
|
||||
<?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;Warning.dark.png;Warning.light.png?>
|
||||
<File Id="FolderPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\Images\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="FolderPluginLanguagesComponent" Directory="FolderPluginLanguagesFolder" Guid="6316D847-5FD2-488B-A60E-5517BF95A25C">
|
||||
<?foreach LanguageFile in de.xaml;en.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="File_Folder_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\Languages\$(var.LanguageFile)" />
|
||||
<?undef IdSafeLanguage?>
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="FolderPluginpinyindbComponent" Directory="FolderPluginpinyindbFolder" Guid="233BE087-B9DC-408A-8809-593C42DE8B1B">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
<File Id="FolderPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\pinyindb\$(var.File)" />
|
||||
@@ -930,20 +908,6 @@
|
||||
<?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>
|
||||
<Component Id="ProgramLanguagesComponent" Directory="ProgramLanguagesFolder" Guid="EBFF53B6-3602-4F55-8784-FC7DB29D3D62">
|
||||
<?foreach LanguageFile in de.xaml;en.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="File_Program_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Program\Languages\$(var.LanguageFile)" />
|
||||
<?undef IdSafeLanguage?>
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="ProgrampinyindbComponent" Directory="ProgrampinyindbFolder" Guid="65A488C3-C67D-45F7-9654-6DF529AEEB3F">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
@@ -961,20 +925,6 @@
|
||||
<?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?>
|
||||
<!--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="File_Shell_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Shell\Languages\$(var.LanguageFile)" />
|
||||
<?undef IdSafeLanguage?>
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="ShellpinyindbComponent" Directory="ShellpinyindbFolder" Guid="A60742F3-2187-47F2-A5B5-300E44837DD7">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
@@ -993,26 +943,28 @@
|
||||
<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?>
|
||||
<File Id="IndexerPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\pinyindb\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
|
||||
<!-- Uri Plugin -->
|
||||
<Component Id="UriComponent" Directory="UriPluginFolder" Guid="C7DC8F88-554C-4375-9510-9435399B5D3D">
|
||||
<?foreach File in plugin.json;Wox.Infrastructure.dll;Wox.Plugin.dll;Microsoft.Plugin.Uri.deps.json;Microsoft.Plugin.Uri.dll;Telemetry.dll?>
|
||||
<File Id="Uri_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
<Component Id="UriImagesComponent" Directory="UriImagesFolder" Guid="8C9C1634-28C8-45C4-A8EA-8D4C9B4810D0">
|
||||
<File Id="UriDarkIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\Images\Uri.dark.png" />
|
||||
<File Id="UriLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\Images\Uri.light.png" />
|
||||
</Component>
|
||||
<Component Id="UripinyindbComponent" Directory="UripinyindbFolder" Guid="A52A7281-CD7C-4E7D-A5A6-EA8CFCF462A2">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
<File Id="UriPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\pinyindb\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
|
||||
<!-- WindowWalker Plugin -->
|
||||
<Component Id="WindowWalkerComponent" Directory="WindowWalkerPluginFolder" Guid="EB1391C9-B701-421F-80FC-ABB2FEDFAD19">
|
||||
<?foreach File in plugin.json;Wox.Infrastructure.dll;Wox.Plugin.dll;Microsoft.Plugin.WindowWalker.deps.json;Microsoft.Plugin.WindowWalker.dll;Telemetry.dll?>
|
||||
@@ -1023,9 +975,6 @@
|
||||
<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" />
|
||||
</Component>
|
||||
<Component Id="WindowWalkerpinyindbComponent" Directory="WindowWalkerpinyindbFolder" Guid="02C7A758-CDD4-4E27-9EC7-2ED68DC444B0">
|
||||
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
|
||||
<File Id="WindowWalkerPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\pinyindb\$(var.File)" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Version>0.20.0</Version>
|
||||
<DefineConstants>Version=$(Version);</DefineConstants>
|
||||
<Version>0.23.0</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
14
src/action_runner/LocProject.json
Normal file
14
src/action_runner/LocProject.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Projects": [
|
||||
{
|
||||
"LanguageSet": "Azure_Languages",
|
||||
"LocItems": [
|
||||
{
|
||||
"SourceFile": "src\\runner\\Resources.resx",
|
||||
"CopyOption": "LangIDOnName",
|
||||
"OutputPath": "src\\runner"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
67
src/action_runner/Resources.resx
Normal file
67
src/action_runner/Resources.resx
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="DOTNET_CORE_DOWNLOAD_FAILURE" xml:space="preserve">
|
||||
<value>Couldn't download .NET Core Desktop Runtime 3.1, please install it manually.</value>
|
||||
</data>
|
||||
<data name="DOTNET_CORE_DOWNLOAD_FAILURE_TITLE" xml:space="preserve">
|
||||
<value>PowerToys installation error</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2,12 +2,6 @@
|
||||
#include "resource.h"
|
||||
#include "../common/version.h"
|
||||
|
||||
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
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "../runner/tray_icon.h"
|
||||
#include "../runner/action_runner_utils.h"
|
||||
|
||||
#include "resource.h"
|
||||
#include "Generated Files/resource.h"
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
@@ -98,7 +98,7 @@ bool install_new_version_stage_1(const std::wstring_view installer_filename, con
|
||||
}
|
||||
}
|
||||
|
||||
bool install_new_version_stage_2(std::wstring installer_path, std::wstring_view install_path, const bool launch_powertoys)
|
||||
bool install_new_version_stage_2(std::wstring installer_path, std::wstring_view install_path, bool launch_powertoys)
|
||||
{
|
||||
std::transform(begin(installer_path), end(installer_path), begin(installer_path), ::towlower);
|
||||
|
||||
@@ -112,10 +112,20 @@ 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 | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE};
|
||||
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";
|
||||
std::wstring parameters = L"--no_full_ui";
|
||||
if (launch_powertoys)
|
||||
{
|
||||
// .exe installer launches the main app by default
|
||||
launch_powertoys = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters += L"--no_start_pt";
|
||||
}
|
||||
sei.lpParameters = parameters.c_str();
|
||||
|
||||
success = ShellExecuteExW(&sei) == TRUE;
|
||||
// Wait for the install completion
|
||||
@@ -180,7 +190,8 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
}
|
||||
else
|
||||
{
|
||||
params = args[nextArg];
|
||||
params += args[nextArg];
|
||||
params += L' ';
|
||||
nextArg++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.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="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -19,6 +19,10 @@
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 . resource.base.h resource.h action_runner.base.rc action_runner.rc" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}</ProjectGuid>
|
||||
@@ -167,20 +171,21 @@
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="action_runner.rc" />
|
||||
<None Include="action_runner.base.rc" />
|
||||
<ResourceCompile Include="Generated Files/action_runner.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<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')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.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'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.200703.9" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -9,8 +9,3 @@
|
||||
#define INTERNAL_NAME "action_runner"
|
||||
#define ORIGINAL_FILENAME "action_runner.exe"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
|
||||
#define IDS_DOTNET_CORE_DOWNLOAD_FAILURE 101
|
||||
#define IDS_DOTNET_CORE_DOWNLOAD_FAILURE_TITLE 102
|
||||
9
src/common/LowlevelKeyboardEvent.h
Normal file
9
src/common/LowlevelKeyboardEvent.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
struct LowlevelKeyboardEvent
|
||||
{
|
||||
KBDLLHOOKSTRUCT* lParam;
|
||||
WPARAM wParam;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\..\installer\Version.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
@@ -26,7 +26,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@@ -35,5 +35,21 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ManagedTelemetry\Telemetry\Telemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="..\..\codeAnalysis\StyleCop.json">
|
||||
<Link>StyleCop.json</Link>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<Version>1.1.118</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\codeAnalysis\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ManagedCommon
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
internal static extern IntPtr OpenProcess(uint processAccess, bool bInheritHandle, int processId);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
internal static extern uint WaitForSingleObject(IntPtr hHandle, uint dwMilliseconds);
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ManagedCommon
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
internal static extern IntPtr OpenProcess(uint processAccess, bool bInheritHandle, int processId);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
internal static extern uint WaitForSingleObject(IntPtr hHandle, uint dwMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ManagedCommon
|
||||
{
|
||||
public static class RunnerHelper
|
||||
{
|
||||
public static void WaitForPowerToysRunner(int powerToysPID, Action act)
|
||||
{
|
||||
var stackTrace = new StackTrace();
|
||||
var assembly = Assembly.GetCallingAssembly().GetName();
|
||||
var callingMethod = stackTrace.GetFrame(1).GetMethod().Name;
|
||||
PowerToysTelemetry.Log.WriteEvent(new DebugEvent() { Message = $"[{assembly}][{callingMethod}]WaitForPowerToysRunner waiting for Event powerToysPID={powerToysPID}" });
|
||||
Task.Run(() =>
|
||||
{
|
||||
const uint INFINITE = 0xFFFFFFFF;
|
||||
const uint WAIT_OBJECT_0 = 0x00000000;
|
||||
const uint SYNCHRONIZE = 0x00100000;
|
||||
|
||||
IntPtr powerToysProcHandle = NativeMethods.OpenProcess(SYNCHRONIZE, false, powerToysPID);
|
||||
if (NativeMethods.WaitForSingleObject(powerToysProcHandle, INFINITE) == WAIT_OBJECT_0)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new DebugEvent() { Message = $"[{assembly}][{callingMethod}]WaitForPowerToysRunner Event Notified powerToysPID={powerToysPID}" });
|
||||
act.Invoke();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace ManagedCommon
|
||||
{
|
||||
public static class RunnerHelper
|
||||
{
|
||||
public static void WaitForPowerToysRunner(int powerToysPID, Action act)
|
||||
{
|
||||
var stackTrace = new StackTrace();
|
||||
var assembly = Assembly.GetCallingAssembly().GetName();
|
||||
var callingMethod = stackTrace.GetFrame(1).GetMethod().Name;
|
||||
PowerToysTelemetry.Log.WriteEvent(new DebugEvent() { Message = $"[{assembly}][{callingMethod}]WaitForPowerToysRunner waiting for Event powerToysPID={powerToysPID}" });
|
||||
Task.Run(() =>
|
||||
{
|
||||
const uint INFINITE = 0xFFFFFFFF;
|
||||
const uint WAIT_OBJECT_0 = 0x00000000;
|
||||
const uint SYNCHRONIZE = 0x00100000;
|
||||
|
||||
IntPtr powerToysProcHandle = NativeMethods.OpenProcess(SYNCHRONIZE, false, powerToysPID);
|
||||
if (NativeMethods.WaitForSingleObject(powerToysProcHandle, INFINITE) == WAIT_OBJECT_0)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new DebugEvent() { Message = $"[{assembly}][{callingMethod}]WaitForPowerToysRunner Event Notified powerToysPID={powerToysPID}" });
|
||||
act.Invoke();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class DebugEvent : EventBase, IEvent
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class DebugEvent : EventBase, IEvent
|
||||
{
|
||||
public string Message { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class to implement properties that are common to all telemetry events.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class to implement properties that are common to all telemetry events.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
PartA_PrivTags PartA_PrivTags { get; }
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
PartA_PrivTags PartA_PrivTags { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Telemetry helper class for PowerToys.
|
||||
/// </summary>
|
||||
public class PowerToysTelemetry : TelemetryBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Name for ETW event.
|
||||
/// </summary>
|
||||
private const string EventSourceName = "Microsoft.PowerToys";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PowerToysTelemetry"/> class.
|
||||
/// </summary>
|
||||
public PowerToysTelemetry()
|
||||
: base(EventSourceName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an instance of the <see cref="PowerLauncherTelemetry"/> class.
|
||||
/// </summary>
|
||||
public static PowerToysTelemetry Log = new PowerToysTelemetry();
|
||||
|
||||
/// <summary>
|
||||
/// Publishes ETW event when an action is triggered on
|
||||
/// </summary>
|
||||
public void WriteEvent<T>(T telemetryEvent)
|
||||
where T : EventBase, IEvent
|
||||
{
|
||||
this.Write<T>(null, new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
},
|
||||
telemetryEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Telemetry helper class for PowerToys.
|
||||
/// </summary>
|
||||
public class PowerToysTelemetry : TelemetryBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Name for ETW event.
|
||||
/// </summary>
|
||||
private const string EventSourceName = "Microsoft.PowerToys";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PowerToysTelemetry"/> class.
|
||||
/// </summary>
|
||||
public PowerToysTelemetry()
|
||||
: base(EventSourceName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an instance of the <see cref="PowerLauncherTelemetry"/> class.
|
||||
/// </summary>
|
||||
public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry();
|
||||
|
||||
/// <summary>
|
||||
/// Publishes ETW event when an action is triggered on
|
||||
/// </summary>
|
||||
public void WriteEvent<T>(T telemetryEvent)
|
||||
where T : EventBase, IEvent
|
||||
{
|
||||
this.Write<T>(
|
||||
null,
|
||||
new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
},
|
||||
telemetryEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\..\..\installer\Version.props" />
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
@@ -14,10 +14,27 @@
|
||||
<RepositoryType>Github</RepositoryType>
|
||||
<PackageTags>PowerToys</PackageTags>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Telemetry\TelemetryBase.cs" Link="TelemetryBase.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="..\..\..\codeAnalysis\StyleCop.json">
|
||||
<Link>StyleCop.json</Link>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<Version>1.1.118</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\codeAnalysis\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,59 +1,60 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Privacy Tag values
|
||||
/// </summary>
|
||||
public enum PartA_PrivTags
|
||||
: ulong
|
||||
{
|
||||
/// <nodoc/>
|
||||
None = 0,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServicePerformance = 0x0u,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServiceUsage = 0x0u,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for telemetry events.
|
||||
/// </summary>
|
||||
public class TelemetryBase : EventSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The event tag for this event source.
|
||||
/// </summary>
|
||||
public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u;
|
||||
|
||||
/// <summary>
|
||||
/// The event keyword for this event source.
|
||||
/// </summary>
|
||||
public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0;
|
||||
|
||||
/// <summary>
|
||||
/// Group ID for Powertoys project.
|
||||
/// </summary>
|
||||
private static readonly string[] PowerToysTelemetryTraits = { "ETW_GROUP", "{42749043-438c-46a2-82be-c6cbeb192ff2}" };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TelemetryBase"/> class.
|
||||
/// </summary>
|
||||
/// <param name="eventSourceName">.</param>
|
||||
public TelemetryBase(
|
||||
string eventSourceName)
|
||||
: base(
|
||||
eventSourceName,
|
||||
EventSourceSettings.EtwSelfDescribingEventFormat,
|
||||
PowerToysTelemetryTraits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
// WARNING: THIS FILE GETS REPLACED ON THE BUILD FARM
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Privacy Tag values
|
||||
/// </summary>
|
||||
public enum PartA_PrivTags
|
||||
: ulong
|
||||
{
|
||||
/// <nodoc/>
|
||||
None = 0,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServicePerformance = 0x0u,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServiceUsage = 0x0u,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for telemetry events.
|
||||
/// </summary>
|
||||
public class TelemetryBase : EventSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The event tag for this event source.
|
||||
/// </summary>
|
||||
public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u;
|
||||
|
||||
/// <summary>
|
||||
/// The event keyword for this event source.
|
||||
/// </summary>
|
||||
public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0;
|
||||
|
||||
/// <summary>
|
||||
/// Group ID for Powertoys project.
|
||||
/// </summary>
|
||||
private static readonly string[] PowerToysTelemetryTraits = { "ETW_GROUP", "{42749043-438c-46a2-82be-c6cbeb192ff2}" };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TelemetryBase"/> class.
|
||||
/// </summary>
|
||||
/// <param name="eventSourceName">.</param>
|
||||
public TelemetryBase(
|
||||
string eventSourceName)
|
||||
: base(
|
||||
eventSourceName,
|
||||
EventSourceSettings.EtwSelfDescribingEventFormat,
|
||||
PowerToysTelemetryTraits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.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="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -128,13 +128,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<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')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.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'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -4,11 +4,20 @@
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace Microsoft::VisualStudio::CppUnitTestFramework
|
||||
{
|
||||
template<>
|
||||
inline std::wstring ToString<VersionHelper>(const VersionHelper& v)
|
||||
{
|
||||
return v.toWstring();
|
||||
}
|
||||
}
|
||||
|
||||
namespace UnitTestsVersionHelper
|
||||
{
|
||||
const int MAJOR_VERSION_0 = 0;
|
||||
const int MINOR_VERSION_12 = 12;
|
||||
const int REVISION_VERSION_0 = 0;
|
||||
const size_t MAJOR_VERSION_0 = 0;
|
||||
const size_t MINOR_VERSION_12 = 12;
|
||||
const size_t REVISION_VERSION_0 = 0;
|
||||
|
||||
TEST_CLASS (UnitTestsVersionHelper)
|
||||
{
|
||||
@@ -23,9 +32,9 @@ namespace UnitTestsVersionHelper
|
||||
}
|
||||
TEST_METHOD (integerConstructorShouldProperlyInitializationWithDifferentVersionNumbers)
|
||||
{
|
||||
const int testcaseMajor = 2;
|
||||
const int testcaseMinor = 25;
|
||||
const int testcaseRevision = 1;
|
||||
const size_t testcaseMajor = 2;
|
||||
const size_t testcaseMinor = 25;
|
||||
const size_t testcaseRevision = 1;
|
||||
VersionHelper sut(testcaseMajor, testcaseMinor, testcaseRevision);
|
||||
|
||||
Assert::AreEqual(testcaseMajor, sut.major);
|
||||
@@ -36,17 +45,77 @@ namespace UnitTestsVersionHelper
|
||||
{
|
||||
VersionHelper sut("v0.12.3");
|
||||
|
||||
Assert::AreEqual(0, sut.major);
|
||||
Assert::AreEqual(12, sut.minor);
|
||||
Assert::AreEqual(3, sut.revision);
|
||||
Assert::AreEqual(0ull, sut.major);
|
||||
Assert::AreEqual(12ull, sut.minor);
|
||||
Assert::AreEqual(3ull, sut.revision);
|
||||
}
|
||||
TEST_METHOD (stringConstructorShouldProperlyInitializationWithDifferentVersionNumbers)
|
||||
{
|
||||
VersionHelper sut("v2.25.1");
|
||||
|
||||
Assert::AreEqual(2, sut.major);
|
||||
Assert::AreEqual(25, sut.minor);
|
||||
Assert::AreEqual(1, sut.revision);
|
||||
Assert::AreEqual(2ull, sut.major);
|
||||
Assert::AreEqual(25ull, sut.minor);
|
||||
Assert::AreEqual(1ull, sut.revision);
|
||||
}
|
||||
TEST_METHOD (emptyStringNotAccepted)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (invalidStringNotAccepted1)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("v2a.");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (invalidStringNotAccepted2)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("12abc2vv.0");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (invalidStringNotAccepted3)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("123");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (invalidStringNotAccepted4)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("v1v2v3");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (invalidStringNotAccepted5)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("v.1.2.3v");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (partialVersionStringNotAccepted1)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("v1.");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (partialVersionStringNotAccepted2)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("v1.2");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (partialVersionStringNotAccepted3)
|
||||
{
|
||||
Assert::ExpectException<std::logic_error>([] {
|
||||
VersionHelper sut("v1.2.");
|
||||
});
|
||||
}
|
||||
TEST_METHOD (parsedWithoutLeadingV)
|
||||
{
|
||||
VersionHelper expected{ 12ull, 13ull, 111ull };
|
||||
VersionHelper actual("12.13.111");
|
||||
Assert::AreEqual(actual, expected);
|
||||
}
|
||||
TEST_METHOD (whenMajorVersionIsGreaterComparisonOperatorShouldReturnProperValue)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,30 +1,32 @@
|
||||
#include "pch.h"
|
||||
#include "VersionHelper.h"
|
||||
|
||||
#include "string_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
VersionHelper::VersionHelper(std::string str)
|
||||
{
|
||||
std::replace(str.begin(), str.end(), '.', ' ');
|
||||
std::replace(str.begin(), str.end(), 'v', ' ');
|
||||
std::stringstream ss;
|
||||
// Remove whitespaces chars and a leading 'v'
|
||||
str = left_trim<char>(trim<char>(str), "v");
|
||||
// Replace '.' with spaces
|
||||
replace_chars(str, ".", ' ');
|
||||
|
||||
ss << str;
|
||||
|
||||
std::string temp;
|
||||
ss >> temp;
|
||||
std::stringstream(temp) >> major;
|
||||
ss >> temp;
|
||||
std::stringstream(temp) >> minor;
|
||||
ss >> temp;
|
||||
std::stringstream(temp) >> revision;
|
||||
std::istringstream ss{ str };
|
||||
ss >> major;
|
||||
ss >> minor;
|
||||
ss >> revision;
|
||||
if (ss.fail() || !ss.eof())
|
||||
{
|
||||
throw std::logic_error("VersionHelper: couldn't parse the supplied version string");
|
||||
}
|
||||
}
|
||||
|
||||
VersionHelper::VersionHelper(int major, int minor, int revision) :
|
||||
major(major),
|
||||
minor(minor),
|
||||
revision(revision)
|
||||
VersionHelper::VersionHelper(const size_t major, const size_t minor, const size_t revision) :
|
||||
major{ major },
|
||||
minor{ minor },
|
||||
revision{ revision }
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
struct VersionHelper
|
||||
{
|
||||
VersionHelper(std::string str);
|
||||
VersionHelper(int major, int minor, int revision);
|
||||
VersionHelper(const size_t major, const size_t minor, const size_t revision);
|
||||
|
||||
auto operator<=>(const VersionHelper&) const = default;
|
||||
|
||||
int major;
|
||||
int minor;
|
||||
int revision;
|
||||
size_t major;
|
||||
size_t minor;
|
||||
size_t revision;
|
||||
|
||||
std::wstring toWstring() const;
|
||||
};
|
||||
|
||||
14
src/common/WinHookEvent.h
Normal file
14
src/common/WinHookEvent.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
struct WinHookEvent
|
||||
{
|
||||
DWORD event;
|
||||
HWND hwnd;
|
||||
LONG idObject;
|
||||
LONG idChild;
|
||||
DWORD idEventThread;
|
||||
DWORD dwmsEventTime;
|
||||
};
|
||||
67
src/common/comUtils.cpp
Normal file
67
src/common/comUtils.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <Sddl.h>
|
||||
|
||||
#include <wil/resource.h>
|
||||
|
||||
#include "comUtils.h"
|
||||
#include "common.h"
|
||||
|
||||
bool initializeCOMSecurity(const wchar_t* securityDescriptor)
|
||||
{
|
||||
PSECURITY_DESCRIPTOR self_relative_sd{};
|
||||
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(securityDescriptor, SDDL_REVISION_1, &self_relative_sd, nullptr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto free_relative_sd = wil::scope_exit([&] {
|
||||
LocalFree(self_relative_sd);
|
||||
});
|
||||
|
||||
DWORD absolute_sd_size = 0;
|
||||
DWORD dacl_size = 0;
|
||||
DWORD group_size = 0;
|
||||
DWORD owner_size = 0;
|
||||
DWORD sacl_size = 0;
|
||||
|
||||
if (!MakeAbsoluteSD(self_relative_sd, nullptr, &absolute_sd_size, nullptr, &dacl_size, nullptr, &sacl_size, nullptr, &owner_size, nullptr, &group_size))
|
||||
{
|
||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
typed_storage<SECURITY_DESCRIPTOR> absolute_sd{ absolute_sd_size };
|
||||
typed_storage<ACL> dacl{ dacl_size };
|
||||
typed_storage<ACL> sacl{ sacl_size };
|
||||
typed_storage<SID> owner{ owner_size };
|
||||
typed_storage<SID> group{ group_size };
|
||||
|
||||
if (!MakeAbsoluteSD(self_relative_sd,
|
||||
absolute_sd,
|
||||
&absolute_sd_size,
|
||||
dacl,
|
||||
&dacl_size,
|
||||
sacl,
|
||||
&sacl_size,
|
||||
owner,
|
||||
&owner_size,
|
||||
group,
|
||||
&group_size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !FAILED(CoInitializeSecurity(
|
||||
absolute_sd,
|
||||
-1,
|
||||
nullptr,
|
||||
nullptr,
|
||||
RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
|
||||
RPC_C_IMP_LEVEL_IDENTIFY,
|
||||
nullptr,
|
||||
EOAC_DYNAMIC_CLOAKING | EOAC_DISABLE_AAA,
|
||||
nullptr));
|
||||
}
|
||||
3
src/common/comUtils.h
Normal file
3
src/common/comUtils.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
bool initializeCOMSecurity(const wchar_t* securityDescriptor);
|
||||
@@ -11,25 +11,6 @@
|
||||
#pragma comment(lib, "advapi32.lib")
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
|
||||
namespace localized_strings
|
||||
{
|
||||
const wchar_t LAST_ERROR_FORMAT_STRING[] = L"%s failed with error %d: %s";
|
||||
const wchar_t LAST_ERROR_TITLE_STRING[] = L"Error";
|
||||
}
|
||||
|
||||
std::optional<RECT> get_button_pos(HWND hwnd)
|
||||
{
|
||||
RECT button;
|
||||
if (DwmGetWindowAttribute(hwnd, DWMWA_CAPTION_BUTTON_BOUNDS, &button, sizeof(RECT)) == S_OK)
|
||||
{
|
||||
return button;
|
||||
}
|
||||
else
|
||||
{
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<RECT> get_window_pos(HWND hwnd)
|
||||
{
|
||||
RECT window;
|
||||
@@ -43,25 +24,10 @@ std::optional<RECT> get_window_pos(HWND hwnd)
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<POINT> get_mouse_pos()
|
||||
{
|
||||
POINT point;
|
||||
if (GetCursorPos(&point) == 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
else
|
||||
{
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
// Test if a window is part of the shell or the task bar.
|
||||
// We compare the HWND against HWND of the desktop and shell windows,
|
||||
// we also filter out some window class names know to belong to
|
||||
// the taskbar.
|
||||
static bool is_system_window(HWND hwnd, const char* class_name)
|
||||
bool is_system_window(HWND hwnd, const char* class_name)
|
||||
{
|
||||
// We compare the HWND against HWND of the desktop and shell windows,
|
||||
// we also filter out some window class names know to belong to the taskbar.
|
||||
static auto system_classes = { "SysListView32", "WorkerW", "Shell_TrayWnd", "Shell_SecondaryTrayWnd", "Progman" };
|
||||
static auto system_hwnds = { GetDesktopWindow(), GetShellWindow() };
|
||||
for (auto system_hwnd : system_hwnds)
|
||||
@@ -81,193 +47,6 @@ static bool is_system_window(HWND hwnd, const char* class_name)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool no_visible_owner(HWND window) noexcept
|
||||
{
|
||||
auto owner = GetWindow(window, GW_OWNER);
|
||||
if (owner == nullptr)
|
||||
{
|
||||
return true; // There is no owner at all
|
||||
}
|
||||
if (!IsWindowVisible(owner))
|
||||
{
|
||||
return true; // Owner is invisible
|
||||
}
|
||||
RECT rect;
|
||||
if (!GetWindowRect(owner, &rect))
|
||||
{
|
||||
return false; // Could not get the rect, return true (and filter out the window) just in case
|
||||
}
|
||||
// Return false (and allow the window to be zonable) if the owner window size is zero
|
||||
// It is enough that the window is zero-sized in one dimension only.
|
||||
return rect.top == rect.bottom || rect.left == rect.right;
|
||||
}
|
||||
|
||||
FancyZonesFilter get_fancyzones_filtered_window(HWND window)
|
||||
{
|
||||
FancyZonesFilter result;
|
||||
if (GetAncestor(window, GA_ROOT) != window || !IsWindowVisible(window))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
auto style = GetWindowLong(window, GWL_STYLE);
|
||||
auto exStyle = GetWindowLong(window, GWL_EXSTYLE);
|
||||
// WS_POPUP need to have a border or minimize/maximize buttons,
|
||||
// otherwise the window is "not interesting"
|
||||
if ((style & WS_POPUP) == WS_POPUP &&
|
||||
(style & WS_THICKFRAME) == 0 &&
|
||||
(style & WS_MINIMIZEBOX) == 0 &&
|
||||
(style & WS_MAXIMIZEBOX) == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if ((style & WS_CHILD) == WS_CHILD ||
|
||||
(style & WS_DISABLED) == WS_DISABLED ||
|
||||
(exStyle & WS_EX_TOOLWINDOW) == WS_EX_TOOLWINDOW ||
|
||||
(exStyle & WS_EX_NOACTIVATE) == WS_EX_NOACTIVATE)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
std::array<char, 256> class_name;
|
||||
GetClassNameA(window, class_name.data(), static_cast<int>(class_name.size()));
|
||||
if (is_system_window(window, class_name.data()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
auto process_path = get_process_path(window);
|
||||
// Check for Cortana:
|
||||
if (strcmp(class_name.data(), "Windows.UI.Core.CoreWindow") == 0 &&
|
||||
process_path.ends_with(L"SearchUI.exe"))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
result.process_path = std::move(process_path);
|
||||
result.standard_window = true;
|
||||
result.no_visible_owner = no_visible_owner(window);
|
||||
result.zonable = result.standard_window && result.no_visible_owner;
|
||||
return result;
|
||||
}
|
||||
|
||||
ShortcutGuideFilter get_shortcutguide_filtered_window()
|
||||
{
|
||||
ShortcutGuideFilter result;
|
||||
auto active_window = GetForegroundWindow();
|
||||
active_window = GetAncestor(active_window, GA_ROOT);
|
||||
if (!IsWindowVisible(active_window))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
auto style = GetWindowLong(active_window, GWL_STYLE);
|
||||
auto exStyle = GetWindowLong(active_window, GWL_EXSTYLE);
|
||||
if ((style & WS_CHILD) == WS_CHILD ||
|
||||
(style & WS_DISABLED) == WS_DISABLED ||
|
||||
(exStyle & WS_EX_TOOLWINDOW) == WS_EX_TOOLWINDOW ||
|
||||
(exStyle & WS_EX_NOACTIVATE) == WS_EX_NOACTIVATE)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
std::array<char, 256> class_name;
|
||||
GetClassNameA(active_window, class_name.data(), static_cast<int>(class_name.size()));
|
||||
if (is_system_window(active_window, class_name.data()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
static HWND cortana_hwnd = nullptr;
|
||||
if (cortana_hwnd == nullptr)
|
||||
{
|
||||
if (strcmp(class_name.data(), "Windows.UI.Core.CoreWindow") == 0 &&
|
||||
get_process_path(active_window).ends_with(L"SearchUI.exe"))
|
||||
{
|
||||
cortana_hwnd = active_window;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (cortana_hwnd == active_window)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
result.hwnd = active_window;
|
||||
// In reality, Windows Snap works if even one of those styles is set
|
||||
// for a window, it is just limited. If there is no WS_MAXIMIZEBOX using
|
||||
// WinKey + Up just won't maximize the window. Similary, without
|
||||
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
|
||||
// is a example of such window - it can be snapped to both sides and to
|
||||
// all screen corners, but will not get maximized nor minimized.
|
||||
// For now, since ShortcutGuide can only disable entire "Windows Controls"
|
||||
// group, we require that the window supports all the options.
|
||||
result.snappable = ((style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX) &&
|
||||
((style & WS_MINIMIZEBOX) == WS_MINIMIZEBOX) &&
|
||||
((style & WS_THICKFRAME) == WS_THICKFRAME);
|
||||
return result;
|
||||
}
|
||||
|
||||
int width(const RECT& rect)
|
||||
{
|
||||
return rect.right - rect.left;
|
||||
}
|
||||
|
||||
int height(const RECT& rect)
|
||||
{
|
||||
return rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
bool operator<(const RECT& lhs, const RECT& rhs)
|
||||
{
|
||||
auto lhs_tuple = std::make_tuple(lhs.left, lhs.right, lhs.top, lhs.bottom);
|
||||
auto rhs_tuple = std::make_tuple(rhs.left, rhs.right, rhs.top, rhs.bottom);
|
||||
return lhs_tuple < rhs_tuple;
|
||||
}
|
||||
|
||||
RECT keep_rect_inside_rect(const RECT& small_rect, const RECT& big_rect)
|
||||
{
|
||||
RECT result = small_rect;
|
||||
if ((result.right - result.left) > (big_rect.right - big_rect.left))
|
||||
{
|
||||
// small_rect is too big horizontally. resize it.
|
||||
result.right = big_rect.right;
|
||||
result.left = big_rect.left;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.right > big_rect.right)
|
||||
{
|
||||
// move the rect left.
|
||||
result.left -= result.right - big_rect.right;
|
||||
result.right -= result.right - big_rect.right;
|
||||
}
|
||||
|
||||
if (result.left < big_rect.left)
|
||||
{
|
||||
// move the rect right.
|
||||
result.right += big_rect.left - result.left;
|
||||
result.left += big_rect.left - result.left;
|
||||
}
|
||||
}
|
||||
|
||||
if ((result.bottom - result.top) > (big_rect.bottom - big_rect.top))
|
||||
{
|
||||
// small_rect is too big vertically. resize it.
|
||||
result.bottom = big_rect.bottom;
|
||||
result.top = big_rect.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.bottom > big_rect.bottom)
|
||||
{
|
||||
// move the rect up.
|
||||
result.top -= result.bottom - big_rect.bottom;
|
||||
result.bottom -= result.bottom - big_rect.bottom;
|
||||
}
|
||||
|
||||
if (result.top < big_rect.top)
|
||||
{
|
||||
// move the rect down.
|
||||
result.bottom += big_rect.top - result.top;
|
||||
result.top += big_rect.top - result.top;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int run_message_loop(const bool until_idle, const std::optional<uint32_t> timeout_seconds)
|
||||
{
|
||||
MSG msg;
|
||||
@@ -306,7 +85,7 @@ std::optional<std::wstring> get_last_error_message(const DWORD dw)
|
||||
return message;
|
||||
}
|
||||
|
||||
void show_last_error_message(LPCWSTR lpszFunction, DWORD dw)
|
||||
void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle)
|
||||
{
|
||||
const auto system_message = get_last_error_message(dw);
|
||||
if (!system_message.has_value())
|
||||
@@ -322,7 +101,7 @@ void show_last_error_message(LPCWSTR lpszFunction, DWORD dw)
|
||||
lpszFunction,
|
||||
dw,
|
||||
system_message->c_str());
|
||||
MessageBoxW(NULL, (LPCTSTR)lpDisplayBuf, localized_strings::LAST_ERROR_TITLE_STRING, MB_OK);
|
||||
MessageBoxW(NULL, (LPCTSTR)lpDisplayBuf, errorTitle, MB_OK | MB_ICONERROR);
|
||||
LocalFree(lpDisplayBuf);
|
||||
}
|
||||
}
|
||||
@@ -451,7 +230,7 @@ std::wstring get_process_path(DWORD pid) noexcept
|
||||
return name;
|
||||
}
|
||||
|
||||
bool run_elevated(const std::wstring& file, const std::wstring& params)
|
||||
HANDLE run_elevated(const std::wstring& file, const std::wstring& params)
|
||||
{
|
||||
SHELLEXECUTEINFOW exec_info = { 0 };
|
||||
exec_info.cbSize = sizeof(SHELLEXECUTEINFOW);
|
||||
@@ -464,14 +243,7 @@ bool run_elevated(const std::wstring& file, const std::wstring& params)
|
||||
exec_info.hInstApp = 0;
|
||||
exec_info.nShow = SW_SHOWDEFAULT;
|
||||
|
||||
if (ShellExecuteExW(&exec_info))
|
||||
{
|
||||
return exec_info.hProcess != nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ShellExecuteExW(&exec_info) ? exec_info.hProcess : nullptr;
|
||||
}
|
||||
|
||||
bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid)
|
||||
@@ -774,19 +546,25 @@ bool find_app_name_in_path(const std::wstring& where, const std::vector<std::wst
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<std::string> exec_and_read_output(const std::wstring_view command, const DWORD timeout)
|
||||
std::optional<std::string> exec_and_read_output(const std::wstring_view command, DWORD timeout_ms)
|
||||
{
|
||||
SECURITY_ATTRIBUTES saAttr{ sizeof(saAttr) };
|
||||
saAttr.bInheritHandle = true;
|
||||
saAttr.bInheritHandle = false;
|
||||
|
||||
wil::unique_handle childStdoutRead;
|
||||
wil::unique_handle childStdoutWrite;
|
||||
if (!CreatePipe(&childStdoutRead, &childStdoutWrite, &saAttr, 0))
|
||||
constexpr size_t bufferSize = 4096;
|
||||
// We must use a named pipe for async I/O
|
||||
char pipename[MAX_PATH + 1];
|
||||
if (!GetTempFileNameA(R"(\\.\pipe\)", "tmp", 1, pipename))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!SetHandleInformation(childStdoutRead.get(), HANDLE_FLAG_INHERIT, 0))
|
||||
wil::unique_handle readPipe{ CreateNamedPipeA(pipename, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, PIPE_UNLIMITED_INSTANCES, bufferSize, bufferSize, 0, &saAttr) };
|
||||
|
||||
saAttr.bInheritHandle = true;
|
||||
wil::unique_handle writePipe{ CreateFileA(pipename, GENERIC_WRITE, 0, &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr) };
|
||||
|
||||
if (!readPipe || !writePipe)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -794,8 +572,8 @@ std::optional<std::string> exec_and_read_output(const std::wstring_view command,
|
||||
PROCESS_INFORMATION piProcInfo{};
|
||||
STARTUPINFOW siStartInfo{ sizeof(siStartInfo) };
|
||||
|
||||
siStartInfo.hStdError = childStdoutWrite.get();
|
||||
siStartInfo.hStdOutput = childStdoutWrite.get();
|
||||
siStartInfo.hStdError = writePipe.get();
|
||||
siStartInfo.hStdOutput = writePipe.get();
|
||||
siStartInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
||||
siStartInfo.wShowWindow = SW_HIDE;
|
||||
|
||||
@@ -813,24 +591,49 @@ std::optional<std::string> exec_and_read_output(const std::wstring_view command,
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
// Child process inherited the write end of the pipe, we can close it now
|
||||
writePipe.reset();
|
||||
|
||||
WaitForSingleObject(piProcInfo.hProcess, timeout);
|
||||
|
||||
childStdoutWrite.reset();
|
||||
CloseHandle(piProcInfo.hThread);
|
||||
auto closeProcessHandles = wil::scope_exit([&] {
|
||||
CloseHandle(piProcInfo.hThread);
|
||||
CloseHandle(piProcInfo.hProcess);
|
||||
});
|
||||
|
||||
std::string childOutput;
|
||||
bool processExited = false;
|
||||
for (;;)
|
||||
{
|
||||
char buffer[4096];
|
||||
char buffer[bufferSize];
|
||||
DWORD gotBytes = 0;
|
||||
if (!ReadFile(childStdoutRead.get(), buffer, sizeof(buffer), &gotBytes, nullptr) || !gotBytes)
|
||||
{
|
||||
break;
|
||||
}
|
||||
childOutput += std::string_view{ buffer, gotBytes };
|
||||
}
|
||||
wil::unique_handle IOEvent{ CreateEventW(nullptr, true, false, nullptr) };
|
||||
OVERLAPPED overlapped{ .hEvent = IOEvent.get() };
|
||||
ReadFile(readPipe.get(), buffer, sizeof(buffer), nullptr, &overlapped);
|
||||
|
||||
CloseHandle(piProcInfo.hProcess);
|
||||
const std::array<HANDLE, 2> handlesToWait = { overlapped.hEvent, piProcInfo.hProcess };
|
||||
switch (WaitForMultipleObjects(1 + !processExited, handlesToWait.data(), false, timeout_ms))
|
||||
{
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
if (!processExited)
|
||||
{
|
||||
// When the process exits, we can reduce timeout and read the rest of the output w/o possibly big timeout
|
||||
timeout_ms = 1000;
|
||||
processExited = true;
|
||||
closeProcessHandles.reset();
|
||||
}
|
||||
[[fallthrough]];
|
||||
case WAIT_OBJECT_0:
|
||||
if (GetOverlappedResultEx(readPipe.get(), &overlapped, &gotBytes, timeout_ms, true))
|
||||
{
|
||||
childOutput += std::string_view{ buffer, gotBytes };
|
||||
break;
|
||||
}
|
||||
// Timeout
|
||||
[[fallthrough]];
|
||||
default:
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
CancelIo(readPipe.get());
|
||||
return childOutput;
|
||||
}
|
||||
@@ -6,44 +6,24 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// Returns RECT with positions of the minimize/maximize buttons of the given window.
|
||||
// Does not always work, since some apps draw custom toolbars.
|
||||
std::optional<RECT> get_button_pos(HWND hwnd);
|
||||
|
||||
namespace localized_strings
|
||||
{
|
||||
const wchar_t LAST_ERROR_FORMAT_STRING[] = L"%s failed with error %d: %s";
|
||||
const wchar_t LAST_ERROR_TITLE_STRING[] = L"Error";
|
||||
}
|
||||
|
||||
// Gets position of given window.
|
||||
std::optional<RECT> get_window_pos(HWND hwnd);
|
||||
// Gets mouse position.
|
||||
std::optional<POINT> get_mouse_pos();
|
||||
|
||||
// Test if window can be zoned by FancyZones
|
||||
struct FancyZonesFilter
|
||||
{
|
||||
bool zonable = false; // If the window is zonable by FancyZones by default - true when both standard_window and no_visible_owner are also true
|
||||
bool standard_window = false; // True if from the styles the window looks like a standard window
|
||||
bool no_visible_owner = false; // True if the window is a top-level window that does not have a visible owner
|
||||
std::wstring process_path; // Path to the executable owning the window
|
||||
};
|
||||
FancyZonesFilter get_fancyzones_filtered_window(HWND window);
|
||||
// Check if window is part of the shell or the taskbar.
|
||||
bool is_system_window(HWND hwnd, const char* class_name);
|
||||
|
||||
// Gets active foreground window, filtering out all "non standard" windows like the taskbar, etc.
|
||||
struct ShortcutGuideFilter
|
||||
{
|
||||
HWND hwnd = nullptr; // Handle to the top-level foreground window or nullptr if there is no such window
|
||||
bool snappable = false; // True, if the window can react to Windows Snap keys
|
||||
};
|
||||
ShortcutGuideFilter get_shortcutguide_filtered_window();
|
||||
|
||||
// Calculate sizes
|
||||
int width(const RECT& rect);
|
||||
int height(const RECT& rect);
|
||||
// Compare rects
|
||||
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(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);
|
||||
void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle = localized_strings::LAST_ERROR_TITLE_STRING);
|
||||
|
||||
enum WindowState
|
||||
{
|
||||
@@ -67,7 +47,7 @@ bool is_process_elevated(const bool use_cached_value = true);
|
||||
bool drop_elevated_privileges();
|
||||
|
||||
// Run command as elevated user, returns true if succeeded
|
||||
bool run_elevated(const std::wstring& file, const std::wstring& params);
|
||||
HANDLE run_elevated(const std::wstring& file, const std::wstring& params);
|
||||
|
||||
// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL
|
||||
bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid);
|
||||
@@ -99,7 +79,7 @@ std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wch
|
||||
// is added to the .cpp file.
|
||||
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)
|
||||
|
||||
std::optional<std::string> exec_and_read_output(const std::wstring_view command, const DWORD timeout = INFINITE);
|
||||
std::optional<std::string> exec_and_read_output(const std::wstring_view command, DWORD timeout_ms = 30000);
|
||||
|
||||
// Helper class for various COM-related APIs, e.g working with security descriptors
|
||||
template<typename T>
|
||||
@@ -116,19 +96,6 @@ struct typed_storage
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Callable>
|
||||
struct on_scope_exit
|
||||
{
|
||||
Callable _f;
|
||||
on_scope_exit(Callable f) :
|
||||
_f{ std::move(f) } {}
|
||||
|
||||
~on_scope_exit()
|
||||
{
|
||||
_f();
|
||||
}
|
||||
};
|
||||
|
||||
template<class... Ts>
|
||||
struct overloaded : Ts...
|
||||
{
|
||||
@@ -136,5 +103,3 @@ struct overloaded : Ts...
|
||||
};
|
||||
template<class... Ts>
|
||||
overloaded(Ts...) -> overloaded<Ts...>;
|
||||
|
||||
#define POWER_LAUNCHER_PID_SHARED_FILE L"Local\\3cbfbad4-199b-4e2c-9825-942d5d3d3c74"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.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" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\Version.props" />
|
||||
<Target Name="GenerateVersionData" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="#pragma once" />
|
||||
@@ -82,7 +82,8 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>shlwapi.lib;shcore.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(CIBuild)'!='true'">
|
||||
@@ -113,13 +114,15 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>shlwapi.lib;shcore.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="animation.h" />
|
||||
<ClInclude Include="appMutex.h" />
|
||||
<ClInclude Include="async_message_queue.h" />
|
||||
<ClInclude Include="comUtils.h" />
|
||||
<ClInclude Include="d2d_svg.h" />
|
||||
<ClInclude Include="d2d_text.h" />
|
||||
<ClInclude Include="d2d_window.h" />
|
||||
@@ -128,12 +131,14 @@
|
||||
<ClInclude Include="com_object_factory.h" />
|
||||
<ClInclude Include="keyboard_layout.h" />
|
||||
<ClInclude Include="keyboard_layout_impl.h" />
|
||||
<ClInclude Include="LowlevelKeyboardEvent.h" />
|
||||
<ClInclude Include="notifications.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="string_utils.h" />
|
||||
<ClInclude Include="timeutil.h" />
|
||||
<ClInclude Include="two_way_pipe_message_ipc.h" />
|
||||
<ClInclude Include="VersionHelper.h" />
|
||||
@@ -153,10 +158,12 @@
|
||||
<ClInclude Include="two_way_pipe_message_ipc_impl.h" />
|
||||
<ClInclude Include="version.h" />
|
||||
<ClInclude Include="windows_colors.h" />
|
||||
<ClInclude Include="WinHookEvent.h" />
|
||||
<ClInclude Include="winstore.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="animation.cpp" />
|
||||
<ClCompile Include="comUtils.cpp" />
|
||||
<ClCompile Include="d2d_svg.cpp" />
|
||||
<ClCompile Include="d2d_text.cpp" />
|
||||
<ClCompile Include="d2d_window.cpp" />
|
||||
@@ -191,14 +198,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.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -129,6 +129,18 @@
|
||||
<ClInclude Include="processApi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="comUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LowlevelKeyboardEvent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WinHookEvent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="string_utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d2d_svg.cpp">
|
||||
@@ -207,6 +219,9 @@
|
||||
<ClCompile Include="RcResource.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="comUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -34,10 +34,10 @@ D2DSVG& D2DSVG::resize(int x, int y, int width, int height, float fill, float ma
|
||||
transform = transform * D2D1::Matrix3x2F::Translation((width - svg_width) / 2.0f, (height - svg_height) / 2.0f);
|
||||
float h_scale = fill * height / svg_height;
|
||||
float v_scale = fill * width / svg_width;
|
||||
used_scale = min(h_scale, v_scale);
|
||||
used_scale = std::min(h_scale, v_scale);
|
||||
if (max_scale > 0)
|
||||
{
|
||||
used_scale = min(used_scale, max_scale);
|
||||
used_scale = std::min(used_scale, max_scale);
|
||||
}
|
||||
transform = transform * D2D1::Matrix3x2F::Scale(used_scale, used_scale, D2D1::Point2F(width / 2.0f, height / 2.0f));
|
||||
transform = transform * D2D1::Matrix3x2F::Translation((float)x, (float)y);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "windef.h"
|
||||
|
||||
#pragma comment(lib, "shcore.lib")
|
||||
|
||||
namespace DPIAware
|
||||
{
|
||||
constexpr inline int DEFAULT_DPI = 96;
|
||||
|
||||
82
src/common/interop-tests/InteropTests.cs
Normal file
82
src/common/interop-tests/InteropTests.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using interop;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.Interop.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class InteropTests : IDisposable
|
||||
{
|
||||
private const string ServerSidePipe = "\\\\.\\pipe\\serverside";
|
||||
private const string ClientSidePipe = "\\\\.\\pipe\\clientside";
|
||||
|
||||
internal TwoWayPipeMessageIPCManaged ClientPipe { get; set; }
|
||||
|
||||
private bool disposedValue;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
ClientPipe = new TwoWayPipeMessageIPCManaged(ClientSidePipe, ServerSidePipe, null);
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
ClientPipe.End();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSend()
|
||||
{
|
||||
var testString = "This string is a test\n";
|
||||
using (var reset = new AutoResetEvent(false))
|
||||
{
|
||||
using (var serverPipe = new TwoWayPipeMessageIPCManaged(
|
||||
ServerSidePipe,
|
||||
ClientSidePipe,
|
||||
(string msg) =>
|
||||
{
|
||||
Assert.AreEqual(testString, msg);
|
||||
reset.Set();
|
||||
}))
|
||||
{
|
||||
serverPipe.Start();
|
||||
ClientPipe.Start();
|
||||
|
||||
ClientPipe.Send(testString);
|
||||
reset.WaitOne();
|
||||
|
||||
serverPipe.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
ClientPipe.Dispose();
|
||||
}
|
||||
|
||||
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
|
||||
// TODO: set large fields to null
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,112 +1,136 @@
|
||||
<?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.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 -->
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>interop-tests</AssemblyTitle>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<AssemblyCopyright>Copyright (C) 2020 Microsoft Corp.</AssemblyCopyright>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
||||
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
||||
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
||||
<HeaderLines Include="#pragma warning disable SA1516" />
|
||||
<HeaderLines Include="using System.Reflection%3b" />
|
||||
<HeaderLines Include="using System.Runtime.InteropServices%3b" />
|
||||
<HeaderLines Include="using System.Windows%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyTitle("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyDescription("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyConfiguration("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCompany("$(AssemblyCompany)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCopyright("$(AssemblyCopyright)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyProduct("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyTrademark("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCulture("")]" />
|
||||
<HeaderLines Include="[assembly: ComVisible(false)]" />
|
||||
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="Generated Files\AssemblyInfo.cs" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{437AD818-3F1F-4CA5-A79B-25233A157026}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>interop_tests</RootNamespace>
|
||||
<AssemblyName>interop-tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</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.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.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="UnitTest1.cs" />
|
||||
<Compile Include="Generated Files\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\interop\interop.vcxproj">
|
||||
<Project>{f055103b-f80b-4d0c-bf48-057c55620033}</Project>
|
||||
<Name>interop</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<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\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.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<?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.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="..\..\Version.props" />
|
||||
<!-- We don't have GenerateAssemblyInfo task until we use .net core, so we generate it with WriteLinesToFile -->
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>interop-tests</AssemblyTitle>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<AssemblyCopyright>Copyright (C) 2020 Microsoft Corp.</AssemblyCopyright>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
||||
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
||||
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
||||
<HeaderLines Include="#pragma warning disable SA1516" />
|
||||
<HeaderLines Include="using System.Reflection%3b" />
|
||||
<HeaderLines Include="using System.Runtime.InteropServices%3b" />
|
||||
<HeaderLines Include="using System.Windows%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyTitle("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyDescription("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyConfiguration("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCompany("$(AssemblyCompany)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCopyright("$(AssemblyCopyright)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyProduct("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyTrademark("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCulture("")]" />
|
||||
<HeaderLines Include="[assembly: ComVisible(false)]" />
|
||||
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="Generated Files\AssemblyInfo.cs" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{437AD818-3F1F-4CA5-A79B-25233A157026}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Interop.Tests</RootNamespace>
|
||||
<AssemblyName>Microsoft.Interop.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</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.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.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\codeAnalysis\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="InteropTests.cs" />
|
||||
<Compile Include="Generated Files\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="..\..\codeAnalysis\StyleCop.json">
|
||||
<Link>StyleCop.json</Link>
|
||||
</AdditionalFiles>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
|
||||
<Version>3.3.0</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<Version>1.1.118</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\interop\interop.vcxproj">
|
||||
<Project>{f055103b-f80b-4d0c-bf48-057c55620033}</Project>
|
||||
<Name>interop</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<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\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.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.IO.Pipes;
|
||||
using interop;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
|
||||
namespace interop_tests
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
private string SERVER_SIDE = "\\\\.\\pipe\\serverside";
|
||||
private string CLIENT_SIDE = "\\\\.\\pipe\\clientside";
|
||||
|
||||
private TwoWayPipeMessageIPCManaged clientPipe;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
clientPipe = new TwoWayPipeMessageIPCManaged(CLIENT_SIDE, SERVER_SIDE, null);
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
clientPipe.End();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSend()
|
||||
{
|
||||
var testString = "This string is a test\n";
|
||||
var reset = new AutoResetEvent(false);
|
||||
|
||||
var serverPipe = new TwoWayPipeMessageIPCManaged(
|
||||
SERVER_SIDE,
|
||||
CLIENT_SIDE,
|
||||
(string msg) =>
|
||||
{
|
||||
Assert.AreEqual(testString, msg);
|
||||
reset.Set();
|
||||
});
|
||||
serverPipe.Start();
|
||||
clientPipe.Start();
|
||||
|
||||
clientPipe.Send(testString);
|
||||
reset.WaitOne();
|
||||
|
||||
serverPipe.End();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <msclr\marshal.h>
|
||||
#include <msclr\marshal_cppstd.h>
|
||||
#include <common/debug_control.h>
|
||||
#include <common/common.h>
|
||||
|
||||
using namespace interop;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
@@ -46,12 +47,13 @@ void KeyboardHook::Start()
|
||||
0);
|
||||
if (hookHandle == nullptr)
|
||||
{
|
||||
throw std::exception("SetWindowsHookEx failed.");
|
||||
DWORD errorCode = GetLastError();
|
||||
show_last_error_message(L"SetWindowsHookEx", errorCode, L"PowerToys - Interop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK KeyboardHook::HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
LRESULT __clrcall KeyboardHook::HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (nCode == HC_ACTION && isActiveCallback->Invoke())
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ public
|
||||
HHOOK hookHandle;
|
||||
HookProcDelegate ^ hookProc;
|
||||
|
||||
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT __clrcall HookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -127,5 +127,10 @@ public
|
||||
{
|
||||
public:
|
||||
literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH;
|
||||
|
||||
static String^ PowerLauncherSharedEvent()
|
||||
{
|
||||
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\installer\Version.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>PowerToysInterop</AssemblyTitle>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
@@ -70,7 +70,7 @@
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src\common\interop;../../;../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<OmitDefaultLibName>false</OmitDefaultLibName>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -84,7 +84,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src\common\interop;../../;../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "keyboard_layout.h"
|
||||
#include "..\modules\interface\lowlevel_keyboard_event_data.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
bool operator<(const RECT& lhs, const RECT& rhs)
|
||||
{
|
||||
auto lhs_tuple = std::make_tuple(lhs.left, lhs.right, lhs.top, lhs.bottom);
|
||||
auto rhs_tuple = std::make_tuple(rhs.left, rhs.right, rhs.top, rhs.bottom);
|
||||
return lhs_tuple < rhs_tuple;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const ScreenSize& lhs, const ScreenSize& rhs)
|
||||
{
|
||||
auto lhs_tuple = std::make_tuple(lhs.rect.left, lhs.rect.right, lhs.rect.top, lhs.rect.bottom);
|
||||
|
||||
@@ -30,6 +30,7 @@ using winrt::Windows::UI::Notifications::ToastNotificationManager;
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
// This namespace contains strings that SHOULD NOT be localized
|
||||
namespace
|
||||
{
|
||||
constexpr std::wstring_view TASK_NAME = L"PowerToysBackgroundNotificationsHandler";
|
||||
@@ -37,7 +38,7 @@ namespace
|
||||
constexpr std::wstring_view PACKAGED_APPLICATION_ID = L"PowerToys";
|
||||
constexpr std::wstring_view APPIDS_REGISTRY = LR"(Software\Classes\AppUserModelId\)";
|
||||
|
||||
std::wstring APPLICATION_ID;
|
||||
std::wstring APPLICATION_ID = L"Microsoft.PowerToysWin32";
|
||||
}
|
||||
|
||||
namespace localized_strings
|
||||
@@ -184,7 +185,7 @@ void notifications::unregister_application_id()
|
||||
RegDeleteKeyW(registryRoot.get(), APPLICATION_ID.data());
|
||||
}
|
||||
|
||||
void notifications::set_application_id(const std::wstring_view appID)
|
||||
void notifications::override_application_id(const std::wstring_view appID)
|
||||
{
|
||||
APPLICATION_ID = appID;
|
||||
SetCurrentProcessExplicitAppUserModelID(APPLICATION_ID.c_str());
|
||||
@@ -402,8 +403,13 @@ void notifications::show_toast_with_activations(std::wstring message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifier.Show(notification);
|
||||
try
|
||||
{
|
||||
notifier.Show(notification);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void notifications::update_progress_bar_toast(std::wstring_view tag, progress_bar_params params)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace notifications
|
||||
{
|
||||
constexpr inline const wchar_t TOAST_ACTIVATED_LAUNCH_ARG[] = L"-ToastActivated";
|
||||
|
||||
void set_application_id(const std::wstring_view appID);
|
||||
void override_application_id(const std::wstring_view appID);
|
||||
void register_background_toast_handler();
|
||||
void run_desktop_app_activator_loop();
|
||||
|
||||
|
||||
@@ -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.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="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -185,7 +185,7 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<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')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\notifications_winrt\notifications.vcxproj">
|
||||
@@ -199,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.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'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.200703.9" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" 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.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="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.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'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.200703.9" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -22,10 +22,9 @@ public:
|
||||
private:
|
||||
void worker_thread();
|
||||
|
||||
std::thread _worker_thread;
|
||||
|
||||
std::mutex _task_mutex;
|
||||
std::condition_variable _task_cv;
|
||||
std::atomic_bool _shutdown_request;
|
||||
std::queue<std::packaged_task<void()>> _task_queue;
|
||||
std::thread _worker_thread;
|
||||
};
|
||||
|
||||
@@ -1,5 +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.CppWinRT" version="2.0.200729.8" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.200519.2" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,3 +1,4 @@
|
||||
#define NOMINMAX
|
||||
#include <winrt/base.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <Windows.h>
|
||||
|
||||
@@ -27,15 +27,21 @@ inline std::vector<wil::unique_process_handle> getProcessHandlesByName(const std
|
||||
handleAccess |= PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ;
|
||||
for (const DWORD processId : processIds)
|
||||
{
|
||||
wil::unique_process_handle hProcess{ OpenProcess(handleAccess, FALSE, processId) };
|
||||
wchar_t name[MAX_PATH + 1];
|
||||
if (!hProcess || !GetProcessImageFileNameW(hProcess.get(), name, MAX_PATH))
|
||||
try
|
||||
{
|
||||
continue;
|
||||
wil::unique_process_handle hProcess{ OpenProcess(handleAccess, FALSE, processId) };
|
||||
wchar_t name[MAX_PATH + 1];
|
||||
if (!hProcess || !GetProcessImageFileNameW(hProcess.get(), name, MAX_PATH))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (processName == PathFindFileNameW(name))
|
||||
{
|
||||
result.push_back(std::move(hProcess));
|
||||
}
|
||||
}
|
||||
if (processName == PathFindFileNameW(name))
|
||||
catch (...)
|
||||
{
|
||||
result.push_back(std::move(hProcess));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -343,6 +343,11 @@ namespace PowerToysSettings
|
||||
return m_json.GetNamedObject(L"properties").GetNamedObject(property_name).GetNamedObject(L"value");
|
||||
}
|
||||
|
||||
json::JsonObject PowerToyValues::get_raw_json()
|
||||
{
|
||||
return m_json;
|
||||
}
|
||||
|
||||
std::wstring PowerToyValues::serialize()
|
||||
{
|
||||
set_version();
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace PowerToysSettings
|
||||
std::optional<int> get_int_value(std::wstring_view property_name);
|
||||
std::optional<std::wstring> get_string_value(std::wstring_view property_name);
|
||||
std::optional<json::JsonObject> get_json(std::wstring_view property_name);
|
||||
json::JsonObject get_raw_json();
|
||||
|
||||
std::wstring serialize();
|
||||
void save_to_settings_file();
|
||||
|
||||
@@ -8,4 +8,7 @@ namespace CommonSharedConstants
|
||||
|
||||
// Fake key code to represent VK_WIN.
|
||||
inline const DWORD VK_WIN_BOTH = 0x104;
|
||||
}
|
||||
|
||||
// Path to the event used by PowerLauncher
|
||||
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
|
||||
}
|
||||
|
||||
50
src/common/string_utils.h
Normal file
50
src/common/string_utils.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
template<typename CharT>
|
||||
struct default_trim_arg
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct default_trim_arg<char>
|
||||
{
|
||||
static inline constexpr std::string_view value = " \t\r\n";
|
||||
};
|
||||
|
||||
template<>
|
||||
struct default_trim_arg<wchar_t>
|
||||
{
|
||||
static inline constexpr std::wstring_view value = L" \t\r\n";
|
||||
};
|
||||
|
||||
template<typename CharT>
|
||||
inline std::basic_string_view<CharT> left_trim(std::basic_string_view<CharT> s, const std::basic_string_view<CharT> chars_to_trim = default_trim_arg<CharT>::value)
|
||||
{
|
||||
s.remove_prefix(std::min<size_t>(s.find_first_not_of(chars_to_trim), size(s)));
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename CharT>
|
||||
inline std::basic_string_view<CharT> right_trim(std::basic_string_view<CharT> s, const std::basic_string_view<CharT> chars_to_trim = default_trim_arg<CharT>::value)
|
||||
{
|
||||
s.remove_suffix(std::min<size_t>(size(s) - s.find_last_not_of(chars_to_trim) - 1, size(s)));
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename CharT>
|
||||
inline std::basic_string_view<CharT> trim(std::basic_string_view<CharT> s, const std::basic_string_view<CharT> chars_to_trim = default_trim_arg<CharT>::value)
|
||||
{
|
||||
return left_trim(right_trim(s, chars_to_trim), chars_to_trim);
|
||||
}
|
||||
|
||||
inline void replace_chars(std::string& s, const std::string_view chars_to_replace, const char replacement_char)
|
||||
{
|
||||
for (const char c : chars_to_replace)
|
||||
{
|
||||
std::replace(begin(s), end(s), c, replacement_char);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace updating
|
||||
return runtimes->find(DESKTOP_DOTNET_RUNTIME_STRING) != std::string::npos;
|
||||
}
|
||||
|
||||
bool install_dotnet()
|
||||
bool install_dotnet(const bool silent)
|
||||
{
|
||||
const wchar_t DOTNET_DESKTOP_DOWNLOAD_LINK[] = L"https://download.visualstudio.microsoft.com/download/pr/3eb7efa1-96c6-4e97-bb9f-563ecf595f8a/7efd9c1cdd74df8fb0a34c288138a84f/windowsdesktop-runtime-3.1.6-win-x64.exe";
|
||||
const wchar_t DOTNET_DESKTOP_FILENAME[] = L"windowsdesktop-runtime.exe";
|
||||
@@ -52,7 +52,9 @@ namespace updating
|
||||
sei.fMask = { SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE };
|
||||
sei.lpFile = dotnet_download_path.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpParameters = L"/install /passive";
|
||||
std::wstring dotnet_flags = L"/install ";
|
||||
dotnet_flags += silent ? L"/quiet" : L"/passive";
|
||||
sei.lpParameters = dotnet_flags.c_str();
|
||||
if (ShellExecuteExW(&sei) != TRUE)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
namespace updating
|
||||
{
|
||||
bool dotnet_is_installed();
|
||||
bool install_dotnet();
|
||||
bool install_dotnet(const bool silent = false);
|
||||
}
|
||||
4
src/common/updating/packages.config
Normal file
4
src/common/updating/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -25,7 +25,6 @@ namespace localized_strings
|
||||
const wchar_t GITHUB_NEW_VERSION_UPDATE_NOW[] = L"Update now";
|
||||
const wchar_t GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART[] = L"At next launch";
|
||||
|
||||
const wchar_t UNINSTALLATION_SUCCESS[] = L"Previous version of PowerToys was uninstalled successfully.";
|
||||
const wchar_t UNINSTALLATION_UNKNOWN_ERROR[] = L"Error: please uninstall the previous version of PowerToys manually.";
|
||||
|
||||
const wchar_t GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT[] = L"An update to PowerToys is available. Visit our GitHub page to update.\n";
|
||||
@@ -131,11 +130,6 @@ namespace updating
|
||||
std::move(toast_params));
|
||||
}
|
||||
|
||||
void show_uninstallation_success()
|
||||
{
|
||||
::notifications::show_toast(localized_strings::UNINSTALLATION_SUCCESS, TOAST_TITLE);
|
||||
}
|
||||
|
||||
void show_uninstallation_error()
|
||||
{
|
||||
::notifications::show_toast(localized_strings::UNINSTALLATION_UNKNOWN_ERROR, TOAST_TITLE);
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace updating
|
||||
void show_visit_github(const updating::new_version_download_info& info);
|
||||
void show_install_error(const updating::new_version_download_info& info);
|
||||
void show_version_ready(const updating::new_version_download_info& info);
|
||||
void show_uninstallation_success();
|
||||
void show_uninstallation_error();
|
||||
|
||||
void update_download_progress(const updating::new_version_download_info& info, float progress);
|
||||
|
||||
@@ -84,7 +84,6 @@ namespace updating
|
||||
const auto uninstall_result = MsiInstallProductW(package_path.c_str(), L"REMOVE=ALL");
|
||||
if (ERROR_SUCCESS == uninstall_result)
|
||||
{
|
||||
notifications::show_uninstallation_success();
|
||||
return true;
|
||||
}
|
||||
else if (auto system_message = get_last_error_message(uninstall_result); system_message.has_value())
|
||||
@@ -238,16 +237,17 @@ namespace updating
|
||||
}
|
||||
}
|
||||
|
||||
std::future<void> check_new_version_available()
|
||||
std::future<std::wstring> check_new_version_available()
|
||||
{
|
||||
const auto new_version = co_await get_new_github_version_info_async();
|
||||
if (!new_version)
|
||||
{
|
||||
updating::notifications::show_unavailable();
|
||||
co_return;
|
||||
co_return VersionHelper{ VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION }.toWstring();
|
||||
}
|
||||
|
||||
updating::notifications::show_available(new_version.value());
|
||||
co_return new_version->version_string;
|
||||
}
|
||||
|
||||
std::future<std::wstring> download_update()
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace updating
|
||||
std::future<void> try_autoupdate(const bool download_updates_automatically);
|
||||
std::filesystem::path get_pending_updates_path();
|
||||
|
||||
std::future<void> check_new_version_available();
|
||||
std::future<std::wstring> check_new_version_available();
|
||||
std::future<std::wstring> download_update();
|
||||
|
||||
// non-localized
|
||||
|
||||
@@ -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.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="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -119,7 +119,7 @@
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Pathcch.lib;Version.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>Version.lib</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
@@ -153,7 +153,7 @@
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Pathcch.lib;Version.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>Version.lib</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@@ -198,13 +198,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<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')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\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.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'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -3,9 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
public virtual string ToJsonString()
|
||||
{
|
||||
// By default JsonSerializer will only serialize the properties in the base class. This can be avoided by passing the object type (more details at https://stackoverflow.com/a/62498888)
|
||||
return JsonSerializer.Serialize(this, this.GetType());
|
||||
return JsonSerializer.Serialize(this, GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user