diff --git a/.github/actions/spell-check/patterns.txt b/.github/actions/spell-check/patterns.txt index 5959fbe8fc..e79179449e 100644 --- a/.github/actions/spell-check/patterns.txt +++ b/.github/actions/spell-check/patterns.txt @@ -181,5 +181,8 @@ http://tes/ # Autogenerated revert commit message ^This reverts commit [0-9a-f]{40}\.$ +# Compile flag added to Cpp.Build.props +_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING + # ignore long runs of a single character: \b([A-Za-z])\g{-1}{3,}\b diff --git a/Cpp.Build.props b/Cpp.Build.props index 5eb275a507..3279750b33 100644 --- a/Cpp.Build.props +++ b/Cpp.Build.props @@ -50,7 +50,7 @@ pch.h Level4 - 4679;%(DisableSpecificWarnings) + 4679;5271;%(DisableSpecificWarnings) true TurnOffAllWarnings false @@ -58,7 +58,8 @@ stdcpplatest false /await %(AdditionalOptions) - _UNICODE;UNICODE;%(PreprocessorDefinitions) + + _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_UNICODE;UNICODE;%(PreprocessorDefinitions) Guard ProgramDatabase diff --git a/src/common/interop/two_way_pipe_message_ipc.cpp b/src/common/interop/two_way_pipe_message_ipc.cpp index 7dd1dedf36..4b09e67626 100644 --- a/src/common/interop/two_way_pipe_message_ipc.cpp +++ b/src/common/interop/two_way_pipe_message_ipc.cpp @@ -176,7 +176,7 @@ BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken, if (!GetTokenInformation( hToken, // handle to the access token TokenGroups, // get information about the token's groups - (LPVOID)ptg, // pointer to TOKEN_GROUPS buffer + static_cast(ptg), // pointer to TOKEN_GROUPS buffer 0, // size of buffer &dwLength // receives required buffer size )) @@ -197,7 +197,7 @@ BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken, if (!GetTokenInformation( hToken, // handle to the access token TokenGroups, // get information about the token's groups - (LPVOID)ptg, // pointer to TOKEN_GROUPS buffer + static_cast(ptg), // pointer to TOKEN_GROUPS buffer dwLength, // size of buffer &dwLength // receives required buffer size )) diff --git a/src/modules/Hosts/HostsModuleInterface/dllmain.cpp b/src/modules/Hosts/HostsModuleInterface/dllmain.cpp index e971bc3f77..e089c06975 100644 --- a/src/modules/Hosts/HostsModuleInterface/dllmain.cpp +++ b/src/modules/Hosts/HostsModuleInterface/dllmain.cpp @@ -49,7 +49,7 @@ private: //contains the non localized key of the powertoy std::wstring app_key; - HANDLE m_hProcess; + HANDLE m_hProcess = nullptr; HANDLE m_hShowEvent; diff --git a/src/modules/MouseWithoutBorders/ModuleInterface/dllmain.cpp b/src/modules/MouseWithoutBorders/ModuleInterface/dllmain.cpp index ad8dc5eaed..0b259c71f8 100644 --- a/src/modules/MouseWithoutBorders/ModuleInterface/dllmain.cpp +++ b/src/modules/MouseWithoutBorders/ModuleInterface/dllmain.cpp @@ -123,9 +123,7 @@ class MouseWithoutBorders : public PowertoyModuleIface private: bool m_enabled = false; bool run_in_service_mode = false; - HANDLE send_telemetry_event; - HANDLE m_hInvokeEvent; - PROCESS_INFORMATION p_info; + PROCESS_INFORMATION p_info = {}; bool is_enabled_by_default() const override { @@ -520,8 +518,6 @@ public: virtual void enable() { Trace::MouseWithoutBorders::Enable(true); - ResetEvent(send_telemetry_event); - ResetEvent(m_hInvokeEvent); launch_process(); @@ -534,8 +530,6 @@ public: { Trace::MouseWithoutBorders::Enable(false); Logger::trace(L"Disabling MouseWithoutBorders..."); - ResetEvent(send_telemetry_event); - ResetEvent(m_hInvokeEvent); Logger::trace(L"Signaled exit event for PowerToys MouseWithoutBorders."); TerminateProcess(p_info.hProcess, 1); diff --git a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp index a589da85e4..bbb660a6ea 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp +++ b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp @@ -705,7 +705,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_device_context) { continue; } - render_arrow(arrows[(size_t)(button.keynum) - 1], button, window_rect, use_overlay->get_scale(), d2d_device_context, taskbar_icon_shortcuts_x_offset, taskbar_icon_shortcuts_y_offset); + render_arrow(arrows[static_cast(button.keynum) - 1], button, window_rect, use_overlay->get_scale(), d2d_device_context, taskbar_icon_shortcuts_x_offset, taskbar_icon_shortcuts_y_offset); } } } diff --git a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h index 440bae0021..00f05db565 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h +++ b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h @@ -93,7 +93,7 @@ private: std::mutex tasklist_cv_mutex; std::condition_variable tasklist_cv; - HTHUMBNAIL thumbnail; + HTHUMBNAIL thumbnail = nullptr; HWND active_window = nullptr; bool active_window_snappable = false; D2DOverlaySVG landscape, portrait; diff --git a/src/modules/awake/AwakeModuleInterface/dllmain.cpp b/src/modules/awake/AwakeModuleInterface/dllmain.cpp index 027eb9913c..cf753533dd 100644 --- a/src/modules/awake/AwakeModuleInterface/dllmain.cpp +++ b/src/modules/awake/AwakeModuleInterface/dllmain.cpp @@ -44,9 +44,7 @@ class Awake : public PowertoyModuleIface private: bool m_enabled = false; - HANDLE send_telemetry_event; - HANDLE m_hInvokeEvent; - PROCESS_INFORMATION p_info; + PROCESS_INFORMATION p_info = {}; bool is_process_running() { @@ -137,8 +135,6 @@ public: virtual void enable() { Trace::EnableAwake(true); - ResetEvent(send_telemetry_event); - ResetEvent(m_hInvokeEvent); launch_process(); m_enabled = true; }; @@ -149,8 +145,6 @@ public: { Trace::EnableAwake(false); Logger::trace(L"Disabling Awake..."); - ResetEvent(send_telemetry_event); - ResetEvent(m_hInvokeEvent); auto exitEvent = CreateEvent(nullptr, false, false, CommonSharedConstants::AWAKE_EXIT_EVENT); if (!exitEvent) diff --git a/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h b/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h index 65d2dca34a..f2358d7135 100644 --- a/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h +++ b/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h @@ -3,6 +3,7 @@ #include "KeyboardListener.g.h" #include +#include namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { diff --git a/src/modules/poweraccent/PowerAccentModuleInterface/dllmain.cpp b/src/modules/poweraccent/PowerAccentModuleInterface/dllmain.cpp index d726166c41..59a275b0d0 100644 --- a/src/modules/poweraccent/PowerAccentModuleInterface/dllmain.cpp +++ b/src/modules/poweraccent/PowerAccentModuleInterface/dllmain.cpp @@ -46,8 +46,7 @@ class PowerAccent : public PowertoyModuleIface private: bool m_enabled = false; - HANDLE m_hInvokeEvent; - PROCESS_INFORMATION p_info; + PROCESS_INFORMATION p_info = {}; bool is_process_running() { @@ -135,7 +134,6 @@ public: virtual void enable() { - ResetEvent(m_hInvokeEvent); launch_process(); m_enabled = true; Trace::EnablePowerAccent(true); @@ -146,7 +144,6 @@ public: if (m_enabled) { Logger::trace(L"Disabling QuickAccent... {}", m_enabled); - ResetEvent(m_hInvokeEvent); auto exitEvent = CreateEvent(nullptr, false, false, CommonSharedConstants::POWERACCENT_EXIT_EVENT); if (!exitEvent) diff --git a/src/runner/auto_start_helper.cpp b/src/runner/auto_start_helper.cpp index 7724877cef..56e11f1c6e 100644 --- a/src/runner/auto_start_helper.cpp +++ b/src/runner/auto_start_helper.cpp @@ -156,7 +156,7 @@ bool create_auto_start_task_for_this_user(bool runElevated) ExitOnFailure(hr, "Cannot create the trigger: %x", hr); hr = pTrigger->QueryInterface( - IID_ILogonTrigger, (void**)&pLogonTrigger); + IID_ILogonTrigger, reinterpret_cast(&pLogonTrigger)); pTrigger->Release(); ExitOnFailure(hr, "QueryInterface call failed for ILogonTrigger: %x", hr); @@ -191,7 +191,7 @@ bool create_auto_start_task_for_this_user(bool runElevated) // QI for the executable task pointer. hr = pAction->QueryInterface( - IID_IExecAction, (void**)&pExecAction); + IID_IExecAction, reinterpret_cast(&pExecAction)); pAction->Release(); ExitOnFailure(hr, "QueryInterface call failed for IExecAction: %x", hr);