[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 # Autogenerated revert commit message
^This reverts commit [0-9a-f]{40}\.$ ^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: # ignore long runs of a single character:
\b([A-Za-z])\g{-1}{3,}\b \b([A-Za-z])\g{-1}{3,}\b

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

@ -50,7 +50,7 @@
<ClCompile> <ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4679;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4679;5271;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableAnalyzeExternal >true</DisableAnalyzeExternal> <DisableAnalyzeExternal >true</DisableAnalyzeExternal>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel> <ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<ConformanceMode>false</ConformanceMode> <ConformanceMode>false</ConformanceMode>
@ -58,7 +58,8 @@
<LanguageStandard>stdcpplatest</LanguageStandard> <LanguageStandard>stdcpplatest</LanguageStandard>
<BuildStlModules>false</BuildStlModules> <BuildStlModules>false</BuildStlModules>
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions> <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 >:{ --> <!-- CLR + CFG are not compatible >:{ -->
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard> <ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat> <DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>

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

@ -176,7 +176,7 @@ BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken,
if (!GetTokenInformation( if (!GetTokenInformation(
hToken, // handle to the access token hToken, // handle to the access token
TokenGroups, // get information about the token's groups 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 0, // size of buffer
&dwLength // receives required buffer size &dwLength // receives required buffer size
)) ))
@ -197,7 +197,7 @@ BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken,
if (!GetTokenInformation( if (!GetTokenInformation(
hToken, // handle to the access token hToken, // handle to the access token
TokenGroups, // get information about the token's groups 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, // size of buffer
&dwLength // receives required buffer size &dwLength // receives required buffer size
)) ))

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

@ -49,7 +49,7 @@ private:
//contains the non localized key of the powertoy //contains the non localized key of the powertoy
std::wstring app_key; std::wstring app_key;
HANDLE m_hProcess; HANDLE m_hProcess = nullptr;
HANDLE m_hShowEvent; HANDLE m_hShowEvent;

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

@ -123,9 +123,7 @@ class MouseWithoutBorders : public PowertoyModuleIface
private: private:
bool m_enabled = false; bool m_enabled = false;
bool run_in_service_mode = false; bool run_in_service_mode = false;
HANDLE send_telemetry_event; PROCESS_INFORMATION p_info = {};
HANDLE m_hInvokeEvent;
PROCESS_INFORMATION p_info;
bool is_enabled_by_default() const override bool is_enabled_by_default() const override
{ {
@ -520,8 +518,6 @@ public:
virtual void enable() virtual void enable()
{ {
Trace::MouseWithoutBorders::Enable(true); Trace::MouseWithoutBorders::Enable(true);
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
launch_process(); launch_process();
@ -534,8 +530,6 @@ public:
{ {
Trace::MouseWithoutBorders::Enable(false); Trace::MouseWithoutBorders::Enable(false);
Logger::trace(L"Disabling MouseWithoutBorders..."); Logger::trace(L"Disabling MouseWithoutBorders...");
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
Logger::trace(L"Signaled exit event for PowerToys MouseWithoutBorders."); Logger::trace(L"Signaled exit event for PowerToys MouseWithoutBorders.");
TerminateProcess(p_info.hProcess, 1); TerminateProcess(p_info.hProcess, 1);

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

@ -705,7 +705,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_device_context)
{ {
continue; 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::mutex tasklist_cv_mutex;
std::condition_variable tasklist_cv; std::condition_variable tasklist_cv;
HTHUMBNAIL thumbnail; HTHUMBNAIL thumbnail = nullptr;
HWND active_window = nullptr; HWND active_window = nullptr;
bool active_window_snappable = false; bool active_window_snappable = false;
D2DOverlaySVG landscape, portrait; D2DOverlaySVG landscape, portrait;

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

@ -44,9 +44,7 @@ class Awake : public PowertoyModuleIface
private: private:
bool m_enabled = false; bool m_enabled = false;
HANDLE send_telemetry_event; PROCESS_INFORMATION p_info = {};
HANDLE m_hInvokeEvent;
PROCESS_INFORMATION p_info;
bool is_process_running() bool is_process_running()
{ {
@ -137,8 +135,6 @@ public:
virtual void enable() virtual void enable()
{ {
Trace::EnableAwake(true); Trace::EnableAwake(true);
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
launch_process(); launch_process();
m_enabled = true; m_enabled = true;
}; };
@ -149,8 +145,6 @@ public:
{ {
Trace::EnableAwake(false); Trace::EnableAwake(false);
Logger::trace(L"Disabling Awake..."); Logger::trace(L"Disabling Awake...");
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
auto exitEvent = CreateEvent(nullptr, false, false, CommonSharedConstants::AWAKE_EXIT_EVENT); auto exitEvent = CreateEvent(nullptr, false, false, CommonSharedConstants::AWAKE_EXIT_EVENT);
if (!exitEvent) if (!exitEvent)

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

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

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

@ -46,8 +46,7 @@ class PowerAccent : public PowertoyModuleIface
private: private:
bool m_enabled = false; bool m_enabled = false;
HANDLE m_hInvokeEvent; PROCESS_INFORMATION p_info = {};
PROCESS_INFORMATION p_info;
bool is_process_running() bool is_process_running()
{ {
@ -135,7 +134,6 @@ public:
virtual void enable() virtual void enable()
{ {
ResetEvent(m_hInvokeEvent);
launch_process(); launch_process();
m_enabled = true; m_enabled = true;
Trace::EnablePowerAccent(true); Trace::EnablePowerAccent(true);
@ -146,7 +144,6 @@ public:
if (m_enabled) if (m_enabled)
{ {
Logger::trace(L"Disabling QuickAccent... {}", m_enabled); Logger::trace(L"Disabling QuickAccent... {}", m_enabled);
ResetEvent(m_hInvokeEvent);
auto exitEvent = CreateEvent(nullptr, false, false, CommonSharedConstants::POWERACCENT_EXIT_EVENT); auto exitEvent = CreateEvent(nullptr, false, false, CommonSharedConstants::POWERACCENT_EXIT_EVENT);
if (!exitEvent) if (!exitEvent)

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

@ -156,7 +156,7 @@ bool create_auto_start_task_for_this_user(bool runElevated)
ExitOnFailure(hr, "Cannot create the trigger: %x", hr); ExitOnFailure(hr, "Cannot create the trigger: %x", hr);
hr = pTrigger->QueryInterface( hr = pTrigger->QueryInterface(
IID_ILogonTrigger, (void**)&pLogonTrigger); IID_ILogonTrigger, reinterpret_cast<void**>(&pLogonTrigger));
pTrigger->Release(); pTrigger->Release();
ExitOnFailure(hr, "QueryInterface call failed for ILogonTrigger: %x", hr); 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. // QI for the executable task pointer.
hr = pAction->QueryInterface( hr = pAction->QueryInterface(
IID_IExecAction, (void**)&pExecAction); IID_IExecAction, reinterpret_cast<void**>(&pExecAction));
pAction->Release(); pAction->Release();
ExitOnFailure(hr, "QueryInterface call failed for IExecAction: %x", hr); ExitOnFailure(hr, "QueryInterface call failed for IExecAction: %x", hr);