mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-29 08:29:10 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
081cd3b017 | ||
|
|
d1794e284a | ||
|
|
0bb1a95b46 | ||
|
|
4dd712008e | ||
|
|
38b19096e2 | ||
|
|
5bc07a1329 | ||
|
|
676b56a73f | ||
|
|
37ef90103c | ||
|
|
220f27a2a9 |
@@ -4,9 +4,8 @@
|
||||
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
||||
<policyNamespaces>
|
||||
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
|
||||
<using prefix="windows" namespace="Microsoft.Policies.Windows" />
|
||||
</policyNamespaces>
|
||||
<resources minRequiredRevision="1.0"/>
|
||||
<resources minRequiredRevision="1.0"/><!-- PowerToys v0.64.0 -->
|
||||
<supportedOn>
|
||||
<definitions>
|
||||
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
|
||||
|
||||
@@ -103,6 +103,7 @@ std::vector<ProcessResult> find_processes_recursive(const std::vector<std::wstri
|
||||
{
|
||||
process_info.name,
|
||||
process_info.pid,
|
||||
process_info.user,
|
||||
std::vector(it->second.begin(), it->second.end())
|
||||
});
|
||||
}
|
||||
@@ -111,50 +112,6 @@ std::vector<ProcessResult> find_processes_recursive(const std::vector<std::wstri
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring pid_to_user(DWORD pid)
|
||||
{
|
||||
HANDLE process = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);
|
||||
|
||||
if (process == NULL)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::wstring user = L"";
|
||||
std::wstring domain = L"";
|
||||
|
||||
HANDLE token = NULL;
|
||||
|
||||
if (OpenProcessToken(process, TOKEN_QUERY, &token))
|
||||
{
|
||||
DWORD token_size = 0;
|
||||
GetTokenInformation(token, TokenUser, NULL, 0, &token_size);
|
||||
|
||||
if (token_size > 0)
|
||||
{
|
||||
std::vector<BYTE> token_buffer(token_size);
|
||||
GetTokenInformation(token, TokenUser, token_buffer.data(), token_size, &token_size);
|
||||
TOKEN_USER* user_ptr = (TOKEN_USER*)token_buffer.data();
|
||||
PSID psid = user_ptr->User.Sid;
|
||||
DWORD user_size = 0;
|
||||
DWORD domain_size = 0;
|
||||
SID_NAME_USE sid_name;
|
||||
LookupAccountSidW(NULL, psid, NULL, &user_size, NULL, &domain_size, &sid_name);
|
||||
user.resize(user_size + 1);
|
||||
domain.resize(domain_size + 1);
|
||||
LookupAccountSidW(NULL, psid, user.data(), &user_size, domain.data(), &domain_size, &sid_name);
|
||||
user[user_size] = L'\0';
|
||||
domain[domain_size] = L'\0';
|
||||
}
|
||||
|
||||
CloseHandle(token);
|
||||
}
|
||||
|
||||
CloseHandle(process);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
constexpr size_t LongMaxPathSize = 65536;
|
||||
|
||||
std::wstring pid_to_full_path(DWORD pid)
|
||||
|
||||
@@ -6,14 +6,12 @@ struct ProcessResult
|
||||
{
|
||||
std::wstring name;
|
||||
DWORD pid;
|
||||
std::wstring user;
|
||||
std::vector<std::wstring> files;
|
||||
};
|
||||
|
||||
// Second version, checks handles towards files and all subfiles and folders of given dirs, if any.
|
||||
std::vector<ProcessResult> find_processes_recursive(const std::vector<std::wstring>& paths);
|
||||
|
||||
// Gives the user name of the account running this process
|
||||
std::wstring pid_to_user(DWORD pid);
|
||||
|
||||
// Gives the full path of the executable, given the process id
|
||||
std::wstring pid_to_full_path(DWORD pid);
|
||||
|
||||
@@ -128,46 +128,6 @@
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\FileLocksmith\</OutDir>
|
||||
<TargetName>PowerToys.FileLocksmithLib.Interop</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;FILELOCKSMITHLIBINTEROP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAsManaged>NetCore</CompileAsManaged>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AdditionalOptions>/Zc:twoPhase-</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;FILELOCKSMITHLIBINTEROP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAsManaged>NetCore</CompileAsManaged>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>/Zc:twoPhase-</AdditionalOptions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
||||
@@ -238,6 +238,57 @@ std::vector<NtdllExtensions::HandleInfo> NtdllExtensions::handles() noexcept
|
||||
// Returns the list of all processes.
|
||||
// On failure, returns an empty vector.
|
||||
|
||||
std::wstring NtdllExtensions::pid_to_user(DWORD pid)
|
||||
{
|
||||
HANDLE process = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);
|
||||
std::wstring user;
|
||||
std::wstring domain;
|
||||
|
||||
if (process == nullptr)
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
HANDLE token = nullptr;
|
||||
|
||||
if (!OpenProcessToken(process, TOKEN_QUERY, &token))
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
DWORD token_size = 0;
|
||||
GetTokenInformation(token, TokenUser, nullptr, 0, &token_size);
|
||||
|
||||
if (token_size < 0)
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
std::vector<BYTE> token_buffer(token_size);
|
||||
GetTokenInformation(token, TokenUser, token_buffer.data(), token_size, &token_size);
|
||||
TOKEN_USER* user_ptr = (TOKEN_USER*)token_buffer.data();
|
||||
PSID psid = user_ptr->User.Sid;
|
||||
DWORD user_buf_size = 0;
|
||||
DWORD domain_buf_size = 0;
|
||||
SID_NAME_USE sid_name;
|
||||
LookupAccountSidW(nullptr, psid, nullptr, &user_buf_size, nullptr, &domain_buf_size, &sid_name);
|
||||
if (!user_buf_size || !domain_buf_size)
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
user.resize(user_buf_size);
|
||||
domain.resize(domain_buf_size);
|
||||
LookupAccountSidW(nullptr, psid, user.data(), &user_buf_size, domain.data(), &domain_buf_size, &sid_name);
|
||||
user.resize(user.size() - 1);
|
||||
domain.resize(domain.size() - 1);
|
||||
CloseHandle(token);
|
||||
CloseHandle(process);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
std::vector<NtdllExtensions::ProcessInfo> NtdllExtensions::processes() noexcept
|
||||
{
|
||||
auto get_info_result = NtQuerySystemInformationMemoryLoop(SystemProcessInformation);
|
||||
@@ -258,6 +309,7 @@ std::vector<NtdllExtensions::ProcessInfo> NtdllExtensions::processes() noexcept
|
||||
item.name = unicode_to_str(info_ptr->ImageName);
|
||||
item.pid = (DWORD)(uintptr_t)info_ptr->UniqueProcessId;
|
||||
item.modules = process_modules(item.pid);
|
||||
item.user = pid_to_user(item.pid);
|
||||
|
||||
result.push_back(item);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
{
|
||||
DWORD pid;
|
||||
std::wstring name;
|
||||
std::wstring user;
|
||||
std::vector<std::wstring> modules;
|
||||
};
|
||||
|
||||
@@ -44,6 +45,9 @@ public:
|
||||
|
||||
std::wstring path_to_kernel_name(LPCWSTR path);
|
||||
|
||||
// Gives the user name of the account running this process
|
||||
std::wstring pid_to_user(DWORD pid);
|
||||
|
||||
std::vector<HandleInfo> handles() noexcept;
|
||||
|
||||
// Returns the list of all processes.
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace FileLocksmith::Interop
|
||||
{
|
||||
System::String^ name;
|
||||
System::UInt32 pid;
|
||||
System::String^ user;
|
||||
array<System::String^>^ files;
|
||||
};
|
||||
|
||||
@@ -69,6 +70,7 @@ namespace FileLocksmith::Interop
|
||||
|
||||
item->name = from_wstring_view(result_cpp[i].name);
|
||||
item->pid = result_cpp[i].pid;
|
||||
item->user = from_wstring_view(result_cpp[i].user);
|
||||
|
||||
const int n_files = static_cast<int>(result_cpp[i].files.size());
|
||||
item->files = gcnew array<System::String ^>(n_files);
|
||||
@@ -83,12 +85,6 @@ namespace FileLocksmith::Interop
|
||||
return result;
|
||||
}
|
||||
|
||||
static System::String^ PidToUser(System::UInt32 pid)
|
||||
{
|
||||
auto user_cpp = pid_to_user(pid);
|
||||
return from_wstring_view(user_cpp);
|
||||
}
|
||||
|
||||
static System::String^ PidToFullPath(System::UInt32 pid)
|
||||
{
|
||||
auto path_cpp = pid_to_full_path(pid);
|
||||
@@ -180,5 +176,72 @@ namespace FileLocksmith::Interop
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Adapted from "https://learn.microsoft.com/en-us/windows/win32/secauthz/enabling-and-disabling-privileges-in-c--" */
|
||||
static System::Boolean SetDebugPrivilege()
|
||||
{
|
||||
HANDLE hToken;
|
||||
TOKEN_PRIVILEGES tp;
|
||||
LUID luid;
|
||||
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken) != 0)
|
||||
{
|
||||
if (!LookupPrivilegeValue(
|
||||
NULL, // lookup privilege on local system
|
||||
SE_DEBUG_NAME, // privilege to lookup
|
||||
&luid)) // receives LUID of privilege
|
||||
{
|
||||
CloseHandle(hToken);
|
||||
return false;
|
||||
}
|
||||
tp.PrivilegeCount = 1;
|
||||
tp.Privileges[0].Luid = luid;
|
||||
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
|
||||
if (!AdjustTokenPrivileges(
|
||||
hToken,
|
||||
FALSE,
|
||||
&tp,
|
||||
sizeof(TOKEN_PRIVILEGES),
|
||||
(PTOKEN_PRIVILEGES)NULL,
|
||||
(PDWORD)NULL))
|
||||
{
|
||||
CloseHandle(hToken);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetLastError() == ERROR_NOT_ALL_ASSIGNED)
|
||||
{
|
||||
CloseHandle(hToken);
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseHandle(hToken);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// adapted from common/utils/elevation.h. No need to bring all dependencies to this project, though.
|
||||
// TODO: Make elevation.h lighter so that this function can be used without bringing dependencies like spdlog in.
|
||||
static System::Boolean IsProcessElevated()
|
||||
{
|
||||
HANDLE token = nullptr;
|
||||
bool elevated = false;
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
TOKEN_ELEVATION elevation;
|
||||
DWORD size;
|
||||
if (GetTokenInformation(token, TokenElevation, &elevation, sizeof(elevation), &size))
|
||||
{
|
||||
elevated = (elevation.TokenIsElevated != 0);
|
||||
}
|
||||
}
|
||||
if (token)
|
||||
{
|
||||
CloseHandle(token);
|
||||
}
|
||||
return elevated;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,7 +40,17 @@ namespace FileLocksmithUI
|
||||
return;
|
||||
}
|
||||
|
||||
_window = new MainWindow(Environment.GetCommandLineArgs().Contains("--elevated"));
|
||||
bool isElevated = FileLocksmith.Interop.NativeMethods.IsProcessElevated();
|
||||
|
||||
if (isElevated)
|
||||
{
|
||||
if (!FileLocksmith.Interop.NativeMethods.SetDebugPrivilege())
|
||||
{
|
||||
Logger.LogWarning("Couldn't set debug privileges to see system processes.");
|
||||
}
|
||||
}
|
||||
|
||||
_window = new MainWindow(isElevated);
|
||||
_window.Activate();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,29 @@
|
||||
namespace PowerToys.FileLocksmithUI.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
public sealed class PidToUserConverter : IValueConverter
|
||||
public sealed class UserToSystemWarningVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return NativeMethods.PidToUser((uint)value);
|
||||
string user = ((string)value).ToUpperInvariant().Trim();
|
||||
if (user.Equals("SYSTEM", StringComparison.Ordinal) || user.Equals("LOCALSYSTEM", StringComparison.Ordinal))
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return value;
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
|
||||
<PackageReference Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.2" />
|
||||
<PackageReference Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.7" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.5" />
|
||||
|
||||
@@ -136,6 +136,9 @@
|
||||
<value>Click to see the entire list of paths.</value>
|
||||
<comment>Paths as in file paths that were selected for the utility to check.</comment>
|
||||
</data>
|
||||
<data name="ProcessIsSystemUserWarning.Text" xml:space="preserve">
|
||||
<value>The process belongs to a system user. Closing it may cause the system to malfunction.</value>
|
||||
</data>
|
||||
<data name="SelectedFilesListDialog.Title" xml:space="preserve">
|
||||
<value>Selected file paths</value>
|
||||
<comment>Paths as in file paths that were selected for the utility to check.</comment>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:interop="using:FileLocksmith.Interop"
|
||||
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:local="using:PowerToys.FileLocksmithUI.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkitConverters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
mc:Ignorable="d">
|
||||
@@ -25,7 +24,7 @@
|
||||
TrueValue="Collapsed" />
|
||||
<converters:FileCountConverter x:Key="fileCountConverter" />
|
||||
<converters:PidToIconConverter x:Key="pidToIconConverter" />
|
||||
<converters:PidToUserConverter x:Key="pidToUserConverter" />
|
||||
<converters:UserToSystemWarningVisibilityConverter x:Key="userToSystemWarningVisibilityConverter" />
|
||||
<converters:FileListToDescriptionConverter x:Key="fileListToDescriptionConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
@@ -41,23 +40,28 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Padding="18,0,18,4" VerticalAlignment="Bottom">
|
||||
<!--<TextBlock Margin="0,2,0,0" Text="Current proccesses:" Style="{ThemeResource BodyStrongTextBlockStyle}"/>-->
|
||||
<Button Content="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}" Click="ShowSelectedPathsButton_Click">
|
||||
<Grid
|
||||
Padding="18,0,18,4"
|
||||
VerticalAlignment="Bottom">
|
||||
<Button
|
||||
Click="ShowSelectedPathsButton_Click"
|
||||
Content="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<TextBlock Margin="0,8,0,0"
|
||||
<TextBlock
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{ThemeResource BodyStrongTextBlockStyle}"
|
||||
Text="{TemplateBinding Content}" >
|
||||
</TextBlock>
|
||||
Text="{TemplateBinding Content}" />
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="PathsTooltipDescription" TextWrapping="WrapWholeWords"/>
|
||||
<TextBlock
|
||||
x:Uid="PathsTooltipDescription"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
|
||||
|
||||
<StackPanel
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
@@ -71,7 +75,7 @@
|
||||
<FontIcon
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
Glyph="" />
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="Reload" />
|
||||
</ToolTipService.ToolTip>
|
||||
@@ -85,7 +89,7 @@
|
||||
<FontIcon
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
Glyph="" />
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="RestartAsAdmin" />
|
||||
</ToolTipService.ToolTip>
|
||||
@@ -98,75 +102,101 @@
|
||||
<ListView
|
||||
x:Name="ProcessesListView"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{x:Bind ViewModel.Processes}"
|
||||
IncrementalLoadingThreshold="10"
|
||||
ItemsSource="{x:Bind ViewModel.Processes}"
|
||||
SelectionMode="None">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="interop:ProcessResult">
|
||||
<labs:SettingsExpander Margin="0,3,0,0">
|
||||
<labs:SettingsExpander.Header>
|
||||
<!-- We can't use the HeaderIcon because it only support a BitmapIcon, which only supports UriSource - not a direct BitmapImage -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Margin="2,0,24,0"
|
||||
Source="{x:Bind pid, Converter={StaticResource pidToIconConverter}}" />
|
||||
<TextBlock IsTextSelectionEnabled="True" Text="{x:Bind name}" />
|
||||
</StackPanel>
|
||||
</labs:SettingsExpander.Header>
|
||||
<labs:SettingsExpander.Content>
|
||||
<Button Command="{Binding Path=DataContext.EndTaskCommand, ElementName=ProcessesListView}" CommandParameter="{Binding}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||
<labs:SettingsExpander Margin="0,3,0,0">
|
||||
<labs:SettingsExpander.Resources>
|
||||
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
|
||||
</labs:SettingsExpander.Resources>
|
||||
<labs:SettingsExpander.Header>
|
||||
<!-- We can't use the HeaderIcon because it only support a BitmapIcon, which only supports UriSource - not a direct BitmapImage -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Margin="2,0,24,0"
|
||||
Source="{x:Bind pid, Converter={StaticResource pidToIconConverter}}" />
|
||||
<TextBlock
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind name}" />
|
||||
</StackPanel>
|
||||
</labs:SettingsExpander.Header>
|
||||
<labs:SettingsExpander.Content>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<FontIcon
|
||||
Foreground="{ThemeResource InfoBarWarningSeverityIconBackground}"
|
||||
Glyph=""
|
||||
Visibility="{x:Bind user, Mode=OneTime, Converter={StaticResource userToSystemWarningVisibilityConverter}}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock
|
||||
x:Uid="ProcessIsSystemUserWarning"
|
||||
TextWrapping="Wrap" />
|
||||
</ToolTipService.ToolTip>
|
||||
</FontIcon>
|
||||
<Button
|
||||
MinWidth="132"
|
||||
Command="{Binding Path=DataContext.EndTaskCommand, ElementName=ProcessesListView}"
|
||||
CommandParameter="{Binding}">
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="6">
|
||||
<FontIcon
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph="" />
|
||||
<TextBlock x:Uid="EndTask" />
|
||||
<TextBlock
|
||||
x:Uid="EndTask"
|
||||
FontSize="14" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</labs:SettingsExpander.Content>
|
||||
<labs:SettingsExpander.Items>
|
||||
<labs:SettingsCard x:Uid="ProcessID">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind pid}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard x:Uid="User">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind pid, Converter={StaticResource pidToUserConverter}}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard ContentAlignment="Vertical">
|
||||
<labs:SettingsCard.Header>
|
||||
<TextBlock>
|
||||
<Run x:Uid="Files" />
|
||||
<Run Text="(" /><Run Text="{x:Bind files, Converter={StaticResource fileCountConverter}}" /><Run Text=")" />
|
||||
</TextBlock>
|
||||
</labs:SettingsCard.Header>
|
||||
<ListView
|
||||
Margin="-16,0,0,0"
|
||||
ItemsSource="{x:Bind files}"
|
||||
SelectionMode="None">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{Binding}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="NoWrap"
|
||||
ToolTipService.ToolTip="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
</StackPanel>
|
||||
</labs:SettingsExpander.Content>
|
||||
<labs:SettingsExpander.Items>
|
||||
<labs:SettingsCard x:Uid="ProcessID">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind pid}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard x:Uid="User">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind user}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard ContentAlignment="Vertical">
|
||||
<labs:SettingsCard.Header>
|
||||
<TextBlock>
|
||||
<Run x:Uid="Files" />
|
||||
<Run Text="(" /><Run Text="{x:Bind files, Converter={StaticResource fileCountConverter}}" /><Run Text=")" />
|
||||
</TextBlock>
|
||||
</labs:SettingsCard.Header>
|
||||
<ItemsRepeater
|
||||
Margin="-16,0,0,0"
|
||||
ItemsSource="{x:Bind files}">
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<TextBlock
|
||||
Margin="16,0,0,4"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{Binding}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="NoWrap"
|
||||
ToolTipService.ToolTip="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
@@ -176,17 +206,23 @@
|
||||
Orientation="Vertical"
|
||||
Spacing="8"
|
||||
Visibility="{x:Bind ViewModel.Processes.Count, Mode=OneWay, Converter={StaticResource doubleToVisibilityConverter}}">
|
||||
<Button HorizontalAlignment="Center" Command="{Binding LoadProcessesCommand}" >
|
||||
<Button
|
||||
HorizontalAlignment="Center"
|
||||
Command="{Binding LoadProcessesCommand}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<FontIcon FontSize="32" Glyph="" />
|
||||
<FontIcon
|
||||
FontSize="32"
|
||||
Glyph="" />
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="Reload" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<TextBlock x:Uid="EmptyListDescription" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
<TextBlock
|
||||
x:Uid="EmptyListDescription"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ProgressRing
|
||||
@@ -196,10 +232,15 @@
|
||||
</Grid>
|
||||
<ContentDialog
|
||||
x:Name="SelectedFilesListDialog"
|
||||
x:Uid="SelectedFilesListDialog"
|
||||
>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" HorizontalScrollMode="Auto" VerticalScrollBarVisibility="Auto" VerticalScrollMode="Auto">
|
||||
<TextBlock Text="{x:Bind ViewModel.PathsToString, Mode=OneWay}"/>
|
||||
x:Uid="SelectedFilesListDialog">
|
||||
<ScrollViewer
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
HorizontalScrollMode="Auto"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
VerticalScrollMode="Auto">
|
||||
<TextBlock
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind ViewModel.PathsToString, Mode=OneWay}" />
|
||||
</ScrollViewer>
|
||||
</ContentDialog>
|
||||
</Grid>
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
Height="36"
|
||||
Margin="16,0,0,0"
|
||||
Command="{x:Bind NewDialogCommand}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="12">
|
||||
<TextBlock
|
||||
x:Name="Icon"
|
||||
Margin="0,0,0,0"
|
||||
@@ -49,7 +51,7 @@
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
|
||||
Text="" />
|
||||
Text="" />
|
||||
<TextBlock x:Uid="AddEntry" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
@@ -124,7 +126,7 @@
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
|
||||
|
||||
<Button
|
||||
x:Uid="OpenHostsFileBtn"
|
||||
Height="36"
|
||||
@@ -135,7 +137,7 @@
|
||||
FontSize="14"
|
||||
Glyph="" />
|
||||
</Button>
|
||||
|
||||
|
||||
<Button
|
||||
x:Uid="SettingsBtn"
|
||||
Height="36"
|
||||
@@ -165,7 +167,9 @@
|
||||
IsOpen="{x:Bind ViewModel.FileChanged, Mode=TwoWay}"
|
||||
Severity="Informational">
|
||||
<InfoBar.ActionButton>
|
||||
<Button x:Uid="Reload" Command="{x:Bind ViewModel.ReadHostsCommand}" />
|
||||
<Button
|
||||
x:Uid="Reload"
|
||||
Command="{x:Bind ViewModel.ReadHostsCommand}" />
|
||||
</InfoBar.ActionButton>
|
||||
</InfoBar>
|
||||
</StackPanel>
|
||||
@@ -177,8 +181,8 @@
|
||||
CanReorderItems="{x:Bind ViewModel.Filtered, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
|
||||
-->
|
||||
<ListView
|
||||
x:Uid="Entries"
|
||||
x:Name="Entries"
|
||||
x:Uid="Entries"
|
||||
Grid.Row="1"
|
||||
Margin="16,8,16,16"
|
||||
Background="{ThemeResource LayerFillColorDefaultBrush}"
|
||||
@@ -253,8 +257,8 @@
|
||||
x:Name="PingIcon"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,8,0"
|
||||
FontSize="18"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="18"
|
||||
Visibility="Collapsed">
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:DataTriggerBehavior
|
||||
@@ -324,7 +328,9 @@
|
||||
<ContentDialog.DataContext>
|
||||
<models:Entry />
|
||||
</ContentDialog.DataContext>
|
||||
<ScrollViewer HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<ScrollViewer
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
HorizontalScrollMode="Auto">
|
||||
<StackPanel
|
||||
MinWidth="480"
|
||||
Margin="0,12,0,0"
|
||||
@@ -372,6 +378,9 @@
|
||||
Margin="0,12,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
AcceptsReturn="True"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
</ContentDialog>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
|
||||
<PackageReference Include="System.ComponentModel.Composition" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
|
||||
|
||||
@@ -56,7 +56,9 @@ namespace ColorPicker.Settings
|
||||
if (!_loadingColorsHistory)
|
||||
{
|
||||
var settings = _settingsUtils.GetSettingsOrDefault<ColorPickerSettings>(ColorPickerModuleName);
|
||||
ColorHistory.CollectionChanged -= ColorHistory_CollectionChanged;
|
||||
settings.Properties.ColorHistory = ColorHistory.ToList();
|
||||
ColorHistory.CollectionChanged += ColorHistory_CollectionChanged;
|
||||
settings.Save(_settingsUtils);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,29 +122,31 @@ bool Layout::Init(const FancyZonesUtils::Rect& workArea, HMONITOR monitor) noexc
|
||||
return false;
|
||||
}
|
||||
|
||||
auto spacing = m_data.showSpacing ? m_data.spacing : 0;
|
||||
|
||||
switch (m_data.type)
|
||||
{
|
||||
case FancyZonesDataTypes::ZoneSetLayoutType::Focus:
|
||||
m_zones = LayoutConfigurator::Focus(workArea, m_data.zoneCount);
|
||||
break;
|
||||
case FancyZonesDataTypes::ZoneSetLayoutType::Columns:
|
||||
m_zones = LayoutConfigurator::Columns(workArea, m_data.zoneCount, m_data.spacing);
|
||||
m_zones = LayoutConfigurator::Columns(workArea, m_data.zoneCount, spacing);
|
||||
break;
|
||||
case FancyZonesDataTypes::ZoneSetLayoutType::Rows:
|
||||
m_zones = LayoutConfigurator::Rows(workArea, m_data.zoneCount, m_data.spacing);
|
||||
m_zones = LayoutConfigurator::Rows(workArea, m_data.zoneCount, spacing);
|
||||
break;
|
||||
case FancyZonesDataTypes::ZoneSetLayoutType::Grid:
|
||||
m_zones = LayoutConfigurator::Grid(workArea, m_data.zoneCount, m_data.spacing);
|
||||
m_zones = LayoutConfigurator::Grid(workArea, m_data.zoneCount, spacing);
|
||||
break;
|
||||
case FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid:
|
||||
m_zones = LayoutConfigurator::PriorityGrid(workArea, m_data.zoneCount, m_data.spacing);
|
||||
m_zones = LayoutConfigurator::PriorityGrid(workArea, m_data.zoneCount, spacing);
|
||||
break;
|
||||
case FancyZonesDataTypes::ZoneSetLayoutType::Custom:
|
||||
{
|
||||
const auto customLayoutData = CustomLayouts::instance().GetCustomLayoutData(m_data.uuid);
|
||||
if (customLayoutData.has_value())
|
||||
{
|
||||
m_zones = LayoutConfigurator::Custom(workArea, monitor, customLayoutData.value(), m_data.spacing);
|
||||
m_zones = LayoutConfigurator::Custom(workArea, monitor, customLayoutData.value(), spacing);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace FancyZonesUnitTests
|
||||
{
|
||||
.uuid = FancyZonesUtils::GuidFromString(L"{F762BAD6-DAA1-4997-9497-E11DFEB72F21}").value(),
|
||||
.type = ZoneSetLayoutType::Grid,
|
||||
.showSpacing = false,
|
||||
.showSpacing = true,
|
||||
.spacing = 17,
|
||||
.zoneCount = 4,
|
||||
.sensitivityRadius = 33
|
||||
@@ -192,7 +192,7 @@ namespace FancyZonesUnitTests
|
||||
const LayoutData m_data{
|
||||
.uuid = FancyZonesUtils::GuidFromString(L"{33A2B101-06E0-437B-A61E-CDBECF502906}").value(),
|
||||
.type = ZoneSetLayoutType::Grid,
|
||||
.showSpacing = false,
|
||||
.showSpacing = true,
|
||||
.spacing = 17,
|
||||
.zoneCount = 4,
|
||||
.sensitivityRadius = 33
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
|
||||
<PackageReference Include="System.Text.Json" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
|
||||
<PackageReference Include="System.IO.Abstractions">
|
||||
<Version>17.2.3</Version>
|
||||
</PackageReference>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
|
||||
<PackageReference Include="ScipBe.Common.Office.OneNote" Version="3.0.1" />
|
||||
<PackageReference Include="System.Reactive" Version="5.0.0" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
|
||||
@@ -2147,7 +2147,7 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Zone appearance</value>
|
||||
</data>
|
||||
<data name="VideoConference_DeprecationWarning.Title" xml:space="preserve">
|
||||
<value>Video Conference utility is reaching its end of life and will be unavailable in one of the future releases.</value>
|
||||
<value>VCM is moving into legacy mode (maintenance only).</value>
|
||||
</data>
|
||||
<data name="VideoConference_DeprecationWarningButton.Content" xml:space="preserve">
|
||||
<value>Learn more</value>
|
||||
|
||||
Reference in New Issue
Block a user