diff --git a/src/helper.cpp b/src/helper.cpp index 08de54f6..277624ec 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -216,7 +216,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); + const size_t addr_hash = _r_str_hash (formatted_address, INVALID_SIZE_T); if (addr_hash) { @@ -1563,7 +1563,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)); + 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); } bool _app_isvalidconnection (ADDRESS_FAMILY af, PVOID paddr) @@ -1857,7 +1857,7 @@ void _app_generate_packages () continue; } - const size_t app_hash = _r_str_hash (package_sid_string); + const size_t app_hash = _r_str_hash (package_sid_string, package_sid_string.GetLength ()); if (apps_helper.find (app_hash) != apps_helper.end ()) { @@ -1986,7 +1986,7 @@ void _app_generate_services () time_t timestamp = 0; - const size_t app_hash = _r_str_hash (service_name); + const size_t app_hash = _r_str_hash (service_name, INVALID_SIZE_T); if (apps_helper.find (app_hash) != apps_helper.end ()) continue; @@ -2697,7 +2697,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); + const size_t dns_hash = _r_str_hash (ni.NamedAddress.Address, INVALID_SIZE_T); _r_fastlock_acquireshared (&lock_cache); const bool is_exists = cache_dns.find (dns_hash) != cache_dns.end (); @@ -2994,7 +2994,7 @@ bool _app_resolveaddress (ADDRESS_FAMILY af, LPVOID paddr, LPWSTR * pbuffer) if (pstraddr) { - const size_t arpa_hash = _r_str_hash (pstraddr); + const size_t arpa_hash = _r_str_hash (pstraddr, INVALID_SIZE_T); _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 6862c6b1..8126d8c9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -560,7 +560,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); + ptr_clr->clr_hash = _r_str_hash (config_value, INVALID_SIZE_T); ptr_clr->new_clr = app.ConfigGet (config_value, default_clr, L"colors").AsUlong (); } @@ -715,10 +715,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")); + new_clr = _app_getcolorvalue (_r_str_hash (L"ColorInvalid", INVALID_SIZE_T)); else if (ptr_rule->is_forservices || !ptr_rule->apps.empty ()) - new_clr = _app_getcolorvalue (_r_str_hash (L"ColorSpecial")); + new_clr = _app_getcolorvalue (_r_str_hash (L"ColorSpecial", INVALID_SIZE_T)); if (new_clr) { @@ -2756,9 +2756,9 @@ void _app_initialize () StringCchPrintf (config.rules_config_path_backup, _countof (config.rules_config_path_backup), L"%s\\" XML_RULES_CONFIG L".bak", app.GetProfileDirectory ()); StringCchPrintf (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); - config.svchost_hash = _r_str_hash (_r_path_expand (PATH_SVCHOST)); - config.my_hash = _r_str_hash (app.GetBinaryPath ()); + 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); // get the Administrators group security identifier if (!config.padminsid) diff --git a/src/profile.cpp b/src/profile.cpp index d23bb752..7d683ac0 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -238,7 +238,7 @@ PR_OBJECT _app_getrulebyhash (size_t rule_hash) { if (ptr_rule->is_readonly) { - if (ptr_rule->pname && _r_str_hash (ptr_rule->pname) == rule_hash) + if (ptr_rule->pname && _r_str_hash (ptr_rule->pname, INVALID_SIZE_T) == rule_hash) return ptr_rule_object; } } @@ -652,7 +652,7 @@ void _app_ruleenable (PITEM_RULE ptr_rule, bool is_enable) if (ptr_rule->is_readonly && !_r_str_empty (ptr_rule->pname)) { - const size_t rule_hash = _r_str_hash (ptr_rule->pname); + const size_t rule_hash = _r_str_hash (ptr_rule->pname, INVALID_SIZE_T); if (rule_hash) { @@ -705,7 +705,7 @@ void _app_ruleenable2 (PITEM_RULE ptr_rule, bool is_enable) if (ptr_rule->is_readonly && !_r_str_empty (ptr_rule->pname)) { - const size_t rule_hash = _r_str_hash (ptr_rule->pname); + const size_t rule_hash = _r_str_hash (ptr_rule->pname, INVALID_SIZE_T); if (rule_hash) { @@ -982,7 +982,7 @@ bool _app_isappexists (ITEM_APP* ptr_app) return !_r_str_empty (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), nullptr, nullptr, nullptr, nullptr); + return _app_item_get (ptr_app->type, _r_str_hash (ptr_app->original_path, INVALID_SIZE_T), nullptr, nullptr, nullptr, nullptr); return true; } @@ -1129,7 +1129,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 ()); + const size_t rule_hash = _r_str_hash (item.attribute (L"name").as_string (), INVALID_SIZE_T); PR_OBJECT ptr_config_object = nullptr; PITEM_RULE_CONFIG ptr_config = nullptr; @@ -1802,7 +1802,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); + const size_t rule_hash = _r_str_hash (ptr_config->pname, INVALID_SIZE_T); PR_OBJECT ptr_rule_object = _app_getrulebyhash (rule_hash); if (ptr_rule_object) diff --git a/src/timer.cpp b/src/timer.cpp index 3cfd9a3a..239b66e4 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); // note: be carefull (!) + const size_t app_hash = _r_str_hash (ptr_app->original_path, INVALID_SIZE_T); // 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); // note: be carefull (!) + const size_t app_hash = _r_str_hash (ptr_app->original_path, INVALID_SIZE_T); // 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 2f23366e..e97e7f9b 100644 --- a/src/wfp.cpp +++ b/src/wfp.cpp @@ -1282,7 +1282,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), 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, INVALID_SIZE_T), nullptr, nullptr, 0, AF_UNSPEC, FWP_DIRECTION_MAX, FILTER_WEIGHT_APPLICATION, action, 0, &guids)) is_haveerrors = true; } @@ -1906,7 +1906,7 @@ DWORD _FwpmGetAppIdFromFileName1 (LPCWSTR path, FWP_BYTE_BLOB * *lpblob, EnumDat { path_buff = path; - if (_r_str_hash (path) == config.ntoskrnl_hash) + if (_r_str_hash (path, INVALID_SIZE_T) == config.ntoskrnl_hash) { if (ByteBlobAlloc ((LPVOID)path_buff.GetString (), (path_buff.GetLength () + 1) * sizeof (WCHAR), lpblob)) return ERROR_SUCCESS;