From 570c020d25e4f77c18f008f8cb6362ee699eae1f Mon Sep 17 00:00:00 2001 From: henrypp Date: Tue, 1 Oct 2019 00:15:41 +0600 Subject: [PATCH] upd project sdk --- src/helper.cpp | 14 +++++++------- src/main.cpp | 12 ++++++------ src/profile.cpp | 20 ++++++++++---------- src/timer.cpp | 4 ++-- src/wfp.cpp | 8 ++++---- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/helper.cpp b/src/helper.cpp index 91b81cca..ebaaa24b 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -198,7 +198,7 @@ bool _app_formataddress (ADDRESS_FAMILY af, UINT8 proto, const PVOID ptr_addr, U { if (result && app.ConfigGet (L"IsNetworkResolutionsEnabled", false).AsBool ()) { - const size_t addr_hash = _r_str_hash (formatted_address, INVALID_SIZE_T); + const size_t addr_hash = _r_str_hash (formatted_address); if (addr_hash) { @@ -1567,7 +1567,7 @@ size_t _app_getnetworkhash (ADDRESS_FAMILY af, DWORD pid, PVOID remote_addr, DWO return 0; } - return _r_str_hash (_r_fmt (L"%" PRIu8 L"_%" PRId32 L"_%s_%" PRId32 L"_%s_%" PRId32 L"_%" PRIu8 "_%" PRId32, af, pid, remote_addr_str, remote_port, local_addr_str, local_port, proto, state), INVALID_SIZE_T); + return _r_str_hash (_r_fmt (L"%" PRIu8 L"_%" PRId32 L"_%s_%" PRId32 L"_%s_%" PRId32 L"_%" PRIu8 "_%" PRId32, af, pid, remote_addr_str, remote_port, local_addr_str, local_port, proto, state)); } bool _app_isvalidconnection (ADDRESS_FAMILY af, PVOID paddr) @@ -1863,7 +1863,7 @@ void _app_generate_packages () continue; } - const size_t app_hash = _r_str_hash (package_sid_string, package_sid_string.GetLength ()); + const size_t app_hash = _r_str_hash (package_sid_string); if (apps_helper.find (app_hash) != apps_helper.end ()) { @@ -1992,7 +1992,7 @@ void _app_generate_services () time_t timestamp = 0; - const size_t app_hash = _r_str_hash (service_name, INVALID_SIZE_T); + const size_t app_hash = _r_str_hash (service_name); if (apps_helper.find (app_hash) != apps_helper.end ()) continue; @@ -2082,7 +2082,7 @@ void _app_generate_services () _r_str_alloc (&ptr_item->real_path, _r_str_length (real_path), real_path); _r_str_alloc (&ptr_item->internal_name, _r_str_length (service_name), service_name); - _r_str_toupper (sidstring.GetBuffer (), sidstring.GetLength ()); + _r_str_toupper (sidstring.GetBuffer ()); if ( !ConvertStringSecurityDescriptorToSecurityDescriptor (_r_fmt (SERVICE_SECURITY_DESCRIPTOR, sidstring.GetString ()), SDDL_REVISION_1, &ptr_item->pdata, nullptr) || @@ -2703,7 +2703,7 @@ bool _app_parsenetworkstring (LPCWSTR network_string, NET_ADDRESS_FORMAT * forma { if (paddr_dns) { - const size_t dns_hash = _r_str_hash (ni.NamedAddress.Address, INVALID_SIZE_T); + const size_t dns_hash = _r_str_hash (ni.NamedAddress.Address); _r_fastlock_acquireshared (&lock_cache); const bool is_exists = cache_dns.find (dns_hash) != cache_dns.end (); @@ -3000,7 +3000,7 @@ bool _app_resolveaddress (ADDRESS_FAMILY af, LPVOID paddr, LPWSTR * pbuffer) if (pstraddr) { - const size_t arpa_hash = _r_str_hash (pstraddr, INVALID_SIZE_T); + const size_t arpa_hash = _r_str_hash (pstraddr); _r_fastlock_acquireshared (&lock_cache); const bool is_exists = cache_arpa.find (arpa_hash) != cache_arpa.end (); diff --git a/src/main.cpp b/src/main.cpp index 71762c05..60f764ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -577,7 +577,7 @@ void addcolor (UINT locale_id, LPCWSTR config_name, bool is_enabled, LPCWSTR con { _r_str_alloc (&ptr_clr->pcfg_value, _r_str_length (config_value), config_value); - ptr_clr->clr_hash = _r_str_hash (config_value, INVALID_SIZE_T); + ptr_clr->clr_hash = _r_str_hash (config_value); ptr_clr->new_clr = app.ConfigGet (config_value, default_clr, L"colors").AsUlong (); } @@ -732,10 +732,10 @@ LONG _app_nmcustdraw_listview (LPNMLVCUSTOMDRAW lpnmlv) COLORREF new_clr = 0; if (ptr_rule->is_enabled && ptr_rule->is_haveerrors) - new_clr = _app_getcolorvalue (_r_str_hash (L"ColorInvalid", INVALID_SIZE_T)); + new_clr = _app_getcolorvalue (_r_str_hash (L"ColorInvalid")); else if (ptr_rule->is_forservices || !ptr_rule->apps.empty ()) - new_clr = _app_getcolorvalue (_r_str_hash (L"ColorSpecial", INVALID_SIZE_T)); + new_clr = _app_getcolorvalue (_r_str_hash (L"ColorSpecial")); if (new_clr) { @@ -2780,9 +2780,9 @@ void _app_initialize () _r_str_printf (config.rules_config_path_backup, _countof (config.rules_config_path_backup), L"%s\\" XML_RULES_CONFIG L".bak", app.GetProfileDirectory ()); _r_str_printf (config.rules_custom_path_backup, _countof (config.rules_custom_path_backup), L"%s\\" XML_RULES_CUSTOM L".bak", app.GetProfileDirectory ()); - config.ntoskrnl_hash = _r_str_hash (PROC_SYSTEM_NAME, INVALID_SIZE_T); - config.svchost_hash = _r_str_hash (_r_path_expand (PATH_SVCHOST), INVALID_SIZE_T); - config.my_hash = _r_str_hash (app.GetBinaryPath (), INVALID_SIZE_T); + config.ntoskrnl_hash = _r_str_hash (PROC_SYSTEM_NAME); + config.svchost_hash = _r_str_hash (_r_path_expand (PATH_SVCHOST)); + config.my_hash = _r_str_hash (app.GetBinaryPath ()); // get the Administrators group security identifier if (!config.padminsid) diff --git a/src/profile.cpp b/src/profile.cpp index b13bd3b8..baa4e6d6 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -89,7 +89,7 @@ size_t _app_addapplication (HWND hwnd, LPCWSTR path, time_t timestamp, time_t ti } const size_t app_length = _r_str_length (path); - const size_t app_hash = _r_str_hash (path, app_length); + const size_t app_hash = _r_str_hash (path); if (_app_isappfound (app_hash)) return app_hash; // already exists @@ -153,7 +153,7 @@ size_t _app_addapplication (HWND hwnd, LPCWSTR path, time_t timestamp, time_t ti if (is_ntoskrnl && !_r_str_isempty (ptr_app->original_path)) { - _r_str_tolower (ptr_app->original_path, INVALID_SIZE_T); + _r_str_tolower (ptr_app->original_path); ptr_app->original_path[0] = _r_str_upper (ptr_app->original_path[0]); // fix "System" lowercase } @@ -236,7 +236,7 @@ PR_OBJECT _app_getrulebyhash (size_t rule_hash) { if (ptr_rule->is_readonly) { - if (ptr_rule->pname && _r_str_hash (ptr_rule->pname, INVALID_SIZE_T) == rule_hash) + if (ptr_rule->pname && _r_str_hash (ptr_rule->pname) == rule_hash) return ptr_rule_object; } } @@ -650,7 +650,7 @@ void _app_ruleenable (PITEM_RULE ptr_rule, bool is_enable) if (ptr_rule->is_readonly && !_r_str_isempty (ptr_rule->pname)) { - const size_t rule_hash = _r_str_hash (ptr_rule->pname, INVALID_SIZE_T); + const size_t rule_hash = _r_str_hash (ptr_rule->pname); if (rule_hash) { @@ -703,7 +703,7 @@ void _app_ruleenable2 (PITEM_RULE ptr_rule, bool is_enable) if (ptr_rule->is_readonly && !_r_str_isempty (ptr_rule->pname)) { - const size_t rule_hash = _r_str_hash (ptr_rule->pname, INVALID_SIZE_T); + const size_t rule_hash = _r_str_hash (ptr_rule->pname); if (rule_hash) { @@ -1014,7 +1014,7 @@ bool _app_isappexists (ITEM_APP* ptr_app) return !_r_str_isempty (ptr_app->real_path) && _r_fs_exists (ptr_app->real_path); else if (ptr_app->type == DataAppService || ptr_app->type == DataAppUWP) - return _app_item_get (ptr_app->type, _r_str_hash (ptr_app->original_path, INVALID_SIZE_T), nullptr, nullptr, nullptr, nullptr); + return _app_item_get (ptr_app->type, _r_str_hash (ptr_app->original_path), nullptr, nullptr, nullptr, nullptr); return true; } @@ -1161,7 +1161,7 @@ void _app_profile_load_helper (const pugi::xml_node & root, EnumDataType type, U { PITEM_RULE ptr_rule = new ITEM_RULE; - const size_t rule_hash = _r_str_hash (item.attribute (L"name").as_string (), INVALID_SIZE_T); + const size_t rule_hash = _r_str_hash (item.attribute (L"name").as_string ()); PR_OBJECT ptr_config_object = nullptr; PITEM_RULE_CONFIG ptr_config = nullptr; @@ -1245,7 +1245,7 @@ void _app_profile_load_helper (const pugi::xml_node & root, EnumDataType type, U if (!apps_rule.IsEmpty ()) { if (version < XML_PROFILE_VER_3) - _r_str_replace (apps_rule.GetBuffer (), apps_rule.GetLength (), DIVIDER_RULE[0], DIVIDER_APP[0]); // for compat with old profiles + _r_str_replace (apps_rule.GetBuffer (), DIVIDER_RULE[0], DIVIDER_APP[0]); // for compat with old profiles rstringvec rvc; _r_str_split (apps_rule, apps_rule.GetLength (), DIVIDER_APP[0], rvc); @@ -1312,7 +1312,7 @@ void _app_profile_load_helper (const pugi::xml_node & root, EnumDataType type, U rstring attr_apps = item.attribute (L"apps").as_string (); if (version < XML_PROFILE_VER_3) - _r_str_replace (attr_apps.GetBuffer (), attr_apps.GetLength (), DIVIDER_RULE[0], DIVIDER_APP[0]); // for compat with old profiles + _r_str_replace (attr_apps.GetBuffer (), DIVIDER_RULE[0], DIVIDER_APP[0]); // for compat with old profiles _r_str_alloc (&ptr_config->pname, rule_name.GetLength (), rule_name); _r_str_alloc (&ptr_config->papps, attr_apps.GetLength (), attr_apps); @@ -1837,7 +1837,7 @@ void _app_profile_save (LPCWSTR path_custom) bool is_enabled_default = ptr_config->is_enabled; { - const size_t rule_hash = _r_str_hash (ptr_config->pname, INVALID_SIZE_T); + const size_t rule_hash = _r_str_hash (ptr_config->pname); PR_OBJECT ptr_rule_object = _app_getrulebyhash (rule_hash); if (ptr_rule_object) diff --git a/src/timer.cpp b/src/timer.cpp index a1ca7bec..52e3b517 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -24,7 +24,7 @@ bool _app_timer_set (HWND hwnd, PITEM_APP ptr_app, time_t seconds) const time_t current_time = _r_unixtime_now (); - const size_t app_hash = _r_str_hash (ptr_app->original_path, INVALID_SIZE_T); // note: be carefull (!) + const size_t app_hash = _r_str_hash (ptr_app->original_path); // note: be carefull (!) BOOL is_created = FALSE; if (ptr_app->htimer) @@ -85,7 +85,7 @@ bool _app_timer_reset (HWND hwnd, PITEM_APP ptr_app) ptr_app->is_enabled = false; ptr_app->timer = 0; - const size_t app_hash = _r_str_hash (ptr_app->original_path, INVALID_SIZE_T); // note: be carefull (!) + const size_t app_hash = _r_str_hash (ptr_app->original_path); // note: be carefull (!) const INT listview_id = _app_getlistview_id (ptr_app->type); if (listview_id) diff --git a/src/wfp.cpp b/src/wfp.cpp index 01b25cfd..f14fa2ad 100644 --- a/src/wfp.cpp +++ b/src/wfp.cpp @@ -1287,7 +1287,7 @@ bool _wfp_create3filters (HANDLE hengine, OBJECTS_VEC & ptr_apps, UINT line, boo if (ptr_app->is_enabled) { - if (!_wfp_createrulefilter (hengine, ptr_app->display_name, _r_str_hash (ptr_app->original_path, INVALID_SIZE_T), nullptr, nullptr, 0, AF_UNSPEC, FWP_DIRECTION_MAX, FILTER_WEIGHT_APPLICATION, action, 0, &guids)) + if (!_wfp_createrulefilter (hengine, ptr_app->display_name, _r_str_hash (ptr_app->original_path), nullptr, nullptr, 0, AF_UNSPEC, FWP_DIRECTION_MAX, FILTER_WEIGHT_APPLICATION, action, 0, &guids)) is_haveerrors = true; } @@ -1910,7 +1910,7 @@ DWORD _FwpmGetAppIdFromFileName1 (LPCWSTR path, FWP_BYTE_BLOB * *lpblob, EnumDat { path_buff = path; - if (_r_str_hash (path, INVALID_SIZE_T) == config.ntoskrnl_hash) + if (_r_str_hash (path) == config.ntoskrnl_hash) { if (ByteBlobAlloc ((LPVOID)path_buff.GetString (), (path_buff.GetLength () + 1) * sizeof (WCHAR), lpblob)) return ERROR_SUCCESS; @@ -1950,7 +1950,7 @@ DWORD _FwpmGetAppIdFromFileName1 (LPCWSTR path, FWP_BYTE_BLOB * *lpblob, EnumDat path_buff.Append (path_noroot); - _r_str_tolower (path_buff.GetBuffer (), path_buff.GetLength ()); // lower is important! + _r_str_tolower (path_buff.GetBuffer ()); // lower is important! } } else if (rc != ERROR_SUCCESS) @@ -1967,7 +1967,7 @@ DWORD _FwpmGetAppIdFromFileName1 (LPCWSTR path, FWP_BYTE_BLOB * *lpblob, EnumDat path_buff = path; if (type == DataAppDevice) - _r_str_tolower (path_buff.GetBuffer (), path_buff.GetLength ()); // lower is important! + _r_str_tolower (path_buff.GetBuffer ()); // lower is important! if (ByteBlobAlloc ((LPVOID)path_buff.GetString (), (path_buff.GetLength () + 1) * sizeof (WCHAR), lpblob)) return ERROR_SUCCESS;