From 9bcfbd0687565b58ab2b955a37d9edab76f90a20 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Wed, 2 Dec 2020 05:00:57 -0500 Subject: merge common-install with common --- common-install/utility-install.hpp | 46 -------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 common-install/utility-install.hpp (limited to 'common-install/utility-install.hpp') diff --git a/common-install/utility-install.hpp b/common-install/utility-install.hpp deleted file mode 100644 index e1823e4..0000000 --- a/common-install/utility-install.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include - -#include "external/WinReg.hpp" - -namespace fs = std::filesystem; -namespace wr = winreg; - -inline const std::wstring DRIVER_NAME = L"rawaccel"; -inline const std::wstring DRIVER_FILE_NAME = DRIVER_NAME + L".sys"; - -fs::path get_sys_path() { - std::wstring path; - path.resize(MAX_PATH); - - UINT chars_copied = GetSystemDirectoryW(path.data(), MAX_PATH); - if (chars_copied == 0) throw std::runtime_error("GetSystemDirectory failed"); - - path.resize(chars_copied); - return path; -} - -fs::path get_target_path() { - return get_sys_path() / L"drivers" / DRIVER_FILE_NAME; -} - -fs::path make_temp_path(const fs::path& p) { - auto tmp_path = p; - tmp_path.concat(".tmp"); - return tmp_path; -} - -template -void modify_upper_filters(Func fn) { - const std::wstring FILTERS_NAME = L"UpperFilters"; - wr::RegKey key( - HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e96f-e325-11ce-bfc1-08002be10318}" - ); - - std::vector filters = key.GetMultiStringValue(FILTERS_NAME); - fn(filters); - key.SetMultiStringValue(FILTERS_NAME, filters); -} -- cgit v1.2.3