mirror of
https://github.com/henrypp/simplewall.git
synced 2026-10-22 02:52:54 -05:00
fix #424
This commit is contained in:
6 files changed
+106
-110
No files matched your search
+13
-13
@@ -1103,7 +1103,7 @@ INT_PTR CALLBACK EditorProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
MFILTER_RULES rules;
|
||||
rules.push_back (ptr_rule);
|
||||
|
||||
_wfp_create4filters (&rules, __LINE__);
|
||||
_wfp_create4filters (rules, __LINE__);
|
||||
}
|
||||
|
||||
EndDialog (hwnd, 1);
|
||||
@@ -2873,8 +2873,8 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
|
||||
if (is_changed)
|
||||
{
|
||||
_app_timer_remove (hwnd, &timer_apps);
|
||||
_wfp_create3filters (&rules, __LINE__);
|
||||
_app_timer_remove (hwnd, timer_apps);
|
||||
_wfp_create3filters (rules, __LINE__);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
@@ -2909,7 +2909,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
_r_fastlock_releaseexclusive (&lock_access);
|
||||
|
||||
if (is_changed)
|
||||
_wfp_create4filters (&rules, __LINE__);
|
||||
_wfp_create4filters (rules, __LINE__);
|
||||
}
|
||||
|
||||
if (is_changed)
|
||||
@@ -3463,7 +3463,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
MFILTER_RULES rules;
|
||||
rules.push_back (ptr_rule);
|
||||
|
||||
_wfp_create4filters (&rules, __LINE__);
|
||||
_wfp_create4filters (rules, __LINE__);
|
||||
}
|
||||
|
||||
_app_listviewsort (hwnd, listview_id);
|
||||
@@ -3497,7 +3497,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
_r_fastlock_releaseshared (&lock_access);
|
||||
}
|
||||
|
||||
_app_timer_create (hwnd, &rules, timers.at (timer_idx));
|
||||
_app_timer_create (hwnd, rules, timers.at (timer_idx));
|
||||
|
||||
_app_listviewsort (hwnd, listview_id);
|
||||
|
||||
@@ -4147,7 +4147,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
_r_fastlock_releaseshared (&lock_access);
|
||||
|
||||
if (ctrl_id == IDM_DISABLETIMER)
|
||||
_app_timer_remove (hwnd, &rules);
|
||||
_app_timer_remove (hwnd, rules);
|
||||
|
||||
if (
|
||||
ctrl_id == IDM_DISABLETIMER ||
|
||||
@@ -4245,7 +4245,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
}
|
||||
|
||||
if (is_changed)
|
||||
_wfp_create3filters (&rules, __LINE__);
|
||||
_wfp_create3filters (rules, __LINE__);
|
||||
}
|
||||
else if (
|
||||
listview_id == IDC_RULES_BLOCKLIST ||
|
||||
@@ -4283,12 +4283,12 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
}
|
||||
|
||||
if (is_changed)
|
||||
_wfp_create4filters (&rules, __LINE__);
|
||||
_wfp_create4filters (rules, __LINE__);
|
||||
}
|
||||
|
||||
if (is_changed)
|
||||
{
|
||||
_app_timer_remove (hwnd, &timer_apps);
|
||||
_app_timer_remove (hwnd, timer_apps);
|
||||
|
||||
_app_listviewsort (hwnd, listview_id);
|
||||
|
||||
@@ -4608,7 +4608,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
}
|
||||
}
|
||||
|
||||
_wfp_destroy2filters (&ids, __LINE__);
|
||||
_wfp_destroy2filters (ids, __LINE__);
|
||||
|
||||
_app_refreshstatus (hwnd);
|
||||
_app_profile_save ();
|
||||
@@ -4656,7 +4656,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
|
||||
if (is_deleted)
|
||||
{
|
||||
_wfp_destroy2filters (&ids, __LINE__);
|
||||
_wfp_destroy2filters (ids, __LINE__);
|
||||
|
||||
_app_refreshstatus (hwnd);
|
||||
_app_profile_save ();
|
||||
@@ -4684,7 +4684,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
|
||||
_r_fastlock_releaseshared (&lock_access);
|
||||
|
||||
if (_app_timer_remove (hwnd, &rules))
|
||||
if (_app_timer_remove (hwnd, rules))
|
||||
{
|
||||
_app_listviewsort (hwnd, _app_gettab_id (hwnd));
|
||||
|
||||
|
||||
@@ -223,14 +223,11 @@ bool _app_notifycommand (HWND hwnd, UINT ctrl_id, size_t timer_idx)
|
||||
_r_fastlock_releaseexclusive (&lock_access);
|
||||
|
||||
// create filters
|
||||
if (!rules.empty ())
|
||||
{
|
||||
if (timer_idx != LAST_VALUE)
|
||||
_app_timer_create (app.GetHWND (), &rules, timers.at (timer_idx));
|
||||
if (timer_idx != LAST_VALUE)
|
||||
_app_timer_create (app.GetHWND (), rules, timers.at (timer_idx));
|
||||
|
||||
else
|
||||
_wfp_create3filters (&rules, __LINE__);
|
||||
}
|
||||
else
|
||||
_wfp_create3filters (rules, __LINE__);
|
||||
|
||||
_app_refreshstatus (app.GetHWND ());
|
||||
_app_profile_save ();
|
||||
@@ -983,7 +980,7 @@ LRESULT CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
||||
MFILTER_RULES rules;
|
||||
rules.push_back (ptr_rule);
|
||||
|
||||
_wfp_create4filters (&rules, __LINE__);
|
||||
_wfp_create4filters (rules, __LINE__);
|
||||
|
||||
if (_app_gettab_id (app.GetHWND ()) == listview_id)
|
||||
{
|
||||
|
||||
+39
-42
@@ -3,18 +3,18 @@
|
||||
|
||||
#include "global.hpp"
|
||||
|
||||
void _app_timer_create (HWND hwnd, MFILTER_APPS *ptr_apps, time_t seconds)
|
||||
void _app_timer_create (HWND hwnd, MFILTER_APPS& ptr_apps, time_t seconds)
|
||||
{
|
||||
if (!config.hengine || !ptr_apps || ptr_apps->empty ())
|
||||
if (!config.hengine || ptr_apps.empty ())
|
||||
return;
|
||||
|
||||
const time_t current_time = _r_unixtime_now ();
|
||||
|
||||
_r_fastlock_acquireexclusive (&lock_access);
|
||||
|
||||
for (size_t i = 0; i < ptr_apps->size (); i++)
|
||||
for (size_t i = 0; i < ptr_apps.size (); i++)
|
||||
{
|
||||
PITEM_APP ptr_app = ptr_apps->at (i);
|
||||
PITEM_APP ptr_app = ptr_apps.at (i);
|
||||
|
||||
if (!ptr_app)
|
||||
continue;
|
||||
@@ -55,9 +55,9 @@ void _app_timer_create (HWND hwnd, MFILTER_APPS *ptr_apps, time_t seconds)
|
||||
_wfp_create3filters (ptr_apps, __LINE__);
|
||||
}
|
||||
|
||||
size_t _app_timer_remove (HWND hwnd, MFILTER_APPS *ptr_apps)
|
||||
size_t _app_timer_remove (HWND hwnd, MFILTER_APPS& ptr_apps)
|
||||
{
|
||||
if (!config.hengine || !ptr_apps || ptr_apps->empty ())
|
||||
if (!config.hengine ||ptr_apps.empty ())
|
||||
return false;
|
||||
|
||||
const time_t current_time = _r_unixtime_now ();
|
||||
@@ -65,45 +65,42 @@ size_t _app_timer_remove (HWND hwnd, MFILTER_APPS *ptr_apps)
|
||||
|
||||
MARRAY ids;
|
||||
|
||||
_r_fastlock_acquireexclusive (&lock_access);
|
||||
|
||||
for (size_t i = 0; i < ptr_apps->size (); i++)
|
||||
for (size_t i = 0; i < ptr_apps.size (); i++)
|
||||
{
|
||||
PITEM_APP ptr_app = ptr_apps->at (i);
|
||||
_r_fastlock_acquireexclusive (&lock_access);
|
||||
|
||||
if (!ptr_app || !_app_istimeractive (ptr_app))
|
||||
continue;
|
||||
PITEM_APP ptr_app = ptr_apps.at (i);
|
||||
|
||||
ids.insert (ids.end (), ptr_app->mfarr.begin (), ptr_app->mfarr.end ());
|
||||
ptr_app->mfarr.clear ();
|
||||
ptr_app->is_haveerrors = false;
|
||||
|
||||
if (ptr_app->htimer)
|
||||
if (ptr_app && _app_istimeractive (ptr_app))
|
||||
{
|
||||
DeleteTimerQueueTimer (config.htimer, ptr_app->htimer, nullptr);
|
||||
ptr_app->htimer = nullptr;
|
||||
}
|
||||
ids.insert (ids.end (), ptr_app->mfarr.begin (), ptr_app->mfarr.end ());
|
||||
ptr_app->mfarr.clear ();
|
||||
ptr_app->is_haveerrors = false;
|
||||
|
||||
if (ptr_app->timer)
|
||||
ptr_app->timer = 0;
|
||||
|
||||
ptr_app->is_enabled = false;
|
||||
|
||||
const size_t app_hash = _r_str_hash (ptr_app->original_path); // note: be carefull (!)
|
||||
|
||||
const UINT listview_id = _app_getlistview_id (ptr_app->type);
|
||||
const size_t item = _app_getposition (hwnd, listview_id, app_hash);
|
||||
|
||||
if (item != LAST_VALUE)
|
||||
{
|
||||
if (!_app_isappexists (ptr_app) || ptr_app->is_temp)
|
||||
if (ptr_app->htimer)
|
||||
{
|
||||
SendDlgItemMessage (hwnd, listview_id, LVM_DELETEITEM, item, 0);
|
||||
_app_freeapplication (app_hash);
|
||||
DeleteTimerQueueTimer (config.htimer, ptr_app->htimer, nullptr);
|
||||
ptr_app->htimer = nullptr;
|
||||
}
|
||||
else
|
||||
|
||||
if (ptr_app->timer)
|
||||
ptr_app->timer = 0;
|
||||
|
||||
ptr_app->is_enabled = false;
|
||||
|
||||
const size_t app_hash = _r_str_hash (ptr_app->original_path); // note: be carefull (!)
|
||||
|
||||
const UINT listview_id = _app_getlistview_id (ptr_app->type);
|
||||
const size_t item = _app_getposition (hwnd, listview_id, app_hash);
|
||||
|
||||
if (item != LAST_VALUE)
|
||||
{
|
||||
if (listview_id)
|
||||
if (!ptr_app->is_undeletable && (!_app_isappexists (ptr_app) || ptr_app->is_temp))
|
||||
{
|
||||
SendDlgItemMessage (hwnd, listview_id, LVM_DELETEITEM, item, 0);
|
||||
_app_freeapplication (app_hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
_r_fastlock_acquireshared (&lock_checkbox);
|
||||
|
||||
@@ -113,14 +110,14 @@ size_t _app_timer_remove (HWND hwnd, MFILTER_APPS *ptr_apps)
|
||||
_r_fastlock_releaseshared (&lock_checkbox);
|
||||
}
|
||||
}
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
||||
count += 1;
|
||||
_r_fastlock_releaseexclusive (&lock_access);
|
||||
}
|
||||
|
||||
_r_fastlock_releaseexclusive (&lock_access);
|
||||
|
||||
_wfp_destroy2filters (&ids, __LINE__);
|
||||
_wfp_destroy2filters (ids, __LINE__);
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -163,7 +160,7 @@ void CALLBACK _app_timer_callback (PVOID lparam, BOOLEAN)
|
||||
|
||||
_r_fastlock_releaseshared (&lock_access);
|
||||
|
||||
const bool is_succcess = _app_timer_remove (hwnd, &rules);
|
||||
const bool is_succcess = _app_timer_remove (hwnd, rules);
|
||||
|
||||
if (is_succcess)
|
||||
{
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void _app_timer_create (HWND hwnd, MFILTER_APPS* ptr_apps, time_t seconds);
|
||||
size_t _app_timer_remove (HWND hwnd, MFILTER_APPS* ptr_apps);
|
||||
void _app_timer_create (HWND hwnd, MFILTER_APPS& ptr_apps, time_t seconds);
|
||||
size_t _app_timer_remove (HWND hwnd, MFILTER_APPS& ptr_apps);
|
||||
|
||||
bool _app_istimeractive (ITEM_APP const *ptr_app);
|
||||
bool _app_istimersactive ();
|
||||
|
||||
+41
-39
@@ -457,7 +457,7 @@ void _wfp_installfilters ()
|
||||
arr.push_back (ptr_app);
|
||||
}
|
||||
|
||||
_wfp_create3filters (&arr, __LINE__, is_intransact);
|
||||
_wfp_create3filters (arr, __LINE__, is_intransact);
|
||||
}
|
||||
|
||||
// apply system/custom/blocklist rules
|
||||
@@ -472,7 +472,7 @@ void _wfp_installfilters ()
|
||||
arr.push_back (ptr_rule);
|
||||
}
|
||||
|
||||
_wfp_create4filters (&arr, __LINE__, is_intransact);
|
||||
_wfp_create4filters (arr, __LINE__, is_intransact);
|
||||
}
|
||||
|
||||
if (is_intransact)
|
||||
@@ -539,23 +539,23 @@ bool _wfp_transact_commit (UINT line)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _wfp_deletefilter (HANDLE engineHandle, const GUID * pfilter_id)
|
||||
bool _wfp_deletefilter (HANDLE engineHandle, const GUID * ptr_filter_id)
|
||||
{
|
||||
if (!engineHandle || !pfilter_id || *pfilter_id == GUID_NULL)
|
||||
if (!engineHandle || !ptr_filter_id || *ptr_filter_id == GUID_NULL)
|
||||
return false;
|
||||
|
||||
const DWORD result = FwpmFilterDeleteByKey (config.hengine, pfilter_id);
|
||||
const DWORD result = FwpmFilterDeleteByKey (config.hengine, ptr_filter_id);
|
||||
|
||||
if (result != ERROR_SUCCESS && result != FWP_E_FILTER_NOT_FOUND)
|
||||
{
|
||||
_app_logerror (L"FwpmFilterDeleteByKey", result, _r_str_fromguid (*pfilter_id).GetString (), false);
|
||||
_app_logerror (L"FwpmFilterDeleteByKey", result, _r_str_fromguid (*ptr_filter_id).GetString (), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DWORD _wfp_createfilter (LPCWSTR name, FWPM_FILTER_CONDITION * lpcond, UINT32 const count, UINT8 weight, const GUID * layer, const GUID * callout, FWP_ACTION_TYPE action, UINT32 flags, MARRAY * pmar)
|
||||
DWORD _wfp_createfilter (LPCWSTR name, FWPM_FILTER_CONDITION * lpcond, UINT32 const count, UINT8 weight, const GUID * layer, const GUID * callout, FWP_ACTION_TYPE action, UINT32 flags, MARRAY * ptr_filters)
|
||||
{
|
||||
FWPM_FILTER filter = {0};
|
||||
|
||||
@@ -609,8 +609,8 @@ DWORD _wfp_createfilter (LPCWSTR name, FWPM_FILTER_CONDITION * lpcond, UINT32 co
|
||||
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
if (pmar)
|
||||
pmar->push_back (filter.filterKey);
|
||||
if (ptr_filters)
|
||||
ptr_filters->push_back (filter.filterKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -660,25 +660,27 @@ void _wfp_destroyfilters ()
|
||||
MARRAY filter_all;
|
||||
|
||||
if (_wfp_dumpfilters (&GUID_WfpProvider, &filter_all))
|
||||
_wfp_destroy2filters (&filter_all, __LINE__);
|
||||
_wfp_destroy2filters (filter_all, __LINE__);
|
||||
}
|
||||
|
||||
bool _wfp_destroy2filters (const MARRAY * pmar, UINT line)
|
||||
bool _wfp_destroy2filters (MARRAY& ptr_filters, UINT line)
|
||||
{
|
||||
if (!config.hengine || !pmar || pmar->empty ())
|
||||
if (!config.hengine || ptr_filters.empty ())
|
||||
return false;
|
||||
|
||||
const bool is_enabled = _app_initinterfacestate ();
|
||||
|
||||
_r_fastlock_acquireshared (&lock_transaction);
|
||||
|
||||
for (size_t i = 0; i < pmar->size (); i++)
|
||||
_wfp_setfiltersecurity (config.hengine, &pmar->at (i), config.pusersid, config.pacl_default, line);
|
||||
for (size_t i = 0; i < ptr_filters.size (); i++)
|
||||
_wfp_setfiltersecurity (config.hengine, &ptr_filters.at (i), config.pusersid, config.pacl_default, line);
|
||||
|
||||
const bool is_intransact = _wfp_transact_start (line);
|
||||
|
||||
for (size_t i = 0; i < pmar->size (); i++)
|
||||
_wfp_deletefilter (config.hengine, &pmar->at (i));
|
||||
for (size_t i = 0; i < ptr_filters.size (); i++)
|
||||
_wfp_deletefilter (config.hengine, &ptr_filters.at (i));
|
||||
|
||||
ptr_filters.clear ();
|
||||
|
||||
if (is_intransact)
|
||||
_wfp_transact_commit (line);
|
||||
@@ -1019,9 +1021,9 @@ bool _wfp_createrulefilter (LPCWSTR name, size_t app_hash, LPCWSTR rule_remote,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _wfp_create4filters (MFILTER_RULES * ptr_rules, UINT line, bool is_intransact)
|
||||
bool _wfp_create4filters (MFILTER_RULES & ptr_rules, UINT line, bool is_intransact)
|
||||
{
|
||||
if (!config.hengine || !ptr_rules || ptr_rules->empty ())
|
||||
if (!config.hengine || ptr_rules.empty ())
|
||||
return false;
|
||||
|
||||
const bool is_enabled = _app_initinterfacestate ();
|
||||
@@ -1033,11 +1035,11 @@ bool _wfp_create4filters (MFILTER_RULES * ptr_rules, UINT line, bool is_intransa
|
||||
{
|
||||
MARRAY ids;
|
||||
|
||||
for (size_t i = 0; i < ptr_rules->size (); i++)
|
||||
for (size_t i = 0; i < ptr_rules.size (); i++)
|
||||
{
|
||||
_r_fastlock_acquireshared (&lock_access);
|
||||
|
||||
const PITEM_RULE ptr_rule = ptr_rules->at (i);
|
||||
const PITEM_RULE ptr_rule = ptr_rules.at (i);
|
||||
|
||||
if (ptr_rule)
|
||||
ids.insert (ids.end (), ptr_rule->mfarr.begin (), ptr_rule->mfarr.end ());
|
||||
@@ -1045,17 +1047,17 @@ bool _wfp_create4filters (MFILTER_RULES * ptr_rules, UINT line, bool is_intransa
|
||||
_r_fastlock_releaseshared (&lock_access);
|
||||
}
|
||||
|
||||
_wfp_destroy2filters (&ids, line);
|
||||
_wfp_destroy2filters (ids, line);
|
||||
|
||||
_r_fastlock_acquireshared (&lock_transaction);
|
||||
is_intransact = !_wfp_transact_start (line);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ptr_rules->size (); i++)
|
||||
for (size_t i = 0; i < ptr_rules.size (); i++)
|
||||
{
|
||||
_r_fastlock_acquireexclusive (&lock_access);
|
||||
|
||||
PITEM_RULE ptr_rule = ptr_rules->at (i);
|
||||
PITEM_RULE ptr_rule = ptr_rules.at (i);
|
||||
|
||||
if (ptr_rule)
|
||||
{
|
||||
@@ -1125,11 +1127,11 @@ bool _wfp_create4filters (MFILTER_RULES * ptr_rules, UINT line, bool is_intransa
|
||||
|
||||
if (is_secure ? config.pacl_secure : config.pacl_default)
|
||||
{
|
||||
for (size_t i = 0; i < ptr_rules->size (); i++)
|
||||
for (size_t i = 0; i < ptr_rules.size (); i++)
|
||||
{
|
||||
_r_fastlock_acquireshared (&lock_access);
|
||||
|
||||
const PITEM_RULE ptr_rule = ptr_rules->at (i);
|
||||
const PITEM_RULE ptr_rule = ptr_rules.at (i);
|
||||
|
||||
if (ptr_rule && ptr_rule->is_enabled)
|
||||
{
|
||||
@@ -1149,9 +1151,9 @@ bool _wfp_create4filters (MFILTER_RULES * ptr_rules, UINT line, bool is_intransa
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _wfp_create3filters (MFILTER_APPS * ptr_apps, UINT line, bool is_intransact)
|
||||
bool _wfp_create3filters (MFILTER_APPS & ptr_apps, UINT line, bool is_intransact)
|
||||
{
|
||||
if (!config.hengine || !ptr_apps || ptr_apps->empty ())
|
||||
if (!config.hengine || ptr_apps.empty ())
|
||||
return false;
|
||||
|
||||
const bool is_enabled = _app_initinterfacestate ();
|
||||
@@ -1165,11 +1167,11 @@ bool _wfp_create3filters (MFILTER_APPS * ptr_apps, UINT line, bool is_intransact
|
||||
{
|
||||
MARRAY ids;
|
||||
|
||||
for (size_t i = 0; i < ptr_apps->size (); i++)
|
||||
for (size_t i = 0; i < ptr_apps.size (); i++)
|
||||
{
|
||||
_r_fastlock_acquireshared (&lock_access);
|
||||
|
||||
const PITEM_APP ptr_app = ptr_apps->at (i);
|
||||
const PITEM_APP ptr_app = ptr_apps.at (i);
|
||||
|
||||
if (ptr_app)
|
||||
ids.insert (ids.end (), ptr_app->mfarr.begin (), ptr_app->mfarr.end ());
|
||||
@@ -1177,17 +1179,17 @@ bool _wfp_create3filters (MFILTER_APPS * ptr_apps, UINT line, bool is_intransact
|
||||
_r_fastlock_releaseshared (&lock_access);
|
||||
}
|
||||
|
||||
_wfp_destroy2filters (&ids, line);
|
||||
_wfp_destroy2filters (ids, line);
|
||||
|
||||
_r_fastlock_acquireshared (&lock_transaction);
|
||||
is_intransact = !_wfp_transact_start (line);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ptr_apps->size (); i++)
|
||||
for (size_t i = 0; i < ptr_apps.size (); i++)
|
||||
{
|
||||
_r_fastlock_acquireexclusive (&lock_access);
|
||||
|
||||
PITEM_APP ptr_app = ptr_apps->at (i);
|
||||
PITEM_APP ptr_app = ptr_apps.at (i);
|
||||
|
||||
if (ptr_app)
|
||||
{
|
||||
@@ -1212,11 +1214,11 @@ bool _wfp_create3filters (MFILTER_APPS * ptr_apps, UINT line, bool is_intransact
|
||||
|
||||
if (is_secure ? config.pacl_secure : config.pacl_default)
|
||||
{
|
||||
for (size_t i = 0; i < ptr_apps->size (); i++)
|
||||
for (size_t i = 0; i < ptr_apps.size (); i++)
|
||||
{
|
||||
_r_fastlock_acquireshared (&lock_access);
|
||||
|
||||
const PITEM_APP ptr_app = ptr_apps->at (i);
|
||||
const PITEM_APP ptr_app = ptr_apps.at (i);
|
||||
|
||||
if (ptr_app)
|
||||
{
|
||||
@@ -1248,7 +1250,7 @@ bool _wfp_create2filters (UINT line, bool is_intransact)
|
||||
|
||||
if (!is_intransact)
|
||||
{
|
||||
_wfp_destroy2filters (&filter_ids, line);
|
||||
_wfp_destroy2filters (filter_ids, line);
|
||||
filter_ids.clear ();
|
||||
|
||||
_r_fastlock_acquireshared (&lock_transaction);
|
||||
@@ -1543,12 +1545,12 @@ void _wfp_setfiltersecurity (HANDLE engineHandle, const GUID * pfilter_id, const
|
||||
}
|
||||
}
|
||||
|
||||
size_t _wfp_dumpfilters (const GUID * pprovider, MARRAY * pfilters)
|
||||
size_t _wfp_dumpfilters (const GUID * pprovider, MARRAY * ptr_filters)
|
||||
{
|
||||
if (!config.hengine || !pprovider || !pfilters)
|
||||
if (!config.hengine || !pprovider || !ptr_filters)
|
||||
return 0;
|
||||
|
||||
pfilters->clear ();
|
||||
ptr_filters->clear ();
|
||||
|
||||
UINT32 count = 0;
|
||||
HANDLE henum = nullptr;
|
||||
@@ -1577,7 +1579,7 @@ size_t _wfp_dumpfilters (const GUID * pprovider, MARRAY * pfilters)
|
||||
for (UINT32 i = 0; i < count; i++)
|
||||
{
|
||||
if (matchingFwpFilter[i] && matchingFwpFilter[i]->providerKey && memcmp (matchingFwpFilter[i]->providerKey, pprovider, sizeof (GUID)) == 0)
|
||||
pfilters->push_back (matchingFwpFilter[i]->filterKey);
|
||||
ptr_filters->push_back (matchingFwpFilter[i]->filterKey);
|
||||
}
|
||||
|
||||
FwpmFreeMemory ((void **)& matchingFwpFilter);
|
||||
|
||||
+6
-6
@@ -14,22 +14,22 @@ void _wfp_installfilters ();
|
||||
bool _wfp_transact_start (UINT line);
|
||||
bool _wfp_transact_commit (UINT line);
|
||||
|
||||
bool _wfp_deletefilter (HANDLE engineHandle, const GUID* pfilter_id);
|
||||
DWORD _wfp_createfilter (LPCWSTR name, FWPM_FILTER_CONDITION* lpcond, UINT32 const count, UINT8 weight, const GUID* layer, const GUID* callout, FWP_ACTION_TYPE action, UINT32 flags, MARRAY* pmar = nullptr);
|
||||
bool _wfp_deletefilter (HANDLE engineHandle, const GUID* ptr_filter_id);
|
||||
DWORD _wfp_createfilter (LPCWSTR name, FWPM_FILTER_CONDITION* lpcond, UINT32 const count, UINT8 weight, const GUID* layer, const GUID* callout, FWP_ACTION_TYPE action, UINT32 flags, MARRAY* ptr_filters);
|
||||
|
||||
void _wfp_clearfilter_ids ();
|
||||
void _wfp_destroyfilters ();
|
||||
bool _wfp_destroy2filters (const MARRAY* pmar, UINT line);
|
||||
bool _wfp_destroy2filters (MARRAY& ptr_filters, UINT line);
|
||||
|
||||
bool _wfp_createrulefilter (LPCWSTR name, size_t app_hash, LPCWSTR rule_remote, LPCWSTR rule_local, UINT8 protocol, ADDRESS_FAMILY af, FWP_DIRECTION dir, UINT8 weight, FWP_ACTION_TYPE action, UINT32 flag, MARRAY* pmfarr);
|
||||
|
||||
bool _wfp_create4filters (MFILTER_RULES* ptr_rules, UINT line, bool is_intransact = false);
|
||||
bool _wfp_create3filters (MFILTER_APPS* ptr_apps, UINT line, bool is_intransact = false);
|
||||
bool _wfp_create4filters (MFILTER_RULES& ptr_rules, UINT line, bool is_intransact = false);
|
||||
bool _wfp_create3filters (MFILTER_APPS& ptr_apps, UINT line, bool is_intransact = false);
|
||||
bool _wfp_create2filters (UINT line, bool is_intransact = false);
|
||||
|
||||
void _wfp_setfiltersecurity (HANDLE engineHandle, const GUID* pfilter_id, const PSID psid, PACL pacl, UINT line);
|
||||
|
||||
size_t _wfp_dumpfilters (const GUID* pprovider, MARRAY* pfilters);
|
||||
size_t _wfp_dumpfilters (const GUID* pprovider, MARRAY* ptr_filters);
|
||||
|
||||
bool _mps_firewallapi (bool* pis_enabled, const bool* pis_enable);
|
||||
void _mps_changeconfig2 (bool is_enable);
|
||||
|
||||
Reference in new issue
Block a user