mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
[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:
@@ -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)
|
||||
@@ -78,7 +76,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
{
|
||||
type = static_cast<KeyboardManagerEditorType>(_wtoi(cmdArgs[1]));
|
||||
}
|
||||
|
||||
|
||||
if (numArgs == 3)
|
||||
{
|
||||
std::wstring pid = std::wstring(cmdArgs[2]);
|
||||
@@ -106,12 +104,12 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
auto errorMessage = get_last_error_message(errorCode);
|
||||
Logger::error(L"Unable to start keyboard hook: {}", errorMessage.has_value() ? errorMessage.value() : L"");
|
||||
Trace::Error(errorCode, errorMessage.has_value() ? errorMessage.value() : L"", L"start_lowlevel_keyboard_hook.SetWindowsHookEx");
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
editor->OpenEditorWindow(type);
|
||||
|
||||
|
||||
editor = nullptr;
|
||||
|
||||
Trace::UnregisterProvider();
|
||||
|
||||
@@ -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);
|
||||
@@ -59,11 +62,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
|
||||
auto kbm = KeyboardManager();
|
||||
kbm.StartLowlevelKeyboardHook();
|
||||
|
||||
|
||||
run_message_loop();
|
||||
|
||||
|
||||
kbm.StopLowlevelKeyboardHook();
|
||||
Trace::UnregisterProvider();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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,12 +41,13 @@ private:
|
||||
std::wstring app_key = KeyboardManagerConstants::ModuleName;
|
||||
|
||||
HANDLE m_hProcess = nullptr;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
KeyboardManager()
|
||||
{
|
||||
LoggerHelpers::init_logger(KeyboardManagerConstants::ModuleName, L"ModuleInterface", LogSettings::keyboardManagerLoggerName);
|
||||
|
||||
|
||||
std::filesystem::path oldLogPath(PTSettingsHelper::get_module_save_folder_location(app_key));
|
||||
oldLogPath.append("Logs");
|
||||
LoggerHelpers::delete_old_log_folder(oldLogPath);
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
|
||||
@@ -118,7 +120,7 @@ public:
|
||||
m_enabled = true;
|
||||
// Log telemetry
|
||||
Trace::EnableKeyboardManager(true);
|
||||
|
||||
|
||||
unsigned long powertoys_pid = GetCurrentProcessId();
|
||||
std::wstring executable_args = L"";
|
||||
executable_args.append(std::to_wstring(powertoys_pid));
|
||||
|
||||
Reference in New Issue
Block a user