Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added settings file checking for zone count test #4

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
04027b9
Temporarily removed a test with huge running time on Azure (#1591)
ivan100sic Mar 16, 2020
02857d1
Some refactoring of FancyZones::IsInterestingWindow and added Unit Te…
yevhenii44-zz Mar 16, 2020
97e98d2
Remove failing Svg Preview Handler Unit Tests in CI (#1583)
udit3333 Mar 16, 2020
96a7e4f
disable unit tests in CI (#1592)
enricogior Mar 16, 2020
2cc6d2e
Fixed some compiler warnings (#1577)
ivan100sic Mar 16, 2020
1fc6798
Bump acorn from 5.7.3 to 5.7.4 in /src/settings-web (#1588)
dependabot[bot] Mar 16, 2020
f49727e
Invalid json test cases + strings validation (#1558)
SeraphimaZykova Mar 16, 2020
d8c1cb2
fix for #1595 (#1598)
crutkas Mar 16, 2020
72eb761
Fixed issue with autostarting as admin even if it should as user, fix…
PrzemyslawTusinski Mar 17, 2020
419fc15
WinAppDriver tests (#1371)
SeraphimaZykova Mar 17, 2020
98ed178
Double-qoute the paths when passing them as cmd args (#1604)
stefansjfw Mar 17, 2020
f0f044b
Add Window Walker to module list (#1613)
betsegaw Mar 17, 2020
ff0c021
Check if settings file is open before parsing JSON content from it (#…
vldmr11080 Mar 18, 2020
1c90107
Implement canceling edits in FZE, fix crashes related to canceling. (…
ivan100sic Mar 18, 2020
81710ff
update bundle with fixes (#1608)
crutkas Mar 18, 2020
57f763b
Check key existance before getting it from JSON (#1632)
vldmr11080 Mar 19, 2020
f507ef5
Update dev doc github workflow (#1618)
enricogior Mar 19, 2020
35054c1
Editor opening tests (#1633)
SeraphimaZykova Mar 19, 2020
8fcf0c0
open and close settings methods added
SeraphimaZykova Feb 27, 2020
1b48869
added FancyZones tests
SeraphimaZykova Mar 2, 2020
f29e9a6
toggles double click tests
SeraphimaZykova Mar 2, 2020
d9ee592
moved common function
SeraphimaZykova Mar 3, 2020
eff7116
keep settings file unchanged after tests
SeraphimaZykova Mar 3, 2020
dd006c2
toggles click tests
SeraphimaZykova Mar 3, 2020
a1f73e6
opacity highlight input tests
SeraphimaZykova Mar 3, 2020
fcfe91e
clear button test
SeraphimaZykova Mar 3, 2020
6519bf7
refactoring
SeraphimaZykova Mar 4, 2020
85ed1e4
test color sliders
SeraphimaZykova Mar 4, 2020
1f01e53
test color inputs
SeraphimaZykova Mar 4, 2020
3dbc4b8
refactoring
SeraphimaZykova Mar 5, 2020
25b4ba2
added test for excluded apps input
SeraphimaZykova Mar 5, 2020
2fd9716
exit without saving tests
SeraphimaZykova Mar 5, 2020
96dcdea
added test for hotkeys
SeraphimaZykova Mar 9, 2020
3d9f243
added test case for excluded apps
SeraphimaZykova Mar 9, 2020
7360e09
fixed elements search
SeraphimaZykova Mar 10, 2020
168b704
refactoring
SeraphimaZykova Mar 11, 2020
9e419ef
updated toggles tests
SeraphimaZykova Mar 11, 2020
294f3c5
fix settings reading
SeraphimaZykova Mar 13, 2020
31aaaf8
added test plan for editor
SeraphimaZykova Mar 13, 2020
58e1433
added editor tests file
SeraphimaZykova Mar 16, 2020
b74f9d8
open editor using button with different settings
SeraphimaZykova Mar 17, 2020
9b59207
Added test method for Fancy Zones count (#3)
yevhenii44-zz Mar 17, 2020
49762f3
changed test files
SeraphimaZykova Mar 18, 2020
ba375ee
Added file checking and methods to optimize elemets finding
yevhenii44 Mar 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed issue with autostarting as admin even if it should as user, fix…
…ed issue with autostart permissions bug (microsoft#1538)

* Fixed issue with autostarting as admin even if it should as user, fixed permissions issue for autostart configuration

* Indentation fix

* Added support for all cases of autostart task modifying

* Fix for compilation
  • Loading branch information
PrzemyslawTusinski authored Mar 17, 2020
commit 72eb76191faf672e3d21c108444b5e6fdea890e9
25 changes: 14 additions & 11 deletions installer/PowerToysSetupCustomActions/CustomAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,25 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall) {
}

// Run the task with the highest available privileges.
hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_HIGHEST);
hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_LUA);
pPrincipal->Release();
ExitOnFailure(hr, "Cannot put principal run level: %x", hr);

// ------------------------------------------------------
// Save the task in the PowerToys folder.
hr = pTaskFolder->RegisterTaskDefinition(
_bstr_t(wstrTaskName.c_str()),
pTask,
TASK_CREATE_OR_UPDATE,
_variant_t(username_domain),
_variant_t(),
TASK_LOGON_INTERACTIVE_TOKEN,
_variant_t(L""),
&pRegisteredTask);
ExitOnFailure(hr, "Error saving the Task : %x", hr);
{
_variant_t SDDL_FULL_ACCESS_FOR_EVERYONE = L"D:(A;;FA;;;WD)";
hr = pTaskFolder->RegisterTaskDefinition(
_bstr_t(wstrTaskName.c_str()),
pTask,
TASK_CREATE_OR_UPDATE,
_variant_t(username_domain),
_variant_t(),
TASK_LOGON_INTERACTIVE_TOKEN,
SDDL_FULL_ACCESS_FOR_EVERYONE,
&pRegisteredTask);
ExitOnFailure(hr, "Error saving the Task : %x", hr);
}

WcaLog(LOGMSG_STANDARD, "Scheduled task created for the current user.");

Expand Down
40 changes: 19 additions & 21 deletions src/runner/auto_start_helper.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "pch.h"
#include "auto_start_helper.h"

#include "general_settings.h"

#include <Lmcons.h>

#include <comdef.h>
Expand Down Expand Up @@ -35,7 +37,7 @@
const DWORD USERNAME_DOMAIN_LEN = DNLEN + UNLEN + 2; // Domain Name + '\' + User Name + '\0'
const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0'

bool enable_auto_start_task_for_this_user()
bool create_auto_start_task_for_this_user(bool runEvelvated)
{
HRESULT hr = S_OK;

Expand Down Expand Up @@ -217,8 +219,7 @@ bool enable_auto_start_task_for_this_user()

hr = pPrincipal->put_LogonType(TASK_LOGON_INTERACTIVE_TOKEN);

// Run the task with the highest available privileges.
if (IsUserAnAdmin())
if (runEvelvated)
{
hr = pPrincipal->put_RunLevel(_TASK_RUNLEVEL::TASK_RUNLEVEL_HIGHEST);
}
Expand All @@ -231,16 +232,19 @@ bool enable_auto_start_task_for_this_user()
}
// ------------------------------------------------------
// Save the task in the PowerToys folder.
hr = pTaskFolder->RegisterTaskDefinition(
_bstr_t(wstrTaskName.c_str()),
pTask,
TASK_CREATE_OR_UPDATE,
_variant_t(username_domain),
_variant_t(),
TASK_LOGON_INTERACTIVE_TOKEN,
_variant_t(L""),
&pRegisteredTask);
ExitOnFailure(hr, "Error saving the Task : %x", hr);
{
_variant_t SDDL_FULL_ACCESS_FOR_EVERYONE = L"D:(A;;FA;;;WD)";
hr = pTaskFolder->RegisterTaskDefinition(
_bstr_t(wstrTaskName.c_str()),
pTask,
TASK_CREATE_OR_UPDATE,
_variant_t(username_domain),
_variant_t(),
TASK_LOGON_INTERACTIVE_TOKEN,
SDDL_FULL_ACCESS_FOR_EVERYONE,
&pRegisteredTask);
ExitOnFailure(hr, "Error saving the Task : %x", hr);
}

LExit:
if (pService)
Expand All @@ -261,7 +265,7 @@ bool enable_auto_start_task_for_this_user()
return (SUCCEEDED(hr));
}

bool disable_auto_start_task_for_this_user()
bool delete_auto_start_task_for_this_user()
{
HRESULT hr = S_OK;

Expand Down Expand Up @@ -313,13 +317,7 @@ bool disable_auto_start_task_for_this_user()
if (SUCCEEDED(hr))
{
// Task exists, try disabling it.
hr = pExistingRegisteredTask->put_Enabled(VARIANT_FALSE);
pExistingRegisteredTask->Release();
if (SUCCEEDED(hr))
{
// Function disable. Sounds like a success.
ExitFunction();
}
hr = pTaskFolder->DeleteTask(_bstr_t(wstrTaskName.c_str()), 0);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/runner/auto_start_helper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

bool is_auto_start_task_active_for_this_user();
bool enable_auto_start_task_for_this_user();
bool disable_auto_start_task_for_this_user();
bool create_auto_start_task_for_this_user(bool runEvelvated);
bool delete_auto_start_task_for_this_user();
29 changes: 23 additions & 6 deletions src/runner/general_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ json::JsonObject get_general_settings()

void apply_general_settings(const json::JsonObject& general_configs)
{
run_as_elevated = general_configs.GetNamedBoolean(L"run_elevated", false);

if (json::has(general_configs, L"startup", json::JsonValueType::Boolean))
{
const bool startup = general_configs.GetNamedBoolean(L"startup");
Expand All @@ -124,18 +126,33 @@ void apply_general_settings(const json::JsonObject& general_configs)
}
else
{
const bool current_startup = is_auto_start_task_active_for_this_user();
if (current_startup != startup)
if (startup)
{
if (startup)
if (is_process_elevated())
{
enable_auto_start_task_for_this_user();
delete_auto_start_task_for_this_user();
create_auto_start_task_for_this_user(general_configs.GetNamedBoolean(L"run_elevated", false));
}
else
{
disable_auto_start_task_for_this_user();
if (!is_auto_start_task_active_for_this_user())
{
delete_auto_start_task_for_this_user();
create_auto_start_task_for_this_user(false);

run_as_elevated = false;
}
else if (!general_configs.GetNamedBoolean(L"run_elevated", false))
{
delete_auto_start_task_for_this_user();
create_auto_start_task_for_this_user(false);
}
}
}
else
{
delete_auto_start_task_for_this_user();
}
}
}
if (json::has(general_configs, L"enabled"))
Expand Down Expand Up @@ -169,7 +186,7 @@ void apply_general_settings(const json::JsonObject& general_configs)
}
}
}
run_as_elevated = general_configs.GetNamedBoolean(L"run_elevated", false);

if (json::has(general_configs, L"theme", json::JsonValueType::String))
{
settings_theme = general_configs.GetNamedString(L"theme");
Expand Down
3 changes: 2 additions & 1 deletion src/settings-web/src/components/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ export class GeneralSettings extends React.Component <any, any> {

{this.state.settings.general.is_admin &&
(<BoolToggleSettingsControl
setting={{display_name: 'Always run as administrator', value: this.state.settings.general.run_elevated}}
setting={{display_name: this.state.settings.general.is_elevated ? 'Always run as administrator' : 'Always run as administrator (Restart as administrator to change this)', value: this.state.settings.general.run_elevated}}
disabled={!this.state.settings.general.is_elevated}
on_change={this.parent_on_change}
ref={(input) => {this.elevated_reference=input;}}
/>)
Expand Down
Loading