diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp
index 85774cc741..24a2d54a86 100644
--- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp
+++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp
@@ -14,7 +14,7 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
-auto Strings = updating::notifications::strings::create();
+auto Strings = create_notifications_strings();
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj
index 0f20390820..f03a56aa49 100644
--- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj
+++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj
@@ -83,6 +83,7 @@
../../../src/;%(AdditionalIncludeDirectories)
Use
pch.h
+ /await /Zc:twoPhase- %(AdditionalOptions)
Windows
@@ -104,6 +105,7 @@
../../../src/;%(AdditionalIncludeDirectories)
Use
pch.h
+ /await /Zc:twoPhase- %(AdditionalOptions)
Windows
diff --git a/installer/PowerToysSetupCustomActions/CustomAction.cpp b/installer/PowerToysSetupCustomActions/CustomAction.cpp
index 99d915d55d..8fd2d67f1a 100644
--- a/installer/PowerToysSetupCustomActions/CustomAction.cpp
+++ b/installer/PowerToysSetupCustomActions/CustomAction.cpp
@@ -32,15 +32,21 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
std::wstring wstrTaskName;
- ITaskService* pService = NULL;
- ITaskFolder* pTaskFolder = NULL;
- ITaskDefinition* pTask = NULL;
- IRegistrationInfo* pRegInfo = NULL;
- ITaskSettings* pSettings = NULL;
- ITriggerCollection* pTriggerCollection = NULL;
- IRegisteredTask* pRegisteredTask = NULL;
+ ITaskService* pService = nullptr;
+ ITaskFolder* pTaskFolder = nullptr;
+ ITaskDefinition* pTask = nullptr;
+ IRegistrationInfo* pRegInfo = nullptr;
+ ITaskSettings* pSettings = nullptr;
+ ITriggerCollection* pTriggerCollection = nullptr;
+ IRegisteredTask* pRegisteredTask = nullptr;
+ IPrincipal * pPrincipal = nullptr;
+ ITrigger * pTrigger = nullptr;
+ ILogonTrigger * pLogonTrigger = nullptr;
+ IAction * pAction = nullptr;
+ IActionCollection * pActionCollection = nullptr;
+ IExecAction * pExecAction = nullptr;
- LPWSTR wszExecutablePath = NULL;
+ LPWSTR wszExecutablePath = nullptr;
hr = WcaInitialize(hInstall, "CreateScheduledTaskCA");
ExitOnFailure(hr, "Failed to initialize");
@@ -79,7 +85,7 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
// ------------------------------------------------------
// Create an instance of the Task Service.
hr = CoCreateInstance(CLSID_TaskScheduler,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_ITaskService,
(void**)&pService);
@@ -95,7 +101,7 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
if (FAILED(hr))
{
// Folder doesn't exist. Get the Root folder and create the PowerToys subfolder.
- ITaskFolder* pRootFolder = NULL;
+ ITaskFolder* pRootFolder = nullptr;
hr = pService->GetFolder(_bstr_t(L"\\"), &pRootFolder);
ExitOnFailure(hr, "Cannot get Root Folder pointer: %x", hr);
hr = pRootFolder->CreateFolder(_bstr_t(L"\\PowerToys"), _variant_t(L""), &pTaskFolder);
@@ -141,11 +147,9 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
ExitOnFailure(hr, "Cannot get trigger collection: %x", hr);
// Add the logon trigger to the task.
- ITrigger* pTrigger = NULL;
hr = pTriggerCollection->Create(TASK_TRIGGER_LOGON, &pTrigger);
ExitOnFailure(hr, "Cannot create the trigger: %x", hr);
- ILogonTrigger* pLogonTrigger = NULL;
hr = pTrigger->QueryInterface(
IID_ILogonTrigger, (void**)&pLogonTrigger);
pTrigger->Release();
@@ -173,19 +177,17 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
// ------------------------------------------------------
// Add an Action to the task. This task will execute the path passed to this custom action.
- IActionCollection* pActionCollection = NULL;
// Get the task action collection pointer.
hr = pTask->get_Actions(&pActionCollection);
ExitOnFailure(hr, "Cannot get Task collection pointer: %x", hr);
// Create the action, specifying that it is an executable action.
- IAction* pAction = NULL;
hr = pActionCollection->Create(TASK_ACTION_EXEC, &pAction);
pActionCollection->Release();
ExitOnFailure(hr, "Cannot create the action: %x", hr);
- IExecAction* pExecAction = NULL;
+
// QI for the executable task pointer.
hr = pAction->QueryInterface(
IID_IExecAction, (void**)&pExecAction);
@@ -199,7 +201,6 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
// ------------------------------------------------------
// Create the principal for the task
- IPrincipal* pPrincipal = NULL;
hr = pTask->get_Principal(&pPrincipal);
ExitOnFailure(hr, "Cannot get principal pointer: %x", hr);
@@ -295,9 +296,11 @@ UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
- ITaskService* pService = NULL;
- ITaskFolder* pTaskFolder = NULL;
- IRegisteredTaskCollection* pTaskCollection = NULL;
+ ITaskService* pService = nullptr;
+ ITaskFolder* pTaskFolder = nullptr;
+ IRegisteredTaskCollection* pTaskCollection = nullptr;
+ ITaskFolder * pRootFolder = nullptr;
+ LONG numTasks = 0;
hr = WcaInitialize(hInstall, "RemoveScheduledTasksCA");
ExitOnFailure(hr, "Failed to initialize");
@@ -309,7 +312,7 @@ UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
// ------------------------------------------------------
// Create an instance of the Task Service.
hr = CoCreateInstance(CLSID_TaskScheduler,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_ITaskService,
(void**)&pService);
@@ -335,21 +338,20 @@ UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
hr = pTaskFolder->GetTasks(TASK_ENUM_HIDDEN, &pTaskCollection);
ExitOnFailure(hr, "Cannot get the registered tasks: %x", hr);
- LONG numTasks = 0;
hr = pTaskCollection->get_Count(&numTasks);
for (LONG i = 0; i < numTasks; i++)
{
// Delete all the tasks found.
// If some tasks can't be deleted, the folder won't be deleted later and the user will still be notified.
- IRegisteredTask* pRegisteredTask = NULL;
+ IRegisteredTask* pRegisteredTask = nullptr;
hr = pTaskCollection->get_Item(_variant_t(i + 1), &pRegisteredTask);
if (SUCCEEDED(hr))
{
- BSTR taskName = NULL;
+ BSTR taskName = nullptr;
hr = pRegisteredTask->get_Name(&taskName);
if (SUCCEEDED(hr))
{
- hr = pTaskFolder->DeleteTask(taskName, NULL);
+ hr = pTaskFolder->DeleteTask(taskName, 0);
if (FAILED(hr))
{
WcaLogError(hr, "Cannot delete the '%S' task: %x", taskName, hr);
@@ -370,10 +372,9 @@ UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
// ------------------------------------------------------
// Get the pointer to the root task folder and delete the PowerToys subfolder.
- ITaskFolder* pRootFolder = NULL;
hr = pService->GetFolder(_bstr_t(L"\\"), &pRootFolder);
ExitOnFailure(hr, "Cannot get Root Folder pointer: %x", hr);
- hr = pRootFolder->DeleteFolder(_bstr_t(L"PowerToys"), NULL);
+ hr = pRootFolder->DeleteFolder(_bstr_t(L"PowerToys"), 0);
pRootFolder->Release();
ExitOnFailure(hr, "Cannot delete the PowerToys folder: %x", hr);
diff --git a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj
index e0a23ec46d..dedb7601e1 100644
--- a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj
+++ b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj
@@ -15,7 +15,7 @@
{32f3882b-f2d6-4586-b5ed-11e39e522bd3}
Win32Proj
PowerToysSetupCustomActions
- 10.0
+ 10.0.17134.0
@@ -97,6 +97,8 @@
Use
stdafx.h
+ /await /Zc:twoPhase- %(AdditionalOptions)
+ /await /Zc:twoPhase- %(AdditionalOptions)
diff --git a/src/action_runner/action_runner.cpp b/src/action_runner/action_runner.cpp
index 321be922b2..99189b4f05 100644
--- a/src/action_runner/action_runner.cpp
+++ b/src/action_runner/action_runner.cpp
@@ -20,7 +20,7 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
-auto Strings = updating::notifications::strings::create();
+auto Strings = create_notifications_strings();
int uninstall_msi_action()
{
diff --git a/src/common/common-md-flag/common-md-flag.vcxproj b/src/common/common-md-flag/common-md-flag.vcxproj
index 4a9200ebb3..e239fb209f 100644
--- a/src/common/common-md-flag/common-md-flag.vcxproj
+++ b/src/common/common-md-flag/common-md-flag.vcxproj
@@ -61,6 +61,7 @@
false
stdcpplatest
inc;telemetry;../../;%(AdditionalIncludeDirectories)
+ /await /Zc:twoPhase- %(AdditionalOptions)
Windows
@@ -77,6 +78,7 @@
false
stdcpplatest
inc;telemetry;../../;%(AdditionalIncludeDirectories)
+ /await /Zc:twoPhase- %(AdditionalOptions)
Windows
diff --git a/src/common/updating/notifications.h b/src/common/updating/notifications.h
index 0bd791620f..eade6076a7 100644
--- a/src/common/updating/notifications.h
+++ b/src/common/updating/notifications.h
@@ -29,33 +29,6 @@ namespace updating
std::wstring TOAST_TITLE;
std::wstring OFFER_UNINSTALL_MSI;
std::wstring OFFER_UNINSTALL_MSI_TITLE;
- template
- static strings create()
- {
- return strings{
- .GITHUB_NEW_VERSION_AVAILABLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE),
- .GITHUB_NEW_VERSION_DOWNLOAD_STARTED = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_DOWNLOAD_STARTED),
- .GITHUB_NEW_VERSION_READY_TO_INSTALL = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_READY_TO_INSTALL),
- .GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR),
- .GITHUB_NEW_VERSION_UPDATE_NOW = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW),
- .GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART),
- .UNINSTALLATION_UNKNOWN_ERROR = GET_RESOURCE_STRING(IDS_UNINSTALLATION_UNKNOWN_ERROR),
- .GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT),
- .GITHUB_NEW_VERSION_UNAVAILABLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UNAVAILABLE),
- .GITHUB_NEW_VERSION_VISIT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_VISIT),
- .GITHUB_NEW_VERSION_MORE_INFO = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO),
- .GITHUB_NEW_VERSION_ABORT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_ABORT),
- .GITHUB_NEW_VERSION_SNOOZE_TITLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_SNOOZE_TITLE),
- .SNOOZE_BUTTON = GET_RESOURCE_STRING(IDS_SNOOZE_BUTTON),
- .GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D),
- .GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D),
- .DOWNLOAD_IN_PROGRESS = GET_RESOURCE_STRING(IDS_DOWNLOAD_IN_PROGRESS),
- .DOWNLOAD_COMPLETE = GET_RESOURCE_STRING(IDS_DOWNLOAD_COMPLETE),
- .TOAST_TITLE = GET_RESOURCE_STRING(IDS_TOAST_TITLE),
- .OFFER_UNINSTALL_MSI = GET_RESOURCE_STRING(IDS_OFFER_UNINSTALL_MSI),
- .OFFER_UNINSTALL_MSI_TITLE = GET_RESOURCE_STRING(IDS_OFFER_UNINSTALL_MSI_TITLE)
- };
- }
};
void show_unavailable(const notifications::strings& strings);
@@ -68,4 +41,30 @@ namespace updating
void update_download_progress(const updating::new_version_download_info& info, float progress, const notifications::strings& strings);
}
-}
\ No newline at end of file
+}
+
+#define create_notifications_strings() \
+ ::updating::notifications::strings \
+ { \
+ .GITHUB_NEW_VERSION_AVAILABLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE), \
+ .GITHUB_NEW_VERSION_DOWNLOAD_STARTED = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_DOWNLOAD_STARTED), \
+ .GITHUB_NEW_VERSION_READY_TO_INSTALL = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_READY_TO_INSTALL), \
+ .GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR), \
+ .GITHUB_NEW_VERSION_UPDATE_NOW = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW), \
+ .GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART), \
+ .UNINSTALLATION_UNKNOWN_ERROR = GET_RESOURCE_STRING(IDS_UNINSTALLATION_UNKNOWN_ERROR), \
+ .GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT), \
+ .GITHUB_NEW_VERSION_UNAVAILABLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UNAVAILABLE), \
+ .GITHUB_NEW_VERSION_VISIT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_VISIT), \
+ .GITHUB_NEW_VERSION_MORE_INFO = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO), \
+ .GITHUB_NEW_VERSION_ABORT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_ABORT), \
+ .GITHUB_NEW_VERSION_SNOOZE_TITLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_SNOOZE_TITLE), \
+ .SNOOZE_BUTTON = GET_RESOURCE_STRING(IDS_SNOOZE_BUTTON), \
+ .GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D), \
+ .GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D), \
+ .DOWNLOAD_IN_PROGRESS = GET_RESOURCE_STRING(IDS_DOWNLOAD_IN_PROGRESS), \
+ .DOWNLOAD_COMPLETE = GET_RESOURCE_STRING(IDS_DOWNLOAD_COMPLETE), \
+ .TOAST_TITLE = GET_RESOURCE_STRING(IDS_TOAST_TITLE), \
+ .OFFER_UNINSTALL_MSI = GET_RESOURCE_STRING(IDS_OFFER_UNINSTALL_MSI), \
+ .OFFER_UNINSTALL_MSI_TITLE = GET_RESOURCE_STRING(IDS_OFFER_UNINSTALL_MSI_TITLE) \
+ }
diff --git a/src/modules/fancyzones/lib/JsonHelpers.cpp b/src/modules/fancyzones/lib/JsonHelpers.cpp
index 1e7c799b87..a8789e2067 100644
--- a/src/modules/fancyzones/lib/JsonHelpers.cpp
+++ b/src/modules/fancyzones/lib/JsonHelpers.cpp
@@ -79,7 +79,7 @@ namespace
if (json.HasKey(NonLocalizable::ZoneIndexSetStr))
{
data.zoneIndexSet = {};
- for (auto& value : json.GetNamedArray(NonLocalizable::ZoneIndexSetStr))
+ for (const auto& value : json.GetNamedArray(NonLocalizable::ZoneIndexSetStr))
{
data.zoneIndexSet.push_back(static_cast(value.GetNumber()));
}
diff --git a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp
index dd814732b3..1ea486e326 100644
--- a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp
+++ b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp
@@ -420,7 +420,7 @@ namespace FancyZonesUnitTests
IFACEMETHODIMP_(void)
MoveSizeEnd(HWND window, POINT const& ptScreen) noexcept {}
IFACEMETHODIMP_(void)
- HandleWinHookEvent(const WinHookEvent * data) noexcept {}
+ HandleWinHookEvent(const WinHookEvent* data) noexcept {}
IFACEMETHODIMP_(void)
VirtualDesktopChanged() noexcept {}
IFACEMETHODIMP_(void)
@@ -559,8 +559,9 @@ namespace FancyZonesUnitTests
m_settings->SetCallback(callback.get());
- int bufSize = 0;
- m_settings->GetConfig(L"", &bufSize);
+ int bufSize = 1;
+ wchar_t buffer{};
+ m_settings->GetConfig(&buffer, &bufSize);
Assert::IsFalse(flag);
}
@@ -622,93 +623,93 @@ namespace FancyZonesUnitTests
}
TEST_METHOD_INITIALIZE(Init)
- {
- HINSTANCE hInst = (HINSTANCE)GetModuleHandleW(nullptr);
+ {
+ HINSTANCE hInst = (HINSTANCE)GetModuleHandleW(nullptr);
- m_settings = MakeFancyZonesSettings(hInst, m_moduleName, m_moduleKey);
- Assert::IsTrue(m_settings != nullptr);
- }
+ m_settings = MakeFancyZonesSettings(hInst, m_moduleName, m_moduleKey);
+ Assert::IsTrue(m_settings != nullptr);
+ }
- TEST_METHOD_CLEANUP(Cleanup)
- {
- std::filesystem::remove_all(PTSettingsHelper::get_module_save_folder_location(m_moduleName));
- }
+ TEST_METHOD_CLEANUP(Cleanup)
+ {
+ std::filesystem::remove_all(PTSettingsHelper::get_module_save_folder_location(m_moduleName));
+ }
- TEST_METHOD (GetConfig)
- {
- int expectedSize = 0;
- m_settings->GetConfig(nullptr, &expectedSize);
- Assert::AreNotEqual(0, expectedSize);
+ TEST_METHOD (GetConfig)
+ {
+ int expectedSize = 0;
+ m_settings->GetConfig(nullptr, &expectedSize);
+ Assert::AreNotEqual(0, expectedSize);
- int actualBufferSize = expectedSize;
- PWSTR actualBuffer = new wchar_t[actualBufferSize];
+ int actualBufferSize = expectedSize;
+ PWSTR actualBuffer = new wchar_t[actualBufferSize];
- Assert::IsTrue(m_settings->GetConfig(actualBuffer, &actualBufferSize));
- Assert::AreEqual(expectedSize, actualBufferSize);
- }
+ Assert::IsTrue(m_settings->GetConfig(actualBuffer, &actualBufferSize));
+ Assert::AreEqual(expectedSize, actualBufferSize);
+ }
- TEST_METHOD (GetConfigSmallBuffer)
- {
- int size = 0;
- m_settings->GetConfig(nullptr, &size);
- Assert::AreNotEqual(0, size);
+ TEST_METHOD (GetConfigSmallBuffer)
+ {
+ int size = 0;
+ m_settings->GetConfig(nullptr, &size);
+ Assert::AreNotEqual(0, size);
- int actualBufferSize = size - 1;
- PWSTR actualBuffer = new wchar_t[actualBufferSize];
+ int actualBufferSize = size - 1;
+ PWSTR actualBuffer = new wchar_t[actualBufferSize];
- Assert::IsFalse(m_settings->GetConfig(actualBuffer, &actualBufferSize));
- Assert::AreEqual(size, actualBufferSize);
- }
+ Assert::IsFalse(m_settings->GetConfig(actualBuffer, &actualBufferSize));
+ Assert::AreEqual(size, actualBufferSize);
+ }
- TEST_METHOD (GetConfigNullBuffer)
- {
- int expectedSize = 0;
- m_settings->GetConfig(nullptr, &expectedSize);
- Assert::AreNotEqual(0, expectedSize);
+ TEST_METHOD (GetConfigNullBuffer)
+ {
+ int expectedSize = 0;
+ m_settings->GetConfig(nullptr, &expectedSize);
+ Assert::AreNotEqual(0, expectedSize);
- int actualBufferSize = 0;
+ int actualBufferSize = 0;
- Assert::IsFalse(m_settings->GetConfig(nullptr, &actualBufferSize));
- Assert::AreEqual(expectedSize, actualBufferSize);
- }
+ Assert::IsFalse(m_settings->GetConfig(nullptr, &actualBufferSize));
+ Assert::AreEqual(expectedSize, actualBufferSize);
+ }
- TEST_METHOD (SetConfig)
- {
- //cleanup file before call set config
- const auto settingsFile = PTSettingsHelper::get_module_save_folder_location(m_moduleName) + L"\\settings.json";
- std::filesystem::remove(settingsFile);
+ TEST_METHOD (SetConfig)
+ {
+ //cleanup file before call set config
+ const auto settingsFile = PTSettingsHelper::get_module_save_folder_location(m_moduleName) + L"\\settings.json";
+ std::filesystem::remove(settingsFile);
- const Settings expected{
- .shiftDrag = true,
- .mouseSwitch = true,
- .displayChange_moveWindows = true,
- .zoneSetChange_flashZones = false,
- .zoneSetChange_moveWindows = true,
- .overrideSnapHotkeys = false,
- .moveWindowAcrossMonitors = false,
- .appLastZone_moveWindows = true,
- .openWindowOnActiveMonitor = false,
- .restoreSize = false,
- .use_cursorpos_editor_startupscreen = true,
- .showZonesOnAllMonitors = false,
- .spanZonesAcrossMonitors = false,
- .makeDraggedWindowTransparent = true,
- .zoneColor = L"#FAFAFA",
- .zoneBorderColor = L"CCDDEE",
- .zoneHighlightColor = L"#00AABB",
- .zoneHighlightOpacity = 45,
- .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, false, false, false, VK_OEM_3),
- .excludedApps = L"app\r\napp2",
- .excludedAppsArray = { L"APP", L"APP2" },
- };
+ const Settings expected{
+ .shiftDrag = true,
+ .mouseSwitch = true,
+ .displayChange_moveWindows = true,
+ .zoneSetChange_flashZones = false,
+ .zoneSetChange_moveWindows = true,
+ .overrideSnapHotkeys = false,
+ .moveWindowAcrossMonitors = false,
+ .appLastZone_moveWindows = true,
+ .openWindowOnActiveMonitor = false,
+ .restoreSize = false,
+ .use_cursorpos_editor_startupscreen = true,
+ .showZonesOnAllMonitors = false,
+ .spanZonesAcrossMonitors = false,
+ .makeDraggedWindowTransparent = true,
+ .zoneColor = L"#FAFAFA",
+ .zoneBorderColor = L"CCDDEE",
+ .zoneHighlightColor = L"#00AABB",
+ .zoneHighlightOpacity = 45,
+ .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, false, false, false, VK_OEM_3),
+ .excludedApps = L"app\r\napp2",
+ .excludedAppsArray = { L"APP", L"APP2" },
+ };
- auto config = serializedPowerToySettings(expected);
- m_settings->SetConfig(config.c_str());
+ auto config = serializedPowerToySettings(expected);
+ m_settings->SetConfig(config.c_str());
- auto actual = m_settings->GetSettings();
- compareSettings(expected, *actual);
+ auto actual = m_settings->GetSettings();
+ compareSettings(expected, *actual);
- Assert::IsTrue(std::filesystem::exists(settingsFile));
- }
+ Assert::IsTrue(std::filesystem::exists(settingsFile));
+ }
};
}
diff --git a/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp b/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp
index bb7e33ee48..45d446c5a6 100644
--- a/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp
+++ b/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp
@@ -16,7 +16,7 @@ namespace KeyboardEventHandlers
// Check if the key event was generated by KeyboardManager to avoid remapping events generated by us.
if (!(data->lParam->dwExtraInfo & CommonSharedConstants::KEYBOARDMANAGER_INJECTED_FLAG))
{
- auto& remapping = keyboardManagerState.GetSingleKeyRemap(data->lParam->vkCode);
+ const auto remapping = keyboardManagerState.GetSingleKeyRemap(data->lParam->vkCode);
if (remapping)
{
auto it = remapping.value();
@@ -187,7 +187,7 @@ namespace KeyboardEventHandlers
// Iterate through the shortcut remaps and apply whichever has been pressed
for (auto& itShortcut : keyboardManagerState.GetSortedShortcutRemapVector(activatedApp))
{
- auto& it = reMap.find(itShortcut);
+ const auto it = reMap.find(itShortcut);
// If a shortcut is currently in the invoked state then skip till the shortcut that is currently invoked
if (isShortcutInvoked && !it->second.isShortcutInvoked)
diff --git a/src/runner/update_utils.cpp b/src/runner/update_utils.cpp
index 5a2f30eb8b..4728fa21d0 100644
--- a/src/runner/update_utils.cpp
+++ b/src/runner/update_utils.cpp
@@ -13,7 +13,7 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
-auto Strings = updating::notifications::strings::create();
+auto Strings = create_notifications_strings();
bool start_msi_uninstallation_sequence()
{