mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
[Installer]Upgrade to Windows App SDK 1.1.0 (#18603)
* Move to WinAppSDK-1.1.0
* expect.txt
* Revert "[Settings]Don't launch if explorer is running elevated"
This reverts commit c485da2816
.
* Make copyright header analyze suppression module scope
This commit is contained in:
parent
29f0ae0395
commit
7a7d025956
2
.github/actions/spell-check/expect.txt
vendored
2
.github/actions/spell-check/expect.txt
vendored
@ -388,6 +388,7 @@ DCOM
|
|||||||
dcomp
|
dcomp
|
||||||
DComposition
|
DComposition
|
||||||
ddf
|
ddf
|
||||||
|
DDLM
|
||||||
Deact
|
Deact
|
||||||
debian
|
debian
|
||||||
debugbreak
|
debugbreak
|
||||||
@ -1295,6 +1296,7 @@ MYTZ
|
|||||||
NAMECHANGE
|
NAMECHANGE
|
||||||
nameof
|
nameof
|
||||||
namespace
|
namespace
|
||||||
|
namespaceanddescendants
|
||||||
Navassa
|
Navassa
|
||||||
NCACTIVATE
|
NCACTIVATE
|
||||||
ncc
|
ncc
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
<?define Dotnet6PayloadSize="57791288"?>
|
<?define Dotnet6PayloadSize="57791288"?>
|
||||||
<?define Dotnet6PayloadHash="B5B1819CCA753B070181F50411375B80412860A3"?>
|
<?define Dotnet6PayloadHash="B5B1819CCA753B070181F50411375B80412860A3"?>
|
||||||
|
|
||||||
<?define WinAppSDKPayloadSize="57090456"?>
|
<?define WinAppSDKPayloadSize="59625472"?>
|
||||||
<?define WinAppSDKPayloadHash="1269BB136655325EF6D66A018269BDAB3921E56B"?>
|
<?define WinAppSDKPayloadHash="8696DA7FE75464E8729FFB487A6E3A6247BC53D0"?>
|
||||||
|
|
||||||
<?define VCRedistDownloadUrl="https://download.visualstudio.microsoft.com/download/pr/6b6923b0-3045-4379-a96f-ef5506a65d5b/426A34C6F10EA8F7DA58A8C976B586AD84DD4BAB42A0CFDBE941F1763B7755E5/VC_redist.x64.exe"?>
|
<?define VCRedistDownloadUrl="https://download.visualstudio.microsoft.com/download/pr/6b6923b0-3045-4379-a96f-ef5506a65d5b/426A34C6F10EA8F7DA58A8C976B586AD84DD4BAB42A0CFDBE941F1763B7755E5/VC_redist.x64.exe"?>
|
||||||
<?define VCRedistPayloadSize="25337776"?>
|
<?define VCRedistPayloadSize="25337776"?>
|
||||||
@ -27,8 +27,8 @@
|
|||||||
<?define Dotnet6PayloadSize="51774400"?>
|
<?define Dotnet6PayloadSize="51774400"?>
|
||||||
<?define Dotnet6PayloadHash="62C15858951B123AFD4D3E14F8BE4829A7CAFF18"?>
|
<?define Dotnet6PayloadHash="62C15858951B123AFD4D3E14F8BE4829A7CAFF18"?>
|
||||||
|
|
||||||
<?define WinAppSDKPayloadSize="57092528"?>
|
<?define WinAppSDKPayloadSize="59625472"?>
|
||||||
<?define WinAppSDKPayloadHash="377ACE2157BE077C63C650588A18CBEFD93B5B51"?>
|
<?define WinAppSDKPayloadHash="29F1CD6782CF840C652343C9C718DFE9D155D2F3"?>
|
||||||
|
|
||||||
<?define VCRedistDownloadUrl="https://download.visualstudio.microsoft.com/download/pr/6b6923b0-3045-4379-a96f-ef5506a65d5b/6114C0A7A526EA47D9ADD78C718BEA0BA32EEF0826AA5610AF76877CC5FEB7F3/VC_redist.arm64.exe"?>
|
<?define VCRedistDownloadUrl="https://download.visualstudio.microsoft.com/download/pr/6b6923b0-3045-4379-a96f-ef5506a65d5b/6114C0A7A526EA47D9ADD78C718BEA0BA32EEF0826AA5610AF76877CC5FEB7F3/VC_redist.arm64.exe"?>
|
||||||
<?define VCRedistPayloadSize="11596400"?>
|
<?define VCRedistPayloadSize="11596400"?>
|
||||||
@ -110,18 +110,19 @@
|
|||||||
UninstallCommand="/silent /uninstall">
|
UninstallCommand="/silent /uninstall">
|
||||||
</ExePackage>
|
</ExePackage>
|
||||||
<ExePackage
|
<ExePackage
|
||||||
Name="WindowsAppRuntimeInstall-1.0.3.exe"
|
Name="WindowsAppRuntimeInstall-1.1.0.exe"
|
||||||
Compressed="no"
|
Compressed="no"
|
||||||
Id="WinAppSDK101"
|
Id="WinAppSDK110"
|
||||||
DownloadUrl="https://aka.ms/windowsappsdk/1.0/1.0.3/windowsappruntimeinstall-1.0.3-$(var.PowerToysPlatform).exe"
|
DownloadUrl="https://aka.ms/windowsappsdk/1.1/1.1.0/windowsappruntimeinstall-1.1.0-$(var.PowerToysPlatform).exe"
|
||||||
|
InstallCommand="--force"
|
||||||
RepairCommand=""
|
RepairCommand=""
|
||||||
Permanent="yes">
|
Permanent="yes">
|
||||||
<ExitCode Value="-2147009274" Behavior="success"/>
|
<ExitCode Value="-2147009274" Behavior="success"/>
|
||||||
<RemotePayload
|
<RemotePayload
|
||||||
Description="Windows App SDK 1.0.3 Runtime Install"
|
Description="Windows App SDK 1.1.0 Runtime Install"
|
||||||
ProductName="Windows App SDK 1.0.3 Runtime Install"
|
ProductName="Windows App SDK 1.1.0 Runtime Install"
|
||||||
Size="$(var.WinAppSDKPayloadSize)"
|
Size="$(var.WinAppSDKPayloadSize)"
|
||||||
Version="1.0.3.0"
|
Version="1.1.0.0"
|
||||||
Hash="$(var.WinAppSDKPayloadHash)" />
|
Hash="$(var.WinAppSDKPayloadHash)" />
|
||||||
</ExePackage>
|
</ExePackage>
|
||||||
<ExePackage
|
<ExePackage
|
||||||
|
@ -493,30 +493,3 @@ inline bool check_user_is_admin()
|
|||||||
freeMemory(pSID, pGroupInfo);
|
freeMemory(pSID, pGroupInfo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_process_of_window_elevated(HWND window)
|
|
||||||
{
|
|
||||||
DWORD pid = 0;
|
|
||||||
GetWindowThreadProcessId(window, &pid);
|
|
||||||
if (!pid)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wil::unique_handle hProcess{ OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION,
|
|
||||||
FALSE,
|
|
||||||
pid) };
|
|
||||||
|
|
||||||
wil::unique_handle token;
|
|
||||||
|
|
||||||
if (OpenProcessToken(hProcess.get(), TOKEN_QUERY, &token))
|
|
||||||
{
|
|
||||||
TOKEN_ELEVATION elevation;
|
|
||||||
DWORD size;
|
|
||||||
if (GetTokenInformation(token.get(), TokenElevation, &elevation, sizeof(elevation), &size))
|
|
||||||
{
|
|
||||||
return elevation.TokenIsElevated != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
#include <common/display/dpi_aware.h>
|
#include <common/display/dpi_aware.h>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
#include <common/utils/elevation.h>
|
|
||||||
#include <common/utils/excluded_apps.h>
|
|
||||||
#include <common/utils/process_path.h>
|
#include <common/utils/process_path.h>
|
||||||
#include <common/utils/winapi_error.h>
|
#include <common/utils/winapi_error.h>
|
||||||
#include <common/utils/window.h>
|
#include <common/utils/window.h>
|
||||||
|
#include <common/utils/excluded_apps.h>
|
||||||
|
|
||||||
#include <FancyZonesLib/FancyZonesWindowProperties.h>
|
#include <FancyZonesLib/FancyZonesWindowProperties.h>
|
||||||
#include <FancyZonesLib/Settings.h>
|
#include <FancyZonesLib/Settings.h>
|
||||||
@ -246,7 +245,30 @@ bool FancyZonesWindowUtils::IsCandidateForZoning(HWND window)
|
|||||||
|
|
||||||
bool FancyZonesWindowUtils::IsProcessOfWindowElevated(HWND window)
|
bool FancyZonesWindowUtils::IsProcessOfWindowElevated(HWND window)
|
||||||
{
|
{
|
||||||
return is_process_of_window_elevated(window);
|
DWORD pid = 0;
|
||||||
|
GetWindowThreadProcessId(window, &pid);
|
||||||
|
if (!pid)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wil::unique_handle hProcess{ OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION,
|
||||||
|
FALSE,
|
||||||
|
pid) };
|
||||||
|
|
||||||
|
wil::unique_handle token;
|
||||||
|
bool elevated = false;
|
||||||
|
|
||||||
|
if (OpenProcessToken(hProcess.get(), TOKEN_QUERY, &token))
|
||||||
|
{
|
||||||
|
TOKEN_ELEVATION elevation;
|
||||||
|
DWORD size;
|
||||||
|
if (GetTokenInformation(token.get(), TokenElevation, &elevation, sizeof(elevation), &size))
|
||||||
|
{
|
||||||
|
return elevation.TokenIsElevated != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FancyZonesWindowUtils::IsExcludedByUser(const std::wstring& processPath) noexcept
|
bool FancyZonesWindowUtils::IsExcludedByUser(const std::wstring& processPath) noexcept
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.props" Condition="Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.props')" />
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.props" Condition="Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.props')" />
|
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props')" />
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props')" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||||
@ -171,10 +171,10 @@
|
|||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets')" />
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets')" />
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.targets" Condition="Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.targets')" />
|
|
||||||
<Import Project="..\..\..\..\packages\boost.1.79.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.79.0\build\boost.targets')" />
|
<Import Project="..\..\..\..\packages\boost.1.79.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.79.0\build\boost.targets')" />
|
||||||
<Import Project="..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets')" />
|
<Import Project="..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets')" />
|
||||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||||
|
<Import Project="..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.targets" Condition="Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.targets')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -183,12 +183,12 @@
|
|||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.props'))" />
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22000.197\build\Microsoft.Windows.SDK.BuildTools.targets'))" />
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.props'))" />
|
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.WindowsAppSDK.1.0.3\build\native\Microsoft.WindowsAppSDK.targets'))" />
|
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\boost.1.79.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.79.0\build\boost.targets'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\boost.1.79.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.79.0\build\boost.targets'))" />
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc143.1.79.0\build\boost_regex-vc143.targets'))" />
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.props'))" />
|
||||||
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.WindowsAppSDK.1.1.0\build\native\Microsoft.WindowsAppSDK.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AddWildCardItems" AfterTargets="BuildGenerateSources">
|
<Target Name="AddWildCardItems" AfterTargets="BuildGenerateSources">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.220418.1" targetFramework="native" />
|
<package id="Microsoft.Windows.CppWinRT" version="2.0.220418.1" targetFramework="native" />
|
||||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" />
|
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" />
|
||||||
<package id="Microsoft.Windows.SDK.BuildTools" version="10.0.22000.197" targetFramework="native" />
|
<package id="Microsoft.Windows.SDK.BuildTools" version="10.0.22000.197" targetFramework="native" />
|
||||||
<package id="Microsoft.WindowsAppSDK" version="1.0.3" targetFramework="native" />
|
<package id="Microsoft.WindowsAppSDK" version="1.1.0" targetFramework="native" />
|
||||||
</packages>
|
</packages>
|
@ -69,7 +69,6 @@ public:
|
|||||||
IFACEMETHOD(GetSelected)(_Out_ bool* selected) = 0;
|
IFACEMETHOD(GetSelected)(_Out_ bool* selected) = 0;
|
||||||
IFACEMETHOD(PutSelected)(_In_ bool selected) = 0;
|
IFACEMETHOD(PutSelected)(_In_ bool selected) = 0;
|
||||||
IFACEMETHOD(GetId)(_Out_ int *id) = 0;
|
IFACEMETHOD(GetId)(_Out_ int *id) = 0;
|
||||||
IFACEMETHOD(GetIconIndex)(_Out_ int* iconIndex) = 0;
|
|
||||||
IFACEMETHOD(GetDepth)(_Out_ UINT* depth) = 0;
|
IFACEMETHOD(GetDepth)(_Out_ UINT* depth) = 0;
|
||||||
IFACEMETHOD(PutDepth)(_In_ int depth) = 0;
|
IFACEMETHOD(PutDepth)(_In_ int depth) = 0;
|
||||||
IFACEMETHOD(ShouldRenameItem)(_In_ DWORD flags, _Out_ bool* shouldRename) = 0;
|
IFACEMETHOD(ShouldRenameItem)(_In_ DWORD flags, _Out_ bool* shouldRename) = 0;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "PowerRenameItem.h"
|
#include "PowerRenameItem.h"
|
||||||
#include <common/themes/icon_helpers.h>
|
|
||||||
|
|
||||||
int CPowerRenameItem::s_id = 0;
|
int CPowerRenameItem::s_id = 0;
|
||||||
|
|
||||||
@ -180,16 +179,6 @@ IFACEMETHODIMP CPowerRenameItem::GetId(_Out_ int* id)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP CPowerRenameItem::GetIconIndex(_Out_ int* iconIndex)
|
|
||||||
{
|
|
||||||
if (m_iconIndex == -1)
|
|
||||||
{
|
|
||||||
GetIconIndexFromPath((PCWSTR)m_path, &m_iconIndex);
|
|
||||||
}
|
|
||||||
*iconIndex = m_iconIndex;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFACEMETHODIMP CPowerRenameItem::GetDepth(_Out_ UINT* depth)
|
IFACEMETHODIMP CPowerRenameItem::GetDepth(_Out_ UINT* depth)
|
||||||
{
|
{
|
||||||
*depth = m_depth;
|
*depth = m_depth;
|
||||||
|
@ -27,7 +27,6 @@ public:
|
|||||||
IFACEMETHODIMP GetSelected(_Out_ bool* selected);
|
IFACEMETHODIMP GetSelected(_Out_ bool* selected);
|
||||||
IFACEMETHODIMP PutSelected(_In_ bool selected);
|
IFACEMETHODIMP PutSelected(_In_ bool selected);
|
||||||
IFACEMETHODIMP GetId(_Out_ int* id);
|
IFACEMETHODIMP GetId(_Out_ int* id);
|
||||||
IFACEMETHODIMP GetIconIndex(_Out_ int* iconIndex);
|
|
||||||
IFACEMETHODIMP GetDepth(_Out_ UINT* depth);
|
IFACEMETHODIMP GetDepth(_Out_ UINT* depth);
|
||||||
IFACEMETHODIMP PutDepth(_In_ int depth);
|
IFACEMETHODIMP PutDepth(_In_ int depth);
|
||||||
IFACEMETHODIMP Reset();
|
IFACEMETHODIMP Reset();
|
||||||
|
@ -122,7 +122,4 @@
|
|||||||
<data name="BUGREPORT_SUCCESS" xml:space="preserve">
|
<data name="BUGREPORT_SUCCESS" xml:space="preserve">
|
||||||
<value>Bug report .zip file has been created on your Desktop.</value>
|
<value>Bug report .zip file has been created on your Desktop.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CANNOT_LAUNCH_SETTINGS_NONELEVATED" xml:space="preserve">
|
|
||||||
<value>Cannot start PowerToys.Settings process non-elevated, because explorer.exe process is elevated. Consider enabling UAC.</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "restart_elevated.h"
|
#include "restart_elevated.h"
|
||||||
#include "UpdateUtils.h"
|
#include "UpdateUtils.h"
|
||||||
#include "centralized_kb_hook.h"
|
#include "centralized_kb_hook.h"
|
||||||
#include "Generated Files/resource.h"
|
|
||||||
|
|
||||||
#include <common/utils/json.h>
|
#include <common/utils/json.h>
|
||||||
#include <common/SettingsAPI/settings_helpers.cpp>
|
#include <common/SettingsAPI/settings_helpers.cpp>
|
||||||
@ -21,7 +20,6 @@
|
|||||||
#include <common/utils/elevation.h>
|
#include <common/utils/elevation.h>
|
||||||
#include <common/utils/process_path.h>
|
#include <common/utils/process_path.h>
|
||||||
#include <common/utils/timeutil.h>
|
#include <common/utils/timeutil.h>
|
||||||
#include <common/utils/resources.h>
|
|
||||||
#include <common/utils/winapi_error.h>
|
#include <common/utils/winapi_error.h>
|
||||||
#include <common/updating/updateState.h>
|
#include <common/updating/updateState.h>
|
||||||
#include <common/themes/windows_colors.h>
|
#include <common/themes/windows_colors.h>
|
||||||
@ -199,6 +197,67 @@ void receive_json_send_to_main_thread(const std::wstring& msg)
|
|||||||
dispatch_run_on_main_ui_thread(dispatch_received_json_callback, copy);
|
dispatch_run_on_main_ui_thread(dispatch_received_json_callback, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to run the Settings process with non-elevated privileges.
|
||||||
|
BOOL run_settings_non_elevated(LPCWSTR executable_path, LPWSTR executable_args, PROCESS_INFORMATION* process_info)
|
||||||
|
{
|
||||||
|
HWND hwnd = GetShellWindow();
|
||||||
|
if (!hwnd)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD pid;
|
||||||
|
GetWindowThreadProcessId(hwnd, &pid);
|
||||||
|
|
||||||
|
winrt::handle process{ OpenProcess(PROCESS_CREATE_PROCESS, FALSE, pid) };
|
||||||
|
if (!process)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SIZE_T size = 0;
|
||||||
|
InitializeProcThreadAttributeList(nullptr, 1, 0, &size);
|
||||||
|
auto pproc_buffer = std::unique_ptr<char[]>{ new (std::nothrow) char[size] };
|
||||||
|
auto pptal = reinterpret_cast<PPROC_THREAD_ATTRIBUTE_LIST>(pproc_buffer.get());
|
||||||
|
if (!pptal)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!InitializeProcThreadAttributeList(pptal, 1, 0, &size))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!UpdateProcThreadAttribute(pptal,
|
||||||
|
0,
|
||||||
|
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS,
|
||||||
|
&process,
|
||||||
|
sizeof(process),
|
||||||
|
nullptr,
|
||||||
|
nullptr))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
STARTUPINFOEX siex = { 0 };
|
||||||
|
siex.lpAttributeList = pptal;
|
||||||
|
siex.StartupInfo.cb = sizeof(siex);
|
||||||
|
|
||||||
|
BOOL process_created = CreateProcessW(executable_path,
|
||||||
|
executable_args,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
FALSE,
|
||||||
|
EXTENDED_STARTUPINFO_PRESENT,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
&siex.StartupInfo,
|
||||||
|
process_info);
|
||||||
|
g_isLaunchInProgress = false;
|
||||||
|
return process_created;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD g_settings_process_id = 0;
|
DWORD g_settings_process_id = 0;
|
||||||
|
|
||||||
void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::optional<std::wstring> settings_window)
|
void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::optional<std::wstring> settings_window)
|
||||||
@ -295,16 +354,6 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op
|
|||||||
BOOL process_created = false;
|
BOOL process_created = false;
|
||||||
|
|
||||||
if (is_process_elevated())
|
if (is_process_elevated())
|
||||||
{
|
|
||||||
const bool explorer_is_elevated = is_process_of_window_elevated(GetShellWindow());
|
|
||||||
if (explorer_is_elevated)
|
|
||||||
{
|
|
||||||
MessageBoxW(nullptr,
|
|
||||||
GET_RESOURCE_STRING(IDS_CANNOT_LAUNCH_SETTINGS_NONELEVATED).c_str(),
|
|
||||||
L"PowerToys",
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
auto res = RunNonElevatedFailsafe(executable_path, executable_args, get_module_folderpath());
|
auto res = RunNonElevatedFailsafe(executable_path, executable_args, get_module_folderpath());
|
||||||
process_created = res.has_value();
|
process_created = res.has_value();
|
||||||
@ -315,7 +364,6 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op
|
|||||||
g_isLaunchInProgress = false;
|
g_isLaunchInProgress = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (FALSE == process_created)
|
if (FALSE == process_created)
|
||||||
{
|
{
|
||||||
|
@ -73,3 +73,8 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "type", Target = "~T:Microsoft.WindowsAppSDK.Runtime.Packages.Singleton")]
|
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "type", Target = "~T:Microsoft.WindowsAppSDK.Runtime.Packages.Singleton")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "type", Target = "~T:Microsoft.WindowsAppSDK.Runtime.Packages.Singleton")]
|
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "type", Target = "~T:Microsoft.WindowsAppSDK.Runtime.Packages.Singleton")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "type", Target = "~T:Microsoft.WindowsAppSDK.Runtime.Packages.Main")]
|
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "type", Target = "~T:Microsoft.WindowsAppSDK.Runtime.Packages.Main")]
|
||||||
|
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "namespaceanddescendants", Target = "Microsoft.WindowsAppSDK.Runtime.Packages")]
|
||||||
|
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "namespaceanddescendants", Target = "Microsoft.WindowsAppSDK.Runtime.Packages")]
|
||||||
|
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1403:File may only contain a single namespace", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "namespaceanddescendants", Target = "Microsoft.WindowsAppSDK.Runtime.Packages.DDLM")]
|
||||||
|
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "namespaceanddescendants", Target = "Microsoft.WindowsAppSDK.Runtime.Packages.DDLM")]
|
||||||
|
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1636:File header copyright text should match", Justification = "Not part of the project. WindowsAppSDK file.", Scope = "module")]
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
|
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
|
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.3" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.0" />
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
|
||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.8" />
|
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.8" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
|
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
|
||||||
|
Loading…
Reference in New Issue
Block a user