Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypp committed May 7, 2023
1 parent b86d1fa commit e1eb52d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 230 deletions.
40 changes: 7 additions & 33 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,7 @@ VOID _wfp_logsetoption (
status = FwpmEngineSetOption (engine_handle, FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS, &val);

if (status != ERROR_SUCCESS)
{
_r_log (
LOG_LEVEL_WARNING,
NULL,
L"FwpmEngineSetOption",
status,
L"FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS"
);
}
_r_log (LOG_LEVEL_WARNING, NULL, L"FwpmEngineSetOption", status, L"FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS");

// enables the connection monitoring feature and starts logging creation and
// deletion events (and notifying any subscribers)
Expand All @@ -492,15 +484,7 @@ VOID _wfp_logsetoption (
status = FwpmEngineSetOption (engine_handle, FWPM_ENGINE_MONITOR_IPSEC_CONNECTIONS, &val);

if (status != ERROR_SUCCESS)
{
_r_log (
LOG_LEVEL_WARNING,
NULL,
L"FwpmEngineSetOption",
status,
L"FWPM_ENGINE_MONITOR_IPSEC_CONNECTIONS"
);
}
_r_log (LOG_LEVEL_WARNING, NULL, L"FwpmEngineSetOption", status, L"FWPM_ENGINE_MONITOR_IPSEC_CONNECTIONS");
}

VOID CALLBACK _wfp_logcallback (
Expand Down Expand Up @@ -1267,12 +1251,10 @@ VOID CALLBACK _wfp_logcallback0 (
_In_ const FWPM_NET_EVENT1 *event_data
)
{
ITEM_LOG_CALLBACK log;
ITEM_LOG_CALLBACK log = {0};

UNREFERENCED_PARAMETER (context);

RtlZeroMemory (&log, sizeof (log));

if (log_struct_to_f (&log, (PVOID)event_data, WINDOWS_7))
_wfp_logcallback (&log);
}
Expand All @@ -1283,12 +1265,10 @@ VOID CALLBACK _wfp_logcallback1 (
_In_ const FWPM_NET_EVENT2 *event_data
)
{
ITEM_LOG_CALLBACK log;
ITEM_LOG_CALLBACK log = {0};

UNREFERENCED_PARAMETER (context);

RtlZeroMemory (&log, sizeof (log));

if (log_struct_to_f (&log, (PVOID)event_data, WINDOWS_8))
_wfp_logcallback (&log);
}
Expand All @@ -1299,12 +1279,10 @@ VOID CALLBACK _wfp_logcallback2 (
_In_ const FWPM_NET_EVENT3 *event_data
)
{
ITEM_LOG_CALLBACK log;
ITEM_LOG_CALLBACK log = {0};

UNREFERENCED_PARAMETER (context);

RtlZeroMemory (&log, sizeof (log));

if (log_struct_to_f (&log, (PVOID)event_data, WINDOWS_10_1607))
_wfp_logcallback (&log);
}
Expand All @@ -1315,12 +1293,10 @@ VOID CALLBACK _wfp_logcallback3 (
_In_ const FWPM_NET_EVENT4 *event_data
)
{
ITEM_LOG_CALLBACK log;
ITEM_LOG_CALLBACK log = {0};

UNREFERENCED_PARAMETER (context);

RtlZeroMemory (&log, sizeof (log));

if (log_struct_to_f (&log, (PVOID)event_data, WINDOWS_10_1803))
_wfp_logcallback (&log);
}
Expand All @@ -1331,12 +1307,10 @@ VOID CALLBACK _wfp_logcallback4 (
_In_ const FWPM_NET_EVENT5 *event_data
)
{
ITEM_LOG_CALLBACK log;
ITEM_LOG_CALLBACK log = {0};

UNREFERENCED_PARAMETER (context);

RtlZeroMemory (&log, sizeof (log));

if (log_struct_to_f (&log, (PVOID)event_data, WINDOWS_10_1809))
_wfp_logcallback (&log);
}
Expand Down
Loading

0 comments on commit e1eb52d

Please sign in to comment.