[Build]Fix building on Visual Studio 17.8 (#29303)

* Add definition to ignore deprecated stdext checked_array_iterator

* Disable warning to ignore direct mention of dll in C# headers

* Fix PowerAccent Keyboard Service build errors

* Remove unused event variables

* Fix uninitialized events

* Remove unused telemetry events

* Fix building ShortcutGuide

* Fix C-style casts

* Fix spellcheck
This commit is contained in:
Jaime Bernardo 2023-10-19 15:04:09 +01:00 коммит произвёл GitHub
Родитель 3c10542c4c
Коммит f0b460312a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 17 добавлений и 27 удалений

3
.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

Просмотреть файл

@ -50,7 +50,7 @@
<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>
@ -58,7 +58,8 @@
<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>

Просмотреть файл

@ -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
))
@ -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
))

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
}
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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)

Просмотреть файл

@ -3,6 +3,7 @@
#include "KeyboardListener.g.h"
#include <spdlog/stopwatch.h>
#include <mutex>
namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
{

Просмотреть файл

@ -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)

Просмотреть файл

@ -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);
@ -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);