diff --git a/src/helper.c b/src/helper.c index 6efca8a8..987c8375 100644 --- a/src/helper.c +++ b/src/helper.c @@ -215,7 +215,7 @@ PR_STRING _app_formatarpa ( { case AF_INET: { - p4addr = (PIN_ADDR)address; + p4addr = (const PIN_ADDR)address; _r_obj_appendstringbuilderformat ( &formatted_address, @@ -232,7 +232,7 @@ PR_STRING _app_formatarpa ( case AF_INET6: { - p6addr = (PIN6_ADDR)address; + p6addr = (const PIN6_ADDR)address; for (INT i = sizeof (IN6_ADDR) - 1; i >= 0; i--) { diff --git a/src/listview.c b/src/listview.c index ad6fc1ee..74f70087 100644 --- a/src/listview.c +++ b/src/listview.c @@ -479,8 +479,8 @@ VOID _app_listview_updateby_id ( _In_ ULONG flags ) { - INT listview_id; ENUM_TYPE_DATA type; + INT listview_id; if (flags & PR_UPDATE_TYPE) { diff --git a/src/log.c b/src/log.c index 17d3a23f..b8970e89 100644 --- a/src/log.c +++ b/src/log.c @@ -336,9 +336,13 @@ VOID _wfp_logsubscribe ( if (!NT_SUCCESS (status)) { if (hwnd) + { _r_show_errormessage (hwnd, L"Could not load \"fwpuclnt.dll\" library.", status, NULL, TRUE); - - _r_log (LOG_LEVEL_WARNING, NULL, L"_r_sys_loadlibrary", status, L"fwpuclnt.dll"); + } + else + { + _r_log (LOG_LEVEL_WARNING, NULL, L"_r_sys_loadlibrary", status, L"fwpuclnt.dll"); + } return; } @@ -372,9 +376,13 @@ VOID _wfp_logsubscribe ( if (status != STATUS_SUCCESS) { if (hwnd) + { _r_show_errormessage (hwnd, L"Log subscribe failed. Try again later.", status, NULL, FALSE); - - _r_log (LOG_LEVEL_WARNING, NULL, L"FwpmNetEventSubscribe", status, NULL); + } + else + { + _r_log (LOG_LEVEL_WARNING, NULL, L"FwpmNetEventSubscribe", status, NULL); + } _r_sys_freelibrary (hfwpuclnt, FALSE); @@ -420,7 +428,7 @@ VOID _wfp_logsetoption ( _In_ HANDLE engine_handle ) { - FWP_VALUE val = {0}; + FWP_VALUE0 val = {0}; UINT32 mask = 0; ULONG status; @@ -684,7 +692,7 @@ VOID CALLBACK _wfp_logcallback ( BOOLEAN log_struct_to_f ( _In_ ULONG version, _Out_ PITEM_LOG_CALLBACK log, - _In_ const PVOID event_data + _In_ LPCVOID event_data ) { RtlSecureZeroMemory (log, sizeof (ITEM_LOG_CALLBACK)); @@ -1157,7 +1165,7 @@ VOID CALLBACK _wfp_logcallback1 ( { ITEM_LOG_CALLBACK log; - if (log_struct_to_f (PtrToUlong (context), &log, (const PVOID)event_data)) + if (log_struct_to_f (PtrToUlong (context), &log, (LPCVOID)event_data)) _wfp_logcallback (&log); } @@ -1169,7 +1177,7 @@ VOID CALLBACK _wfp_logcallback2 ( { ITEM_LOG_CALLBACK log; - if (log_struct_to_f (PtrToUlong (context), &log, (const PVOID)event_data)) + if (log_struct_to_f (PtrToUlong (context), &log, (LPCVOID)event_data)) _wfp_logcallback (&log); } @@ -1181,7 +1189,7 @@ VOID CALLBACK _wfp_logcallback3 ( { ITEM_LOG_CALLBACK log; - if (log_struct_to_f (PtrToUlong (context), &log, (const PVOID)event_data)) + if (log_struct_to_f (PtrToUlong (context), &log, (LPCVOID)event_data)) _wfp_logcallback (&log); } @@ -1193,7 +1201,7 @@ VOID CALLBACK _wfp_logcallback4 ( { ITEM_LOG_CALLBACK log; - if (log_struct_to_f (PtrToUlong (context), &log, (const PVOID)event_data)) + if (log_struct_to_f (PtrToUlong (context), &log, (LPCVOID)event_data)) _wfp_logcallback (&log); } diff --git a/src/main.c b/src/main.c index 480bd258..0ba17171 100644 --- a/src/main.c +++ b/src/main.c @@ -119,7 +119,7 @@ BOOLEAN _app_installmessage ( if (SUCCEEDED (status)) { - _r_config_setboolean (L"WF_State", is_flagchecked); + _r_config_setboolean (L"WF_State", is_flagchecked ? TRUE : FALSE); if (command_id == IDYES) { diff --git a/src/security.c b/src/security.c index 6d67a415..7447ff7c 100644 --- a/src/security.c +++ b/src/security.c @@ -23,6 +23,7 @@ PSID _app_quyerybuiltinsid ( return NULL; } + return sid; } @@ -50,13 +51,13 @@ PACL _app_createaccesscontrollist ( _In_ BOOLEAN is_secure ) { + PACCESS_ALLOWED_ACE ace = NULL; EXPLICIT_ACCESS ea[3] = {0}; - PACCESS_ALLOWED_ACE ace; PACL new_dacl; - BOOLEAN is_secured = FALSE; + ULONG count = 0; BOOLEAN is_currentuserhaverights = FALSE; BOOLEAN is_openforeveryone = FALSE; - ULONG count; + BOOLEAN is_secured = FALSE; NTSTATUS status; for (WORD ace_index = 0; ace_index < acl->AceCount; ace_index++) @@ -103,8 +104,6 @@ PACL _app_createaccesscontrollist ( if (is_openforeveryone || is_currentuserhaverights || is_secured != is_secure) { - count = 0; - // revoke current user access rights if (is_currentuserhaverights) _app_setexplicitaccess (&ea[count++], REVOKE_ACCESS, 0, NO_INHERITANCE, config.builtin_current_sid); @@ -155,14 +154,14 @@ VOID _app_setenginesecurity ( ) { PSECURITY_DESCRIPTOR security_descriptor; - PACCESS_ALLOWED_ACE ace; + PACCESS_ALLOWED_ACE ace = NULL; EXPLICIT_ACCESS ea[18] = {0}; PSID sid_owner; PSID sid_group; PACL new_dacl; PACL dacl; PACL sacl; - ULONG count; + ULONG count = 0; BOOLEAN is_currentuserhaverights = FALSE; BOOLEAN is_openforeveryone = FALSE; NTSTATUS status; @@ -218,8 +217,6 @@ VOID _app_setenginesecurity ( FwpmNetEventsSetSecurityInfo0 (hengine, OWNER_SECURITY_INFORMATION, &SeLocalServiceSid, NULL, NULL, NULL); - count = 0; - // revoke current user access rights if (is_currentuserhaverights) {