Compare commits

..

1 Commits

Author SHA1 Message Date
Stefan Markovic
3d1f7c03c3 Test admin sid 2023-11-28 14:43:10 +01:00
24 changed files with 229 additions and 231 deletions

View File

@@ -725,7 +725,6 @@ Jsons
jsonval
junja
jxr
Kazakhstani
kdc
keybd
KEYBDDATA
@@ -1546,7 +1545,6 @@ TDevice
telem
telephon
templatenamespace
Tenge
testhost
testprocess
TEXCOORD

View File

@@ -8,7 +8,7 @@ resources:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release-2023-11-13-4
ref: refs/tags/release
parameters:
- name: buildConfigurations

View File

@@ -74,7 +74,7 @@
<PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" />
<PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" />
<PackageVersion Include="WinUIEx" Version="2.2.0" />
<PackageVersion Include="WPF-UI" Version="3.0.0-preview.12" />
<PackageVersion Include="WPF-UI" Version="3.0.0-preview.11" />
</ItemGroup>
<ItemGroup Condition="'$(IsExperimentationLive)'!=''">
<!-- Additional dependencies used by experimentation -->

View File

@@ -1331,5 +1331,5 @@ EXHIBIT A -Mozilla Public License.
- Vanara.PInvoke.Shell32 3.4.11
- Vanara.PInvoke.User32 3.4.11
- WinUIEx 2.2.0
- WPF-UI 3.0.0-preview.12
- WPF-UI 3.0.0-preview.11

200
README.md
View File

@@ -39,19 +39,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F50
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F49
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.76.0/PowerToysUserSetup-0.76.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.76.0/PowerToysUserSetup-0.76.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.76.0/PowerToysSetup-0.76.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.76.0/PowerToysSetup-0.76.0-arm64.exe
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F49
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F48
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.75.1/PowerToysUserSetup-0.75.1-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.75.1/PowerToysUserSetup-0.75.1-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.75.1/PowerToysSetup-0.75.1-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.75.1/PowerToysSetup-0.75.1-arm64.exe
| Description | Filename | sha256 hash |
|----------------|----------|-------------|
| Per user - x64 | [PowerToysUserSetup-0.76.0-x64.exe][ptUserX64] | 627F60BF3F04583A2ECE7ACE7E6F09ABDE92493E1FFFAC5705CC83009781CD8D |
| Per user - ARM64 | [PowerToysUserSetup-0.76.0-arm64.exe][ptUserArm64] | 79D11CDDBDD87DF8A69A5B2FC28869B3085392E5F45FEE6560D278E48F8B0673 |
| Machine wide - x64 | [PowerToysSetup-0.76.0-x64.exe][ptMachineX64] | 4F24A288AC92DD0AB74EF52CFE3D66FA744BDC6889CB4E3ED088763D9134C06D |
| Machine wide - ARM64 | [PowerToysSetup-0.76.0-arm64.exe][ptMachineArm64] | 1BD9CD9C696D8898AAEE5A6D6A7122F053202CF1865C511BFC91FCFD0D767864 |
| Per user - x64 | [PowerToysUserSetup-0.75.1-x64.exe][ptUserX64] | CFDAE52607689A695F4E4DDD7C1FE68400359AEF0D2B23C86122835E9D32A20F |
| Per user - ARM64 | [PowerToysUserSetup-0.75.1-arm64.exe][ptUserArm64] | 9BAD3EF71DEDE70445416AC7369D115FAE095152722BC4F23EE393D8A10F45CA |
| Machine wide - x64 | [PowerToysSetup-0.75.1-x64.exe][ptMachineX64] | 18FEB9377B0BA45189FFF4F89627B152DD794CCC15F005592B34A40A3EA62EA8 |
| Machine wide - ARM64 | [PowerToysSetup-0.75.1-arm64.exe][ptMachineArm64] | F5CDF5A35876A0B581F446BF728B7AC52B6B701C0850D9CEA9A1874523745CFD |
This is our preferred method.
@@ -97,158 +97,142 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
### 0.76 - November 2023 Update
### 0.75 - October 2023 Update
In this release, we focused on new features, stability and improvements.
**Highlights**
- Upgrade to .NET 8. Thanks [@snickler](https://github.com/snickler)!
- Keyboard Manager can now remap keys and shortcuts to send sequences of unicode text.
- Modernized the Keyboard Manager Editor UI. Thanks [@dillydylann](https://github.com/dillydylann)!
- Modernized the PowerToys Run, Quick Accent and Text Extractor UIs. Thanks [@niels9001](https://github.com/niels9001)!
- New File Explorer Add-ons: QOI image Preview Handler and Thumbnail Provider. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- New utility: An environment variables editor with the functionality to configure profiles that can be enabled/disabled. Thanks [@niels9001](https://github.com/niels9001) for the design and UI work that made this possible!
- Settings has a new Dashboard home page, with quick access for enabling modules, short descriptions and activation methods. Thanks [@niels9001](https://github.com/niels9001) for the design and UI work that made this possible!
- Added a previewer to Peek that hosts File Explorer previewers to support every file type that a machine is currently able to preview. For example, this means that if Microsoft Office handlers are installed, Peek can preview Office files. Thanks [@dillydylann](https://github.com/dillydylann)!
### General
- Updated the WebView 2 dependency to 1.0.2088.41. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed unreadable color brushes used across WinUI3 applications for improved accessibility. Thanks [@niels9001](https://github.com/niels9001)!
- Flyouts used across WinUI3 applications are no longer constrained to the application's bounds. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
- Upgraded the WPF-UI dependency to preview.9 and then preview.11. Thanks [@niels9001](https://github.com/niels9001) and [@pomianowski](https://github.com/pomianowski)!
- Upgraded to .NET 8. Thanks [@snickler](https://github.com/snickler)!
- Updated the WinAppSDK dependency to 1.4.3.
### Awake
- Many typo fixes through the projects and documentation. Thanks [@brianteeman](https://github.com/brianteeman)!
- Refactored and improved the logic across utilities for bringing a window to the foreground after activation.
- Added localization to the tray icon context menu.
### Color Picker
### Crop And Lock
- Fixed restoring windows that were reparented while maximized.
- After activating Color Picker, it's now possible to cancel the session by clicking the right mouse button. Thanks [@fredso90](https://github.com/fredso90)!
### Environment Variables
- Fixed crash caused by WinAppSDK version bump by replacing ListView elements with ItemsControl.
- Added a new utility: An environment variables editor that has the functionality to configure profiles that can be enabled/disabled. Thanks [@niels9001](https://github.com/niels9001) for the design and UI work that made this possible!
- Shows in the title bar if it's running as an administrator. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
### FancyZones
- Reverted a change that caused some applications, like the Windows Calculator, to not snap correctly. (This was a hotfix for 0.75)
- FancyZones Editor will no longer apply a layout to the current monitor after editing it.
- Fixed and refactored the code that detected if a window can be snapped. Added tests to it with known application window styles to avoid regressions in the future.
- Fixed an issue causing context menu pop-ups from some apps to automatically snap to a zone. (This was a hotfix for 0.74)
- Applied the fix for the context menu pop-ups to the logic that decides which windows can be snapped.
- Reworked the "Keep windows in their zones" option to include the work area and turn it on by default, fixing an incompatibility with the Copilot flyout.
- Fixed an issue causing windows to be snapped while moving to a different virtual desktop.
### File Explorer add-ons
- Solved an issue incorrectly detecting encoding when previewing code files preview.
- Fixed the background color for Gcode preview handler on dark theme. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- New utilities: Preview Handler and Thumbnail Provider for QOI image files. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- GCode Thumbnails are now in the 32 bit ARGB format. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Added the perceived type to SVG and QOI file thumbnails. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Fixed an issue blocking some SVG files from being previewed correctly. (This was a hotfix for 0.74)
- Fixed crashes on invalid files in the STL Thumbnail generator.
### GPO
- Added the missing Environment Variables utility policy to the .admx and .adml files. (This was a hotfix for 0.75)
- Fixed some typos and text improvements in the .adml file. Thanks [@htcfreek](https://github.com/htcfreek)!
### Hosts File Editor
- Added a proper warning when the hosts file is read-only and a button to make it writable. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added a global GPO rule that applies for all utilities unless it's overridden. Thanks [@htcfreek](https://github.com/htcfreek)!
- Added GPO rules to control which PowerToys Run plugins should be enabled/disabled by policy. Thanks [@htcfreek](https://github.com/htcfreek)!
* All plugins have to provide its plugin ID as static property in its Main method.
### Image Resizer
- Fixed a WPF-UI issue regarding the application's background brushes. Thanks [@niels9001](https://github.com/niels9001)!
### Installer
- Included the Text Extractor and Awake localization files in the install process.
- Fixed wrong .bmp file association in the registry. Thanks [@meitinger](https://github.com/meitinger)!
### Keyboard Manager
- Modernized the UI with the Fluent design. Thanks [@dillydylann](https://github.com/dillydylann)!
- Added the feature to remap keys and shortcuts to arbitrary unicode text sequences.
- Visually distinguish between the Numpad and regular period characters in the UI.
- This utility is now disabled by default on new installations, since it requires user configuration to affect keyboard behavior.
- Fixed a typo in the Numpad Subtract key in the editor.
### Mouse Without Borders
### Mouse Highlighter
- Removed Thread.Suspend calls when exiting the utility. That call is deprecated, unneeded and was causing a silent crash.
- Removed the lower limit of fade delay and duration, to allow better signaling of doing a double click. Thanks [@fredso90](https://github.com/fredso90)!
### Mouse Jump
- The process now runs in the background, for a faster activation time. Thanks [@mikeclayton](https://github.com/mikeclayton)!
### Peek
- Added the possibility to pause/resume videos with the space bar. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed high CPU usage when idle before initializing the main window. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Implemented Ctrl+W as a shortcut to close Peek. Thanks [@Physalis2](https://github.com/Physalis2)!
- Solved an issue incorrectly detecting encoding when previewing code files.
- Fixed background issues when peeking into HTML files after the WebView 2 upgrade.
- Reported file sizes will now more closely match what's reported by File Explorer. Thanks [@Deepak-Sangle](https://github.com/Deepak-Sangle)!
- Added a previewer that hosts File Explorer previewers to support every file type that a machine is currently able to preview. Thanks [@dillydylann](https://github.com/dillydylann)!
- Fixed an issue causing the preview of the first file to be stuck loading. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed showing the previously previewed video file when invoking Peek with a new file. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added the wrap and file formatting options to the Monaco previewer. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
### PowerRename
- Save data from the last run in a different file to avoid conflicting with changing settings in the Settings application.
### PowerToys Run
- Moved to WPF-UI and redesigned according to Fluent UX principles. Thanks [@niels9001](https://github.com/niels9001)!
- Fixed an issue causing 3rd party plugins to not have their custom settings correctly initialized with default values. (This was a hotfix for 0.75) Thanks [@waaverecords](https://github.com/waaverecords)!
- Fixed a crash in the VSCode plugin when the VSCode path had trailing backspaces. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed a crash when trying to load invalid image icons.
- Fixed a crash in the Programs plugin when getting images for some .lnk files.
- Fixed a rare startup initialization error and removed cold start operations that were no longer needed. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Improved calculations for Windows File Time and Unix Epoch Time in the DateTime plugin. Thanks [@htcfreek](https://github.com/htcfreek)!
- Fixed a crash when trying to get the icon for a link that pointed to no file.
- Cleaned up code in the WindowWalker plugin improving the logic. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed a case where the query wasn't being cleared after invoking a result action through the keyboard. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Improved the shell selection option for Windows Terminal in the Shell plugin and improved the backend code for adding combo box options to plugins. Thanks [@htcfreek](https://github.com/htcfreek)!
* The implementation of the combo box items has changed and isn't backward compatible. (Old plugins won't crash, but the combo box setting isn't shown in settings ui anymore.)
- Added Unix time in milliseconds, fixed negative unix time input and improved error messages in the TimeDate plugin. Thanks [@htcfreek](https://github.com/htcfreek)!
- The PowerToys plugin allows calling the new Environment Variables utility. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Refactored and added support to VSCodium Stable, VSCodium Insider and Remote Tunnels workspaces. Thanks [@eternalphane](https://github.com/eternalphane)!
### Quick Accent
- Moved from ModernWPF to WPF-UI. Thanks [@niels9001](https://github.com/niels9001)!
- Added support to the Finnish language character set. Thanks [@davidtlascelles](https://github.com/davidtlascelles)!
- Added currency symbols for Croatian, Gaeilge, Gàidhlig and Welsh. Thanks [@PesBandi](https://github.com/PesBandi)!
- Added a missing Latin letter ꝡ. Thanks [@cubedhuang](https://github.com/cubedhuang)!
- Added fraction characters. Thanks [@PesBandi](https://github.com/PesBandi)!
- Added support to the Danish language character set. Thanks [@PesBandi](https://github.com/PesBandi)!
- Added the Kazakhstani Tenge character to the Currencies characters set. Thanks [@PesBandi](https://github.com/PesBandi)!
- Renamed Slovakian to Slovak, which is the correct term. Thanks [@PesBandi](https://github.com/PesBandi)!
- Added the Greek language character set. Thanks [@mcbabo](https://github.com/mcbabo)!
- Fixed characters that were removed from "All languages" because they were not in any single language. (This was a hotfix for 0.74)
- Added Asturian characters to the Spanish character set. Thanks [@blakestack](https://github.com/blakestack)!
- Added Greek characters with tonos. Thanks [@PesBandi](https://github.com/PesBandi)!
### Registry Preview
- Fixed a parsing error that crashed the Application. (This was a hotfix for 0.74)
- Fixed opening file names with non-ASCII characters. Thanks [@randyrants](https://github.com/randyrants)!
- Fixed wrong parsing when the file contained an assignment with spaces around the equals sign. Thanks [@randyrants](https://github.com/randyrants)!
- Fixed key transversal issues when a key was a substring of a parent key. Thanks [@randyrants](https://github.com/randyrants)!
### Runner
- Fixed the update notification toast to show a Unicode arrow. Thanks [@TheJoeFin](https://github.com/TheJoeFin)!
### Settings
- When clicking a module's name on the Dashboard, it will navigate to that module's page.
- Fixed the clipping of information in the Backup and Restore section of the General Settings page. Thanks [@niels9001](https://github.com/niels9001)!
- Updated the File Explorer Add-ons fluent icon. Thanks [@niels9001](https://github.com/niels9001)!
- Added a warning when trying to set a shortcut that might conflict with "Alt Gr" key combinations.
- Added a direct link to the OOBE's "What's New page" from the main Settings window. Thanks [@iakrayna](https://github.com/iakrayna)!
- Changed mentions from Microsoft Docs to Microsoft Learn.
- Fixed the slow reaction to system theme changes.
- Added a new Dashboard home page, with quick access for enabling modules, short descriptions and activation methods. Thanks [@niels9001](https://github.com/niels9001) for the design and UI work that made this possible!
- Fixed a typo in the Hosts File Editor page. Thanks [@Deepak-Sangle](https://github.com/Deepak-Sangle)!
- Added a lock icon to the flyout listing of all modules when its enabled state is controlled by policy.
- The "All apps" list in the flyout will now list all apps even if their enabled state is controlled by policy.
### Text Extractor
### Video Conference Mute
- Move to WPF-UI, localization and light theme support. Thanks [@niels9001](https://github.com/niels9001)!
- Disabled by default on Windows 11, with a information box on Settings to prefer using the Windows Snipping Tool, which now supports OCR.
- Added an option to allow for the toolbar to hide after some time passed. Thanks [@quyenvsp](https://github.com/quyenvsp)!
- Added an option to select to mute or unmute at startup. Thanks [@quyenvsp](https://github.com/quyenvsp)!
- Fixed an issue causing a cascade of mute/unmute triggers.
### Documentation
- Fixed some typos in the README. Thanks [@Asymtode712](https://github.com/Asymtode712)!
- Reworked the gpo docs on learn.microsoft.com, adding .admx, registry and Intune information. Thanks [@htcfreek](https://github.com/htcfreek)!
- Updated the Group Policy documentation on learn.microsoft.com, removed the Group Policy documentation from the repository and linked to the published documentation on learn.microsoft.com instead.
### Development
- Updated the check-spelling ci action to 0.22. Thanks [@jsoref](https://github.com/jsoref)!
- Refactored the modules data model used between the Settings Dashboard and Flyout.
- Fixed a flaky interop test that was causing automated CI to hang occasionally.
- Increased the WebView 2 loading timeout to reduce flakiness in those tests. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added support for building with the Dev Drive CopyOnWrite feature, increasing build speed. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Addressed the C# static analyzers suggestions. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Addressed the C++ static analyzers suggestions.
- PRs that only contain Markdown or text files changes no longer trigger the full CI. Thanks [@snickler](https://github.com/snickler)!
- Updated the Microsoft.Windows.CsWinRT to 2.0.4 to fix building with the official Visual Studio 17.8 release.
- Fixed new code quality issues caught by the official Visual Studio 17.8 release.
- Added a bot trigger to point contributors to the main new contribution issue on GitHub. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Removed unneeded entries from expect.txt.
- Turned off a new feature from Visual Studio that was adding the commit hash to the binary files Product Version.
- Refactored and reviewed the spellcheck entries into different files. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
- Added Spectre mitigation and SHA256 hash creation for some DLLs.
- Reverted the release pipeline template to a previous release that's stable for shipping PowerToys.
- Added project dependencies to the version project and headers to avoid building errors. Thanks [@johnterickson](https://github.com/johnterickson)!
- Enabled Control Flow Guard in the C++ projects. Thanks [@DHowett](https://github.com/DHowett)!
- Switched the release pipeline to the 1ES governed template. Thanks [@DHowett](https://github.com/DHowett)!
- Styled XAML files and added a XAML Style checker to the solution, with a CI action to check if code being contributed is compliant. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Suppressed redundant midl file warnings in PowerRename.
- Add unit tests to FancyZones Editor. Thanks [@garv5014](https://github.com/garv5014), [@andrewbengordon](https://github.com/andrewbengordon) and [@Cwighty](https://github.com/Cwighty)!
- Improved the Default Layouts internal structure in FancyZones Editor. Thanks [@garv5014](https://github.com/garv5014)!
- Fixed code issues to allow building in Visual Studio 17.8 Preview 4.
#### What is being planned for version 0.77
#### What is being planned for version 0.76
For [v0.77][github-next-release-work], we'll work on the items below:
For [v0.76][github-next-release-work], we'll work on the items below:
- New utility: Command Not Found
- Language selection
- .NET 8 upgrade
- Allowing Keyboard Manager to output arbitrary Unicode sequences
- Automated UI testing through WinAppDriver
- Develop support for Desired State Configuration
- Modernize and refresh the UX of PowerToys based on WPF. Here's the Work in Progress preview for "Color Picker":
- Modernize and refresh the UX of PowerToys based on WPF. Here's Work in Progress previews for the modules "PowerToys Run" and "Color Picker":
![PowerToys Run UI refresh WIP](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055)
![ColorPicker UI refresh WIP](https://github.com/microsoft/PowerToys/assets/9866362/ceebe54b-de63-4ce7-afcb-2cd4280bf4d1)

View File

@@ -138,6 +138,9 @@
<Custom Action="CheckGPO" After="InstallInitialize">
NOT Installed
</Custom>
<Custom Action="CheckAdministratorConstraints" After="InstallInitialize">
NOT Installed
</Custom>
<Custom Action="ApplyModulesRegistryChangeSets" After="InstallFiles">
NOT Installed
</Custom>
@@ -347,6 +350,13 @@
DllEntry="CheckGPOCA"
/>
<CustomAction Id="CheckAdministratorConstraints"
Return="check"
Impersonate="yes"
BinaryKey="PTCustomActions"
DllEntry="CheckAdministratorConstraintsCA"
/>
<!-- Close 'PowerToys.exe' before uninstall-->
<Property Id="MSIRESTARTMANAGERCONTROL" Value="DisableShutdown" />
<Property Id="MSIFASTINSTALL" Value="DisableShutdown" />

View File

@@ -15,10 +15,11 @@
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Management.Deployment.h>
#include <wtsapi32.h>
#include <processthreadsapi.h>
#include <sddl.h>
#include <UserEnv.h>
#include <winnt.h>
#include <wtsapi32.h>
using namespace std;
@@ -93,6 +94,65 @@ BOOL IsLocalSystem()
return bSystem;
}
bool GetUserSid(const wchar_t* username, PSID& sid)
{
DWORD sidSize = 0;
DWORD domainNameSize = 0;
SID_NAME_USE sidNameUse;
LookupAccountName(nullptr, username, nullptr, &sidSize, nullptr, &domainNameSize, &sidNameUse);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
Logger::error("Failed to get buffer sizes");
return false;
}
sid = LocalAlloc(LPTR, sidSize);
LPWSTR domainName = static_cast<LPWSTR>(LocalAlloc(LPTR, domainNameSize * sizeof(wchar_t)));
if (!LookupAccountNameW(nullptr, username, sid, &sidSize, domainName, &domainNameSize, &sidNameUse))
{
Logger::error("Failed to lookup account name");
LocalFree(sid);
LocalFree(domainName);
return false;
}
LocalFree(domainName);
return true;
}
std::wstring GetCurrentUserSid()
{
wchar_t username[UNLEN + 1];
DWORD usernameSize = UNLEN + 1;
std::wstring result;
if (!GetUserNameW(username, &usernameSize))
{
Logger::error("Failed to get the current user name");
return result;
}
PSID sid;
if (GetUserSid(username, sid))
{
LPWSTR sidString;
if (ConvertSidToStringSid(sid, &sidString))
{
result = sidString;
LocalFree(sidString);
}
LocalFree(sid);
}
else
{
Logger::error(L"Failed to get SID for user \"");
}
return result;
}
BOOL ImpersonateLoggedInUserAndDoSomething(std::function<bool(HANDLE userToken)> action)
{
HRESULT hr = S_OK;
@@ -262,6 +322,29 @@ LExit:
return WcaFinalize(er);
}
UINT __stdcall CheckAdministratorConstraintsCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
std::wstring asd;
hr = WcaInitialize(hInstall, "CheckAdministratorConstraintsCA");
ExitOnFailure(hr, "Failed to initialize");
LPWSTR currentScope = nullptr;
hr = WcaGetProperty(L"InstallScope", &currentScope);
if (std::wstring{ currentScope } == L"perUser")
{
}
asd = GetCurrentUserSid();
MessageBox(NULL, asd.c_str(), asd.c_str(), NULL);
LExit:
UINT er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
UINT __stdcall ApplyModulesRegistryChangeSetsCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;

View File

@@ -3,6 +3,7 @@ LIBRARY "PowerToysSetupCustomActions"
EXPORTS
LaunchPowerToysCA
CheckGPOCA
CheckAdministratorConstraintsCA
ApplyModulesRegistryChangeSetsCA
DetectPrevInstallPathCA
RemoveScheduledTasksCA

View File

@@ -465,13 +465,14 @@
TextChanged="EditVariableDialogValueTxtBox_TextChanged"
TextWrapping="Wrap" />
<MenuFlyoutSeparator Visibility="{Binding ShowAsList, Converter={StaticResource BoolToVisibilityConverter}}" />
<ItemsControl
<ListView
x:Name="EditVariableValuesList"
Margin="0,-8,0,12"
Margin="-16,-8,0,12"
HorizontalAlignment="Stretch"
ItemsSource="{Binding ValuesList, Mode=TwoWay}"
SelectionMode="None"
Visibility="{Binding ShowAsList, Converter={StaticResource BoolToVisibilityConverter}}">
<ItemsControl.ItemTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
@@ -522,8 +523,8 @@
</Button>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</ScrollViewer>
</ContentDialog>
@@ -582,14 +583,15 @@
HorizontalAlignment="Right"
Visibility="Collapsed" />
<ItemsControl
<ListView
x:Name="NewProfileVariablesListView"
Grid.Row="1"
Grid.ColumnSpan="2"
Margin="0,-8,0,12"
Margin="-16,-8,0,12"
HorizontalAlignment="Stretch"
ItemsSource="{Binding Variables, Mode=TwoWay}">
<ItemsControl.ItemTemplate>
ItemsSource="{Binding Variables, Mode=TwoWay}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:Variable">
<Grid Height="48" ColumnSpacing="8">
<Grid.ColumnDefinitions>
@@ -615,8 +617,8 @@
Visibility="Collapsed" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ListView.ItemTemplate>
</ListView>
</Grid>

View File

@@ -49,17 +49,7 @@ public partial class OCROverlay : Window
Top = screenRectangle.Top >= 0 ? screenRectangle.Top : screenRectangle.Top + (screenRectangle.Height / 2);
InitializeComponent();
// workaround for #30177
try
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this, Wpf.Ui.Controls.WindowBackdropType.None);
}
catch (Exception ex)
{
Logger.LogError($"Exception in SystemThemeWatcher.Watch, issue 30177. {ex.Message}");
}
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this, Wpf.Ui.Controls.WindowBackdropType.None);
PopulateLanguageMenu();
}

View File

@@ -34,13 +34,12 @@ FancyZonesWindowProcessing::ProcessabilityType FancyZonesWindowProcessing::Defin
bool isPopup = FancyZonesWindowUtils::HasStyle(style, WS_POPUP);
bool hasThickFrame = FancyZonesWindowUtils::HasStyle(style, WS_THICKFRAME);
bool hasCaption = FancyZonesWindowUtils::HasStyle(style, WS_CAPTION);
bool hasMinimizeMaximizeButtons = FancyZonesWindowUtils::HasStyle(style, WS_MINIMIZEBOX) || FancyZonesWindowUtils::HasStyle(style, WS_MAXIMIZEBOX);
if (isPopup && !(hasThickFrame && (hasCaption || hasMinimizeMaximizeButtons)))
bool hasCaption = FancyZonesWindowUtils::HasStyle(style, WS_CAPTION);
if (isPopup && !(hasThickFrame && hasCaption))
{
// popup windows we want to snap: e.g. Calculator, Telegram
// popup windows we don't want to snap: start menu, notification popup, tray window, etc.
// WS_CAPTION, WS_MINIMIZEBOX, WS_MAXIMIZEBOX are used for filtering out menus,
// WS_CAPTION is used for filtering out menus,
// e.g., in Edge "Running as admin" menu when creating a new PowerToys issue.
return ProcessabilityType::NonProcessablePopupWindow;
}

View File

@@ -118,14 +118,6 @@ namespace FancyZonesUnitTests
Assert::IsTrue(FancyZonesWindowProcessing::IsProcessable(window));
}
TEST_METHOD(Popup_FacebookMessenger)
{
HWND window = Mocks::WindowCreate(hInst, L"", L"", 0, WS_GROUP | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TABSTOP | WS_THICKFRAME);
Assert::AreEqual(FancyZonesWindowProcessing::ProcessabilityType::Processable, FancyZonesWindowProcessing::DefineWindowType(window));
Assert::IsTrue(FancyZonesWindowProcessing::IsProcessable(window));
}
TEST_METHOD (ChildWindow_OptionDisabled)
{
FancyZonesSettings::instance().SetSettings(Settings{ .allowSnapChildWindows = false });

View File

@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Linq;
using Common.UI;
using ImageResizer.ViewModels;
using ManagedCommon;
using Microsoft.Win32;
using Wpf.Ui.Controls;
using AppResources = ImageResizer.Properties.Resources;
@@ -19,8 +18,7 @@ namespace ImageResizer.Views
public MainWindow(MainViewModel viewModel)
{
DataContext = viewModel;
InitializeComponent();
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
if (OSVersionHelper.IsWindows11())
{
@@ -31,15 +29,7 @@ namespace ImageResizer.Views
WindowBackdropType = WindowBackdropType.None;
}
// workaround for #30177
try
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this, WindowBackdropType);
}
catch (Exception ex)
{
Logger.LogError($"Exception in SystemThemeWatcher.Watch, issue 30177. {ex.Message}");
}
InitializeComponent();
}
public IEnumerable<string> OpenPictureFiles()

View File

@@ -23,7 +23,6 @@ using Wox.Infrastructure.Image;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
using Wox.Plugin.Logger;
using Wpf.Ui.Appearance;
using Stopwatch = Wox.Infrastructure.Stopwatch;
namespace PowerLauncher
@@ -153,9 +152,6 @@ namespace PowerLauncher
_settingsReader.ReadSettingsOnChange();
_themeManager.ThemeChanged += OnThemeChanged;
OnThemeChanged(_settings.Theme, _settings.Theme);
textToLog.AppendLine("End PowerToys Run startup ---------------------------------------------------- ");
bootTime.Stop();
@@ -221,37 +217,6 @@ namespace PowerLauncher
/// <param name="newTheme">Current Theme</param>
private void OnThemeChanged(Theme oldTheme, Theme newTheme)
{
// If OS theme is high contrast, don't change theme.
if (SystemParameters.HighContrast)
{
return;
}
ApplicationTheme theme = ApplicationTheme.Unknown;
switch (newTheme)
{
case Theme.Dark:
theme = ApplicationTheme.Dark; break;
case Theme.Light:
theme = ApplicationTheme.Light; break;
case Theme.HighContrastWhite:
case Theme.HighContrastBlack:
case Theme.HighContrastOne:
case Theme.HighContrastTwo:
theme = ApplicationTheme.HighContrast; break;
default:
break;
}
_mainWindow?.Dispatcher.Invoke(() =>
{
if (theme != ApplicationTheme.Unknown)
{
ApplicationThemeManager.Apply(theme);
}
});
ImageLoader.UpdateIconPath(newTheme);
_mainVM.Query();
}

View File

@@ -108,7 +108,7 @@
<TextBlock
x:Name="AutoCompleteTextBlock"
Grid.Column="1"
Margin="7,0,7,0"
Margin="7,0,14,0"
VerticalAlignment="Center"
x:FieldModifier="public"
Canvas.ZIndex="-1"

View File

@@ -27,8 +27,7 @@
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
WindowStartupLocation="Manual"
WindowStyle="None"
mc:Ignorable="d"
MinHeight="0">
mc:Ignorable="d">
<Grid x:Name="RootGrid" MouseDown="OnMouseDown">
<!-- We set the background here because the Acrylic can be too translucent / background too bright on Light theme -->

View File

@@ -56,6 +56,8 @@ namespace PowerLauncher
_settings = settings;
InitializeComponent();
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
if (OSVersionHelper.IsWindows11())
{
WindowBackdropType = Wpf.Ui.Controls.WindowBackdropType.Acrylic;
@@ -65,16 +67,6 @@ namespace PowerLauncher
WindowBackdropType = Wpf.Ui.Controls.WindowBackdropType.None;
}
// workaround for #30217
try
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this, WindowBackdropType);
}
catch (Exception ex)
{
Log.Exception("Exception in SystemThemeWatcher.Watch, issue 30217.", ex, GetType());
}
_firstDeleteTimer.Elapsed += CheckForFirstDelete;
_firstDeleteTimer.Interval = 1000;
NativeEventWaiter.WaitForEventLoop(

View File

@@ -50,7 +50,7 @@ namespace PowerLauncher.ViewModel
{
get
{
return (_settings.MaxResultsToShow * 50) + 40;
return _settings.MaxResultsToShow * 75;
}
}

View File

@@ -83,10 +83,17 @@ namespace Wox.Infrastructure.Image
public static BitmapSource GetThumbnail(string fileName, int width, int height, ThumbnailOptions options)
{
IntPtr hBitmap = IntPtr.Zero;
string targetLinkedFilePath = string.Empty;
if (Path.GetExtension(fileName).Equals(".lnk", StringComparison.OrdinalIgnoreCase))
{
hBitmap = ExtractIconToHBitmap(fileName);
// If the file has a '.lnk' extension, it is a shortcut file. Use the shellLinkHelper to retrieve the actual target file path from the shortcut.
IShellLinkHelper shellLinkHelper = new ShellLinkHelper();
targetLinkedFilePath = shellLinkHelper.RetrieveTargetPath(fileName);
}
if (!string.IsNullOrEmpty(targetLinkedFilePath))
{
hBitmap = ExtractIconToHBitmap(targetLinkedFilePath);
}
else
{

View File

@@ -5,7 +5,6 @@
using System;
using System.ComponentModel;
using System.Windows;
using ManagedCommon;
using Wpf.Ui.Controls;
using Point = PowerAccent.Core.Point;
using Size = PowerAccent.Core.Size;
@@ -39,17 +38,7 @@ public partial class Selector : FluentWindow, IDisposable, INotifyPropertyChange
public Selector()
{
InitializeComponent();
// workaround for #30177
try
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
}
catch (Exception ex)
{
Logger.LogError($"Exception in SystemThemeWatcher.Watch, issue 30177. {ex.Message}");
}
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
Application.Current.MainWindow.ShowActivated = false;
Application.Current.MainWindow.Topmost = true;
}

View File

@@ -130,7 +130,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
DefaultBackgroundColor = Color.Transparent,
};
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents --disable-features=RendererAppContainer");
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: _webView2UserDataFolder, options: webView2Options)

View File

@@ -125,13 +125,10 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
InitializeIndexFileAndSelectedFile(filePath);
Logger.LogInfo("Create WebView2 environment");
var webView2Options = new CoreWebView2EnvironmentOptions("--disable-features=RendererAppContainer");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(
userDataFolder: System.Environment.GetEnvironmentVariable("USERPROFILE") +
"\\AppData\\LocalLow\\Microsoft\\PowerToys\\MonacoPreview-Temp",
options: webView2Options)
.CreateAsync(userDataFolder: System.Environment.GetEnvironmentVariable("USERPROFILE") +
"\\AppData\\LocalLow\\Microsoft\\PowerToys\\MonacoPreview-Temp")
.ConfigureAwait(true).GetAwaiter();
webView2EnvironmentAwaiter.OnCompleted(async () =>
{

View File

@@ -225,7 +225,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
_browser.Dock = DockStyle.Fill;
// Prevent new windows from being opened.
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents --disable-features=RendererAppContainer");
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: _webView2UserDataFolder, options: webView2Options)

View File

@@ -142,7 +142,7 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Svg
thumbnailDone.Set();
};
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents --disable-features=RendererAppContainer");
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: _webView2UserDataFolder, options: webView2Options)