[Analyzers][CPP] turn on Warning 4100 (#21449)

* Analyzers CPP

Changing the warning level from 3 to 4.
change some project files to make them use the warning config in cpp props file.

* Analyzers C++ turn on warning 4706

Change Cpp.Build.props file to enable 4706
fix BugReportTool code to get rid of 4706

* Turn on warning 4100 and fix the code

* Follow c++ core guidelines

* Adapting to PR comments
This commit is contained in:
sosssego 2022-11-09 14:41:14 +00:00 коммит произвёл GitHub
Родитель cca10d2455
Коммит 78f5b4c3a4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
40 изменённых файлов: 128 добавлений и 127 удалений

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

@ -42,7 +42,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>26800;28251;4100;4127;4189;4239;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26800;28251;4127;4189;4239;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<ConformanceMode>false</ConformanceMode>

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

@ -19,7 +19,7 @@ MonitorInfo::MonitorInfo(HMONITOR h) :
GetMonitorInfoW(handle, &info);
}
static BOOL CALLBACK GetDisplaysEnumCb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
static BOOL CALLBACK GetDisplaysEnumCb(HMONITOR monitor, HDC /*hdc*/, LPRECT /*rect*/, LPARAM data)
{
auto* monitors = reinterpret_cast<std::vector<MonitorInfo>*>(data);
monitors->emplace_back(monitor);

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

@ -24,7 +24,7 @@ HotkeyManager::~HotkeyManager()
}
// When all Shortcut keys are pressed, fire the HotkeyCallback event.
void HotkeyManager::KeyboardEventProc(KeyboardEvent ^ ev)
void HotkeyManager::KeyboardEventProc(KeyboardEvent ^ /*ev*/)
{
// pressedKeys always stores the latest keyboard state
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);

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

@ -90,7 +90,7 @@ public:
}
virtual HRESULT STDMETHODCALLTYPE Activate(
LPCWSTR appUserModelId,
LPCWSTR /*appUserModelId*/,
LPCWSTR invokedArgs,
const NOTIFICATION_USER_INPUT_DATA*,
ULONG) override

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

@ -14,7 +14,7 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -141,7 +141,7 @@ public:
return powertoys_gpo::getConfiguredHostsFileEditorEnabledValue();
}
virtual bool get_config(wchar_t* buffer, int* buffer_size) override
virtual bool get_config(wchar_t* /*buffer*/, int* /*buffer_size*/) override
{
return false;
}
@ -173,7 +173,7 @@ public:
}
}
virtual void set_config(const wchar_t* config) override
virtual void set_config(const wchar_t* /*config*/) override
{
}

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

@ -9,11 +9,8 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
HMODULE m_hModule;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
m_hModule = hModule;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
@ -245,7 +242,7 @@ public:
return m_enabled;
}
virtual bool on_hotkey(size_t hotkeyId) override
virtual bool on_hotkey(size_t /*hotkeyId*/) override
{
if (m_enabled)
{

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

@ -13,9 +13,9 @@
#include <common/utils/logger_helper.h>
#include <common/utils/winapi_error.h>
BOOL APIENTRY DllMain(HMODULE hModule,
BOOL APIENTRY DllMain(HMODULE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID lpReserved)
LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -30,6 +30,7 @@ BOOL APIENTRY DllMain(HMODULE hModule,
Trace::UnregisterProvider();
break;
}
return TRUE;
}
@ -127,7 +128,7 @@ private:
}
else
{
Logger::error( L"TextExtractor failed to start. {}", get_last_error_or_default(GetLastError()));
Logger::error(L"TextExtractor failed to start. {}", get_last_error_or_default(GetLastError()));
}
m_hProcess = sei.hProcess;
@ -207,7 +208,7 @@ public:
return settings.serialize_to_buffer(buffer, buffer_size);
}
virtual void call_custom_action(const wchar_t* action) override
virtual void call_custom_action(const wchar_t* /*action*/) override
{
}
@ -254,7 +255,7 @@ public:
Trace::EnablePowerOCR(false);
}
virtual bool on_hotkey(size_t hotkeyId) override
virtual bool on_hotkey(size_t /*hotkeyId*/) override
{
if (m_enabled)
{
@ -292,7 +293,6 @@ public:
{
return m_enabled;
}
};
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()

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

@ -43,7 +43,7 @@ bool SetCurrentPath()
return true;
}
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PWSTR lpCmdLine, _In_ int nCmdShow)
int WINAPI wWinMain(_In_ HINSTANCE /*hInstance*/, _In_opt_ HINSTANCE /*hPrevInstance*/, _In_ PWSTR lpCmdLine, _In_ int /*nCmdShow*/)
{
winrt::init_apartment();
LoggerHelpers::init_logger(ShortcutGuideConstants::ModuleKey, L"ShortcutGuide", LogSettings::shortcutGuideLoggerName);

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

@ -11,7 +11,7 @@
#include "Generated Files/resource.h"
#include <common/SettingsAPI/settings_objects.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD /*ul_reason_for_call*/, LPVOID /*lpReserved*/)
{
return TRUE;
}
@ -271,7 +271,7 @@ private:
{
Logger::error("Failed to init settings. {}", ex.what());
}
catch(...)
catch (...)
{
Logger::error("Failed to init settings");
}

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

@ -30,7 +30,7 @@ namespace
const wchar_t JSON_KEY_VALUE[] = L"value";
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -106,7 +106,7 @@ public:
}
}
virtual bool on_hotkey(size_t hotkeyId) override
virtual bool on_hotkey(size_t /*hotkeyId*/) override
{
if (m_enabled)
{

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

@ -17,7 +17,7 @@
#include <filesystem>
#include <set>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{

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

@ -13,9 +13,7 @@
#include <common/utils/logger_helper.h>
#include <common/utils/winapi_error.h>
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -127,7 +125,7 @@ private:
}
else
{
Logger::error( L"ColorPicker failed to start. {}", get_last_error_or_default(GetLastError()));
Logger::error(L"ColorPicker failed to start. {}", get_last_error_or_default(GetLastError()));
}
m_hProcess = sei.hProcess;
@ -208,7 +206,7 @@ public:
return settings.serialize_to_buffer(buffer, buffer_size);
}
virtual void call_custom_action(const wchar_t* action) override
virtual void call_custom_action(const wchar_t* /*action*/) override
{
}
@ -255,7 +253,7 @@ public:
m_enabled = false;
}
virtual bool on_hotkey(size_t hotkeyId) override
virtual bool on_hotkey(size_t /*hotkeyId*/) override
{
if (m_enabled)
{

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

@ -247,7 +247,7 @@ namespace std
template<>
struct hash<FancyZonesDataTypes::WorkAreaId>
{
size_t operator()(const FancyZonesDataTypes::WorkAreaId& Value) const
size_t operator()(const FancyZonesDataTypes::WorkAreaId& /*Value*/) const
{
return 0;
}

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

@ -110,7 +110,7 @@ namespace std
template<>
struct hash<BackwardsCompatibility::DeviceIdData>
{
size_t operator()(const BackwardsCompatibility::DeviceIdData& Value) const
size_t operator()(const BackwardsCompatibility::DeviceIdData& /*Value*/) const
{
return 0;
}

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

@ -19,7 +19,7 @@ public:
FancyZonesSettings::instance().RemoveObserver(*this);
}
virtual void SettingsUpdate(SettingId type) {}
virtual void SettingsUpdate(SettingId /*type*/) {}
bool WantsToBeNotified(SettingId type) const noexcept
{

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

@ -59,7 +59,7 @@ WindowMoveHandler::WindowMoveHandler(const std::function<void()>& keyUpdateCallb
{
}
void WindowMoveHandler::MoveSizeStart(HWND window, HMONITOR monitor, POINT const& ptScreen, const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& workAreaMap) noexcept
void WindowMoveHandler::MoveSizeStart(HWND window, HMONITOR monitor, POINT const& /*ptScreen*/, const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& workAreaMap) noexcept
{
if (!FancyZonesWindowProcessing::IsProcessable(window))
{

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

@ -38,7 +38,7 @@ enum DWM_WINDOW_CORNER_PREFERENCE
namespace
{
BOOL CALLBACK saveDisplayToVector(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
BOOL CALLBACK saveDisplayToVector(HMONITOR monitor, HDC /*hdc*/, LPRECT /*rect*/, LPARAM data)
{
reinterpret_cast<std::vector<HMONITOR>*>(data)->emplace_back(monitor);
return true;
@ -121,7 +121,6 @@ namespace
}
}
bool FancyZonesWindowUtils::IsSplashScreen(HWND window)
{
wchar_t className[MAX_PATH];
@ -200,9 +199,7 @@ bool FancyZonesWindowUtils::IsPopupWindow(HWND window) noexcept
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
{
auto style = GetWindowLong(window, GWL_STYLE);
return ((style & WS_THICKFRAME) == WS_THICKFRAME
&& (style & WS_MINIMIZEBOX) == WS_MINIMIZEBOX
&& (style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX);
return ((style & WS_THICKFRAME) == WS_THICKFRAME && (style & WS_MINIMIZEBOX) == WS_MINIMIZEBOX && (style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX);
}
bool FancyZonesWindowUtils::IsCandidateForZoning(HWND window)

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

@ -14,7 +14,7 @@ public:
~WorkArea();
public:
inline bool Init(HINSTANCE hinstance, const FancyZonesDataTypes::WorkAreaId& parentUniqueId)
inline bool Init([[maybe_unused]] HINSTANCE hinstance, const FancyZonesDataTypes::WorkAreaId& parentUniqueId)
{
#ifndef UNIT_TESTS
if (!InitWindow(hinstance))
@ -22,7 +22,6 @@ public:
return false;
}
#endif
InitLayout(parentUniqueId);
return true;
}
@ -123,4 +122,3 @@ inline std::shared_ptr<WorkArea> MakeWorkArea(HINSTANCE hinstance, HMONITOR moni
return self;
}

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

@ -43,7 +43,7 @@ namespace FancyZonesUtils
quad->rgbBlue = GetBValue(color) * alpha / 255;
}
inline void FillRectARGB(wil::unique_hdc& hdc, RECT const* prcFill, BYTE alpha, COLORREF color, bool blendAlpha)
inline void FillRectARGB(wil::unique_hdc& hdc, RECT const* prcFill, BYTE alpha, COLORREF color, bool /*blendAlpha*/)
{
BITMAPINFO bi;
ZeroMemory(&bi, sizeof(bi));
@ -104,7 +104,7 @@ namespace FancyZonesUtils
using result_t = std::vector<std::pair<HMONITOR, RECT>>;
result_t result;
auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL {
auto enumMonitors = [](HMONITOR monitor, HDC /*hdc*/, LPRECT /*pRect*/, LPARAM param) -> BOOL {
MONITORINFOEX mi;
mi.cbSize = sizeof(mi);
result_t& result = *reinterpret_cast<result_t*>(param);
@ -126,7 +126,7 @@ namespace FancyZonesUtils
using result_t = std::vector<std::pair<HMONITOR, MONITORINFOEX>>;
result_t result;
auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL {
auto enumMonitors = [](HMONITOR monitor, HDC /*hdc*/, LPRECT /*pRect*/, LPARAM param) -> BOOL {
MONITORINFOEX mi;
mi.cbSize = sizeof(mi);
result_t& result = *reinterpret_cast<result_t*>(param);

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

@ -17,7 +17,7 @@
// Non-localizable
const std::wstring fancyZonesPath = L"modules\\FancyZones\\PowerToys.FancyZones.exe";
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -59,20 +59,20 @@ public:
// Return JSON with the configuration options.
// These are the settings shown on the settings page along with their current values.
virtual bool get_config(_Out_ PWSTR buffer, _Out_ int* buffer_size) override
virtual bool get_config(_Out_ PWSTR /*buffer*/, _Out_ int* /*buffer_size*/) override
{
return false;
}
// Passes JSON with the configuration settings for the powertoy.
// This is called when the user hits Save on the settings page.
virtual void set_config(PCWSTR config) override
virtual void set_config(PCWSTR /*config*/) override
{
}
// Signal from the Settings editor to call a custom action.
// This can be used to spawn more complex editors.
virtual void call_custom_action(const wchar_t* action) override
virtual void call_custom_action(const wchar_t* /*action*/) override
{
SetEvent(m_toggleEditorEvent);
}

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

@ -38,7 +38,7 @@ void CContextMenuHandler::Uninitialize()
}
}
HRESULT CContextMenuHandler::Initialize(_In_opt_ PCIDLIST_ABSOLUTE pidlFolder, _In_opt_ IDataObject* pdtobj, _In_opt_ HKEY hkeyProgID)
HRESULT CContextMenuHandler::Initialize(_In_opt_ PCIDLIST_ABSOLUTE pidlFolder, _In_opt_ IDataObject* pdtobj, _In_opt_ HKEY /*hkeyProgID*/)
{
Uninitialize();
@ -61,7 +61,7 @@ HRESULT CContextMenuHandler::Initialize(_In_opt_ PCIDLIST_ABSOLUTE pidlFolder, _
return S_OK;
}
HRESULT CContextMenuHandler::QueryContextMenu(_In_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
HRESULT CContextMenuHandler::QueryContextMenu(_In_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT /*idCmdLast*/, UINT uFlags)
{
if (uFlags & CMF_DEFAULTONLY)
return S_OK;
@ -167,7 +167,7 @@ HRESULT CContextMenuHandler::QueryContextMenu(_In_ HMENU hmenu, UINT indexMenu,
return S_OK;
}
HRESULT CContextMenuHandler::GetCommandString(UINT_PTR idCmd, UINT uType, _In_ UINT* pReserved, LPSTR pszName, UINT cchMax)
HRESULT CContextMenuHandler::GetCommandString(UINT_PTR idCmd, UINT uType, _In_ UINT* /*pReserved*/, LPSTR pszName, UINT cchMax)
{
if (idCmd == ID_RESIZE_PICTURES)
{
@ -360,7 +360,7 @@ HRESULT __stdcall CContextMenuHandler::GetCanonicalName(GUID* pguidCommandName)
return S_OK;
}
HRESULT __stdcall CContextMenuHandler::GetState(IShellItemArray* psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE* pCmdState)
HRESULT __stdcall CContextMenuHandler::GetState(IShellItemArray* psiItemArray, BOOL /*fOkToBeSlow*/, EXPCMDSTATE* pCmdState)
{
if (!CSettingsInstance().GetEnabled())
{

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

@ -92,10 +92,10 @@ public:
// Signal from the Settings editor to call a custom action.
// This can be used to spawn more complex editors.
virtual void call_custom_action(const wchar_t* action) override {}
virtual void call_custom_action(const wchar_t* /*action*/) override {}
// Called by the runner to pass the updated settings values as a serialized JSON.
virtual void set_config(const wchar_t* config) override {}
virtual void set_config(const wchar_t* /*config*/) override {}
// Enable the powertoy
virtual void enable()
@ -114,7 +114,6 @@ public:
}
}
Trace::EnableImageResizer(m_enabled);
}

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

@ -68,7 +68,7 @@ public:
/* Sets the configuration values. */
virtual void set_config(const wchar_t* config) = 0;
/* Call custom action from settings screen. */
virtual void call_custom_action(const wchar_t* action){};
virtual void call_custom_action(const wchar_t* /*action*/){};
/* Enables the PowerToy. */
virtual void enable() = 0;
/* Disables the PowerToy, should free as much memory as possible. */
@ -83,7 +83,10 @@ public:
* Modules do not need to override this method, it will return zero by default.
* This method is called even when the module is disabled.
*/
virtual size_t get_hotkeys(Hotkey* buffer, size_t buffer_size) { return 0; }
virtual size_t get_hotkeys(Hotkey* /*buffer*/, size_t /*buffer_size*/)
{
return 0;
}
virtual std::optional<HotkeyEx> GetHotkeyEx()
{
@ -97,7 +100,10 @@ public:
/* Called when one of the registered hotkeys is pressed. Should return true
* if the key press is to be swallowed.
*/
virtual bool on_hotkey(size_t hotkeyId) { return false; }
virtual bool on_hotkey(size_t /*hotkeyId*/)
{
return false;
}
/* These are for enabling the legacy behavior of showing the shortcut guide after pressing the win key.
* keep_track_of_pressed_win_key returns true if the module wants to keep track of the win key being pressed.
@ -114,7 +120,8 @@ public:
virtual bool is_enabled_by_default() const { return true; }
/* Provides the GPO configuration value for the module. This should be overriden by the module interface to get the proper gpo policy setting. */
virtual powertoys_gpo::gpo_rule_configured_t gpo_policy_enabled_configuration() {
virtual powertoys_gpo::gpo_rule_configured_t gpo_policy_enabled_configuration()
{
return powertoys_gpo::gpo_rule_configured_not_configured;
}

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

@ -22,12 +22,10 @@ std::unique_ptr<KeyboardManagerEditor> editor = nullptr;
const std::wstring instanceMutexName = L"Local\\PowerToys_KBMEditor_InstanceMutex";
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
_In_opt_ HINSTANCE /*hPrevInstance*/,
_In_ LPWSTR /*lpCmdLine*/,
_In_ int /*nCmdShow*/)
{
UNREFERENCED_PARAMETER(hPrevInstance);
LoggerHelpers::init_logger(KeyboardManagerConstants::ModuleName, L"Editor", LogSettings::keyboardManagerLoggerName);
if (powertoys_gpo::getConfiguredKeyboardManagerEnabledValue() == powertoys_gpo::gpo_rule_configured_disabled)

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

@ -11,7 +11,10 @@
const std::wstring instanceMutexName = L"Local\\PowerToys_KBMEngine_InstanceMutex";
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PWSTR lpCmdLine, _In_ int nCmdShow)
int WINAPI wWinMain(_In_ HINSTANCE /*hInstance*/,
_In_opt_ HINSTANCE /*hPrevInstance*/,
_In_ PWSTR lpCmdLine,
_In_ int /*nCmdShow*/)
{
winrt::init_apartment();
LoggerHelpers::init_logger(KeyboardManagerConstants::ModuleName, L"Engine", LogSettings::keyboardManagerLoggerName);

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

@ -10,7 +10,7 @@ void MockedInput::SetHookProc(std::function<intptr_t(LowlevelKeyboardEvent*)> ho
}
// Function to simulate keyboard input - arguments and return value based on SendInput function (https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendinput)
UINT MockedInput::SendVirtualInput(UINT cInputs, LPINPUT pInputs, int cbSize)
UINT MockedInput::SendVirtualInput(UINT cInputs, LPINPUT pInputs, int /*cbSize*/)
{
// Iterate over inputs
for (UINT i = 0; i < cInputs; i++)

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

@ -9,7 +9,7 @@
#include <shellapi.h>
#include <common/utils/logger_helper.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -23,6 +23,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
Trace::UnregisterProvider();
break;
}
return TRUE;
}
@ -40,6 +41,7 @@ private:
std::wstring app_key = KeyboardManagerConstants::ModuleName;
HANDLE m_hProcess = nullptr;
public:
// Constructor
KeyboardManager()
@ -89,7 +91,7 @@ public:
}
// Signal from the Settings editor to call a custom action.
virtual void call_custom_action(const wchar_t* action) override
virtual void call_custom_action(const wchar_t* /*action*/) override
{
}

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

@ -29,7 +29,7 @@ namespace
const wchar_t JSON_KEY_USE_CENTRALIZED_KEYBOARD_HOOK[] = L"use_centralized_keyboard_hook";
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -43,6 +43,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
Trace::UnregisterProvider();
break;
}
return TRUE;
}
@ -318,7 +319,7 @@ public:
}
// Process the hotkey event
virtual bool on_hotkey(size_t hotkeyId) override
virtual bool on_hotkey(size_t /*hotkeyId*/) override
{
// For now, hotkeyId will always be zero
if (m_enabled)

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

@ -18,7 +18,7 @@
#include <filesystem>
#include <set>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{
@ -32,6 +32,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
Trace::UnregisterProvider();
break;
}
return TRUE;
}

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

@ -272,7 +272,7 @@ HRESULT __stdcall CPowerRenameMenu::GetCanonicalName(GUID* pguidCommandName)
return S_OK;
}
HRESULT __stdcall CPowerRenameMenu::GetState(IShellItemArray* psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE* pCmdState)
HRESULT __stdcall CPowerRenameMenu::GetState(IShellItemArray* /*psiItemArray*/, BOOL /*fOkToBeSlow*/, EXPCMDSTATE* pCmdState)
{
*pCmdState = CSettingsInstance().GetEnabled() ? ECS_ENABLED : ECS_HIDDEN;
return S_OK;

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

@ -168,8 +168,6 @@ private:
std::wstring app_key;
public:
// Return the localized display name of the powertoy
virtual PCWSTR get_name() override
{
@ -300,7 +298,7 @@ public:
// Signal from the Settings editor to call a custom action.
// This can be used to spawn more complex editors.
virtual void call_custom_action(const wchar_t* action) override
virtual void call_custom_action(const wchar_t* /*action*/) override
{
}

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

@ -28,9 +28,9 @@ DEFINE_GUID(BHID_DataObject, 0xb8c0bd9f, 0xed24, 0x455c, 0x83, 0xe6, 0xd5, 0x39,
int APIENTRY wWinMain(
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ PWSTR lpCmdLine,
_In_ int nCmdShow)
_In_opt_ HINSTANCE /*hPrevInstance*/,
_In_ PWSTR /*lpCmdLine*/,
_In_ int /*nCmdShow*/)
{
g_hostHInst = hInstance;
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
@ -81,5 +81,6 @@ int APIENTRY wWinMain(
}
CoUninitialize();
}
return 0;
}

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

@ -53,19 +53,19 @@ IFACEMETHODIMP CMockPowerRenameManagerEvents::OnError(_In_ IPowerRenameItem* pIt
return S_OK;
}
IFACEMETHODIMP CMockPowerRenameManagerEvents::OnRegExStarted(_In_ DWORD threadId)
IFACEMETHODIMP CMockPowerRenameManagerEvents::OnRegExStarted(_In_ DWORD /*threadId*/)
{
m_regExStarted = true;
return S_OK;
}
IFACEMETHODIMP CMockPowerRenameManagerEvents::OnRegExCanceled(_In_ DWORD threadId)
IFACEMETHODIMP CMockPowerRenameManagerEvents::OnRegExCanceled(_In_ DWORD /*threadId*/)
{
m_regExCanceled = true;
return S_OK;
}
IFACEMETHODIMP CMockPowerRenameManagerEvents::OnRegExCompleted(_In_ DWORD threadId)
IFACEMETHODIMP CMockPowerRenameManagerEvents::OnRegExCompleted(_In_ DWORD /*threadId*/)
{
m_regExCompleted = true;
return S_OK;

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

@ -31,7 +31,7 @@ HRESULT CALLBACK DllGetClassObject(REFCLSID clsid, REFIID riid, void** ppv)
return hr;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
switch (ul_reason_for_call)
{

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

@ -9,7 +9,7 @@ namespace CentralizedHotkeys
std::wstring moduleName;
std::function<void(WORD, WORD)> action;
Action(std::wstring moduleName = L"", std::function<void(WORD, WORD)> action = ([](WORD modifiersMask, WORD vkCode) {}))
Action(std::wstring moduleName = L"", std::function<void(WORD, WORD)> action = ([](WORD /*modifiersMask*/, WORD /*vkCode*/) {}))
{
this->moduleName = moduleName;
this->action = action;

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

@ -58,9 +58,9 @@ namespace CentralizedKeyboardHook
// Handle the pressed key proc
void PressedKeyTimerProc(
HWND hwnd,
UINT message,
UINT /*message*/,
UINT_PTR idTimer,
DWORD dwTime)
DWORD /*dwTime*/)
{
std::multiset<PressedKeyDescriptor> copy;
{

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

@ -348,7 +348,7 @@ void cleanup_updates()
}
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nCmdShow*/)
{
Gdiplus::GdiplusStartupInput gpStartupInput;
ULONG_PTR gpToken;

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

@ -78,7 +78,7 @@ void PowertoyModule::UpdateHotkeyEx()
{
auto hotkey = container.value();
auto modulePtr = pt_module.get();
auto action = [modulePtr](WORD modifiersMask, WORD vkCode) {
auto action = [modulePtr](WORD /*modifiersMask*/, WORD /*vkCode*/) {
Logger::trace(L"{} hotkey Ex is invoked from Centralized keyboard hook", modulePtr->get_key());
modulePtr->OnHotkeyEx();
};

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

@ -462,7 +462,7 @@ LExit:
#define MAX_TITLE_LENGTH 100
void bring_settings_to_front()
{
auto callback = [](HWND hwnd, LPARAM data) -> BOOL {
auto callback = [](HWND hwnd, LPARAM /*data*/) -> BOOL {
DWORD processId;
if (GetWindowThreadProcessId(hwnd, &processId) && processId == g_settings_process_id)
{

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

@ -9,6 +9,7 @@
<ProjectName>BugReportTool</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Label="Configuration">
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
@ -23,7 +24,7 @@
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>PowerToys.$(ProjectName)</TargetName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
@ -45,7 +46,7 @@
<ItemGroup>
<ClCompile Include="..\..\..\deps\cziplib\src\zip.c">
<!-- Disabling warnings for external code -->
<DisableSpecificWarnings>26451;4706;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4706;26451;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ClCompile Include="EventViewer.cpp" />
<ClCompile Include="InstallationFolder.cpp" />