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

[Build] Fix building on Visual Studio 17.8 #29303

Merged
merged 9 commits into from
Oct 19, 2023
3 changes: 3 additions & 0 deletions .github/actions/spell-check/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions Cpp.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4679;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4679;5271;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<ConformanceMode>false</ConformanceMode>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpplatest</LanguageStandard>
<BuildStlModules>false</BuildStlModules>
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- TODO: _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for compatibility with VS 17.8. Check if we can remove. -->
<PreprocessorDefinitions>_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- CLR + CFG are not compatible >:{ -->
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
Expand Down
4 changes: 2 additions & 2 deletions src/common/interop/two_way_pipe_message_ipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LPVOID>(ptg), // pointer to TOKEN_GROUPS buffer
0, // size of buffer
&dwLength // receives required buffer size
))
Expand All @@ -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<LPVOID>(ptg), // pointer to TOKEN_GROUPS buffer
dwLength, // size of buffer
&dwLength // receives required buffer size
))
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Hosts/HostsModuleInterface/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class HostsModuleInterface : public PowertoyModuleIface
//contains the non localized key of the powertoy
std::wstring app_key;

HANDLE m_hProcess;
HANDLE m_hProcess = nullptr;

HANDLE m_hShowEvent;

Expand Down
8 changes: 1 addition & 7 deletions src/modules/MouseWithoutBorders/ModuleInterface/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -520,8 +518,6 @@ class MouseWithoutBorders : public PowertoyModuleIface
virtual void enable()
{
Trace::MouseWithoutBorders::Enable(true);
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);

launch_process();

Expand All @@ -534,8 +530,6 @@ class MouseWithoutBorders : public PowertoyModuleIface
{
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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class D2DOverlayWindow : public D2DWindow
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;
Expand Down
8 changes: 1 addition & 7 deletions src/modules/awake/AwakeModuleInterface/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -137,8 +135,6 @@ class Awake : public PowertoyModuleIface
virtual void enable()
{
Trace::EnableAwake(true);
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
launch_process();
m_enabled = true;
};
Expand All @@ -149,8 +145,6 @@ class Awake : public PowertoyModuleIface
{
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "KeyboardListener.g.h"

#include <spdlog/stopwatch.h>
#include <mutex>

namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -135,7 +134,6 @@ class PowerAccent : public PowertoyModuleIface

virtual void enable()
{
ResetEvent(m_hInvokeEvent);
launch_process();
m_enabled = true;
Trace::EnablePowerAccent(true);
Expand All @@ -146,7 +144,6 @@ class PowerAccent : public PowertoyModuleIface
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)
Expand Down
4 changes: 2 additions & 2 deletions src/runner/auto_start_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void**>(&pLogonTrigger));
pTrigger->Release();
ExitOnFailure(hr, "QueryInterface call failed for ILogonTrigger: %x", hr);

Expand Down Expand Up @@ -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<void**>(&pExecAction));
pAction->Release();
ExitOnFailure(hr, "QueryInterface call failed for IExecAction: %x", hr);

Expand Down
Loading