diff --git a/src/app.hpp b/src/app.hpp index f0dd1226..657b2af2 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -5,6 +5,6 @@ #define APP_NAME L"simplewall" #define APP_NAME_SHORT L"simplewall" -#define APP_VERSION L"3.2" -#define APP_VERSION_RES 3,2,0,0 +#define APP_VERSION L"3.2.1" +#define APP_VERSION_RES 3,2,1,0 #define APP_COPYRIGHT L"(c) 2016-2020 " _APP_AUTHOR L". All Rights Reversed." diff --git a/src/controls.cpp b/src/controls.cpp index 88ec7dc2..57121561 100644 --- a/src/controls.cpp +++ b/src/controls.cpp @@ -44,7 +44,7 @@ BOOLEAN _app_initinterfacestate (HWND hwnd, BOOLEAN is_forced) SendDlgItemMessage (config.hrebar, IDC_TOOLBAR, TB_ENABLEBUTTON, IDM_TRAY_START, MAKELPARAM (FALSE, 0)); SendDlgItemMessage (config.hrebar, IDC_TOOLBAR, TB_ENABLEBUTTON, IDM_REFRESH, MAKELPARAM (FALSE, 0)); - _r_status_settextformat (hwnd, IDC_STATUSBAR, 0, L"%s...", app.LocaleString (IDS_STATUS_FILTERS_PROCESSING)); + _r_status_settextformat (hwnd, IDC_STATUSBAR, 0, L"%s...", _r_locale_getstring (IDS_STATUS_FILTERS_PROCESSING)); return TRUE; } @@ -62,7 +62,7 @@ VOID _app_restoreinterfacestate (HWND hwnd, BOOLEAN is_enabled) ENUM_INSTALL_TYPE install_type = _wfp_isfiltersinstalled (); - _r_status_settext (hwnd, IDC_STATUSBAR, 0, app.LocaleString (_app_getinterfacestatelocale (install_type))); + _r_status_settext (hwnd, IDC_STATUSBAR, 0, _r_locale_getstring (_app_getinterfacestatelocale (install_type))); } VOID _app_setinterfacestate (HWND hwnd) @@ -73,8 +73,8 @@ VOID _app_setinterfacestate (HWND hwnd) INT icon_id = is_filtersinstalled ? IDI_ACTIVE : IDI_INACTIVE; UINT string_id = is_filtersinstalled ? IDS_TRAY_STOP : IDS_TRAY_START; - HICON hico_sm = app.GetSharedImage (app.GetHINSTANCE (), icon_id, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON)); - HICON hico_big = app.GetSharedImage (app.GetHINSTANCE (), icon_id, _r_dc_getsystemmetrics (hwnd, SM_CXICON)); + HICON hico_sm = _r_app_getsharedimage (_r_app_gethinstance (), icon_id, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON)); + HICON hico_big = _r_app_getsharedimage (_r_app_gethinstance (), icon_id, _r_dc_getsystemmetrics (hwnd, SM_CXICON)); SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hico_sm); SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM)hico_big); @@ -82,16 +82,16 @@ VOID _app_setinterfacestate (HWND hwnd) //SendDlgItemMessage (hwnd, IDC_STATUSBAR, SB_SETICON, 0, (LPARAM)hico_sm); if (!_wfp_isfiltersapplying ()) - _r_status_settext (hwnd, IDC_STATUSBAR, 0, app.LocaleString (_app_getinterfacestatelocale (install_type))); + _r_status_settext (hwnd, IDC_STATUSBAR, 0, _r_locale_getstring (_app_getinterfacestatelocale (install_type))); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_START, app.LocaleString (string_id), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, is_filtersinstalled ? 1 : 0); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_START, _r_locale_getstring (string_id), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, is_filtersinstalled ? 1 : 0); _r_tray_setinfo (hwnd, UID, hico_sm, APP_NAME); } VOID _app_listviewresize (HWND hwnd, INT listview_id, BOOLEAN is_forced) { - if (!listview_id || (!is_forced && !app.ConfigGetBoolean (L"AutoSizeColumns", TRUE))) + if (!listview_id || (!is_forced && !_r_config_getboolean (L"AutoSizeColumns", TRUE))) return; INT column_count = _r_listview_getcolumncount (hwnd, listview_id); @@ -205,8 +205,8 @@ VOID _app_listviewresize (HWND hwnd, INT listview_id, BOOLEAN is_forced) VOID _app_listviewsetview (HWND hwnd, INT listview_id) { BOOLEAN is_mainview = (listview_id >= IDC_APPS_PROFILE) && (listview_id <= IDC_RULES_CUSTOM); - INT view_type = is_mainview ? _r_calc_clamp (INT, app.ConfigGetInteger (L"ViewType", LV_VIEW_DETAILS), LV_VIEW_ICON, LV_VIEW_MAX) : LV_VIEW_DETAILS; - INT icons_size = is_mainview ? _r_calc_clamp (INT, app.ConfigGetInteger (L"IconSize", SHIL_SYSSMALL), SHIL_LARGE, SHIL_LAST) : SHIL_SYSSMALL; + INT view_type = is_mainview ? _r_calc_clamp (INT, _r_config_getinteger (L"ViewType", LV_VIEW_DETAILS), LV_VIEW_ICON, LV_VIEW_MAX) : LV_VIEW_DETAILS; + INT icons_size = is_mainview ? _r_calc_clamp (INT, _r_config_getinteger (L"IconSize", SHIL_SYSSMALL), SHIL_LARGE, SHIL_LAST) : SHIL_SYSSMALL; HIMAGELIST himg = NULL; if (listview_id >= IDC_RULES_BLOCKLIST && listview_id <= IDC_RULES_CUSTOM) @@ -240,7 +240,7 @@ VOID _app_listviewsetfont (HWND hwnd, INT listview_id, BOOLEAN is_redraw) { SAFE_DELETE_OBJECT (config.hfont); - app.ConfigGetFont (L"Font", hwnd, &lf); + _r_config_getfont (L"Font", hwnd, &lf); config.hfont = CreateFontIndirect (&lf); } @@ -264,8 +264,8 @@ INT CALLBACK _app_listviewcompare_callback (LPARAM lparam1, LPARAM lparam2, LPAR WCHAR configName[128]; _r_str_printf (configName, RTL_NUMBER_OF (configName), L"listview\\%04" TEXT (PRIX32), listview_id); - INT column_id = app.ConfigGetInteger (L"SortColumn", 0, configName); - BOOLEAN is_descend = app.ConfigGetBoolean (L"SortIsDescending", FALSE, configName); + INT column_id = _r_config_getinteger (L"SortColumn", 0, configName); + BOOLEAN is_descend = _r_config_getboolean (L"SortIsDescending", FALSE, configName); INT result = 0; @@ -344,20 +344,20 @@ VOID _app_listviewsort (HWND hwnd, INT listview_id, INT column_id, BOOLEAN is_no WCHAR configName[128]; _r_str_printf (configName, RTL_NUMBER_OF (configName), L"listview\\%04" TEXT (PRIX32), listview_id); - BOOLEAN is_descend = app.ConfigGetBoolean (L"SortIsDescending", FALSE, configName); + BOOLEAN is_descend = _r_config_getboolean (L"SortIsDescending", FALSE, configName); if (is_notifycode) is_descend = !is_descend; if (column_id == INVALID_INT) - column_id = app.ConfigGetInteger (L"SortColumn", 0, configName); + column_id = _r_config_getinteger (L"SortColumn", 0, configName); column_id = _r_calc_clamp (INT, column_id, 0, column_count - 1); // set range if (is_notifycode) { - app.ConfigSetBoolean (L"SortIsDescending", is_descend, configName); - app.ConfigSetInteger (L"SortColumn", column_id, configName); + _r_config_setboolean (L"SortIsDescending", is_descend, configName); + _r_config_setinteger (L"SortColumn", column_id, configName); } for (INT i = 0; i < column_count; i++) @@ -448,13 +448,13 @@ VOID _app_refreshgroups (HWND hwnd, INT listview_id) _r_str_printf (groupString3, RTL_NUMBER_OF (groupString3), L" (%d/%d)", group3_count, total_count); } - _r_obj_movereference (&localizedString, _r_format_string (L"%s%s", app.LocaleString (group1_title), groupString1)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s%s", _r_locale_getstring (group1_title), groupString1)); _r_listview_setgroup (hwnd, listview_id, 0, _r_obj_getstringorempty (localizedString), 0, 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s%s", app.LocaleString (group2_title), groupString2)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s%s", _r_locale_getstring (group2_title), groupString2)); _r_listview_setgroup (hwnd, listview_id, 1, _r_obj_getstringorempty (localizedString), 0, 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s%s", app.LocaleString (group3_title), groupString3)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s%s", _r_locale_getstring (group3_title), groupString3)); _r_listview_setgroup (hwnd, listview_id, 2, _r_obj_getstringorempty (localizedString), 0, 0); SAFE_DELETE_REFERENCE (localizedString); @@ -488,7 +488,7 @@ VOID _app_refreshstatus (HWND hwnd, INT listview_id) case 1: { if (pstatus) - text[i] = _r_format_string (L"%s: %" TEXT (PR_SIZE_T), app.LocaleString (IDS_STATUS_UNUSED_APPS), pstatus->apps_unused_count); + text[i] = _r_format_string (L"%s: %" TEXT (PR_SIZE_T), _r_locale_getstring (IDS_STATUS_UNUSED_APPS), pstatus->apps_unused_count); break; } @@ -496,7 +496,7 @@ VOID _app_refreshstatus (HWND hwnd, INT listview_id) case 2: { if (pstatus) - text[i] = _r_format_string (L"%s: %" TEXT (PR_SIZE_T), app.LocaleString (IDS_STATUS_TIMER_APPS), pstatus->apps_timer_count); + text[i] = _r_format_string (L"%s: %" TEXT (PR_SIZE_T), _r_locale_getstring (IDS_STATUS_TIMER_APPS), pstatus->apps_timer_count); break; } @@ -583,7 +583,7 @@ VOID _app_showitem (HWND hwnd, INT listview_id, INT item, INT scroll_pos) LONG_PTR _app_nmcustdraw_listview (LPNMLVCUSTOMDRAW lpnmlv) { - if (!app.ConfigGetBoolean (L"IsEnableHighlighting", TRUE)) + if (!_r_config_getboolean (L"IsEnableHighlighting", TRUE)) return CDRF_DODEFAULT; switch (lpnmlv->nmcd.dwDrawStage) diff --git a/src/editor.cpp b/src/editor.cpp index 9bce3b56..75a4d981 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK AddRuleProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) _r_wnd_center (hwnd, GetParent (hwnd)); // localize window - SetWindowText (hwnd, app.LocaleString (IDS_RULE)); + SetWindowText (hwnd, _r_locale_getstring (IDS_RULE)); if (pcontext->item_id != INVALID_INT) { @@ -35,11 +35,13 @@ INT_PTR CALLBACK AddRuleProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) _r_ctrl_settext (hwnd, IDC_RULE_HINT, L"eg. 192.168.0.1\r\neg. [fe80::]\r\neg. 192.168.0.1:443\r\neg. [fe80::]:443\r\neg. 192.168.0.1-192.168.0.255\r\neg. 192.168.0.1-192.168.0.255:443\r\neg. 192.168.0.0/16\r\neg. fe80::/10\r\neg. 80\r\neg. 443\r\neg. 20-21\r\neg. 49152-65534"); - _r_ctrl_settext (hwnd, IDC_SAVE, app.LocaleString (pcontext->item_id != INVALID_INT ? IDS_SAVE : IDS_ADD)); - _r_ctrl_settext (hwnd, IDC_CLOSE, app.LocaleString (IDS_CLOSE)); + _r_ctrl_settext (hwnd, IDC_SAVE, _r_locale_getstring (pcontext->item_id != INVALID_INT ? IDS_SAVE : IDS_ADD)); + _r_ctrl_settext (hwnd, IDC_CLOSE, _r_locale_getstring (IDS_CLOSE)); - _r_wnd_addstyle (hwnd, IDC_SAVE, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_CLOSE, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + BOOLEAN is_classic = _r_app_isclassicui (); + + _r_wnd_addstyle (hwnd, IDC_SAVE, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_CLOSE, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); _r_ctrl_enable (hwnd, IDC_SAVE, (INT)SendDlgItemMessage (hwnd, IDC_RULE_ID, WM_GETTEXTLENGTH, 0, 0) > 0); // enable apply button @@ -98,7 +100,7 @@ INT_PTR CALLBACK AddRuleProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) if (!_app_parserulestring (ruleString, NULL)) { - _r_ctrl_showballoontip (hwnd, IDC_RULE_ID, 0, NULL, app.LocaleString (IDS_STATUS_SYNTAX_ERROR)); + _r_ctrl_showballoontip (hwnd, IDC_RULE_ID, 0, NULL, _r_locale_getstring (IDS_STATUS_SYNTAX_ERROR)); _r_ctrl_enable (hwnd, IDC_SAVE, FALSE); _r_obj_dereference (ruleString); @@ -143,6 +145,8 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa { case WM_INITDIALOG: { + BOOLEAN is_classic = _r_app_isclassicui (); + ptr_rule = (PITEM_RULE)lparam; #ifndef _APP_NO_DARKTHEME @@ -156,7 +160,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa // name if (GetDlgItem (hwnd, IDC_RULE_NAME_ID)) { - _r_ctrl_settextformat (hwnd, IDC_RULE_NAME, L"%s:", app.LocaleString (IDS_NAME)); + _r_ctrl_settextformat (hwnd, IDC_RULE_NAME, L"%s:", _r_locale_getstring (IDS_NAME)); if (!_r_str_isempty (ptr_rule->name)) _r_ctrl_settext (hwnd, IDC_RULE_NAME_ID, ptr_rule->name->Buffer); @@ -168,11 +172,11 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa // direction if (GetDlgItem (hwnd, IDC_RULE_DIRECTION)) { - _r_ctrl_settextformat (hwnd, IDC_RULE_DIRECTION, L"%s:", app.LocaleString (IDS_DIRECTION)); + _r_ctrl_settextformat (hwnd, IDC_RULE_DIRECTION, L"%s:", _r_locale_getstring (IDS_DIRECTION)); - _r_ctrl_settext (hwnd, IDC_RULE_DIRECTION_OUTBOUND, app.LocaleString (IDS_DIRECTION_1)); - _r_ctrl_settext (hwnd, IDC_RULE_DIRECTION_INBOUND, app.LocaleString (IDS_DIRECTION_2)); - _r_ctrl_settext (hwnd, IDC_RULE_DIRECTION_ANY, app.LocaleString (IDS_ANY)); + _r_ctrl_settext (hwnd, IDC_RULE_DIRECTION_OUTBOUND, _r_locale_getstring (IDS_DIRECTION_1)); + _r_ctrl_settext (hwnd, IDC_RULE_DIRECTION_INBOUND, _r_locale_getstring (IDS_DIRECTION_2)); + _r_ctrl_settext (hwnd, IDC_RULE_DIRECTION_ANY, _r_locale_getstring (IDS_ANY)); if (ptr_rule->direction == FWP_DIRECTION_OUTBOUND) CheckRadioButton (hwnd, IDC_RULE_DIRECTION_OUTBOUND, IDC_RULE_DIRECTION_ANY, IDC_RULE_DIRECTION_OUTBOUND); @@ -191,10 +195,10 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa // action if (GetDlgItem (hwnd, IDC_RULE_ACTION)) { - _r_ctrl_settextformat (hwnd, IDC_RULE_ACTION, L"%s:", app.LocaleString (IDS_ACTION)); + _r_ctrl_settextformat (hwnd, IDC_RULE_ACTION, L"%s:", _r_locale_getstring (IDS_ACTION)); - _r_ctrl_settext (hwnd, IDC_RULE_ACTION_BLOCK, app.LocaleString (IDS_ACTION_BLOCK)); - _r_ctrl_settext (hwnd, IDC_RULE_ACTION_ALLOW, app.LocaleString (IDS_ACTION_ALLOW)); + _r_ctrl_settext (hwnd, IDC_RULE_ACTION_BLOCK, _r_locale_getstring (IDS_ACTION_BLOCK)); + _r_ctrl_settext (hwnd, IDC_RULE_ACTION_ALLOW, _r_locale_getstring (IDS_ACTION_ALLOW)); CheckRadioButton (hwnd, IDC_RULE_ACTION_BLOCK, IDC_RULE_ACTION_ALLOW, ptr_rule->is_block ? IDC_RULE_ACTION_BLOCK : IDC_RULE_ACTION_ALLOW); @@ -205,7 +209,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa // protocols if (GetDlgItem (hwnd, IDC_RULE_PROTOCOL_ID)) { - _r_ctrl_settextformat (hwnd, IDC_RULE_PROTOCOL, L"%s:", app.LocaleString (IDS_PROTOCOL)); + _r_ctrl_settextformat (hwnd, IDC_RULE_PROTOCOL, L"%s:", _r_locale_getstring (IDS_PROTOCOL)); UINT8 protos[] = { IPPROTO_ICMP, @@ -224,7 +228,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa WCHAR format[256]; LPCWSTR protocolString; - SendDlgItemMessage (hwnd, IDC_RULE_PROTOCOL_ID, CB_INSERTSTRING, (WPARAM)index, (LPARAM)app.LocaleString (IDS_ANY)); + SendDlgItemMessage (hwnd, IDC_RULE_PROTOCOL_ID, CB_INSERTSTRING, (WPARAM)index, (LPARAM)_r_locale_getstring (IDS_ANY)); SendDlgItemMessage (hwnd, IDC_RULE_PROTOCOL_ID, CB_SETITEMDATA, (WPARAM)index, 0); if (ptr_rule->protocol == 0) @@ -266,7 +270,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa // rule (remote) if (GetDlgItem (hwnd, IDC_RULE_REMOTE_ID)) { - _r_ctrl_settextformat (hwnd, IDC_RULE_REMOTE, L"%s (" SZ_DIRECTION_REMOTE L"):", app.LocaleString (IDS_RULE)); + _r_ctrl_settextformat (hwnd, IDC_RULE_REMOTE, L"%s (" SZ_DIRECTION_REMOTE L"):", _r_locale_getstring (IDS_RULE)); _r_listview_setstyle (hwnd, IDC_RULE_REMOTE_ID, LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP | LVS_EX_LABELTIP, FALSE); _r_listview_addcolumn (hwnd, IDC_RULE_REMOTE_ID, 0, NULL, -100, 0); @@ -302,23 +306,23 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa _r_listview_setcolumn (hwnd, IDC_RULE_REMOTE_ID, 0, NULL, -100); } - _r_ctrl_settextformat (hwnd, IDC_RULE_REMOTE_ADD, L"%s...", app.LocaleString (IDS_ADD)); - _r_ctrl_settextformat (hwnd, IDC_RULE_REMOTE_EDIT, L"%s...", app.LocaleString (IDS_EDIT2)); - _r_ctrl_settext (hwnd, IDC_RULE_REMOTE_DELETE, app.LocaleString (IDS_DELETE)); + _r_ctrl_settextformat (hwnd, IDC_RULE_REMOTE_ADD, L"%s...", _r_locale_getstring (IDS_ADD)); + _r_ctrl_settextformat (hwnd, IDC_RULE_REMOTE_EDIT, L"%s...", _r_locale_getstring (IDS_EDIT2)); + _r_ctrl_settext (hwnd, IDC_RULE_REMOTE_DELETE, _r_locale_getstring (IDS_DELETE)); _r_ctrl_enable (hwnd, IDC_RULE_REMOTE_ADD, !ptr_rule->is_readonly); _r_ctrl_enable (hwnd, IDC_RULE_REMOTE_EDIT, FALSE); _r_ctrl_enable (hwnd, IDC_RULE_REMOTE_DELETE, FALSE); - _r_wnd_addstyle (hwnd, IDC_RULE_REMOTE_ADD, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_RULE_REMOTE_EDIT, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_RULE_REMOTE_DELETE, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_RULE_REMOTE_ADD, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_RULE_REMOTE_EDIT, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_RULE_REMOTE_DELETE, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); } // rule (local) if (GetDlgItem (hwnd, IDC_RULE_LOCAL_ID)) { - _r_ctrl_settextformat (hwnd, IDC_RULE_LOCAL, L"%s (" SZ_DIRECTION_LOCAL L"):", app.LocaleString (IDS_RULE)); + _r_ctrl_settextformat (hwnd, IDC_RULE_LOCAL, L"%s (" SZ_DIRECTION_LOCAL L"):", _r_locale_getstring (IDS_RULE)); _r_listview_setstyle (hwnd, IDC_RULE_LOCAL_ID, LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP | LVS_EX_LABELTIP, FALSE); _r_listview_addcolumn (hwnd, IDC_RULE_LOCAL_ID, 0, NULL, -100, 0); @@ -354,17 +358,17 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa _r_listview_setcolumn (hwnd, IDC_RULE_LOCAL_ID, 0, NULL, -100); } - _r_ctrl_settextformat (hwnd, IDC_RULE_LOCAL_ADD, L"%s...", app.LocaleString (IDS_ADD)); - _r_ctrl_settextformat (hwnd, IDC_RULE_LOCAL_EDIT, L"%s...", app.LocaleString (IDS_EDIT2)); - _r_ctrl_settext (hwnd, IDC_RULE_LOCAL_DELETE, app.LocaleString (IDS_DELETE)); + _r_ctrl_settextformat (hwnd, IDC_RULE_LOCAL_ADD, L"%s...", _r_locale_getstring (IDS_ADD)); + _r_ctrl_settextformat (hwnd, IDC_RULE_LOCAL_EDIT, L"%s...", _r_locale_getstring (IDS_EDIT2)); + _r_ctrl_settext (hwnd, IDC_RULE_LOCAL_DELETE, _r_locale_getstring (IDS_DELETE)); _r_ctrl_enable (hwnd, IDC_RULE_LOCAL_ADD, !ptr_rule->is_readonly); _r_ctrl_enable (hwnd, IDC_RULE_LOCAL_EDIT, FALSE); _r_ctrl_enable (hwnd, IDC_RULE_LOCAL_DELETE, FALSE); - _r_wnd_addstyle (hwnd, IDC_RULE_LOCAL_ADD, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_RULE_LOCAL_EDIT, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_RULE_LOCAL_DELETE, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_RULE_LOCAL_ADD, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_RULE_LOCAL_EDIT, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_RULE_LOCAL_DELETE, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); } // apps @@ -374,7 +378,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa _r_listview_setstyle (hwnd, IDC_RULE_APPS_ID, LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP | LVS_EX_LABELTIP | LVS_EX_CHECKBOXES, TRUE); - _r_listview_addcolumn (hwnd, IDC_RULE_APPS_ID, 0, app.LocaleString (IDS_NAME), 0, LVCFMT_LEFT); + _r_listview_addcolumn (hwnd, IDC_RULE_APPS_ID, 0, _r_locale_getstring (IDS_NAME), 0, LVCFMT_LEFT); _r_listview_addgroup (hwnd, IDC_RULE_APPS_ID, 0, L"", 0, LVGS_COLLAPSIBLE, LVGS_COLLAPSIBLE); _r_listview_addgroup (hwnd, IDC_RULE_APPS_ID, 1, L"", 0, LVGS_COLLAPSIBLE, LVGS_COLLAPSIBLE); @@ -430,10 +434,10 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa // hints if (GetDlgItem (hwnd, IDC_RULE_HINT)) - _r_ctrl_settext (hwnd, IDC_RULE_HINT, app.LocaleString (IDS_RULE_HINT)); + _r_ctrl_settext (hwnd, IDC_RULE_HINT, _r_locale_getstring (IDS_RULE_HINT)); if (GetDlgItem (hwnd, IDC_RULE_APPS_HINT)) - _r_ctrl_settext (hwnd, IDC_RULE_APPS_HINT, app.LocaleString (IDS_RULE_APPS_HINT)); + _r_ctrl_settext (hwnd, IDC_RULE_APPS_HINT, _r_locale_getstring (IDS_RULE_APPS_HINT)); break; } @@ -508,15 +512,15 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa UINT id_edit = is_remote ? IDC_RULE_REMOTE_EDIT : IDC_RULE_LOCAL_EDIT; UINT id_delete = is_remote ? IDC_RULE_REMOTE_DELETE : IDC_RULE_LOCAL_DELETE; - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_ADD))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_ADD))); AppendMenu (hsubmenu, MF_STRING, id_add, _r_obj_getstringorempty (localizedString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_EDIT2))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_EDIT2))); AppendMenu (hsubmenu, MF_STRING, id_edit, _r_obj_getstringorempty (localizedString)); - AppendMenu (hsubmenu, MF_STRING, id_delete, app.LocaleString (IDS_DELETE)); + AppendMenu (hsubmenu, MF_STRING, id_delete, _r_locale_getstring (IDS_DELETE)); AppendMenu (hsubmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hsubmenu, MF_STRING, IDM_COPY, app.LocaleString (IDS_COPY)); + AppendMenu (hsubmenu, MF_STRING, IDM_COPY, _r_locale_getstring (IDS_COPY)); if (ptr_rule->is_readonly) { @@ -536,12 +540,12 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa } else if (listview_id == IDC_RULE_APPS_ID) { - AppendMenu (hsubmenu, MF_STRING, IDM_CHECK, app.LocaleString (IDS_CHECK)); - AppendMenu (hsubmenu, MF_STRING, IDM_UNCHECK, app.LocaleString (IDS_UNCHECK)); + AppendMenu (hsubmenu, MF_STRING, IDM_CHECK, _r_locale_getstring (IDS_CHECK)); + AppendMenu (hsubmenu, MF_STRING, IDM_UNCHECK, _r_locale_getstring (IDS_UNCHECK)); AppendMenu (hsubmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hsubmenu, MF_STRING, IDM_PROPERTIES, app.LocaleString (IDS_SHOWINLIST)); + AppendMenu (hsubmenu, MF_STRING, IDM_PROPERTIES, _r_locale_getstring (IDS_SHOWINLIST)); AppendMenu (hsubmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hsubmenu, MF_STRING, IDM_COPY, app.LocaleString (IDS_COPY)); + AppendMenu (hsubmenu, MF_STRING, IDM_COPY, _r_locale_getstring (IDS_COPY)); if (ptr_rule->type != DataRuleCustom) { @@ -664,7 +668,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa NMLVEMPTYMARKUP* lpnmlv = (NMLVEMPTYMARKUP*)lparam; lpnmlv->dwFlags = EMF_CENTERED; - _r_str_copy (lpnmlv->szMarkup, RTL_NUMBER_OF (lpnmlv->szMarkup), app.LocaleString (IDS_STATUS_EMPTY)); + _r_str_copy (lpnmlv->szMarkup, RTL_NUMBER_OF (lpnmlv->szMarkup), _r_locale_getstring (IDS_STATUS_EMPTY)); SetWindowLongPtr (hwnd, DWLP_MSGRESULT, TRUE); return TRUE; @@ -725,9 +729,9 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa INT selected = (INT)SendDlgItemMessage (hwnd, listview_id, LVM_GETSELECTEDCOUNT, 0, 0); WCHAR messageText[256]; - _r_str_printf (messageText, RTL_NUMBER_OF (messageText), app.LocaleString (IDS_QUESTION_DELETE), selected); + _r_str_printf (messageText, RTL_NUMBER_OF (messageText), _r_locale_getstring (IDS_QUESTION_DELETE), selected); - if (!selected || app.ShowMessage (hwnd, MB_YESNO | MB_ICONEXCLAMATION, NULL, NULL, messageText) != IDYES) + if (!selected || _r_show_message (hwnd, MB_YESNO | MB_ICONEXCLAMATION, NULL, NULL, messageText) != IDYES) break; INT count = _r_listview_getitemcount (hwnd, listview_id, FALSE) - 1; @@ -770,7 +774,7 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa INT app_listview_id = (INT)_app_getappinfo (app_hash, InfoListviewId); if (app_listview_id) - _app_showitem (app.GetHWND (), app_listview_id, _app_getposition (app.GetHWND (), app_listview_id, app_hash), INVALID_INT); + _app_showitem (_r_app_gethwnd (), app_listview_id, _app_getposition (_r_app_gethwnd (), app_listview_id, app_hash), INVALID_INT); } break; @@ -849,9 +853,9 @@ INT_PTR CALLBACK EditorProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) _r_wnd_center (hwnd, GetParent (hwnd)); // configure tabs - _r_tab_additem (hwnd, IDC_TAB, 0, app.LocaleString (IDS_SETTINGS_GENERAL), I_IMAGENONE, (LPARAM)CreateDialogParam (app.GetHINSTANCE (), MAKEINTRESOURCE (IDD_EDITOR_GENERAL), hwnd, &EditorPagesProc, (LPARAM)ptr_rule)); - _r_tab_additem (hwnd, IDC_TAB, 1, app.LocaleString (IDS_RULE), I_IMAGENONE, (LPARAM)CreateDialogParam (app.GetHINSTANCE (), MAKEINTRESOURCE (IDD_EDITOR_RULE), hwnd, &EditorPagesProc, (LPARAM)ptr_rule)); - _r_tab_additem (hwnd, IDC_TAB, 2, app.LocaleString (IDS_TAB_APPS), I_IMAGENONE, (LPARAM)CreateDialogParam (app.GetHINSTANCE (), MAKEINTRESOURCE (IDD_EDITOR_APPS), hwnd, &EditorPagesProc, (LPARAM)ptr_rule)); + _r_tab_additem (hwnd, IDC_TAB, 0, _r_locale_getstring (IDS_SETTINGS_GENERAL), I_IMAGENONE, (LPARAM)CreateDialogParam (NULL, MAKEINTRESOURCE (IDD_EDITOR_GENERAL), hwnd, &EditorPagesProc, (LPARAM)ptr_rule)); + _r_tab_additem (hwnd, IDC_TAB, 1, _r_locale_getstring (IDS_RULE), I_IMAGENONE, (LPARAM)CreateDialogParam (NULL, MAKEINTRESOURCE (IDD_EDITOR_RULE), hwnd, &EditorPagesProc, (LPARAM)ptr_rule)); + _r_tab_additem (hwnd, IDC_TAB, 2, _r_locale_getstring (IDS_TAB_APPS), I_IMAGENONE, (LPARAM)CreateDialogParam (NULL, MAKEINTRESOURCE (IDD_EDITOR_APPS), hwnd, &EditorPagesProc, (LPARAM)ptr_rule)); #if !defined(_APP_NO_DARKTHEME) _r_wnd_setdarktheme (hwnd); @@ -860,7 +864,7 @@ INT_PTR CALLBACK EditorProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) // localize window { WCHAR title[128]; - _r_str_printf (title, RTL_NUMBER_OF (title), L"%s \"%s\"", app.LocaleString (IDS_EDITOR), _r_obj_getstringordefault (ptr_rule->name, SZ_RULE_NEW_TITLE)); + _r_str_printf (title, RTL_NUMBER_OF (title), L"%s \"%s\"", _r_locale_getstring (IDS_EDITOR), _r_obj_getstringordefault (ptr_rule->name, SZ_RULE_NEW_TITLE)); if (ptr_rule->is_readonly) _r_str_appendformat (title, RTL_NUMBER_OF (title), L" (%s)", SZ_RULE_INTERNAL_TITLE); @@ -868,13 +872,15 @@ INT_PTR CALLBACK EditorProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) SetWindowText (hwnd, title); } - _r_ctrl_settext (hwnd, IDC_ENABLE_CHK, app.LocaleString (IDS_ENABLE_CHK)); + _r_ctrl_settext (hwnd, IDC_ENABLE_CHK, _r_locale_getstring (IDS_ENABLE_CHK)); - _r_ctrl_settext (hwnd, IDC_SAVE, app.LocaleString (IDS_SAVE)); - _r_ctrl_settext (hwnd, IDC_CLOSE, app.LocaleString (IDS_CLOSE)); + _r_ctrl_settext (hwnd, IDC_SAVE, _r_locale_getstring (IDS_SAVE)); + _r_ctrl_settext (hwnd, IDC_CLOSE, _r_locale_getstring (IDS_CLOSE)); - _r_wnd_addstyle (hwnd, IDC_SAVE, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_CLOSE, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + BOOLEAN is_classic = _r_app_isclassicui (); + + _r_wnd_addstyle (hwnd, IDC_SAVE, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_CLOSE, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); // state CheckDlgButton (hwnd, IDC_ENABLE_CHK, ptr_rule->is_enabled ? BST_CHECKED : BST_UNCHECKED); @@ -926,7 +932,7 @@ INT_PTR CALLBACK EditorProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { _r_tab_adjustchild (hwnd, IDC_TAB, hpage); - ShowWindow (hpage, SW_SHOW); + ShowWindow (hpage, SW_SHOWNA); SetFocus (hpage); } diff --git a/src/global.hpp b/src/global.hpp index 33d86801..7c066c6d 100644 --- a/src/global.hpp +++ b/src/global.hpp @@ -41,8 +41,6 @@ #include "resource.hpp" -inline rapp app; - inline STATIC_DATA config; inline OBJECTS_APP_MAP apps; diff --git a/src/helper.cpp b/src/helper.cpp index bafa8afc..2e086f98 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -172,7 +172,7 @@ PR_STRING _app_formataddress (ADDRESS_FAMILY af, UINT8 proto, LPCVOID paddr, UIN if ((flags & FMTADDR_RESOLVE_HOST) != 0) { - if (is_success && app.ConfigGetBoolean (L"IsNetworkResolutionsEnabled", FALSE)) + if (is_success && _r_config_getboolean (L"IsNetworkResolutionsEnabled", FALSE)) { SIZE_T addr_hash = _r_str_hash (formatted_address); BOOLEAN is_exists = cache_hosts.find (addr_hash) != cache_hosts.end (); @@ -430,7 +430,7 @@ VOID _app_freelogstack () VOID _app_getappicon (const PITEM_APP ptr_app, BOOLEAN is_small, PINT picon_id, HICON* picon) { - BOOLEAN is_iconshidden = app.ConfigGetBoolean (L"IsIconsHidden", FALSE); + BOOLEAN is_iconshidden = _r_config_getboolean (L"IsIconsHidden", FALSE); if (ptr_app->type == DataAppRegular || ptr_app->type == DataAppService) { @@ -487,7 +487,7 @@ PR_STRING _app_getdisplayname (SIZE_T app_hash, PITEM_APP ptr_app) if (pathString) { - if (app.ConfigGetBoolean (L"ShowFilenames", TRUE)) + if (_r_config_getboolean (L"ShowFilenames", TRUE)) { return _r_obj_createstring (_r_path_getbasename (_r_obj_getstring (pathString))); } @@ -1542,15 +1542,15 @@ PR_STRING _app_getdirectionname (FWP_DIRECTION direction, BOOLEAN is_loopback, B { if (direction == FWP_DIRECTION_OUTBOUND) { - string = _r_obj_createstring (app.LocaleString (IDS_DIRECTION_1)); + string = _r_obj_createstring (_r_locale_getstring (IDS_DIRECTION_1)); } else if (direction == FWP_DIRECTION_INBOUND) { - string = _r_obj_createstring (app.LocaleString (IDS_DIRECTION_2)); + string = _r_obj_createstring (_r_locale_getstring (IDS_DIRECTION_2)); } else if (direction == FWP_DIRECTION_MAX) { - string = _r_obj_createstring (app.LocaleString (IDS_ANY)); + string = _r_obj_createstring (_r_locale_getstring (IDS_ANY)); } else { @@ -2151,7 +2151,7 @@ VOID _app_generate_services () DWORD dwServiceState = SERVICE_STATE_ALL; // win10+ - if (_r_sys_validversion (10, 0)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_10)) dwServiceType |= SERVICE_INTERACTIVE_PROCESS | SERVICE_USER_SERVICE | SERVICE_USERSERVICE_INSTANCE; DWORD bufferSize = initialBufferSize; @@ -2323,12 +2323,20 @@ VOID _app_generate_rulesmenu (HMENU hsubmenu, SIZE_T app_hash) if (!app_hash || !pstatus->rules_count) { AppendMenu (hsubmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hsubmenu, MF_STRING, IDX_RULES_SPECIAL, app.LocaleString (IDS_STATUS_EMPTY)); + AppendMenu (hsubmenu, MF_STRING, IDX_RULES_SPECIAL, _r_locale_getstring (IDS_STATUS_EMPTY)); _r_menu_enableitem (hsubmenu, IDX_RULES_SPECIAL, MF_BYCOMMAND, FALSE); } else { + MENUITEMINFO mii = {0}; + + WCHAR buffer[128]; + PITEM_RULE ptr_rule; + + BOOLEAN is_global; + BOOLEAN is_enabled; + for (UINT8 type = 0; type < 2; type++) { if (type == 0) @@ -2348,15 +2356,15 @@ VOID _app_generate_rulesmenu (HMENU hsubmenu, SIZE_T app_hash) { for (SIZE_T i = 0; i < rules_arr.size (); i++) { - PVOID pdata = rules_arr.at (i); + ptr_rule = rules_arr.at (i); - if (!pdata) + if (!ptr_rule) continue; - PITEM_RULE ptr_rule = (PITEM_RULE)_r_obj_reference (pdata); + ptr_rule = (PITEM_RULE)_r_obj_reference (ptr_rule); - BOOLEAN is_global = (ptr_rule->is_enabled && ptr_rule->apps->empty ()); - BOOLEAN is_enabled = is_global || (ptr_rule->is_enabled && (ptr_rule->apps->find (app_hash) != ptr_rule->apps->end ())); + is_global = (ptr_rule->is_enabled && ptr_rule->apps->empty ()); + is_enabled = is_global || (ptr_rule->is_enabled && (ptr_rule->apps->find (app_hash) != ptr_rule->apps->end ())); if (ptr_rule->type != DataRuleCustom || (type == 0 && (!ptr_rule->is_readonly || is_global)) || (type == 1 && (ptr_rule->is_readonly || is_global))) { @@ -2370,14 +2378,11 @@ VOID _app_generate_rulesmenu (HMENU hsubmenu, SIZE_T app_hash) continue; } - WCHAR buffer[128]; - _r_str_printf (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_RULE_APPLY_2), _r_obj_getstring (ptr_rule->name)); + _r_str_printf (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_RULE_APPLY_2), _r_obj_getstring (ptr_rule->name)); if (ptr_rule->is_readonly) _r_str_append (buffer, RTL_NUMBER_OF (buffer), SZ_RULE_INTERNAL_MENU); - MENUITEMINFO mii = {0}; - mii.cbSize = sizeof (mii); mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE | MIIM_STRING | MIIM_BITMAP | MIIM_CHECKMARKS; mii.fType = MFT_STRING; @@ -2397,8 +2402,8 @@ VOID _app_generate_rulesmenu (HMENU hsubmenu, SIZE_T app_hash) } AppendMenu (hsubmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hsubmenu, MF_STRING, IDM_EDITRULES, app.LocaleString (IDS_EDITRULES)); - AppendMenu (hsubmenu, MF_STRING, IDM_OPENRULESEDITOR, app.LocaleString (IDS_OPENRULESEDITOR)); + AppendMenu (hsubmenu, MF_STRING, IDM_EDITRULES, _r_locale_getstring (IDS_EDITRULES)); + AppendMenu (hsubmenu, MF_STRING, IDM_OPENRULESEDITOR, _r_locale_getstring (IDS_OPENRULESEDITOR)); _r_mem_free (pstatus); } @@ -2491,7 +2496,7 @@ PR_STRING _app_parsehostaddress_dns (LPCWSTR hostname, USHORT port) if (dnsStatus != DNS_ERROR_RCODE_NO_ERROR) { if (dnsStatus != DNS_INFO_NO_RECORDS) - app.LogError (0, L"DnsQuery (DNS_TYPE_A)", dnsStatus, hostname); + _r_logerror (0, L"DnsQuery (DNS_TYPE_A)", dnsStatus, hostname); } else { @@ -2527,7 +2532,7 @@ PR_STRING _app_parsehostaddress_dns (LPCWSTR hostname, USHORT port) if (dnsStatus != DNS_ERROR_RCODE_NO_ERROR) { if (dnsStatus != DNS_INFO_NO_RECORDS) - app.LogError (0, L"DnsQuery (DNS_TYPE_AAAA)", dnsStatus, hostname); + _r_logerror (0, L"DnsQuery (DNS_TYPE_AAAA)", dnsStatus, hostname); } else { @@ -2580,7 +2585,7 @@ BOOLEAN _app_parsenetworkstring (LPCWSTR network_string, NET_ADDRESS_FORMAT* for if (code != ERROR_SUCCESS) { - app.LogError (0, L"ParseNetworkString", code, network_string); + _r_logerror (0, L"ParseNetworkString", code, network_string); return FALSE; } else diff --git a/src/log.cpp b/src/log.cpp index caf0db00..f2591f7d 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -5,7 +5,7 @@ PR_STRING _app_getlogviewer () { - LPCWSTR result = app.ConfigGetString (L"LogViewer", LOG_VIEWER_DEFAULT); + LPCWSTR result = _r_config_getstring (L"LogViewer", LOG_VIEWER_DEFAULT); if (_r_str_isempty (result)) return _r_path_expand (LOG_VIEWER_DEFAULT); @@ -22,10 +22,10 @@ VOID _app_loginit (BOOLEAN is_install) // reset log handle SAFE_DELETE_HANDLE (config.hlogfile); - if (!is_install || !app.ConfigGetBoolean (L"IsLogEnabled", FALSE)) + if (!is_install || !_r_config_getboolean (L"IsLogEnabled", FALSE)) return; // already closed or not enabled - PR_STRING logPath = _r_path_expand (app.ConfigGetString (L"LogPath", LOG_PATH_DEFAULT)); + PR_STRING logPath = _r_path_expand (_r_config_getstring (L"LogPath", LOG_PATH_DEFAULT)); if (!logPath) return; @@ -260,7 +260,7 @@ VOID _app_logwrite_ui (HWND hwnd, PITEM_LOG ptr_log) BOOLEAN _app_logislimitreached () { - ULONG limit = app.ConfigGetUlong (L"LogSizeLimitKb", LOG_SIZE_LIMIT_DEFAULT); + ULONG limit = _r_config_getulong (L"LogSizeLimitKb", LOG_SIZE_LIMIT_DEFAULT); if (!limit || !_r_fs_isvalidhandle (config.hlogfile)) return FALSE; @@ -280,7 +280,7 @@ VOID _app_logclear () } else { - PR_STRING logPath = _r_path_expand (app.ConfigGetString (L"LogPath", LOG_PATH_DEFAULT)); + PR_STRING logPath = _r_path_expand (_r_config_getstring (L"LogPath", LOG_PATH_DEFAULT)); if (logPath) { @@ -354,7 +354,7 @@ VOID _wfp_logsubscribe (HANDLE hengine) if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmNetEventSubscribe", code, NULL); + _r_logerror (0, L"FwpmNetEventSubscribe", code, NULL); } else { @@ -383,7 +383,7 @@ VOID CALLBACK _wfp_logcallback (UINT32 flags, FILETIME const* pft, UINT8 const* { HANDLE hengine = _wfp_getenginehandle (); - if (!hengine || !filter_id || !layer_id || _wfp_isfiltersapplying () || (is_allow && app.ConfigGetBoolean (L"IsExcludeClassifyAllow", TRUE))) + if (!hengine || !filter_id || !layer_id || _wfp_isfiltersapplying () || (is_allow && _r_config_getboolean (L"IsExcludeClassifyAllow", TRUE))) return; // set allowed directions @@ -617,7 +617,7 @@ VOID CALLBACK _wfp_logcallback (UINT32 flags, FILETIME const* pft, UINT8 const* { _app_freethreadpool (&threads_pool); - HANDLE hthread = _r_sys_createthreadex (&LogThread, app.GetHWND (), TRUE, THREAD_PRIORITY_HIGHEST); + HANDLE hthread = _r_sys_createthreadex (&LogThread, _r_app_gethwnd (), TRUE, THREAD_PRIORITY_HIGHEST); if (hthread) { @@ -876,11 +876,11 @@ THREAD_FN LogThread (PVOID lparam) if (!ptr_log) continue; - BOOLEAN is_logenabled = app.ConfigGetBoolean (L"IsLogEnabled", FALSE); - BOOLEAN is_loguienabled = app.ConfigGetBoolean (L"IsLogUiEnabled", FALSE); - BOOLEAN is_notificationenabled = app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE); + BOOLEAN is_logenabled = _r_config_getboolean (L"IsLogEnabled", FALSE); + BOOLEAN is_loguienabled = _r_config_getboolean (L"IsLogUiEnabled", FALSE); + BOOLEAN is_notificationenabled = _r_config_getboolean (L"IsNotificationsEnabled", TRUE); - BOOLEAN is_exludestealth = !(ptr_log->is_system && app.ConfigGetBoolean (L"IsExcludeStealth", TRUE)); + BOOLEAN is_exludestealth = !(ptr_log->is_system && _r_config_getboolean (L"IsExcludeStealth", TRUE)); // apps collector BOOLEAN is_notexist = ptr_log->app_hash && !_r_str_isempty (ptr_log->path) && !ptr_log->is_allow && !_app_isappfound (ptr_log->app_hash); @@ -933,7 +933,7 @@ THREAD_FN LogThread (PVOID lparam) // display notification if (is_notificationenabled && ptr_log->app_hash && !ptr_log->is_allow) { - if (!(ptr_log->is_blocklist && app.ConfigGetBoolean (L"IsExcludeBlocklist", TRUE)) && !(ptr_log->is_custom && app.ConfigGetBoolean (L"IsExcludeCustomRules", TRUE))) + if (!(ptr_log->is_blocklist && _r_config_getboolean (L"IsExcludeBlocklist", TRUE)) && !(ptr_log->is_custom && _r_config_getboolean (L"IsExcludeCustomRules", TRUE))) { PITEM_APP ptr_app = _app_getappitem (ptr_log->app_hash); diff --git a/src/main.cpp b/src/main.cpp index 8c502967..f9b4651e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,7 +51,7 @@ THREAD_FN ApplyThread (PVOID lparam) THREAD_FN NetworkMonitorThread (PVOID lparam) { - DWORD network_timeout = app.ConfigGetUlong (L"NetworkTimeout", NETWORK_TIMEOUT); + DWORD network_timeout = _r_config_getulong (L"NetworkTimeout", NETWORK_TIMEOUT); if (network_timeout && network_timeout != INFINITE) { @@ -77,7 +77,7 @@ THREAD_FN NetworkMonitorThread (PVOID lparam) { _app_generate_connections (&network_map, &checker_map); - is_highlighting_enabled = app.ConfigGetBoolean (L"IsEnableHighlighting", TRUE) && app.ConfigGetBoolean (L"IsHighlightConnection", TRUE, L"colors"); + is_highlighting_enabled = _r_config_getboolean (L"IsEnableHighlighting", TRUE) && _r_config_getboolean (L"IsHighlightConnection", TRUE, L"colors"); current_listview_id = (INT)_r_tab_getlparam (hwnd, IDC_TAB, INVALID_INT); is_refresh = FALSE; @@ -249,7 +249,7 @@ VOID addcolor (UINT locale_id, LPCWSTR configName, BOOLEAN is_enabled, LPCWSTR c ptr_clr->configValue = _r_obj_createstring (configValue); ptr_clr->hash = _r_str_hash (configValue); - ptr_clr->new_clr = app.ConfigGetUlong (configValue, default_clr, L"colors"); + ptr_clr->new_clr = _r_config_getulong (configValue, default_clr, L"colors"); } ptr_clr->default_clr = default_clr; @@ -298,13 +298,13 @@ BOOLEAN _app_installmessage (HWND hwnd, BOOLEAN is_install) td_buttons[1].nButtonID = IDNO; td_buttons[1].pszButtonText = str_button_text_2; - _r_str_copy (str_button_text_1, RTL_NUMBER_OF (str_button_text_1), app.LocaleString (is_install ? IDS_TRAY_START : IDS_TRAY_STOP)); - _r_str_copy (str_button_text_2, RTL_NUMBER_OF (str_button_text_2), app.LocaleString (IDS_CLOSE)); + _r_str_copy (str_button_text_1, RTL_NUMBER_OF (str_button_text_1), _r_locale_getstring (is_install ? IDS_TRAY_START : IDS_TRAY_STOP)); + _r_str_copy (str_button_text_2, RTL_NUMBER_OF (str_button_text_2), _r_locale_getstring (IDS_CLOSE)); if (is_install) { - _r_str_copy (str_main, RTL_NUMBER_OF (str_main), app.LocaleString (IDS_QUESTION_START)); - _r_str_copy (str_flag, RTL_NUMBER_OF (str_flag), app.LocaleString (IDS_DISABLEWINDOWSFIREWALL_CHK)); + _r_str_copy (str_main, RTL_NUMBER_OF (str_main), _r_locale_getstring (IDS_QUESTION_START)); + _r_str_copy (str_flag, RTL_NUMBER_OF (str_flag), _r_locale_getstring (IDS_DISABLEWINDOWSFIREWALL_CHK)); tdc.pRadioButtons = td_radios; tdc.cRadioButtons = RTL_NUMBER_OF (td_radios); @@ -317,18 +317,18 @@ BOOLEAN _app_installmessage (HWND hwnd, BOOLEAN is_install) td_radios[1].nButtonID = IDNO; td_radios[1].pszButtonText = radio_text_2; - _r_str_copy (radio_text_1, RTL_NUMBER_OF (radio_text_1), app.LocaleString (IDS_INSTALL_PERMANENT)); - _r_str_copy (radio_text_2, RTL_NUMBER_OF (radio_text_2), app.LocaleString (IDS_INSTALL_TEMPORARY)); + _r_str_copy (radio_text_1, RTL_NUMBER_OF (radio_text_1), _r_locale_getstring (IDS_INSTALL_PERMANENT)); + _r_str_copy (radio_text_2, RTL_NUMBER_OF (radio_text_2), _r_locale_getstring (IDS_INSTALL_TEMPORARY)); - if (app.ConfigGetBoolean (L"IsDisableWindowsFirewallChecked", TRUE)) + if (_r_config_getboolean (L"IsDisableWindowsFirewallChecked", TRUE)) tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED; } else { - _r_str_copy (str_main, RTL_NUMBER_OF (str_main), app.LocaleString (IDS_QUESTION_STOP)); - _r_str_copy (str_flag, RTL_NUMBER_OF (str_flag), app.LocaleString (IDS_ENABLEWINDOWSFIREWALL_CHK)); + _r_str_copy (str_main, RTL_NUMBER_OF (str_main), _r_locale_getstring (IDS_QUESTION_STOP)); + _r_str_copy (str_flag, RTL_NUMBER_OF (str_flag), _r_locale_getstring (IDS_ENABLEWINDOWSFIREWALL_CHK)); - if (app.ConfigGetBoolean (L"IsEnableWindowsFirewallChecked", TRUE)) + if (_r_config_getboolean (L"IsEnableWindowsFirewallChecked", TRUE)) tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED; } @@ -344,14 +344,14 @@ BOOLEAN _app_installmessage (HWND hwnd, BOOLEAN is_install) { config.is_filterstemporary = (radio_id == IDNO); - app.ConfigSetBoolean (L"IsDisableWindowsFirewallChecked", !!is_flagchecked); + _r_config_setboolean (L"IsDisableWindowsFirewallChecked", !!is_flagchecked); if (is_flagchecked) _mps_changeconfig2 (FALSE); } else { - app.ConfigSetBoolean (L"IsEnableWindowsFirewallChecked", !!is_flagchecked); + _r_config_setboolean (L"IsEnableWindowsFirewallChecked", !!is_flagchecked); if (is_flagchecked) _mps_changeconfig2 (TRUE); @@ -373,70 +373,70 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_RULE_BLOCKOUTBOUND: case IDM_RULE_BLOCKOUTBOUND: { - new_val = !app.ConfigGetBoolean (L"BlockOutboundConnections", TRUE); + new_val = !_r_config_getboolean (L"BlockOutboundConnections", TRUE); break; } case IDC_RULE_BLOCKINBOUND: case IDM_RULE_BLOCKINBOUND: { - new_val = !app.ConfigGetBoolean (L"BlockInboundConnections", TRUE); + new_val = !_r_config_getboolean (L"BlockInboundConnections", TRUE); break; } case IDC_RULE_ALLOWLOOPBACK: case IDM_RULE_ALLOWLOOPBACK: { - new_val = !app.ConfigGetBoolean (L"AllowLoopbackConnections", TRUE); + new_val = !_r_config_getboolean (L"AllowLoopbackConnections", TRUE); break; } case IDC_RULE_ALLOW6TO4: case IDM_RULE_ALLOW6TO4: { - new_val = !app.ConfigGetBoolean (L"AllowIPv6", TRUE); + new_val = !_r_config_getboolean (L"AllowIPv6", TRUE); break; } case IDC_SECUREFILTERS_CHK: case IDM_SECUREFILTERS_CHK: { - new_val = !app.ConfigGetBoolean (L"IsSecureFilters", TRUE); + new_val = !_r_config_getboolean (L"IsSecureFilters", TRUE); break; } case IDC_USESTEALTHMODE_CHK: case IDM_USESTEALTHMODE_CHK: { - new_val = !app.ConfigGetBoolean (L"UseStealthMode", TRUE); + new_val = !_r_config_getboolean (L"UseStealthMode", TRUE); break; } case IDC_INSTALLBOOTTIMEFILTERS_CHK: case IDM_INSTALLBOOTTIMEFILTERS_CHK: { - new_val = !app.ConfigGetBoolean (L"InstallBoottimeFilters", TRUE); + new_val = !_r_config_getboolean (L"InstallBoottimeFilters", TRUE); break; } case IDC_USENETWORKRESOLUTION_CHK: case IDM_USENETWORKRESOLUTION_CHK: { - new_val = !app.ConfigGetBoolean (L"IsNetworkResolutionsEnabled", FALSE); + new_val = !_r_config_getboolean (L"IsNetworkResolutionsEnabled", FALSE); break; } case IDC_USECERTIFICATES_CHK: case IDM_USECERTIFICATES_CHK: { - new_val = !app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE); + new_val = !_r_config_getboolean (L"IsCertificatesEnabled", FALSE); break; } case IDC_USEREFRESHDEVICES_CHK: case IDM_USEREFRESHDEVICES_CHK: { - new_val = !app.ConfigGetBoolean (L"IsRefreshDevices", TRUE); + new_val = !_r_config_getboolean (L"IsRefreshDevices", TRUE); break; } @@ -453,7 +453,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_RULE_BLOCKOUTBOUND: case IDM_RULE_BLOCKOUTBOUND: { - app.ConfigSetBoolean (L"BlockOutboundConnections", new_val); + _r_config_setboolean (L"BlockOutboundConnections", new_val); _r_menu_checkitem (hmenu, IDM_RULE_BLOCKOUTBOUND, 0, MF_BYCOMMAND, new_val); break; @@ -462,7 +462,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_RULE_BLOCKINBOUND: case IDM_RULE_BLOCKINBOUND: { - app.ConfigSetBoolean (L"BlockInboundConnections", new_val); + _r_config_setboolean (L"BlockInboundConnections", new_val); _r_menu_checkitem (hmenu, IDM_RULE_BLOCKINBOUND, 0, MF_BYCOMMAND, new_val); break; @@ -471,7 +471,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_RULE_ALLOWLOOPBACK: case IDM_RULE_ALLOWLOOPBACK: { - app.ConfigSetBoolean (L"AllowLoopbackConnections", new_val); + _r_config_setboolean (L"AllowLoopbackConnections", new_val); _r_menu_checkitem (hmenu, IDM_RULE_ALLOWLOOPBACK, 0, MF_BYCOMMAND, new_val); break; @@ -480,7 +480,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_RULE_ALLOW6TO4: case IDM_RULE_ALLOW6TO4: { - app.ConfigSetBoolean (L"AllowIPv6", new_val); + _r_config_setboolean (L"AllowIPv6", new_val); _r_menu_checkitem (hmenu, IDM_RULE_ALLOW6TO4, 0, MF_BYCOMMAND, new_val); break; @@ -489,7 +489,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_USESTEALTHMODE_CHK: case IDM_USESTEALTHMODE_CHK: { - app.ConfigSetBoolean (L"UseStealthMode", new_val); + _r_config_setboolean (L"UseStealthMode", new_val); _r_menu_checkitem (hmenu, IDM_USESTEALTHMODE_CHK, 0, MF_BYCOMMAND, new_val); break; @@ -498,7 +498,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_SECUREFILTERS_CHK: case IDM_SECUREFILTERS_CHK: { - app.ConfigSetBoolean (L"IsSecureFilters", new_val); + _r_config_setboolean (L"IsSecureFilters", new_val); _r_menu_checkitem (hmenu, IDM_SECUREFILTERS_CHK, 0, MF_BYCOMMAND, new_val); HANDLE hengine = _wfp_getenginehandle (); @@ -523,7 +523,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_INSTALLBOOTTIMEFILTERS_CHK: case IDM_INSTALLBOOTTIMEFILTERS_CHK: { - app.ConfigSetBoolean (L"InstallBoottimeFilters", new_val); + _r_config_setboolean (L"InstallBoottimeFilters", new_val); _r_menu_checkitem (hmenu, IDM_INSTALLBOOTTIMEFILTERS_CHK, 0, MF_BYCOMMAND, new_val); break; @@ -532,7 +532,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_USENETWORKRESOLUTION_CHK: case IDM_USENETWORKRESOLUTION_CHK: { - app.ConfigSetBoolean (L"IsNetworkResolutionsEnabled", new_val); + _r_config_setboolean (L"IsNetworkResolutionsEnabled", new_val); _r_menu_checkitem (hmenu, IDM_USENETWORKRESOLUTION_CHK, 0, MF_BYCOMMAND, new_val); break; @@ -541,7 +541,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_USECERTIFICATES_CHK: case IDM_USECERTIFICATES_CHK: { - app.ConfigSetBoolean (L"IsCertificatesEnabled", new_val); + _r_config_setboolean (L"IsCertificatesEnabled", new_val); _r_menu_checkitem (hmenu, IDM_USECERTIFICATES_CHK, 0, MF_BYCOMMAND, new_val); if (new_val) @@ -566,7 +566,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) } } - _r_listview_redraw (app.GetHWND (), (INT)_r_tab_getlparam (app.GetHWND (), IDC_TAB, INVALID_INT), INVALID_INT); + _r_listview_redraw (_r_app_gethwnd (), (INT)_r_tab_getlparam (_r_app_gethwnd (), IDC_TAB, INVALID_INT), INVALID_INT); break; } @@ -574,7 +574,7 @@ VOID _app_config_apply (HWND hwnd, INT ctrl_id) case IDC_USEREFRESHDEVICES_CHK: case IDM_USEREFRESHDEVICES_CHK: { - app.ConfigSetBoolean (L"IsRefreshDevices", new_val); + _r_config_setboolean (L"IsRefreshDevices", new_val); _r_menu_checkitem (hmenu, IDM_USEREFRESHDEVICES_CHK, 0, MF_BYCOMMAND, new_val); break; @@ -623,50 +623,50 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { case IDD_SETTINGS_GENERAL: { - CheckDlgButton (hwnd, IDC_ALWAYSONTOP_CHK, app.ConfigGetBoolean (L"AlwaysOnTop", _APP_ALWAYSONTOP) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_ALWAYSONTOP_CHK, _r_config_getboolean (L"AlwaysOnTop", _APP_ALWAYSONTOP) ? BST_CHECKED : BST_UNCHECKED); #if defined(_APP_HAVE_AUTORUN) - CheckDlgButton (hwnd, IDC_LOADONSTARTUP_CHK, app.AutorunIsEnabled () ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_LOADONSTARTUP_CHK, _r_autorun_isenabled () ? BST_CHECKED : BST_UNCHECKED); #endif // _APP_HAVE_AUTORUN - CheckDlgButton (hwnd, IDC_STARTMINIMIZED_CHK, app.ConfigGetBoolean (L"IsStartMinimized", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_STARTMINIMIZED_CHK, _r_config_getboolean (L"IsStartMinimized", FALSE) ? BST_CHECKED : BST_UNCHECKED); #if defined(_APP_HAVE_SKIPUAC) - CheckDlgButton (hwnd, IDC_SKIPUACWARNING_CHK, app.SkipUacIsEnabled () ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_SKIPUACWARNING_CHK, _r_skipuac_isenabled () ? BST_CHECKED : BST_UNCHECKED); #endif // _APP_HAVE_SKIPUAC - CheckDlgButton (hwnd, IDC_CHECKUPDATES_CHK, app.ConfigGetBoolean (L"CheckUpdates", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_CHECKUPDATES_CHK, _r_config_getboolean (L"CheckUpdates", TRUE) ? BST_CHECKED : BST_UNCHECKED); #if defined(_DEBUG) || defined(_APP_BETA) CheckDlgButton (hwnd, IDC_CHECKUPDATESBETA_CHK, BST_CHECKED); _r_ctrl_enable (hwnd, IDC_CHECKUPDATESBETA_CHK, FALSE); #else - CheckDlgButton (hwnd, IDC_CHECKUPDATESBETA_CHK, app.ConfigGetBoolean (L"CheckUpdatesBeta", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_CHECKUPDATESBETA_CHK, _r_config_getboolean (L"CheckUpdatesBeta", FALSE) ? BST_CHECKED : BST_UNCHECKED); - if (!app.ConfigGetBoolean (L"CheckUpdates", TRUE)) + if (!_r_config_getboolean (L"CheckUpdates", TRUE)) _r_ctrl_enable (hwnd, IDC_CHECKUPDATESBETA_CHK, FALSE); #endif // _DEBUG || _APP_BETA - app.LocaleEnum (hwnd, IDC_LANGUAGE, FALSE, 0); + _r_locale_enum (hwnd, IDC_LANGUAGE, 0); break; } case IDD_SETTINGS_RULES: { - CheckDlgButton (hwnd, IDC_RULE_BLOCKOUTBOUND, app.ConfigGetBoolean (L"BlockOutboundConnections", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_RULE_BLOCKINBOUND, app.ConfigGetBoolean (L"BlockInboundConnections", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_RULE_BLOCKOUTBOUND, _r_config_getboolean (L"BlockOutboundConnections", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_RULE_BLOCKINBOUND, _r_config_getboolean (L"BlockInboundConnections", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_RULE_ALLOWLOOPBACK, app.ConfigGetBoolean (L"AllowLoopbackConnections", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_RULE_ALLOW6TO4, app.ConfigGetBoolean (L"AllowIPv6", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_RULE_ALLOWLOOPBACK, _r_config_getboolean (L"AllowLoopbackConnections", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_RULE_ALLOW6TO4, _r_config_getboolean (L"AllowIPv6", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_SECUREFILTERS_CHK, app.ConfigGetBoolean (L"IsSecureFilters", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_USESTEALTHMODE_CHK, app.ConfigGetBoolean (L"UseStealthMode", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_INSTALLBOOTTIMEFILTERS_CHK, app.ConfigGetBoolean (L"InstallBoottimeFilters", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_SECUREFILTERS_CHK, _r_config_getboolean (L"IsSecureFilters", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_USESTEALTHMODE_CHK, _r_config_getboolean (L"UseStealthMode", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_INSTALLBOOTTIMEFILTERS_CHK, _r_config_getboolean (L"InstallBoottimeFilters", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_USECERTIFICATES_CHK, app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_USENETWORKRESOLUTION_CHK, app.ConfigGetBoolean (L"IsNetworkResolutionsEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_USEREFRESHDEVICES_CHK, app.ConfigGetBoolean (L"IsRefreshDevices", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_USECERTIFICATES_CHK, _r_config_getboolean (L"IsCertificatesEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_USENETWORKRESOLUTION_CHK, _r_config_getboolean (L"IsNetworkResolutionsEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_USEREFRESHDEVICES_CHK, _r_config_getboolean (L"IsRefreshDevices", TRUE) ? BST_CHECKED : BST_UNCHECKED); HWND htip = _r_ctrl_createtip (hwnd); @@ -690,18 +690,18 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam for (INT i = IDC_BLOCKLIST_SPY_DISABLE; i <= IDC_BLOCKLIST_EXTRA_BLOCK; i++) CheckDlgButton (hwnd, i, BST_UNCHECKED); // HACK!!! reset button checkboxes! - CheckDlgButton (hwnd, (IDC_BLOCKLIST_SPY_DISABLE + _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistSpyState", 2), 0, 2)), BST_CHECKED); - CheckDlgButton (hwnd, (IDC_BLOCKLIST_UPDATE_DISABLE + _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistUpdateState", 0), 0, 2)), BST_CHECKED); - CheckDlgButton (hwnd, (IDC_BLOCKLIST_EXTRA_DISABLE + _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistExtraState", 0), 0, 2)), BST_CHECKED); + CheckDlgButton (hwnd, (IDC_BLOCKLIST_SPY_DISABLE + _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistSpyState", 2), 0, 2)), BST_CHECKED); + CheckDlgButton (hwnd, (IDC_BLOCKLIST_UPDATE_DISABLE + _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistUpdateState", 0), 0, 2)), BST_CHECKED); + CheckDlgButton (hwnd, (IDC_BLOCKLIST_EXTRA_DISABLE + _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistExtraState", 0), 0, 2)), BST_CHECKED); break; } case IDD_SETTINGS_INTERFACE: { - CheckDlgButton (hwnd, IDC_CONFIRMEXIT_CHK, app.ConfigGetBoolean (L"ConfirmExit2", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_CONFIRMEXITTIMER_CHK, app.ConfigGetBoolean (L"ConfirmExitTimer", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_CONFIRMLOGCLEAR_CHK, app.ConfigGetBoolean (L"ConfirmLogClear", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_CONFIRMEXIT_CHK, _r_config_getboolean (L"ConfirmExit2", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_CONFIRMEXITTIMER_CHK, _r_config_getboolean (L"ConfirmExitTimer", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_CONFIRMLOGCLEAR_CHK, _r_config_getboolean (L"ConfirmLogClear", TRUE) ? BST_CHECKED : BST_UNCHECKED); break; } @@ -724,12 +724,12 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam for (auto it = colors.begin (); it != colors.end (); ++it) { ptr_clr = *it; - ptr_clr->new_clr = app.ConfigGetUlong (_r_obj_getstring (ptr_clr->configValue), ptr_clr->default_clr, L"colors"); + ptr_clr->new_clr = _r_config_getulong (_r_obj_getstring (ptr_clr->configValue), ptr_clr->default_clr, L"colors"); _r_fastlock_acquireshared (&lock_checkbox); - _r_listview_additem (hwnd, IDC_COLORS, item, 0, app.LocaleString (ptr_clr->locale_id), config.icon_id, I_GROUPIDNONE, (LPARAM)ptr_clr); - _r_listview_setitemcheck (hwnd, IDC_COLORS, item, app.ConfigGetBoolean (_r_obj_getstring (ptr_clr->configName), ptr_clr->is_enabled, L"colors")); + _r_listview_additem (hwnd, IDC_COLORS, item, 0, _r_locale_getstring (ptr_clr->locale_id), config.icon_id, I_GROUPIDNONE, (LPARAM)ptr_clr); + _r_listview_setitemcheck (hwnd, IDC_COLORS, item, _r_config_getboolean (_r_obj_getstring (ptr_clr->configName), ptr_clr->is_enabled, L"colors")); _r_fastlock_releaseshared (&lock_checkbox); @@ -741,15 +741,15 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDD_SETTINGS_NOTIFICATIONS: { - CheckDlgButton (hwnd, IDC_ENABLENOTIFICATIONS_CHK, app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_NOTIFICATIONSOUND_CHK, app.ConfigGetBoolean (L"IsNotificationsSound", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_NOTIFICATIONONTRAY_CHK, app.ConfigGetBoolean (L"IsNotificationsOnTray", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_ENABLENOTIFICATIONS_CHK, _r_config_getboolean (L"IsNotificationsEnabled", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_NOTIFICATIONSOUND_CHK, _r_config_getboolean (L"IsNotificationsSound", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_NOTIFICATIONONTRAY_CHK, _r_config_getboolean (L"IsNotificationsOnTray", FALSE) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage (hwnd, IDC_NOTIFICATIONTIMEOUT, UDM_SETRANGE32, 0, _r_calc_days2seconds (LPARAM, 7)); - SendDlgItemMessage (hwnd, IDC_NOTIFICATIONTIMEOUT, UDM_SETPOS32, 0, (LPARAM)app.ConfigGetUlong (L"NotificationsTimeout", NOTIFY_TIMEOUT_DEFAULT)); + SendDlgItemMessage (hwnd, IDC_NOTIFICATIONTIMEOUT, UDM_SETPOS32, 0, (LPARAM)_r_config_getulong (L"NotificationsTimeout", NOTIFY_TIMEOUT_DEFAULT)); - CheckDlgButton (hwnd, IDC_EXCLUDEBLOCKLIST_CHK, app.ConfigGetBoolean (L"IsExcludeBlocklist", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_EXCLUDECUSTOM_CHK, app.ConfigGetBoolean (L"IsExcludeCustomRules", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_EXCLUDEBLOCKLIST_CHK, _r_config_getboolean (L"IsExcludeBlocklist", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_EXCLUDECUSTOM_CHK, _r_config_getboolean (L"IsExcludeCustomRules", TRUE) ? BST_CHECKED : BST_UNCHECKED); PostMessage (hwnd, WM_COMMAND, MAKEWPARAM (IDC_ENABLENOTIFICATIONS_CHK, 0), 0); @@ -758,25 +758,25 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDD_SETTINGS_LOGGING: { - CheckDlgButton (hwnd, IDC_ENABLELOG_CHK, app.ConfigGetBoolean (L"IsLogEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_ENABLELOG_CHK, _r_config_getboolean (L"IsLogEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); - _r_ctrl_settext (hwnd, IDC_LOGPATH, app.ConfigGetString (L"LogPath", LOG_PATH_DEFAULT)); - _r_ctrl_settext (hwnd, IDC_LOGVIEWER, app.ConfigGetString (L"LogViewer", LOG_VIEWER_DEFAULT)); + _r_ctrl_settext (hwnd, IDC_LOGPATH, _r_config_getstring (L"LogPath", LOG_PATH_DEFAULT)); + _r_ctrl_settext (hwnd, IDC_LOGVIEWER, _r_config_getstring (L"LogViewer", LOG_VIEWER_DEFAULT)); UDACCEL ud = {0}; ud.nInc = 64; // set step to 64kb SendDlgItemMessage (hwnd, IDC_LOGSIZELIMIT, UDM_SETACCEL, 1, (LPARAM)&ud); SendDlgItemMessage (hwnd, IDC_LOGSIZELIMIT, UDM_SETRANGE32, 64, _r_calc_kilobytes2bytes (LPARAM, 512)); - SendDlgItemMessage (hwnd, IDC_LOGSIZELIMIT, UDM_SETPOS32, 0, (LPARAM)app.ConfigGetUlong (L"LogSizeLimitKb", LOG_SIZE_LIMIT_DEFAULT)); + SendDlgItemMessage (hwnd, IDC_LOGSIZELIMIT, UDM_SETPOS32, 0, (LPARAM)_r_config_getulong (L"LogSizeLimitKb", LOG_SIZE_LIMIT_DEFAULT)); - CheckDlgButton (hwnd, IDC_ENABLEUILOG_CHK, app.ConfigGetBoolean (L"IsLogUiEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_ENABLEUILOG_CHK, _r_config_getboolean (L"IsLogUiEnabled", FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_EXCLUDESTEALTH_CHK, app.ConfigGetBoolean (L"IsExcludeStealth", TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, app.ConfigGetBoolean (L"IsExcludeClassifyAllow", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_EXCLUDESTEALTH_CHK, _r_config_getboolean (L"IsExcludeStealth", TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, _r_config_getboolean (L"IsExcludeClassifyAllow", TRUE) ? BST_CHECKED : BST_UNCHECKED); // win8+ - if (!_r_sys_validversion (6, 2)) + if (!_r_sys_isosversiongreaterorequal (WINDOWS_8)) _r_ctrl_enable (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, FALSE); PostMessage (hwnd, WM_COMMAND, MAKEWPARAM (IDC_ENABLELOG_CHK, 0), 0); @@ -795,63 +795,63 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam INT dialog_id = (INT)wparam; // localize titles - _r_ctrl_settextformat (hwnd, IDC_TITLE_GENERAL, L"%s:", app.LocaleString (IDS_TITLE_GENERAL)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_LANGUAGE, L"%s: (Language)", app.LocaleString (IDS_TITLE_LANGUAGE)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_BLOCKLIST_SPY, L"%s:", app.LocaleString (IDS_BLOCKLIST_SPY)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_BLOCKLIST_UPDATE, L"%s:", app.LocaleString (IDS_BLOCKLIST_UPDATE)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_BLOCKLIST_EXTRA, L"%s: (Skype, Bing, Live, Outlook, etc.)", app.LocaleString (IDS_BLOCKLIST_EXTRA)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_CONNECTIONS, L"%s:", app.LocaleString (IDS_TAB_NETWORK)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_SECURITY, L"%s:", app.LocaleString (IDS_TITLE_SECURITY)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_CONFIRMATIONS, L"%s:", app.LocaleString (IDS_TITLE_CONFIRMATIONS)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_HIGHLIGHTING, L"%s:", app.LocaleString (IDS_TITLE_HIGHLIGHTING)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_NOTIFICATIONS, L"%s:", app.LocaleString (IDS_TITLE_NOTIFICATIONS)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_LOGGING, L"%s:", app.LocaleString (IDS_TITLE_LOGGING)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_INTERFACE, L"%s:", app.LocaleString (IDS_TITLE_INTERFACE)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_EXCLUDE, L"%s:", app.LocaleString (IDS_TITLE_EXCLUDE)); - _r_ctrl_settextformat (hwnd, IDC_TITLE_ADVANCED, L"%s:", app.LocaleString (IDS_TITLE_ADVANCED)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_GENERAL, L"%s:", _r_locale_getstring (IDS_TITLE_GENERAL)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_LANGUAGE, L"%s: (Language)", _r_locale_getstring (IDS_TITLE_LANGUAGE)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_BLOCKLIST_SPY, L"%s:", _r_locale_getstring (IDS_BLOCKLIST_SPY)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_BLOCKLIST_UPDATE, L"%s:", _r_locale_getstring (IDS_BLOCKLIST_UPDATE)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_BLOCKLIST_EXTRA, L"%s: (Skype, Bing, Live, Outlook, etc.)", _r_locale_getstring (IDS_BLOCKLIST_EXTRA)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_CONNECTIONS, L"%s:", _r_locale_getstring (IDS_TAB_NETWORK)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_SECURITY, L"%s:", _r_locale_getstring (IDS_TITLE_SECURITY)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_CONFIRMATIONS, L"%s:", _r_locale_getstring (IDS_TITLE_CONFIRMATIONS)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_HIGHLIGHTING, L"%s:", _r_locale_getstring (IDS_TITLE_HIGHLIGHTING)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_NOTIFICATIONS, L"%s:", _r_locale_getstring (IDS_TITLE_NOTIFICATIONS)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_LOGGING, L"%s:", _r_locale_getstring (IDS_TITLE_LOGGING)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_INTERFACE, L"%s:", _r_locale_getstring (IDS_TITLE_INTERFACE)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_EXCLUDE, L"%s:", _r_locale_getstring (IDS_TITLE_EXCLUDE)); + _r_ctrl_settextformat (hwnd, IDC_TITLE_ADVANCED, L"%s:", _r_locale_getstring (IDS_TITLE_ADVANCED)); switch (dialog_id) { case IDD_SETTINGS_GENERAL: { - _r_ctrl_settext (hwnd, IDC_ALWAYSONTOP_CHK, app.LocaleString (IDS_ALWAYSONTOP_CHK)); - _r_ctrl_settext (hwnd, IDC_LOADONSTARTUP_CHK, app.LocaleString (IDS_LOADONSTARTUP_CHK)); - _r_ctrl_settext (hwnd, IDC_STARTMINIMIZED_CHK, app.LocaleString (IDS_STARTMINIMIZED_CHK)); - _r_ctrl_settext (hwnd, IDC_SKIPUACWARNING_CHK, app.LocaleString (IDS_SKIPUACWARNING_CHK)); - _r_ctrl_settext (hwnd, IDC_CHECKUPDATES_CHK, app.LocaleString (IDS_CHECKUPDATES_CHK)); - _r_ctrl_settext (hwnd, IDC_CHECKUPDATESBETA_CHK, app.LocaleString (IDS_CHECKUPDATESBETA_CHK)); + _r_ctrl_settext (hwnd, IDC_ALWAYSONTOP_CHK, _r_locale_getstring (IDS_ALWAYSONTOP_CHK)); + _r_ctrl_settext (hwnd, IDC_LOADONSTARTUP_CHK, _r_locale_getstring (IDS_LOADONSTARTUP_CHK)); + _r_ctrl_settext (hwnd, IDC_STARTMINIMIZED_CHK, _r_locale_getstring (IDS_STARTMINIMIZED_CHK)); + _r_ctrl_settext (hwnd, IDC_SKIPUACWARNING_CHK, _r_locale_getstring (IDS_SKIPUACWARNING_CHK)); + _r_ctrl_settext (hwnd, IDC_CHECKUPDATES_CHK, _r_locale_getstring (IDS_CHECKUPDATES_CHK)); + _r_ctrl_settext (hwnd, IDC_CHECKUPDATESBETA_CHK, _r_locale_getstring (IDS_CHECKUPDATESBETA_CHK)); - _r_ctrl_settext (hwnd, IDC_LANGUAGE_HINT, app.LocaleString (IDS_LANGUAGE_HINT)); + _r_ctrl_settext (hwnd, IDC_LANGUAGE_HINT, _r_locale_getstring (IDS_LANGUAGE_HINT)); break; } case IDD_SETTINGS_RULES: { - LPCWSTR recommendedString = app.LocaleString (IDS_RECOMMENDED); + LPCWSTR recommendedString = _r_locale_getstring (IDS_RECOMMENDED); - _r_ctrl_settextformat (hwnd, IDC_RULE_BLOCKOUTBOUND, L"%s (%s)", app.LocaleString (IDS_RULE_BLOCKOUTBOUND), recommendedString); - _r_ctrl_settextformat (hwnd, IDC_RULE_BLOCKINBOUND, L"%s (%s)", app.LocaleString (IDS_RULE_BLOCKINBOUND), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_RULE_BLOCKOUTBOUND, L"%s (%s)", _r_locale_getstring (IDS_RULE_BLOCKOUTBOUND), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_RULE_BLOCKINBOUND, L"%s (%s)", _r_locale_getstring (IDS_RULE_BLOCKINBOUND), recommendedString); - _r_ctrl_settextformat (hwnd, IDC_RULE_ALLOWLOOPBACK, L"%s (%s)", app.LocaleString (IDS_RULE_ALLOWLOOPBACK), recommendedString); - _r_ctrl_settextformat (hwnd, IDC_RULE_ALLOW6TO4, L"%s (%s)", app.LocaleString (IDS_RULE_ALLOW6TO4), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_RULE_ALLOWLOOPBACK, L"%s (%s)", _r_locale_getstring (IDS_RULE_ALLOWLOOPBACK), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_RULE_ALLOW6TO4, L"%s (%s)", _r_locale_getstring (IDS_RULE_ALLOW6TO4), recommendedString); - _r_ctrl_settextformat (hwnd, IDC_SECUREFILTERS_CHK, L"%s (%s)", app.LocaleString (IDS_SECUREFILTERS_CHK), recommendedString); - _r_ctrl_settextformat (hwnd, IDC_USESTEALTHMODE_CHK, L"%s (%s)", app.LocaleString (IDS_USESTEALTHMODE_CHK), recommendedString); - _r_ctrl_settextformat (hwnd, IDC_INSTALLBOOTTIMEFILTERS_CHK, L"%s (%s)", app.LocaleString (IDS_INSTALLBOOTTIMEFILTERS_CHK), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_SECUREFILTERS_CHK, L"%s (%s)", _r_locale_getstring (IDS_SECUREFILTERS_CHK), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_USESTEALTHMODE_CHK, L"%s (%s)", _r_locale_getstring (IDS_USESTEALTHMODE_CHK), recommendedString); + _r_ctrl_settextformat (hwnd, IDC_INSTALLBOOTTIMEFILTERS_CHK, L"%s (%s)", _r_locale_getstring (IDS_INSTALLBOOTTIMEFILTERS_CHK), recommendedString); - _r_ctrl_settext (hwnd, IDC_USENETWORKRESOLUTION_CHK, app.LocaleString (IDS_USENETWORKRESOLUTION_CHK)); - _r_ctrl_settext (hwnd, IDC_USECERTIFICATES_CHK, app.LocaleString (IDS_USECERTIFICATES_CHK)); - _r_ctrl_settextformat (hwnd, IDC_USEREFRESHDEVICES_CHK, L"%s (%s)", app.LocaleString (IDS_USEREFRESHDEVICES_CHK), recommendedString); + _r_ctrl_settext (hwnd, IDC_USENETWORKRESOLUTION_CHK, _r_locale_getstring (IDS_USENETWORKRESOLUTION_CHK)); + _r_ctrl_settext (hwnd, IDC_USECERTIFICATES_CHK, _r_locale_getstring (IDS_USECERTIFICATES_CHK)); + _r_ctrl_settextformat (hwnd, IDC_USEREFRESHDEVICES_CHK, L"%s (%s)", _r_locale_getstring (IDS_USEREFRESHDEVICES_CHK), recommendedString); break; } case IDD_SETTINGS_BLOCKLIST: { - LPCWSTR disableString = app.LocaleString (IDS_DISABLE); - LPCWSTR allowString = app.LocaleString (IDS_ACTION_ALLOW); - LPCWSTR blockString = app.LocaleString (IDS_ACTION_BLOCK); + LPCWSTR disableString = _r_locale_getstring (IDS_DISABLE); + LPCWSTR allowString = _r_locale_getstring (IDS_ACTION_ALLOW); + LPCWSTR blockString = _r_locale_getstring (IDS_ACTION_BLOCK); _r_ctrl_settext (hwnd, IDC_BLOCKLIST_SPY_DISABLE, disableString); _r_ctrl_settext (hwnd, IDC_BLOCKLIST_SPY_ALLOW, allowString); @@ -872,9 +872,9 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDD_SETTINGS_INTERFACE: { - _r_ctrl_settext (hwnd, IDC_CONFIRMEXIT_CHK, app.LocaleString (IDS_CONFIRMEXIT_CHK)); - _r_ctrl_settext (hwnd, IDC_CONFIRMEXITTIMER_CHK, app.LocaleString (IDS_CONFIRMEXITTIMER_CHK)); - _r_ctrl_settext (hwnd, IDC_CONFIRMLOGCLEAR_CHK, app.LocaleString (IDS_CONFIRMLOGCLEAR_CHK)); + _r_ctrl_settext (hwnd, IDC_CONFIRMEXIT_CHK, _r_locale_getstring (IDS_CONFIRMEXIT_CHK)); + _r_ctrl_settext (hwnd, IDC_CONFIRMEXITTIMER_CHK, _r_locale_getstring (IDS_CONFIRMEXITTIMER_CHK)); + _r_ctrl_settext (hwnd, IDC_CONFIRMLOGCLEAR_CHK, _r_locale_getstring (IDS_CONFIRMLOGCLEAR_CHK)); break; } @@ -890,44 +890,46 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam if (ptr_clr) { _r_fastlock_acquireshared (&lock_checkbox); - _r_listview_setitem (hwnd, IDC_COLORS, i, 0, app.LocaleString (ptr_clr->locale_id)); + _r_listview_setitem (hwnd, IDC_COLORS, i, 0, _r_locale_getstring (ptr_clr->locale_id)); _r_fastlock_releaseshared (&lock_checkbox); } } - _r_ctrl_settext (hwnd, IDC_COLORS_HINT, app.LocaleString (IDS_COLORS_HINT)); + _r_ctrl_settext (hwnd, IDC_COLORS_HINT, _r_locale_getstring (IDS_COLORS_HINT)); break; } case IDD_SETTINGS_NOTIFICATIONS: { - _r_ctrl_settext (hwnd, IDC_ENABLENOTIFICATIONS_CHK, app.LocaleString (IDS_ENABLENOTIFICATIONS_CHK)); - _r_ctrl_settext (hwnd, IDC_NOTIFICATIONSOUND_CHK, app.LocaleString (IDS_NOTIFICATIONSOUND_CHK)); - _r_ctrl_settext (hwnd, IDC_NOTIFICATIONONTRAY_CHK, app.LocaleString (IDS_NOTIFICATIONONTRAY_CHK)); + _r_ctrl_settext (hwnd, IDC_ENABLENOTIFICATIONS_CHK, _r_locale_getstring (IDS_ENABLENOTIFICATIONS_CHK)); + _r_ctrl_settext (hwnd, IDC_NOTIFICATIONSOUND_CHK, _r_locale_getstring (IDS_NOTIFICATIONSOUND_CHK)); + _r_ctrl_settext (hwnd, IDC_NOTIFICATIONONTRAY_CHK, _r_locale_getstring (IDS_NOTIFICATIONONTRAY_CHK)); - _r_ctrl_settext (hwnd, IDC_NOTIFICATIONTIMEOUT_HINT, app.LocaleString (IDS_NOTIFICATIONTIMEOUT_HINT)); + _r_ctrl_settext (hwnd, IDC_NOTIFICATIONTIMEOUT_HINT, _r_locale_getstring (IDS_NOTIFICATIONTIMEOUT_HINT)); - _r_ctrl_settextformat (hwnd, IDC_EXCLUDEBLOCKLIST_CHK, L"%s %s", app.LocaleString (IDS_TITLE_EXCLUDE), app.LocaleString (IDS_EXCLUDEBLOCKLIST_CHK)); - _r_ctrl_settextformat (hwnd, IDC_EXCLUDECUSTOM_CHK, L"%s %s", app.LocaleString (IDS_TITLE_EXCLUDE), app.LocaleString (IDS_EXCLUDECUSTOM_CHK)); + _r_ctrl_settextformat (hwnd, IDC_EXCLUDEBLOCKLIST_CHK, L"%s %s", _r_locale_getstring (IDS_TITLE_EXCLUDE), _r_locale_getstring (IDS_EXCLUDEBLOCKLIST_CHK)); + _r_ctrl_settextformat (hwnd, IDC_EXCLUDECUSTOM_CHK, L"%s %s", _r_locale_getstring (IDS_TITLE_EXCLUDE), _r_locale_getstring (IDS_EXCLUDECUSTOM_CHK)); break; } case IDD_SETTINGS_LOGGING: { - _r_ctrl_settext (hwnd, IDC_ENABLELOG_CHK, app.LocaleString (IDS_ENABLELOG_CHK)); + _r_ctrl_settext (hwnd, IDC_ENABLELOG_CHK, _r_locale_getstring (IDS_ENABLELOG_CHK)); - _r_ctrl_settextformat (hwnd, IDC_LOGVIEWER_HINT, L"%s:", app.LocaleString (IDS_LOGVIEWER_HINT)); - _r_ctrl_settext (hwnd, IDC_LOGSIZELIMIT_HINT, app.LocaleString (IDS_LOGSIZELIMIT_HINT)); + _r_ctrl_settextformat (hwnd, IDC_LOGVIEWER_HINT, L"%s:", _r_locale_getstring (IDS_LOGVIEWER_HINT)); + _r_ctrl_settext (hwnd, IDC_LOGSIZELIMIT_HINT, _r_locale_getstring (IDS_LOGSIZELIMIT_HINT)); - _r_ctrl_settextformat (hwnd, IDC_ENABLEUILOG_CHK, L"%s (session only)", app.LocaleString (IDS_ENABLEUILOG_CHK)); + _r_ctrl_settextformat (hwnd, IDC_ENABLEUILOG_CHK, L"%s (session only)", _r_locale_getstring (IDS_ENABLEUILOG_CHK)); - _r_ctrl_settextformat (hwnd, IDC_EXCLUDESTEALTH_CHK, L"%s %s", app.LocaleString (IDS_TITLE_EXCLUDE), app.LocaleString (IDS_EXCLUDESTEALTH_CHK)); - _r_ctrl_settextformat (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, L"%s %s [win8+]", app.LocaleString (IDS_TITLE_EXCLUDE), app.LocaleString (IDS_EXCLUDECLASSIFYALLOW_CHK)); + _r_ctrl_settextformat (hwnd, IDC_EXCLUDESTEALTH_CHK, L"%s %s", _r_locale_getstring (IDS_TITLE_EXCLUDE), _r_locale_getstring (IDS_EXCLUDESTEALTH_CHK)); + _r_ctrl_settextformat (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, L"%s %s [win8+]", _r_locale_getstring (IDS_TITLE_EXCLUDE), _r_locale_getstring (IDS_EXCLUDECLASSIFYALLOW_CHK)); - _r_wnd_addstyle (hwnd, IDC_LOGPATH_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_LOGVIEWER_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + BOOLEAN is_classic = _r_app_isclassicui (); + + _r_wnd_addstyle (hwnd, IDC_LOGPATH_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_LOGVIEWER_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); break; } @@ -942,10 +944,10 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam INT ctrl_id = GetDlgCtrlID ((HWND)lparam); if (ctrl_id == IDC_LOGSIZELIMIT) - app.ConfigSetUlong (L"LogSizeLimitKb", (DWORD)SendDlgItemMessage (hwnd, ctrl_id, UDM_GETPOS32, 0, 0)); + _r_config_setulong (L"LogSizeLimitKb", (DWORD)SendDlgItemMessage (hwnd, ctrl_id, UDM_GETPOS32, 0, 0)); else if (ctrl_id == IDC_NOTIFICATIONTIMEOUT) - app.ConfigSetUlong (L"NotificationsTimeout", (DWORD)SendDlgItemMessage (hwnd, ctrl_id, UDM_GETPOS32, 0, 0)); + _r_config_setulong (L"NotificationsTimeout", (DWORD)SendDlgItemMessage (hwnd, ctrl_id, UDM_GETPOS32, 0, 0)); break; } @@ -966,22 +968,22 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam INT ctrl_id = GetDlgCtrlID ((HWND)(lpnmdi->hdr.idFrom)); if (ctrl_id == IDC_RULE_BLOCKOUTBOUND) - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_RULE_BLOCKOUTBOUND)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_RULE_BLOCKOUTBOUND)); else if (ctrl_id == IDC_RULE_BLOCKINBOUND) - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_RULE_BLOCKINBOUND)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_RULE_BLOCKINBOUND)); else if (ctrl_id == IDC_RULE_ALLOWLOOPBACK) - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_RULE_ALLOWLOOPBACK_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_RULE_ALLOWLOOPBACK_HINT)); else if (ctrl_id == IDC_USESTEALTHMODE_CHK) - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_USESTEALTHMODE_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_USESTEALTHMODE_HINT)); else if (ctrl_id == IDC_INSTALLBOOTTIMEFILTERS_CHK) - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_INSTALLBOOTTIMEFILTERS_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_INSTALLBOOTTIMEFILTERS_HINT)); else if (ctrl_id == IDC_SECUREFILTERS_CHK) - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_SECUREFILTERS_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_SECUREFILTERS_HINT)); if (!_r_str_isempty (buffer)) lpnmdi->lpszText = buffer; @@ -1011,9 +1013,9 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam if (ptr_clr) { - app.ConfigSetBoolean (_r_obj_getstring (ptr_clr->configName), is_enabled, L"colors"); + _r_config_setboolean (_r_obj_getstring (ptr_clr->configName), is_enabled, L"colors"); - _r_listview_redraw (app.GetHWND (), (INT)_r_tab_getlparam (app.GetHWND (), IDC_TAB, INVALID_INT), INVALID_INT); + _r_listview_redraw (_r_app_gethwnd (), (INT)_r_tab_getlparam (_r_app_gethwnd (), IDC_TAB, INVALID_INT), INVALID_INT); } } } @@ -1066,10 +1068,10 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam if (ChooseColor (&cc)) { ptr_clr_current->new_clr = cc.rgbResult; - app.ConfigSetUlong (_r_obj_getstring (ptr_clr_current->configValue), cc.rgbResult, L"colors"); + _r_config_setulong (_r_obj_getstring (ptr_clr_current->configValue), cc.rgbResult, L"colors"); _r_listview_redraw (hwnd, IDC_COLORS, INVALID_INT); - _r_listview_redraw (app.GetHWND (), (INT)_r_tab_getlparam (app.GetHWND (), IDC_TAB, INVALID_INT), INVALID_INT); + _r_listview_redraw (_r_app_gethwnd (), (INT)_r_tab_getlparam (_r_app_gethwnd (), IDC_TAB, INVALID_INT), INVALID_INT); } } } @@ -1093,7 +1095,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam NMLVEMPTYMARKUP* lpnmlv = (NMLVEMPTYMARKUP*)lparam; lpnmlv->dwFlags = EMF_CENTERED; - _r_str_copy (lpnmlv->szMarkup, RTL_NUMBER_OF (lpnmlv->szMarkup), app.LocaleString (IDS_STATUS_EMPTY)); + _r_str_copy (lpnmlv->szMarkup, RTL_NUMBER_OF (lpnmlv->szMarkup), _r_locale_getstring (IDS_STATUS_EMPTY)); SetWindowLongPtr (hwnd, DWLP_MSGRESULT, TRUE); return TRUE; @@ -1114,8 +1116,8 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { BOOLEAN is_enabled = (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED); - app.ConfigSetBoolean (L"AlwaysOnTop", is_enabled); - _r_menu_checkitem (GetMenu (app.GetHWND ()), IDM_ALWAYSONTOP_CHK, 0, MF_BYCOMMAND, is_enabled); + _r_config_setboolean (L"AlwaysOnTop", is_enabled); + _r_menu_checkitem (GetMenu (_r_app_gethwnd ()), IDM_ALWAYSONTOP_CHK, 0, MF_BYCOMMAND, is_enabled); break; } @@ -1123,8 +1125,8 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam #if defined(_APP_HAVE_AUTORUN) case IDC_LOADONSTARTUP_CHK: { - app.AutorunEnable (hwnd, (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); - CheckDlgButton (hwnd, ctrl_id, app.AutorunIsEnabled () ? BST_CHECKED : BST_UNCHECKED); + _r_autorun_enable (hwnd, (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + CheckDlgButton (hwnd, ctrl_id, _r_autorun_isenabled () ? BST_CHECKED : BST_UNCHECKED); break; } @@ -1132,15 +1134,15 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_STARTMINIMIZED_CHK: { - app.ConfigSetBoolean (L"IsStartMinimized", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsStartMinimized", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } #if defined(_APP_HAVE_SKIPUAC) case IDC_SKIPUACWARNING_CHK: { - app.SkipUacEnable (hwnd, (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); - CheckDlgButton (hwnd, ctrl_id, app.SkipUacIsEnabled () ? BST_CHECKED : BST_UNCHECKED); + _r_skipuac_enable (hwnd, (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + CheckDlgButton (hwnd, ctrl_id, _r_skipuac_isenabled () ? BST_CHECKED : BST_UNCHECKED); break; } @@ -1150,7 +1152,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { BOOLEAN is_enabled = (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED); - app.ConfigSetBoolean (L"CheckUpdates", is_enabled); + _r_config_setboolean (L"CheckUpdates", is_enabled); #if !defined(_DEBUG) && !defined(_APP_BETA) _r_ctrl_enable (hwnd, IDC_CHECKUPDATESBETA_CHK, is_enabled); @@ -1162,7 +1164,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam #if !defined(_DEBUG) && !defined(_APP_BETA) case IDC_CHECKUPDATESBETA_CHK: { - app.ConfigSetBoolean (L"CheckUpdatesBeta", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"CheckUpdatesBeta", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } #endif // !_DEBUG && !_APP_BETA @@ -1170,26 +1172,26 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_LANGUAGE: { if (notify_code == CBN_SELCHANGE) - app.LocaleApplyFromControl (hwnd, ctrl_id); + _r_locale_applyfromcontrol (hwnd, ctrl_id); break; } case IDC_CONFIRMEXIT_CHK: { - app.ConfigSetBoolean (L"ConfirmExit2", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"ConfirmExit2", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } case IDC_CONFIRMEXITTIMER_CHK: { - app.ConfigSetBoolean (L"ConfirmExitTimer", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"ConfirmExitTimer", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } case IDC_CONFIRMLOGCLEAR_CHK: { - app.ConfigSetBoolean (L"ConfirmLogClear", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"ConfirmLogClear", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } @@ -1204,7 +1206,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_USENETWORKRESOLUTION_CHK: case IDC_USEREFRESHDEVICES_CHK: { - _app_config_apply (app.GetHWND (), ctrl_id); + _app_config_apply (_r_app_gethwnd (), ctrl_id); break; } @@ -1218,7 +1220,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_BLOCKLIST_EXTRA_ALLOW: case IDC_BLOCKLIST_EXTRA_BLOCK: { - HMENU hmenu = GetMenu (app.GetHWND ()); + HMENU hmenu = GetMenu (_r_app_gethwnd ()); if (ctrl_id >= IDC_BLOCKLIST_SPY_DISABLE && ctrl_id <= IDC_BLOCKLIST_SPY_BLOCK) { @@ -1226,9 +1228,9 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam _r_menu_checkitem (hmenu, IDM_BLOCKLIST_SPY_DISABLE, IDM_BLOCKLIST_SPY_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_SPY_DISABLE + new_state); - app.ConfigSetInteger (L"BlocklistSpyState", new_state); + _r_config_setinteger (L"BlocklistSpyState", new_state); - _app_ruleblocklistset (app.GetHWND (), new_state, INVALID_INT, INVALID_INT, TRUE); + _app_ruleblocklistset (_r_app_gethwnd (), new_state, INVALID_INT, INVALID_INT, TRUE); } else if (ctrl_id >= IDC_BLOCKLIST_UPDATE_DISABLE && ctrl_id <= IDC_BLOCKLIST_UPDATE_BLOCK) { @@ -1236,9 +1238,9 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam _r_menu_checkitem (hmenu, IDM_BLOCKLIST_UPDATE_DISABLE, IDM_BLOCKLIST_UPDATE_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_UPDATE_DISABLE + new_state); - app.ConfigSetInteger (L"BlocklistUpdateState", new_state); + _r_config_setinteger (L"BlocklistUpdateState", new_state); - _app_ruleblocklistset (app.GetHWND (), INVALID_INT, new_state, INVALID_INT, TRUE); + _app_ruleblocklistset (_r_app_gethwnd (), INVALID_INT, new_state, INVALID_INT, TRUE); } else if (ctrl_id >= IDC_BLOCKLIST_EXTRA_DISABLE && ctrl_id <= IDC_BLOCKLIST_EXTRA_BLOCK) { @@ -1246,9 +1248,9 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam _r_menu_checkitem (hmenu, IDM_BLOCKLIST_EXTRA_DISABLE, IDM_BLOCKLIST_EXTRA_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_EXTRA_DISABLE + new_state); - app.ConfigSetInteger (L"BlocklistExtraState", new_state); + _r_config_setinteger (L"BlocklistExtraState", new_state); - _app_ruleblocklistset (app.GetHWND (), INVALID_INT, INVALID_INT, new_state, TRUE); + _app_ruleblocklistset (_r_app_gethwnd (), INVALID_INT, INVALID_INT, new_state, TRUE); } break; @@ -1259,7 +1261,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam BOOLEAN is_checked = (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED); BOOLEAN is_enabled = is_checked || (IsDlgButtonChecked (hwnd, IDC_ENABLEUILOG_CHK) == BST_CHECKED); - app.ConfigSetBoolean (L"IsLogEnabled", is_checked); + _r_config_setboolean (L"IsLogEnabled", is_checked); SendDlgItemMessage (config.hrebar, IDC_TOOLBAR, TB_PRESSBUTTON, IDM_TRAY_ENABLELOG_CHK, MAKELPARAM (is_checked, 0)); _r_ctrl_enable (hwnd, IDC_LOGPATH, is_checked); // input @@ -1273,7 +1275,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam _r_ctrl_enable (hwnd, IDC_EXCLUDESTEALTH_CHK, is_enabled); // win8+ - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) _r_ctrl_enable (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, is_enabled); _app_loginit (is_enabled); @@ -1286,13 +1288,13 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam BOOLEAN is_checked = (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED); BOOLEAN is_enabled = is_checked || (IsDlgButtonChecked (hwnd, IDC_ENABLELOG_CHK) == BST_CHECKED); - app.ConfigSetBoolean (L"IsLogUiEnabled", is_checked); + _r_config_setboolean (L"IsLogUiEnabled", is_checked); SendDlgItemMessage (config.hrebar, IDC_TOOLBAR, TB_PRESSBUTTON, IDM_TRAY_ENABLEUILOG_CHK, MAKELPARAM (is_checked, 0)); _r_ctrl_enable (hwnd, IDC_EXCLUDESTEALTH_CHK, is_enabled); // win8+ - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) _r_ctrl_enable (hwnd, IDC_EXCLUDECLASSIFYALLOW_CHK, is_enabled); break; @@ -1308,9 +1310,9 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { _r_obj_movereference (&logpath, _r_path_unexpand (_r_obj_getstring (logpath))); - app.ConfigSetString (L"LogPath", _r_obj_getstring (logpath)); + _r_config_setstring (L"LogPath", _r_obj_getstring (logpath)); - _app_loginit (app.ConfigGetBoolean (L"IsLogEnabled", FALSE)); + _app_loginit (_r_config_getboolean (L"IsLogEnabled", FALSE)); _r_obj_dereference (logpath); } @@ -1344,10 +1346,10 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { _r_obj_movereference (&expandedPath, _r_path_unexpand (path)); - app.ConfigSetString (L"LogPath", _r_obj_getstring (expandedPath)); + _r_config_setstring (L"LogPath", _r_obj_getstring (expandedPath)); _r_ctrl_settext (hwnd, IDC_LOGPATH, _r_obj_getstringorempty (expandedPath)); - _app_loginit (app.ConfigGetBoolean (L"IsLogEnabled", FALSE)); + _app_loginit (_r_config_getboolean (L"IsLogEnabled", FALSE)); } if (expandedPath) @@ -1366,7 +1368,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { _r_obj_movereference (&logviewer, _r_path_unexpand (_r_obj_getstring (logviewer))); - app.ConfigSetString (L"LogViewer", _r_obj_getstring (logviewer)); + _r_config_setstring (L"LogViewer", _r_obj_getstring (logviewer)); _r_obj_dereference (logviewer); } @@ -1400,7 +1402,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { _r_obj_movereference (&expandedPath, _r_path_unexpand (path)); - app.ConfigSetString (L"LogViewer", _r_obj_getstringorempty (expandedPath)); + _r_config_setstring (L"LogViewer", _r_obj_getstringorempty (expandedPath)); _r_ctrl_settext (hwnd, IDC_LOGVIEWER, _r_obj_getstringorempty (expandedPath)); } @@ -1413,7 +1415,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_LOGSIZELIMIT_CTRL: { if (notify_code == EN_KILLFOCUS) - app.ConfigSetUlong (L"LogSizeLimitKb", (DWORD)SendDlgItemMessage (hwnd, IDC_LOGSIZELIMIT, UDM_GETPOS32, 0, 0)); + _r_config_setulong (L"LogSizeLimitKb", (DWORD)SendDlgItemMessage (hwnd, IDC_LOGSIZELIMIT, UDM_GETPOS32, 0, 0)); break; } @@ -1422,7 +1424,7 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam { BOOLEAN is_enabled = (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED); - app.ConfigSetBoolean (L"IsNotificationsEnabled", is_enabled); + _r_config_setboolean (L"IsNotificationsEnabled", is_enabled); SendDlgItemMessage (config.hrebar, IDC_TOOLBAR, TB_PRESSBUTTON, IDM_TRAY_ENABLENOTIFICATIONS_CHK, MAKELPARAM (is_enabled, 0)); _r_ctrl_enable (hwnd, IDC_NOTIFICATIONSOUND_CHK, is_enabled); @@ -1443,13 +1445,13 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_NOTIFICATIONSOUND_CHK: { - app.ConfigSetBoolean (L"IsNotificationsSound", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsNotificationsSound", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } case IDC_NOTIFICATIONONTRAY_CHK: { - app.ConfigSetBoolean (L"IsNotificationsOnTray", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsNotificationsOnTray", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); if (IsWindowVisible (config.hnotification)) _app_notifysetpos (config.hnotification, TRUE); @@ -1460,32 +1462,32 @@ INT_PTR CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam case IDC_NOTIFICATIONTIMEOUT_CTRL: { if (notify_code == EN_KILLFOCUS) - app.ConfigSetUlong (L"NotificationsTimeout", (DWORD)SendDlgItemMessage (hwnd, IDC_NOTIFICATIONTIMEOUT, UDM_GETPOS32, 0, 0)); + _r_config_setulong (L"NotificationsTimeout", (DWORD)SendDlgItemMessage (hwnd, IDC_NOTIFICATIONTIMEOUT, UDM_GETPOS32, 0, 0)); break; } case IDC_EXCLUDESTEALTH_CHK: { - app.ConfigSetBoolean (L"IsExcludeStealth", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsExcludeStealth", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } case IDC_EXCLUDECLASSIFYALLOW_CHK: { - app.ConfigSetBoolean (L"IsExcludeClassifyAllow", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsExcludeClassifyAllow", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } case IDC_EXCLUDEBLOCKLIST_CHK: { - app.ConfigSetBoolean (L"IsExcludeBlocklist", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsExcludeBlocklist", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } case IDC_EXCLUDECUSTOM_CHK: { - app.ConfigSetBoolean (L"IsExcludeCustomRules", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); + _r_config_setboolean (L"IsExcludeCustomRules", (IsDlgButtonChecked (hwnd, ctrl_id) == BST_CHECKED)); break; } } @@ -1529,7 +1531,7 @@ VOID _app_imagelist_init (HWND hwnd) { INT icon_size_small = _r_dc_getsystemmetrics (hwnd, SM_CXSMICON); INT icon_size_large = _r_dc_getsystemmetrics (hwnd, SM_CXICON); - INT icon_size_toolbar = _r_calc_clamp (INT, _r_dc_getdpi (hwnd, app.ConfigGetInteger (L"ToolbarSize", _R_SIZE_ITEMHEIGHT)), icon_size_small, icon_size_large); + INT icon_size_toolbar = _r_calc_clamp (INT, _r_dc_getdpi (hwnd, _r_config_getinteger (L"ToolbarSize", _R_SIZE_ITEMHEIGHT)), icon_size_small, icon_size_large); SAFE_DELETE_OBJECT (config.hbmp_enable); SAFE_DELETE_OBJECT (config.hbmp_disable); @@ -1550,7 +1552,7 @@ VOID _app_imagelist_init (HWND hwnd) _app_getfileicon (_r_obj_getstring (config.shell32_path), FALSE, &config.icon_service_id, NULL); // get default icon for windows store package (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) { if (!_app_getfileicon (_r_obj_getstring (config.winstore_path), TRUE, &config.icon_uwp_id, &config.hicon_uwp)) { @@ -1559,16 +1561,16 @@ VOID _app_imagelist_init (HWND hwnd) } } - config.hbmp_enable = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_SHIELD_ENABLE), icon_size_small); - config.hbmp_disable = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_SHIELD_DISABLE), icon_size_small); + config.hbmp_enable = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_SHIELD_ENABLE), icon_size_small); + config.hbmp_disable = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_SHIELD_DISABLE), icon_size_small); - config.hbmp_allow = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_ALLOW), icon_size_small); - config.hbmp_block = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_BLOCK), icon_size_small); - config.hbmp_cross = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_CROSS), icon_size_small); - config.hbmp_rules = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_SETTINGS), icon_size_small); + config.hbmp_allow = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_ALLOW), icon_size_small); + config.hbmp_block = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_BLOCK), icon_size_small); + config.hbmp_cross = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_CROSS), icon_size_small); + config.hbmp_rules = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_SETTINGS), icon_size_small); - config.hbmp_checked = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_CHECKED), icon_size_small); - config.hbmp_unchecked = _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_UNCHECKED), icon_size_small); + config.hbmp_checked = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_CHECKED), icon_size_small); + config.hbmp_unchecked = _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_UNCHECKED), icon_size_small); // toolbar imagelist if (config.himg_toolbar) @@ -1578,17 +1580,17 @@ VOID _app_imagelist_init (HWND hwnd) if (config.himg_toolbar) { - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_SHIELD_ENABLE), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_SHIELD_DISABLE), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_REFRESH), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_SETTINGS), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_NOTIFICATIONS), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_LOG), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_LOGOPEN), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_LOGCLEAR), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_ADD), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_DONATE), icon_size_toolbar), NULL); - ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_LOGUI), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_SHIELD_ENABLE), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_SHIELD_DISABLE), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_REFRESH), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_SETTINGS), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_NOTIFICATIONS), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_LOG), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_LOGOPEN), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_LOGCLEAR), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_ADD), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_DONATE), icon_size_toolbar), NULL); + ImageList_Add (config.himg_toolbar, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_LOGUI), icon_size_toolbar), NULL); } // rules imagelist (small) @@ -1603,8 +1605,8 @@ VOID _app_imagelist_init (HWND hwnd) if (config.himg_rules_small) { - ImageList_Add (config.himg_rules_small, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_ALLOW), icon_size_small), NULL); - ImageList_Add (config.himg_rules_small, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_BLOCK), icon_size_small), NULL); + ImageList_Add (config.himg_rules_small, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_ALLOW), icon_size_small), NULL); + ImageList_Add (config.himg_rules_small, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_BLOCK), icon_size_small), NULL); } // rules imagelist (large) @@ -1619,8 +1621,8 @@ VOID _app_imagelist_init (HWND hwnd) if (config.himg_rules_large) { - ImageList_Add (config.himg_rules_large, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_ALLOW), icon_size_large), NULL); - ImageList_Add (config.himg_rules_large, _app_bitmapfrompng (app.GetHINSTANCE (), MAKEINTRESOURCE (IDP_BLOCK), icon_size_large), NULL); + ImageList_Add (config.himg_rules_large, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_ALLOW), icon_size_large), NULL); + ImageList_Add (config.himg_rules_large, _app_bitmapfrompng (NULL, MAKEINTRESOURCE (IDP_BLOCK), icon_size_large), NULL); } } @@ -1695,41 +1697,41 @@ VOID _app_tabs_init (HWND hwnd) SetWindowPos (GetDlgItem (hwnd, IDC_TAB), NULL, 0, 0, _r_calc_rectwidth (INT, &rc), _r_calc_rectheight (INT, &rc), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER); PR_STRING localizedString = NULL; - HINSTANCE hinst = app.GetHINSTANCE (); + HINSTANCE hinst = _r_app_gethinstance (); DWORD listview_ex_style = LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP | LVS_EX_LABELTIP | LVS_EX_CHECKBOXES | LVS_EX_HEADERINALLVIEWS; DWORD listview_style = WS_CHILD | WS_TABSTOP | LVS_SHOWSELALWAYS | LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE; INT tabs_count = 0; CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_APPS_PROFILE, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TAB_APPS), I_IMAGENONE, IDC_APPS_PROFILE); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TAB_APPS), I_IMAGENONE, IDC_APPS_PROFILE); CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_APPS_SERVICE, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TAB_SERVICES), I_IMAGENONE, IDC_APPS_SERVICE); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TAB_SERVICES), I_IMAGENONE, IDC_APPS_SERVICE); // uwp apps (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) { CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_APPS_UWP, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TAB_PACKAGES), I_IMAGENONE, IDC_APPS_UWP); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TAB_PACKAGES), I_IMAGENONE, IDC_APPS_UWP); } - if (!app.ConfigGetBoolean (L"IsInternalRulesDisabled", FALSE)) + if (!_r_config_getboolean (L"IsInternalRulesDisabled", FALSE)) { CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_RULES_BLOCKLIST, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TRAY_BLOCKLIST_RULES), I_IMAGENONE, IDC_RULES_BLOCKLIST); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TRAY_BLOCKLIST_RULES), I_IMAGENONE, IDC_RULES_BLOCKLIST); CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_RULES_SYSTEM, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TRAY_SYSTEM_RULES), I_IMAGENONE, IDC_RULES_SYSTEM); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TRAY_SYSTEM_RULES), I_IMAGENONE, IDC_RULES_SYSTEM); } CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_RULES_CUSTOM, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TRAY_USER_RULES), I_IMAGENONE, IDC_RULES_CUSTOM); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TRAY_USER_RULES), I_IMAGENONE, IDC_RULES_CUSTOM); CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_NETWORK, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TAB_NETWORK), I_IMAGENONE, IDC_NETWORK); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TAB_NETWORK), I_IMAGENONE, IDC_NETWORK); CreateWindowEx (0, WC_LISTVIEW, NULL, listview_style | LVS_NOSORTHEADER, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_LOG, hinst, NULL); - _r_tab_additem (hwnd, IDC_TAB, tabs_count++, app.LocaleString (IDS_TITLE_LOGGING), I_IMAGENONE, IDC_LOG); + _r_tab_additem (hwnd, IDC_TAB, tabs_count++, _r_locale_getstring (IDS_TITLE_LOGGING), I_IMAGENONE, IDC_LOG); for (INT i = 0; i < tabs_count; i++) { @@ -1751,14 +1753,14 @@ VOID _app_tabs_init (HWND hwnd) if (listview_id >= IDC_APPS_PROFILE && listview_id <= IDC_APPS_UWP) { - _r_listview_addcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0, LVCFMT_LEFT); - _r_listview_addcolumn (hwnd, listview_id, 1, app.LocaleString (IDS_ADDED), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0, LVCFMT_LEFT); + _r_listview_addcolumn (hwnd, listview_id, 1, _r_locale_getstring (IDS_ADDED), 0, LVCFMT_RIGHT); } else { - _r_listview_addcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0, LVCFMT_LEFT); - _r_listview_addcolumn (hwnd, listview_id, 1, app.LocaleString (IDS_PROTOCOL), 0, LVCFMT_RIGHT); - _r_listview_addcolumn (hwnd, listview_id, 2, app.LocaleString (IDS_DIRECTION), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0, LVCFMT_LEFT); + _r_listview_addcolumn (hwnd, listview_id, 1, _r_locale_getstring (IDS_PROTOCOL), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 2, _r_locale_getstring (IDS_DIRECTION), 0, LVCFMT_RIGHT); } _r_listview_addgroup (hwnd, listview_id, 0, L"", 0, LVGS_COLLAPSIBLE, LVGS_COLLAPSIBLE); @@ -1769,31 +1771,31 @@ VOID _app_tabs_init (HWND hwnd) { _r_listview_setstyle (hwnd, listview_id, listview_ex_style & ~LVS_EX_CHECKBOXES, FALSE); // no checkboxes - _r_listview_addcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0, LVCFMT_LEFT); + _r_listview_addcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0, LVCFMT_LEFT); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", _r_locale_getstring (IDS_ADDRESS))); _r_listview_addcolumn (hwnd, listview_id, 1, _r_obj_getstringorempty (localizedString), 0, LVCFMT_LEFT); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", _r_locale_getstring (IDS_PORT))); _r_listview_addcolumn (hwnd, listview_id, 2, _r_obj_getstringorempty (localizedString), 0, LVCFMT_RIGHT); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", _r_locale_getstring (IDS_ADDRESS))); _r_listview_addcolumn (hwnd, listview_id, 3, _r_obj_getstringorempty (localizedString), 0, LVCFMT_LEFT); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", _r_locale_getstring (IDS_PORT))); _r_listview_addcolumn (hwnd, listview_id, 4, _r_obj_getstringorempty (localizedString), 0, LVCFMT_RIGHT); - _r_listview_addcolumn (hwnd, listview_id, 5, app.LocaleString (IDS_PROTOCOL), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 5, _r_locale_getstring (IDS_PROTOCOL), 0, LVCFMT_RIGHT); if (listview_id == IDC_NETWORK) { - _r_listview_addcolumn (hwnd, listview_id, 6, app.LocaleString (IDS_STATE), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 6, _r_locale_getstring (IDS_STATE), 0, LVCFMT_RIGHT); } else if (listview_id == IDC_LOG) { - _r_listview_addcolumn (hwnd, listview_id, 6, app.LocaleString (IDS_FILTER), 0, LVCFMT_LEFT); - _r_listview_addcolumn (hwnd, listview_id, 7, app.LocaleString (IDS_DIRECTION), 0, LVCFMT_RIGHT); - _r_listview_addcolumn (hwnd, listview_id, 8, app.LocaleString (IDS_STATE), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 6, _r_locale_getstring (IDS_FILTER), 0, LVCFMT_LEFT); + _r_listview_addcolumn (hwnd, listview_id, 7, _r_locale_getstring (IDS_DIRECTION), 0, LVCFMT_RIGHT); + _r_listview_addcolumn (hwnd, listview_id, 8, _r_locale_getstring (IDS_STATE), 0, LVCFMT_RIGHT); } } @@ -1836,16 +1838,16 @@ VOID _app_initialize () // static initializer config.wd_length = GetWindowsDirectory (config.windows_dir, RTL_NUMBER_OF (config.windows_dir)); - _r_str_printf (config.profile_path, RTL_NUMBER_OF (config.profile_path), L"%s\\" XML_PROFILE, app.GetAppProfileDirectory ()); - _r_str_printf (config.profile_path_backup, RTL_NUMBER_OF (config.profile_path_backup), L"%s\\" XML_PROFILE L".bak", app.GetAppProfileDirectory ()); - _r_str_printf (config.profile_internal_path, RTL_NUMBER_OF (config.profile_internal_path), L"%s\\" XML_PROFILE_INTERNAL, app.GetAppProfileDirectory ()); + _r_str_printf (config.profile_path, RTL_NUMBER_OF (config.profile_path), L"%s\\" XML_PROFILE, _r_app_getprofiledirectory ()); + _r_str_printf (config.profile_path_backup, RTL_NUMBER_OF (config.profile_path_backup), L"%s\\" XML_PROFILE L".bak", _r_app_getprofiledirectory ()); + _r_str_printf (config.profile_internal_path, RTL_NUMBER_OF (config.profile_internal_path), L"%s\\" XML_PROFILE_INTERNAL, _r_app_getprofiledirectory ()); config.svchost_path = _r_path_expand (PATH_SVCHOST); config.ntoskrnl_path = _r_path_expand (PATH_NTOSKRNL); config.shell32_path = _r_path_expand (PATH_SHELL32); config.winstore_path = _r_path_expand (PATH_WINSTORE); - config.my_hash = _r_str_hash (app.GetAppBinaryPath ()); + config.my_hash = _r_str_hash (_r_app_getbinarypath ()); config.ntoskrnl_hash = _r_str_hash (PROC_SYSTEM_NAME); config.svchost_hash = _r_str_hash (config.svchost_path); @@ -1969,17 +1971,17 @@ find_wrap: DragAcceptFiles (hwnd, TRUE); // initialize settings - app.SettingsAddPage (IDD_SETTINGS_GENERAL, IDS_SETTINGS_GENERAL); - app.SettingsAddPage (IDD_SETTINGS_INTERFACE, IDS_TITLE_INTERFACE); - app.SettingsAddPage (IDD_SETTINGS_HIGHLIGHTING, IDS_TITLE_HIGHLIGHTING); - app.SettingsAddPage (IDD_SETTINGS_RULES, IDS_TRAY_RULES); + _r_settings_addpage (IDD_SETTINGS_GENERAL, IDS_SETTINGS_GENERAL); + _r_settings_addpage (IDD_SETTINGS_INTERFACE, IDS_TITLE_INTERFACE); + _r_settings_addpage (IDD_SETTINGS_HIGHLIGHTING, IDS_TITLE_HIGHLIGHTING); + _r_settings_addpage (IDD_SETTINGS_RULES, IDS_TRAY_RULES); - if (!app.ConfigGetBoolean (L"IsInternalRulesDisabled", FALSE)) - app.SettingsAddPage (IDD_SETTINGS_BLOCKLIST, IDS_TRAY_BLOCKLIST_RULES); + if (!_r_config_getboolean (L"IsInternalRulesDisabled", FALSE)) + _r_settings_addpage (IDD_SETTINGS_BLOCKLIST, IDS_TRAY_BLOCKLIST_RULES); // dropped packets logging (win7+) - app.SettingsAddPage (IDD_SETTINGS_NOTIFICATIONS, IDS_TITLE_NOTIFICATIONS); - app.SettingsAddPage (IDD_SETTINGS_LOGGING, IDS_TITLE_LOGGING); + _r_settings_addpage (IDD_SETTINGS_NOTIFICATIONS, IDS_TITLE_NOTIFICATIONS); + _r_settings_addpage (IDD_SETTINGS_LOGGING, IDS_TITLE_LOGGING); // initialize colors addcolor (IDS_HIGHLIGHT_TIMER, L"IsHighlightTimer", TRUE, L"ColorTimer", LISTVIEW_COLOR_TIMER); @@ -1994,7 +1996,7 @@ find_wrap: addcolor (IDS_HIGHLIGHT_CONNECTION, L"IsHighlightConnection", TRUE, L"ColorConnection", LISTVIEW_COLOR_CONNECTION); // restore window size and position (required!) - app.RestoreWindowPosition (hwnd, L"window"); + _r_window_restoreposition (hwnd, L"window"); // initialize imagelist _app_imagelist_init (hwnd); @@ -2014,16 +2016,16 @@ find_wrap: _app_profile_load (hwnd, NULL); // add blocklist to update - if (!app.ConfigGetBoolean (L"IsInternalRulesDisabled", FALSE)) + if (!_r_config_getboolean (L"IsInternalRulesDisabled", FALSE)) { WCHAR internalProfileVersion[128]; _r_str_printf (internalProfileVersion, RTL_NUMBER_OF (internalProfileVersion), L"%" TEXT (PR_LONG64), config.profile_internal_timestamp); - app.UpdateAddComponent (L"Internal rules", L"profile_internal", internalProfileVersion, config.profile_internal_path, FALSE); + _r_update_addcomponent (L"Internal rules", L"profile_internal", internalProfileVersion, config.profile_internal_path, FALSE); } // initialize tab - _app_settab_id (hwnd, app.ConfigGetInteger (L"CurrentTab", IDC_APPS_PROFILE)); + _app_settab_id (hwnd, _r_config_getinteger (L"CurrentTab", IDC_APPS_PROFILE)); // initialize dropped packets log callback thread (win7+) RtlSecureZeroMemory (&log_stack, sizeof (log_stack)); @@ -2044,19 +2046,19 @@ find_wrap: if (install_type == InstallEnabledTemporary) config.is_filterstemporary = TRUE; - //if (app.ConfigGetBoolean (L"IsDisableWindowsFirewallChecked", TRUE)) + //if (_r_config_getboolean (L"IsDisableWindowsFirewallChecked", TRUE)) // _mps_changeconfig2 (FALSE); _app_changefilters (hwnd, TRUE, TRUE); } else { - _r_status_settext (hwnd, IDC_STATUSBAR, 0, app.LocaleString (_app_getinterfacestatelocale (install_type))); + _r_status_settext (hwnd, IDC_STATUSBAR, 0, _r_locale_getstring (_app_getinterfacestatelocale (install_type))); } } // set column size when "auto-size" option are disabled - if (!app.ConfigGetBoolean (L"AutoSizeColumns", TRUE)) + if (!_r_config_getboolean (L"AutoSizeColumns", TRUE)) { for (INT i = 0; i < (INT)SendDlgItemMessage (hwnd, IDC_TAB, TCM_GETITEMCOUNT, 0, 0); i++) { @@ -2078,23 +2080,23 @@ find_wrap: case RM_INITIALIZE: { - _r_tray_create (hwnd, UID, WM_TRAYICON, app.GetSharedImage (app.GetHINSTANCE (), (_wfp_isfiltersinstalled () != InstallDisabled) ? IDI_ACTIVE : IDI_INACTIVE, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON)), APP_NAME, FALSE); + _r_tray_create (hwnd, UID, WM_TRAYICON, _r_app_getsharedimage (_r_app_gethinstance (), (_wfp_isfiltersinstalled () != InstallDisabled) ? IDI_ACTIVE : IDI_INACTIVE, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON)), APP_NAME, FALSE); HMENU hmenu = GetMenu (hwnd); if (hmenu) { - if (app.ConfigGetBoolean (L"IsInternalRulesDisabled", FALSE)) + if (_r_config_getboolean (L"IsInternalRulesDisabled", FALSE)) _r_menu_enableitem (hmenu, 4, MF_BYPOSITION, FALSE); - _r_menu_checkitem (hmenu, IDM_ALWAYSONTOP_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"AlwaysOnTop", _APP_ALWAYSONTOP)); - _r_menu_checkitem (hmenu, IDM_SHOWFILENAMESONLY_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"ShowFilenames", TRUE)); - _r_menu_checkitem (hmenu, IDM_AUTOSIZECOLUMNS_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"AutoSizeColumns", TRUE)); - _r_menu_checkitem (hmenu, IDM_ENABLESPECIALGROUP_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsEnableSpecialGroup", TRUE)); + _r_menu_checkitem (hmenu, IDM_ALWAYSONTOP_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"AlwaysOnTop", _APP_ALWAYSONTOP)); + _r_menu_checkitem (hmenu, IDM_SHOWFILENAMESONLY_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"ShowFilenames", TRUE)); + _r_menu_checkitem (hmenu, IDM_AUTOSIZECOLUMNS_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"AutoSizeColumns", TRUE)); + _r_menu_checkitem (hmenu, IDM_ENABLESPECIALGROUP_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsEnableSpecialGroup", TRUE)); { UINT menu_id; - INT view_type = _r_calc_clamp (INT, app.ConfigGetInteger (L"ViewType", LV_VIEW_DETAILS), LV_VIEW_ICON, LV_VIEW_MAX); + INT view_type = _r_calc_clamp (INT, _r_config_getinteger (L"ViewType", LV_VIEW_DETAILS), LV_VIEW_ICON, LV_VIEW_MAX); if (view_type == LV_VIEW_ICON) menu_id = IDM_VIEW_ICON; @@ -2110,7 +2112,7 @@ find_wrap: { UINT menu_id; - INT icon_size = _r_calc_clamp (INT, app.ConfigGetInteger (L"IconSize", SHIL_SYSSMALL), SHIL_LARGE, SHIL_LAST); + INT icon_size = _r_calc_clamp (INT, _r_config_getinteger (L"IconSize", SHIL_SYSSMALL), SHIL_LARGE, SHIL_LAST); if (icon_size == SHIL_EXTRALARGE) menu_id = IDM_SIZE_EXTRALARGE; @@ -2124,29 +2126,29 @@ find_wrap: _r_menu_checkitem (hmenu, IDM_SIZE_SMALL, IDM_SIZE_EXTRALARGE, MF_BYCOMMAND, menu_id); } - _r_menu_checkitem (hmenu, IDM_ICONSISHIDDEN, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsIconsHidden", FALSE)); + _r_menu_checkitem (hmenu, IDM_ICONSISHIDDEN, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsIconsHidden", FALSE)); - _r_menu_checkitem (hmenu, IDM_RULE_BLOCKOUTBOUND, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"BlockOutboundConnections", TRUE)); - _r_menu_checkitem (hmenu, IDM_RULE_BLOCKINBOUND, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"BlockInboundConnections", TRUE)); - _r_menu_checkitem (hmenu, IDM_RULE_ALLOWLOOPBACK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"AllowLoopbackConnections", TRUE)); - _r_menu_checkitem (hmenu, IDM_RULE_ALLOW6TO4, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"AllowIPv6", TRUE)); + _r_menu_checkitem (hmenu, IDM_RULE_BLOCKOUTBOUND, 0, MF_BYCOMMAND, _r_config_getboolean (L"BlockOutboundConnections", TRUE)); + _r_menu_checkitem (hmenu, IDM_RULE_BLOCKINBOUND, 0, MF_BYCOMMAND, _r_config_getboolean (L"BlockInboundConnections", TRUE)); + _r_menu_checkitem (hmenu, IDM_RULE_ALLOWLOOPBACK, 0, MF_BYCOMMAND, _r_config_getboolean (L"AllowLoopbackConnections", TRUE)); + _r_menu_checkitem (hmenu, IDM_RULE_ALLOW6TO4, 0, MF_BYCOMMAND, _r_config_getboolean (L"AllowIPv6", TRUE)); - _r_menu_checkitem (hmenu, IDM_SECUREFILTERS_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsSecureFilters", TRUE)); - _r_menu_checkitem (hmenu, IDM_USESTEALTHMODE_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"UseStealthMode", TRUE)); - _r_menu_checkitem (hmenu, IDM_INSTALLBOOTTIMEFILTERS_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"InstallBoottimeFilters", TRUE)); + _r_menu_checkitem (hmenu, IDM_SECUREFILTERS_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsSecureFilters", TRUE)); + _r_menu_checkitem (hmenu, IDM_USESTEALTHMODE_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"UseStealthMode", TRUE)); + _r_menu_checkitem (hmenu, IDM_INSTALLBOOTTIMEFILTERS_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"InstallBoottimeFilters", TRUE)); - _r_menu_checkitem (hmenu, IDM_USECERTIFICATES_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE)); - _r_menu_checkitem (hmenu, IDM_USENETWORKRESOLUTION_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsNetworkResolutionsEnabled", FALSE)); - _r_menu_checkitem (hmenu, IDM_USEREFRESHDEVICES_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsRefreshDevices", TRUE)); + _r_menu_checkitem (hmenu, IDM_USECERTIFICATES_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsCertificatesEnabled", FALSE)); + _r_menu_checkitem (hmenu, IDM_USENETWORKRESOLUTION_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsNetworkResolutionsEnabled", FALSE)); + _r_menu_checkitem (hmenu, IDM_USEREFRESHDEVICES_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsRefreshDevices", TRUE)); - _r_menu_checkitem (hmenu, IDM_BLOCKLIST_SPY_DISABLE, IDM_BLOCKLIST_SPY_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_SPY_DISABLE + _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistSpyState", 2), 0, 2)); - _r_menu_checkitem (hmenu, IDM_BLOCKLIST_UPDATE_DISABLE, IDM_BLOCKLIST_UPDATE_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_UPDATE_DISABLE + _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistUpdateState", 0), 0, 2)); - _r_menu_checkitem (hmenu, IDM_BLOCKLIST_EXTRA_DISABLE, IDM_BLOCKLIST_EXTRA_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_EXTRA_DISABLE + _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistExtraState", 0), 0, 2)); + _r_menu_checkitem (hmenu, IDM_BLOCKLIST_SPY_DISABLE, IDM_BLOCKLIST_SPY_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_SPY_DISABLE + _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistSpyState", 2), 0, 2)); + _r_menu_checkitem (hmenu, IDM_BLOCKLIST_UPDATE_DISABLE, IDM_BLOCKLIST_UPDATE_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_UPDATE_DISABLE + _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistUpdateState", 0), 0, 2)); + _r_menu_checkitem (hmenu, IDM_BLOCKLIST_EXTRA_DISABLE, IDM_BLOCKLIST_EXTRA_BLOCK, MF_BYCOMMAND, IDM_BLOCKLIST_EXTRA_DISABLE + _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistExtraState", 0), 0, 2)); } - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLENOTIFICATIONS_CHK, NULL, 0, app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE) ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLELOG_CHK, NULL, 0, app.ConfigGetBoolean (L"IsLogEnabled", FALSE) ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLEUILOG_CHK, NULL, 0, app.ConfigGetBoolean (L"IsLogUiEnabled", FALSE) ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLENOTIFICATIONS_CHK, NULL, 0, _r_config_getboolean (L"IsNotificationsEnabled", TRUE) ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLELOG_CHK, NULL, 0, _r_config_getboolean (L"IsLogEnabled", FALSE) ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLEUILOG_CHK, NULL, 0, _r_config_getboolean (L"IsLogUiEnabled", FALSE) ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); break; } @@ -2164,159 +2166,159 @@ find_wrap: if (hmenu) { - _r_menu_setitemtext (hmenu, 0, app.LocaleString (IDS_FILE), TRUE); - _r_menu_setitemtext (hmenu, 1, app.LocaleString (IDS_EDIT), TRUE); - _r_menu_setitemtext (hmenu, 2, app.LocaleString (IDS_VIEW), TRUE); - _r_menu_setitemtext (hmenu, 3, app.LocaleString (IDS_TRAY_RULES), TRUE); - _r_menu_setitemtext (hmenu, 4, app.LocaleString (IDS_TRAY_BLOCKLIST_RULES), TRUE); - _r_menu_setitemtext (hmenu, 5, app.LocaleString (IDS_HELP), TRUE); + _r_menu_setitemtext (hmenu, 0, _r_locale_getstring (IDS_FILE), TRUE); + _r_menu_setitemtext (hmenu, 1, _r_locale_getstring (IDS_EDIT), TRUE); + _r_menu_setitemtext (hmenu, 2, _r_locale_getstring (IDS_VIEW), TRUE); + _r_menu_setitemtext (hmenu, 3, _r_locale_getstring (IDS_TRAY_RULES), TRUE); + _r_menu_setitemtext (hmenu, 4, _r_locale_getstring (IDS_TRAY_BLOCKLIST_RULES), TRUE); + _r_menu_setitemtext (hmenu, 5, _r_locale_getstring (IDS_HELP), TRUE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tF2", app.LocaleString (IDS_SETTINGS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tF2", _r_locale_getstring (IDS_SETTINGS))); _r_menu_setitemtext (hmenu, IDM_SETTINGS, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_ADD_FILE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_ADD_FILE))); _r_menu_setitemtext (hmenu, IDM_ADD_FILE, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tCtrl+O", app.LocaleString (IDS_IMPORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tCtrl+O", _r_locale_getstring (IDS_IMPORT))); _r_menu_setitemtext (hmenu, IDM_IMPORT, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tCtrl+S", app.LocaleString (IDS_EXPORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tCtrl+S", _r_locale_getstring (IDS_EXPORT))); _r_menu_setitemtext (hmenu, IDM_EXPORT, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hmenu, IDM_EXIT, app.LocaleString (IDS_EXIT), FALSE); + _r_menu_setitemtext (hmenu, IDM_EXIT, _r_locale_getstring (IDS_EXIT), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+Shift+X", app.LocaleString (IDS_PURGE_UNUSED))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+Shift+X", _r_locale_getstring (IDS_PURGE_UNUSED))); _r_menu_setitemtext (hmenu, IDM_PURGE_UNUSED, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+Shift+T", app.LocaleString (IDS_PURGE_TIMERS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+Shift+T", _r_locale_getstring (IDS_PURGE_TIMERS))); _r_menu_setitemtext (hmenu, IDM_PURGE_TIMERS, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+F", app.LocaleString (IDS_FIND))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+F", _r_locale_getstring (IDS_FIND))); _r_menu_setitemtext (hmenu, IDM_FIND, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tF3", app.LocaleString (IDS_FINDNEXT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tF3", _r_locale_getstring (IDS_FINDNEXT))); _r_menu_setitemtext (hmenu, IDM_FINDNEXT, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tF5", app.LocaleString (IDS_REFRESH))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tF5", _r_locale_getstring (IDS_REFRESH))); _r_menu_setitemtext (hmenu, IDM_REFRESH, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hmenu, IDM_ALWAYSONTOP_CHK, app.LocaleString (IDS_ALWAYSONTOP_CHK), FALSE); - _r_menu_setitemtext (hmenu, IDM_SHOWFILENAMESONLY_CHK, app.LocaleString (IDS_SHOWFILENAMESONLY_CHK), FALSE); - _r_menu_setitemtext (hmenu, IDM_AUTOSIZECOLUMNS_CHK, app.LocaleString (IDS_AUTOSIZECOLUMNS_CHK), FALSE); - _r_menu_setitemtext (hmenu, IDM_ENABLESPECIALGROUP_CHK, app.LocaleString (IDS_ENABLESPECIALGROUP_CHK), FALSE); + _r_menu_setitemtext (hmenu, IDM_ALWAYSONTOP_CHK, _r_locale_getstring (IDS_ALWAYSONTOP_CHK), FALSE); + _r_menu_setitemtext (hmenu, IDM_SHOWFILENAMESONLY_CHK, _r_locale_getstring (IDS_SHOWFILENAMESONLY_CHK), FALSE); + _r_menu_setitemtext (hmenu, IDM_AUTOSIZECOLUMNS_CHK, _r_locale_getstring (IDS_AUTOSIZECOLUMNS_CHK), FALSE); + _r_menu_setitemtext (hmenu, IDM_ENABLESPECIALGROUP_CHK, _r_locale_getstring (IDS_ENABLESPECIALGROUP_CHK), FALSE); - _r_menu_setitemtext (GetSubMenu (hmenu, 2), 5, app.LocaleString (IDS_ICONS), TRUE); + _r_menu_setitemtext (GetSubMenu (hmenu, 2), 5, _r_locale_getstring (IDS_ICONS), TRUE); - _r_menu_setitemtext (hmenu, IDM_SIZE_SMALL, app.LocaleString (IDS_ICONSSMALL), FALSE); - _r_menu_setitemtext (hmenu, IDM_SIZE_LARGE, app.LocaleString (IDS_ICONSLARGE), FALSE); - _r_menu_setitemtext (hmenu, IDM_SIZE_EXTRALARGE, app.LocaleString (IDS_ICONSEXTRALARGE), FALSE); + _r_menu_setitemtext (hmenu, IDM_SIZE_SMALL, _r_locale_getstring (IDS_ICONSSMALL), FALSE); + _r_menu_setitemtext (hmenu, IDM_SIZE_LARGE, _r_locale_getstring (IDS_ICONSLARGE), FALSE); + _r_menu_setitemtext (hmenu, IDM_SIZE_EXTRALARGE, _r_locale_getstring (IDS_ICONSEXTRALARGE), FALSE); - _r_menu_setitemtext (hmenu, IDM_VIEW_ICON, app.LocaleString (IDS_VIEW_ICON), FALSE); - _r_menu_setitemtext (hmenu, IDM_VIEW_DETAILS, app.LocaleString (IDS_VIEW_DETAILS), FALSE); - _r_menu_setitemtext (hmenu, IDM_VIEW_TILE, app.LocaleString (IDS_VIEW_TILE), FALSE); + _r_menu_setitemtext (hmenu, IDM_VIEW_ICON, _r_locale_getstring (IDS_VIEW_ICON), FALSE); + _r_menu_setitemtext (hmenu, IDM_VIEW_DETAILS, _r_locale_getstring (IDS_VIEW_DETAILS), FALSE); + _r_menu_setitemtext (hmenu, IDM_VIEW_TILE, _r_locale_getstring (IDS_VIEW_TILE), FALSE); - _r_menu_setitemtext (hmenu, IDM_ICONSISHIDDEN, app.LocaleString (IDS_ICONSISHIDDEN), FALSE); + _r_menu_setitemtext (hmenu, IDM_ICONSISHIDDEN, _r_locale_getstring (IDS_ICONSISHIDDEN), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (Language)", app.LocaleString (IDS_LANGUAGE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (Language)", _r_locale_getstring (IDS_LANGUAGE))); _r_menu_setitemtext (GetSubMenu (hmenu, 2), LANG_MENU, _r_obj_getstringorempty (localizedString), TRUE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_FONT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_FONT))); _r_menu_setitemtext (hmenu, IDM_FONT, _r_obj_getstringorempty (localizedString), FALSE); - LPCWSTR recommendedString = app.LocaleString (IDS_RECOMMENDED); + LPCWSTR recommendedString = _r_locale_getstring (IDS_RECOMMENDED); - _r_menu_setitemtext (hmenu, IDM_CONNECTIONS_TITLE, app.LocaleString (IDS_TAB_NETWORK), FALSE); - _r_menu_setitemtext (hmenu, IDM_SECURITY_TITLE, app.LocaleString (IDS_TITLE_SECURITY), FALSE); - _r_menu_setitemtext (hmenu, IDM_ADVANCED_TITLE, app.LocaleString (IDS_TITLE_ADVANCED), FALSE); + _r_menu_setitemtext (hmenu, IDM_CONNECTIONS_TITLE, _r_locale_getstring (IDS_TAB_NETWORK), FALSE); + _r_menu_setitemtext (hmenu, IDM_SECURITY_TITLE, _r_locale_getstring (IDS_TITLE_SECURITY), FALSE); + _r_menu_setitemtext (hmenu, IDM_ADVANCED_TITLE, _r_locale_getstring (IDS_TITLE_ADVANCED), FALSE); _r_menu_enableitem (hmenu, IDM_CONNECTIONS_TITLE, MF_BYCOMMAND, FALSE); _r_menu_enableitem (hmenu, IDM_SECURITY_TITLE, MF_BYCOMMAND, FALSE); _r_menu_enableitem (hmenu, IDM_ADVANCED_TITLE, MF_BYCOMMAND, FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_RULE_BLOCKOUTBOUND), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_RULE_BLOCKOUTBOUND), recommendedString)); _r_menu_setitemtext (hmenu, IDM_RULE_BLOCKOUTBOUND, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_RULE_BLOCKINBOUND), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_RULE_BLOCKINBOUND), recommendedString)); _r_menu_setitemtext (hmenu, IDM_RULE_BLOCKINBOUND, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_RULE_ALLOWLOOPBACK), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_RULE_ALLOWLOOPBACK), recommendedString)); _r_menu_setitemtext (hmenu, IDM_RULE_ALLOWLOOPBACK, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_RULE_ALLOW6TO4), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_RULE_ALLOW6TO4), recommendedString)); _r_menu_setitemtext (hmenu, IDM_RULE_ALLOW6TO4, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_SECUREFILTERS_CHK), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_SECUREFILTERS_CHK), recommendedString)); _r_menu_setitemtext (hmenu, IDM_SECUREFILTERS_CHK, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_USESTEALTHMODE_CHK), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_USESTEALTHMODE_CHK), recommendedString)); _r_menu_setitemtext (hmenu, IDM_USESTEALTHMODE_CHK, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_INSTALLBOOTTIMEFILTERS_CHK), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_INSTALLBOOTTIMEFILTERS_CHK), recommendedString)); _r_menu_setitemtext (hmenu, IDM_INSTALLBOOTTIMEFILTERS_CHK, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hmenu, IDM_USENETWORKRESOLUTION_CHK, app.LocaleString (IDS_USENETWORKRESOLUTION_CHK), FALSE); - _r_menu_setitemtext (hmenu, IDM_USECERTIFICATES_CHK, app.LocaleString (IDS_USECERTIFICATES_CHK), FALSE); + _r_menu_setitemtext (hmenu, IDM_USENETWORKRESOLUTION_CHK, _r_locale_getstring (IDS_USENETWORKRESOLUTION_CHK), FALSE); + _r_menu_setitemtext (hmenu, IDM_USECERTIFICATES_CHK, _r_locale_getstring (IDS_USECERTIFICATES_CHK), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", app.LocaleString (IDS_USEREFRESHDEVICES_CHK), recommendedString)); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (%s)", _r_locale_getstring (IDS_USEREFRESHDEVICES_CHK), recommendedString)); _r_menu_setitemtext (hmenu, IDM_USEREFRESHDEVICES_CHK, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_TITLE, app.LocaleString (IDS_BLOCKLIST_SPY), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_TITLE, app.LocaleString (IDS_BLOCKLIST_UPDATE), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_TITLE, app.LocaleString (IDS_BLOCKLIST_EXTRA), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_TITLE, _r_locale_getstring (IDS_BLOCKLIST_SPY), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_TITLE, _r_locale_getstring (IDS_BLOCKLIST_UPDATE), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_TITLE, _r_locale_getstring (IDS_BLOCKLIST_EXTRA), FALSE); _r_menu_enableitem (hmenu, IDM_BLOCKLIST_SPY_TITLE, MF_BYCOMMAND, FALSE); _r_menu_enableitem (hmenu, IDM_BLOCKLIST_UPDATE_TITLE, MF_BYCOMMAND, FALSE); _r_menu_enableitem (hmenu, IDM_BLOCKLIST_EXTRA_TITLE, MF_BYCOMMAND, FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_DISABLE, app.LocaleString (IDS_DISABLE), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_ALLOW, app.LocaleString (IDS_ACTION_ALLOW), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_DISABLE, _r_locale_getstring (IDS_DISABLE), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_ALLOW, _r_locale_getstring (IDS_ACTION_ALLOW), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (default)", app.LocaleString (IDS_ACTION_BLOCK))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (default)", _r_locale_getstring (IDS_ACTION_BLOCK))); _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_SPY_BLOCK, _r_obj_getstringorempty (localizedString), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (default)", app.LocaleString (IDS_DISABLE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (default)", _r_locale_getstring (IDS_DISABLE))); _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_DISABLE, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_ALLOW, app.LocaleString (IDS_ACTION_ALLOW), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_BLOCK, app.LocaleString (IDS_ACTION_BLOCK), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_ALLOW, _r_locale_getstring (IDS_ACTION_ALLOW), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_UPDATE_BLOCK, _r_locale_getstring (IDS_ACTION_BLOCK), FALSE); - //_r_obj_movereference (&localizedString, app.LocaleString2 (IDS_DISABLE, L" (default)")); + //_r_obj_movereference (&localizedString, _r_locale_string2 (IDS_DISABLE, L" (default)")); _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_DISABLE, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_ALLOW, app.LocaleString (IDS_ACTION_ALLOW), FALSE); - _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_BLOCK, app.LocaleString (IDS_ACTION_BLOCK), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_ALLOW, _r_locale_getstring (IDS_ACTION_ALLOW), FALSE); + _r_menu_setitemtext (hmenu, IDM_BLOCKLIST_EXTRA_BLOCK, _r_locale_getstring (IDS_ACTION_BLOCK), FALSE); - _r_menu_setitemtext (hmenu, IDM_WEBSITE, app.LocaleString (IDS_WEBSITE), FALSE); - _r_menu_setitemtext (hmenu, IDM_CHECKUPDATES, app.LocaleString (IDS_CHECKUPDATES), FALSE); + _r_menu_setitemtext (hmenu, IDM_WEBSITE, _r_locale_getstring (IDS_WEBSITE), FALSE); + _r_menu_setitemtext (hmenu, IDM_CHECKUPDATES, _r_locale_getstring (IDS_CHECKUPDATES), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tF1", app.LocaleString (IDS_ABOUT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tF1", _r_locale_getstring (IDS_ABOUT))); _r_menu_setitemtext (hmenu, IDM_ABOUT, _r_obj_getstringorempty (localizedString), FALSE); - app.LocaleEnum ((HWND)GetSubMenu (hmenu, 2), LANG_MENU, TRUE, IDX_LANGUAGE); // enum localizations + _r_locale_enum ((HWND)GetSubMenu (hmenu, 2), LANG_MENU, IDX_LANGUAGE); // enum localizations } // localize toolbar _app_setinterfacestate (hwnd); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_REFRESH, app.LocaleString (IDS_REFRESH), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_SETTINGS, app.LocaleString (IDS_SETTINGS), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_REFRESH, _r_locale_getstring (IDS_REFRESH), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_SETTINGS, _r_locale_getstring (IDS_SETTINGS), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_OPENRULESEDITOR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_OPENRULESEDITOR))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_OPENRULESEDITOR, _r_obj_getstringorempty (localizedString), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLENOTIFICATIONS_CHK, app.LocaleString (IDS_ENABLENOTIFICATIONS_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLELOG_CHK, app.LocaleString (IDS_ENABLELOG_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLENOTIFICATIONS_CHK, _r_locale_getstring (IDS_ENABLENOTIFICATIONS_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLELOG_CHK, _r_locale_getstring (IDS_ENABLELOG_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (session only)", app.LocaleString (IDS_ENABLEUILOG_CHK))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (session only)", _r_locale_getstring (IDS_ENABLEUILOG_CHK))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLEUILOG_CHK, _r_obj_getstringorempty (localizedString), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+I)", app.LocaleString (IDS_LOGSHOW))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+I)", _r_locale_getstring (IDS_LOGSHOW))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_LOGSHOW, _r_obj_getstringorempty (localizedString), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+X)", app.LocaleString (IDS_LOGCLEAR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+X)", _r_locale_getstring (IDS_LOGCLEAR))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_LOGCLEAR, _r_obj_getstringorempty (localizedString), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_DONATE, app.LocaleString (IDS_DONATE), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_DONATE, _r_locale_getstring (IDS_DONATE), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); // set rebar size _app_toolbar_resize (); @@ -2355,58 +2357,58 @@ find_wrap: else continue; - _r_tab_setitem (hwnd, IDC_TAB, i, app.LocaleString (locale_id), I_IMAGENONE, 0); + _r_tab_setitem (hwnd, IDC_TAB, i, _r_locale_getstring (locale_id), I_IMAGENONE, 0); if (listview_id >= IDC_APPS_PROFILE && listview_id <= IDC_APPS_UWP) { - _r_listview_setcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0); - _r_listview_setcolumn (hwnd, listview_id, 1, app.LocaleString (IDS_ADDED), 0); + _r_listview_setcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0); + _r_listview_setcolumn (hwnd, listview_id, 1, _r_locale_getstring (IDS_ADDED), 0); } else if (listview_id >= IDC_RULES_BLOCKLIST && listview_id <= IDC_RULES_CUSTOM) { - _r_listview_setcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0); - _r_listview_setcolumn (hwnd, listview_id, 1, app.LocaleString (IDS_PROTOCOL), 0); - _r_listview_setcolumn (hwnd, listview_id, 2, app.LocaleString (IDS_DIRECTION), 0); + _r_listview_setcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0); + _r_listview_setcolumn (hwnd, listview_id, 1, _r_locale_getstring (IDS_PROTOCOL), 0); + _r_listview_setcolumn (hwnd, listview_id, 2, _r_locale_getstring (IDS_DIRECTION), 0); } else if (listview_id == IDC_NETWORK) { - _r_listview_setcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0); + _r_listview_setcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", _r_locale_getstring (IDS_ADDRESS))); _r_listview_setcolumn (hwnd, listview_id, 1, _r_obj_getstringorempty (localizedString), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", _r_locale_getstring (IDS_PORT))); _r_listview_setcolumn (hwnd, listview_id, 2, _r_obj_getstringorempty (localizedString), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", _r_locale_getstring (IDS_ADDRESS))); _r_listview_setcolumn (hwnd, listview_id, 3, _r_obj_getstringorempty (localizedString), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", _r_locale_getstring (IDS_PORT))); _r_listview_setcolumn (hwnd, listview_id, 4, _r_obj_getstringorempty (localizedString), 0); - _r_listview_setcolumn (hwnd, listview_id, 5, app.LocaleString (IDS_PROTOCOL), 0); - _r_listview_setcolumn (hwnd, listview_id, 6, app.LocaleString (IDS_STATE), 0); + _r_listview_setcolumn (hwnd, listview_id, 5, _r_locale_getstring (IDS_PROTOCOL), 0); + _r_listview_setcolumn (hwnd, listview_id, 6, _r_locale_getstring (IDS_STATE), 0); } else if (listview_id == IDC_LOG) { - _r_listview_setcolumn (hwnd, listview_id, 0, app.LocaleString (IDS_NAME), 0); + _r_listview_setcolumn (hwnd, listview_id, 0, _r_locale_getstring (IDS_NAME), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", _r_locale_getstring (IDS_ADDRESS))); _r_listview_setcolumn (hwnd, listview_id, 1, _r_obj_getstringorempty (localizedString), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_LOCAL L")", _r_locale_getstring (IDS_PORT))); _r_listview_setcolumn (hwnd, listview_id, 2, _r_obj_getstringorempty (localizedString), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", _r_locale_getstring (IDS_ADDRESS))); _r_listview_setcolumn (hwnd, listview_id, 3, _r_obj_getstringorempty (localizedString), 0); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (" SZ_DIRECTION_REMOTE L")", _r_locale_getstring (IDS_PORT))); _r_listview_setcolumn (hwnd, listview_id, 4, _r_obj_getstringorempty (localizedString), 0); - _r_listview_setcolumn (hwnd, listview_id, 5, app.LocaleString (IDS_PROTOCOL), 0); - _r_listview_setcolumn (hwnd, listview_id, 6, app.LocaleString (IDS_FILTER), 0); - _r_listview_setcolumn (hwnd, listview_id, 7, app.LocaleString (IDS_DIRECTION), 0); - _r_listview_setcolumn (hwnd, listview_id, 8, app.LocaleString (IDS_STATE), 0); + _r_listview_setcolumn (hwnd, listview_id, 5, _r_locale_getstring (IDS_PROTOCOL), 0); + _r_listview_setcolumn (hwnd, listview_id, 6, _r_locale_getstring (IDS_FILTER), 0); + _r_listview_setcolumn (hwnd, listview_id, 7, _r_locale_getstring (IDS_DIRECTION), 0); + _r_listview_setcolumn (hwnd, listview_id, 8, _r_locale_getstring (IDS_STATE), 0); } SendDlgItemMessage (hwnd, listview_id, LVM_RESETEMPTYTEXT, 0, 0); @@ -2421,10 +2423,12 @@ find_wrap: } // refresh notification - _r_wnd_addstyle (config.hnotification, IDC_RULES_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (config.hnotification, IDC_ALLOW_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (config.hnotification, IDC_BLOCK_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (config.hnotification, IDC_LATER_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + BOOLEAN is_classic = _r_app_isclassicui (); + + _r_wnd_addstyle (config.hnotification, IDC_RULES_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (config.hnotification, IDC_ALLOW_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (config.hnotification, IDC_BLOCK_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (config.hnotification, IDC_LATER_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); _app_notifyrefresh (config.hnotification, FALSE); @@ -2437,7 +2441,7 @@ find_wrap: { // refresh tray icon _r_tray_destroy (hwnd, UID); - _r_tray_create (hwnd, UID, WM_TRAYICON, app.GetSharedImage (app.GetHINSTANCE (), (_wfp_isfiltersinstalled () != InstallDisabled) ? IDI_ACTIVE : IDI_INACTIVE, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON)), APP_NAME, FALSE); + _r_tray_create (hwnd, UID, WM_TRAYICON, _r_app_getsharedimage (_r_app_gethinstance (), (_wfp_isfiltersinstalled () != InstallDisabled) ? IDI_ACTIVE : IDI_INACTIVE, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON)), APP_NAME, FALSE); break; } @@ -2453,23 +2457,23 @@ find_wrap: // reset toolbar information _app_setinterfacestate (hwnd); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_REFRESH, app.LocaleString (IDS_REFRESH), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_SETTINGS, app.LocaleString (IDS_SETTINGS), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_REFRESH, _r_locale_getstring (IDS_REFRESH), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_SETTINGS, _r_locale_getstring (IDS_SETTINGS), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_OPENRULESEDITOR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_OPENRULESEDITOR))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_OPENRULESEDITOR, _r_obj_getstringorempty (localizedString), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLENOTIFICATIONS_CHK, app.LocaleString (IDS_ENABLENOTIFICATIONS_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLELOG_CHK, app.LocaleString (IDS_ENABLELOG_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLEUILOG_CHK, app.LocaleString (IDS_ENABLEUILOG_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLENOTIFICATIONS_CHK, _r_locale_getstring (IDS_ENABLENOTIFICATIONS_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLELOG_CHK, _r_locale_getstring (IDS_ENABLELOG_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_ENABLEUILOG_CHK, _r_locale_getstring (IDS_ENABLEUILOG_CHK), BTNS_CHECK | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+I)", app.LocaleString (IDS_LOGSHOW))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+I)", _r_locale_getstring (IDS_LOGSHOW))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_LOGSHOW, _r_obj_getstringorempty (localizedString), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+X)", app.LocaleString (IDS_LOGCLEAR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (Ctrl+X)", _r_locale_getstring (IDS_LOGCLEAR))); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_LOGCLEAR, _r_obj_getstringorempty (localizedString), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); - _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_DONATE, app.LocaleString (IDS_DONATE), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); + _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_DONATE, _r_locale_getstring (IDS_DONATE), BTNS_BUTTON | BTNS_AUTOSIZE, 0, I_IMAGENONE); _app_toolbar_resize (); @@ -2523,8 +2527,8 @@ find_wrap: if (_wfp_isfiltersinstalled ()) { if (_app_istimersactive () ? - !app.ShowConfirmMessage (hwnd, NULL, app.LocaleString (IDS_QUESTION_TIMER), L"ConfirmExitTimer") : - !app.ShowConfirmMessage (hwnd, NULL, app.LocaleString (IDS_QUESTION_EXIT), L"ConfirmExit2")) + !_r_show_confirmmessage (hwnd, NULL, _r_locale_getstring (IDS_QUESTION_TIMER), L"ConfirmExitTimer") : + !_r_show_confirmmessage (hwnd, NULL, _r_locale_getstring (IDS_QUESTION_EXIT), L"ConfirmExit2")) { SetWindowLongPtr (hwnd, DWLP_MSGRESULT, TRUE); return TRUE; @@ -2538,7 +2542,7 @@ find_wrap: case WM_DESTROY: { - app.ConfigSetInteger (L"CurrentTab", (INT)_r_tab_getlparam (hwnd, IDC_TAB, INVALID_INT)); + _r_config_setinteger (L"CurrentTab", (INT)_r_tab_getlparam (hwnd, IDC_TAB, INVALID_INT)); if (config.hnotification) DestroyWindow (config.hnotification); @@ -2658,10 +2662,11 @@ find_wrap: _r_tab_adjustchild (hwnd, IDC_TAB, hlistview); - _app_listviewsort (hwnd, listview_id, INVALID_INT, FALSE); _app_listviewsetview (hwnd, listview_id); _app_listviewsetfont (hwnd, listview_id, FALSE); + _app_listviewsort (hwnd, listview_id, INVALID_INT, FALSE); + _app_listviewresize (hwnd, listview_id, FALSE); _app_refreshstatus (hwnd, listview_id); @@ -2822,7 +2827,7 @@ find_wrap: NMLVEMPTYMARKUP* lpnmlv = (NMLVEMPTYMARKUP*)lparam; lpnmlv->dwFlags = EMF_CENTERED; - _r_str_copy (lpnmlv->szMarkup, RTL_NUMBER_OF (lpnmlv->szMarkup), app.LocaleString (IDS_STATUS_EMPTY)); + _r_str_copy (lpnmlv->szMarkup, RTL_NUMBER_OF (lpnmlv->szMarkup), _r_locale_getstring (IDS_STATUS_EMPTY)); SetWindowLongPtr (hwnd, DWLP_MSGRESULT, TRUE); return TRUE; @@ -2894,45 +2899,45 @@ find_wrap: hsubmenu2 = CreatePopupMenu (); // show rules - AppendMenu (hsubmenu1, MF_STRING, IDM_DISABLENOTIFICATIONS, app.LocaleString (IDS_DISABLENOTIFICATIONS)); + AppendMenu (hsubmenu1, MF_STRING, IDM_DISABLENOTIFICATIONS, _r_locale_getstring (IDS_DISABLENOTIFICATIONS)); _app_generate_rulesmenu (hsubmenu1, hash_item); // show timers - AppendMenu (hsubmenu2, MF_STRING, IDM_DISABLETIMER, app.LocaleString (IDS_DISABLETIMER)); + AppendMenu (hsubmenu2, MF_STRING, IDM_DISABLETIMER, _r_locale_getstring (IDS_DISABLETIMER)); AppendMenu (hsubmenu2, MF_SEPARATOR, 0, NULL); _app_generate_timermenu (hsubmenu2, hash_item); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tEnter", app.LocaleString (IDS_EXPLORE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tEnter", _r_locale_getstring (IDS_EXPLORE))); AppendMenu (hmenu, MF_STRING, IDM_PROPERTIES, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hmenu, MF_POPUP, (UINT_PTR)hsubmenu1, app.LocaleString (IDS_TRAY_RULES)); - AppendMenu (hmenu, MF_POPUP, (UINT_PTR)hsubmenu2, app.LocaleString (IDS_TIMER)); + AppendMenu (hmenu, MF_POPUP, (UINT_PTR)hsubmenu1, _r_locale_getstring (IDS_TRAY_RULES)); + AppendMenu (hmenu, MF_POPUP, (UINT_PTR)hsubmenu2, _r_locale_getstring (IDS_TIMER)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tDel", app.LocaleString (IDS_DELETE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tDel", _r_locale_getstring (IDS_DELETE))); AppendMenu (hmenu, MF_STRING, IDM_DELETE, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hmenu, MF_STRING, IDM_CHECK, app.LocaleString (IDS_CHECK)); - AppendMenu (hmenu, MF_STRING, IDM_UNCHECK, app.LocaleString (IDS_UNCHECK)); + AppendMenu (hmenu, MF_STRING, IDM_CHECK, _r_locale_getstring (IDS_CHECK)); + AppendMenu (hmenu, MF_STRING, IDM_UNCHECK, _r_locale_getstring (IDS_UNCHECK)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", app.LocaleString (IDS_SELECT_ALL))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", _r_locale_getstring (IDS_SELECT_ALL))); AppendMenu (hmenu, MF_STRING, IDM_SELECT_ALL, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", app.LocaleString (IDS_COPY))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", _r_locale_getstring (IDS_COPY))); AppendMenu (hmenu, MF_STRING, IDM_COPY, _r_obj_getstringorempty (localizedString)); columnText = _r_listview_getcolumntext (hwnd, listview_id, lv_column_current); if (columnText) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", app.LocaleString (IDS_COPY), _r_obj_getstringorempty (columnText))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", _r_locale_getstring (IDS_COPY), _r_obj_getstringorempty (columnText))); AppendMenu (hmenu, MF_STRING, IDM_COPY2, _r_obj_getstringorempty (localizedString)); _r_obj_dereference (columnText); @@ -2949,16 +2954,16 @@ find_wrap: { if (listview_id == IDC_RULES_CUSTOM) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_ADD))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_ADD))); AppendMenu (hmenu, MF_STRING, IDM_OPENRULESEDITOR, _r_obj_getstringorempty (localizedString)); } - _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tEnter", app.LocaleString (IDS_EDIT2))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...\tEnter", _r_locale_getstring (IDS_EDIT2))); AppendMenu (hmenu, MF_STRING, IDM_PROPERTIES, _r_obj_getstringorempty (localizedString)); if (listview_id == IDC_RULES_CUSTOM) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tDel", app.LocaleString (IDS_DELETE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tDel", _r_locale_getstring (IDS_DELETE))); AppendMenu (hmenu, MF_STRING, IDM_DELETE, _r_obj_getstringorempty (localizedString)); PITEM_RULE ptr_rule = _app_getrulebyid (hash_item); @@ -2973,23 +2978,23 @@ find_wrap: } AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hmenu, MF_STRING, IDM_CHECK, app.LocaleString (IDS_CHECK)); - AppendMenu (hmenu, MF_STRING, IDM_UNCHECK, app.LocaleString (IDS_UNCHECK)); + AppendMenu (hmenu, MF_STRING, IDM_CHECK, _r_locale_getstring (IDS_CHECK)); + AppendMenu (hmenu, MF_STRING, IDM_UNCHECK, _r_locale_getstring (IDS_UNCHECK)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", app.LocaleString (IDS_SELECT_ALL))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", _r_locale_getstring (IDS_SELECT_ALL))); AppendMenu (hmenu, MF_STRING, IDM_SELECT_ALL, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", app.LocaleString (IDS_COPY))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", _r_locale_getstring (IDS_COPY))); AppendMenu (hmenu, MF_STRING, IDM_COPY, _r_obj_getstringorempty (localizedString)); columnText = _r_listview_getcolumntext (hwnd, listview_id, lv_column_current); if (columnText) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", app.LocaleString (IDS_COPY), _r_obj_getstringorempty (columnText))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", _r_locale_getstring (IDS_COPY), _r_obj_getstringorempty (columnText))); AppendMenu (hmenu, MF_STRING, IDM_COPY2, _r_obj_getstringorempty (localizedString)); _r_obj_dereference (columnText); @@ -2999,29 +3004,29 @@ find_wrap: } else if (listview_id == IDC_NETWORK) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tEnter", app.LocaleString (IDS_SHOWINLIST))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tEnter", _r_locale_getstring (IDS_SHOWINLIST))); AppendMenu (hmenu, MF_STRING, IDM_PROPERTIES, _r_obj_getstringorempty (localizedString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_OPENRULESEDITOR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_OPENRULESEDITOR))); AppendMenu (hmenu, MF_STRING, IDM_OPENRULESEDITOR, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - AppendMenu (hmenu, MF_STRING, IDM_NETWORK_CLOSE, app.LocaleString (IDS_NETWORK_CLOSE)); + AppendMenu (hmenu, MF_STRING, IDM_NETWORK_CLOSE, _r_locale_getstring (IDS_NETWORK_CLOSE)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", app.LocaleString (IDS_SELECT_ALL))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", _r_locale_getstring (IDS_SELECT_ALL))); AppendMenu (hmenu, MF_STRING, IDM_SELECT_ALL, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", app.LocaleString (IDS_COPY))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", _r_locale_getstring (IDS_COPY))); AppendMenu (hmenu, MF_STRING, IDM_COPY, _r_obj_getstringorempty (localizedString)); columnText = _r_listview_getcolumntext (hwnd, listview_id, lv_column_current); if (columnText) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", app.LocaleString (IDS_COPY), _r_obj_getstringorempty (columnText))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", _r_locale_getstring (IDS_COPY), _r_obj_getstringorempty (columnText))); AppendMenu (hmenu, MF_STRING, IDM_COPY2, _r_obj_getstringorempty (localizedString)); _r_obj_dereference (columnText); @@ -3042,30 +3047,30 @@ find_wrap: } else if (listview_id == IDC_LOG) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tEnter", app.LocaleString (IDS_SHOWINLIST))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tEnter", _r_locale_getstring (IDS_SHOWINLIST))); AppendMenu (hmenu, MF_STRING, IDM_PROPERTIES, _r_obj_getstringorempty (localizedString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_OPENRULESEDITOR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_OPENRULESEDITOR))); AppendMenu (hmenu, MF_STRING, IDM_OPENRULESEDITOR, _r_obj_getstringorempty (localizedString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+X", app.LocaleString (IDS_LOGCLEAR))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+X", _r_locale_getstring (IDS_LOGCLEAR))); AppendMenu (hmenu, MF_STRING, IDM_TRAY_LOGCLEAR, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", app.LocaleString (IDS_SELECT_ALL))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+A", _r_locale_getstring (IDS_SELECT_ALL))); AppendMenu (hmenu, MF_STRING, IDM_SELECT_ALL, _r_obj_getstringorempty (localizedString)); AppendMenu (hmenu, MF_SEPARATOR, 0, NULL); - _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", app.LocaleString (IDS_COPY))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s\tCtrl+C", _r_locale_getstring (IDS_COPY))); AppendMenu (hmenu, MF_STRING, IDM_COPY, _r_obj_getstringorempty (localizedString)); columnText = _r_listview_getcolumntext (hwnd, listview_id, lv_column_current); if (columnText) { - _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", app.LocaleString (IDS_COPY), _r_obj_getstringorempty (columnText))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s \"%s\"", _r_locale_getstring (IDS_COPY), _r_obj_getstringorempty (columnText))); AppendMenu (hmenu, MF_STRING, IDM_COPY2, _r_obj_getstringorempty (localizedString)); _r_obj_dereference (columnText); @@ -3155,51 +3160,51 @@ find_wrap: _r_menu_setitembitmap (hsubmenu, IDM_TRAY_START, is_filtersinstalled ? config.hbmp_disable : config.hbmp_enable, FALSE); // localize - _r_menu_setitemtext (hsubmenu, IDM_TRAY_SHOW, app.LocaleString (IDS_TRAY_SHOW), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_START, app.LocaleString (is_filtersinstalled ? IDS_TRAY_STOP : IDS_TRAY_START), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_SHOW, _r_locale_getstring (IDS_TRAY_SHOW), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_START, _r_locale_getstring (is_filtersinstalled ? IDS_TRAY_STOP : IDS_TRAY_START), FALSE); - _r_menu_setitemtext (hsubmenu, NOTIFICATIONS_ID, app.LocaleString (IDS_TITLE_NOTIFICATIONS), TRUE); - _r_menu_setitemtext (hsubmenu, LOGGING_ID, app.LocaleString (IDS_TITLE_LOGGING), TRUE); + _r_menu_setitemtext (hsubmenu, NOTIFICATIONS_ID, _r_locale_getstring (IDS_TITLE_NOTIFICATIONS), TRUE); + _r_menu_setitemtext (hsubmenu, LOGGING_ID, _r_locale_getstring (IDS_TITLE_LOGGING), TRUE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONS_CHK, app.LocaleString (IDS_ENABLENOTIFICATIONS_CHK), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK, app.LocaleString (IDS_NOTIFICATIONSOUND_CHK), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_NOTIFICATIONONTRAY_CHK, app.LocaleString (IDS_NOTIFICATIONONTRAY_CHK), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONS_CHK, _r_locale_getstring (IDS_ENABLENOTIFICATIONS_CHK), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK, _r_locale_getstring (IDS_NOTIFICATIONSOUND_CHK), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_NOTIFICATIONONTRAY_CHK, _r_locale_getstring (IDS_NOTIFICATIONONTRAY_CHK), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLELOG_CHK, app.LocaleString (IDS_ENABLELOG_CHK), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLELOG_CHK, _r_locale_getstring (IDS_ENABLELOG_CHK), FALSE); - _r_obj_movereference (&localizedString, _r_format_string (L"%s (session only)", app.LocaleString (IDS_ENABLEUILOG_CHK))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s (session only)", _r_locale_getstring (IDS_ENABLEUILOG_CHK))); _r_menu_setitemtext (hsubmenu, IDM_TRAY_ENABLEUILOG_CHK, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGSHOW, app.LocaleString (IDS_LOGSHOW), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGCLEAR, app.LocaleString (IDS_LOGCLEAR), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGSHOW, _r_locale_getstring (IDS_LOGSHOW), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGCLEAR, _r_locale_getstring (IDS_LOGCLEAR), FALSE); - if (_r_fs_exists (app.GetDebugLogPath ())) + if (_r_fs_exists (_r_app_getlogpath ())) { - _r_menu_setitemtext (hsubmenu, ERRLOG_ID, app.LocaleString (IDS_TRAY_LOGERR), TRUE); + _r_menu_setitemtext (hsubmenu, ERRLOG_ID, _r_locale_getstring (IDS_TRAY_LOGERR), TRUE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGSHOW_ERR, app.LocaleString (IDS_LOGSHOW), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGCLEAR_ERR, app.LocaleString (IDS_LOGCLEAR), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGSHOW_ERR, _r_locale_getstring (IDS_LOGSHOW), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_LOGCLEAR_ERR, _r_locale_getstring (IDS_LOGCLEAR), FALSE); } else { DeleteMenu (hsubmenu, ERRLOG_ID, MF_BYPOSITION); } - _r_obj_movereference (&localizedString, _r_format_string (L"%s...", app.LocaleString (IDS_SETTINGS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s...", _r_locale_getstring (IDS_SETTINGS))); _r_menu_setitemtext (hsubmenu, IDM_TRAY_SETTINGS, _r_obj_getstringorempty (localizedString), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_WEBSITE, app.LocaleString (IDS_WEBSITE), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_ABOUT, app.LocaleString (IDS_ABOUT), FALSE); - _r_menu_setitemtext (hsubmenu, IDM_TRAY_EXIT, app.LocaleString (IDS_EXIT), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_WEBSITE, _r_locale_getstring (IDS_WEBSITE), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_ABOUT, _r_locale_getstring (IDS_ABOUT), FALSE); + _r_menu_setitemtext (hsubmenu, IDM_TRAY_EXIT, _r_locale_getstring (IDS_EXIT), FALSE); - _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONS_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE)); - _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsNotificationsSound", TRUE)); - _r_menu_checkitem (hsubmenu, IDM_TRAY_NOTIFICATIONONTRAY_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsNotificationsOnTray", FALSE)); + _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONS_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsNotificationsEnabled", TRUE)); + _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsNotificationsSound", TRUE)); + _r_menu_checkitem (hsubmenu, IDM_TRAY_NOTIFICATIONONTRAY_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsNotificationsOnTray", FALSE)); - _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLELOG_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsLogEnabled", FALSE)); - _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLEUILOG_CHK, 0, MF_BYCOMMAND, app.ConfigGetBoolean (L"IsLogUiEnabled", FALSE)); + _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLELOG_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsLogEnabled", FALSE)); + _r_menu_checkitem (hsubmenu, IDM_TRAY_ENABLEUILOG_CHK, 0, MF_BYCOMMAND, _r_config_getboolean (L"IsLogUiEnabled", FALSE)); - if (!app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE)) + if (!_r_config_getboolean (L"IsNotificationsEnabled", TRUE)) { _r_menu_enableitem (hsubmenu, IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK, MF_BYCOMMAND, FALSE); _r_menu_enableitem (hsubmenu, IDM_TRAY_NOTIFICATIONONTRAY_CHK, MF_BYCOMMAND, FALSE); @@ -3268,7 +3273,7 @@ find_wrap: case DBT_DEVICEARRIVAL: case DBT_DEVICEREMOVECOMPLETE: { - if (!app.ConfigGetBoolean (L"IsRefreshDevices", TRUE)) + if (!_r_config_getboolean (L"IsRefreshDevices", TRUE)) break; PDEV_BROADCAST_HDR lbhdr = (PDEV_BROADCAST_HDR)lparam; @@ -3310,9 +3315,9 @@ find_wrap: { INT ctrl_id = LOWORD (wparam); - if (HIWORD (wparam) == 0 && ctrl_id >= IDX_LANGUAGE && ctrl_id <= (IDX_LANGUAGE + (INT)app.LocaleGetCount ())) + if (HIWORD (wparam) == 0 && ctrl_id >= IDX_LANGUAGE && ctrl_id <= (IDX_LANGUAGE + (INT)_r_locale_getcount ())) { - app.LocaleApplyFromMenu (GetSubMenu (GetSubMenu (GetMenu (hwnd), 2), LANG_MENU), ctrl_id); + _r_locale_applyfrommenu (GetSubMenu (GetSubMenu (GetMenu (hwnd), 2), LANG_MENU), ctrl_id); return FALSE; } else if ((ctrl_id >= IDX_RULES_SPECIAL && ctrl_id <= (IDX_RULES_SPECIAL + (INT)rules_arr.size ()))) @@ -3452,7 +3457,7 @@ find_wrap: case IDM_SETTINGS: case IDM_TRAY_SETTINGS: { - app.CreateSettingsWindow (hwnd, &SettingsProc); + _r_settings_createwindow (hwnd, &SettingsProc); break; } @@ -3472,7 +3477,7 @@ find_wrap: case IDM_CHECKUPDATES: { - app.UpdateCheck (hwnd); + _r_update_check (hwnd); break; } @@ -3485,7 +3490,7 @@ find_wrap: case IDM_ABOUT: case IDM_TRAY_ABOUT: { - app.CreateAboutWindow (hwnd); + _r_show_aboutmessage (hwnd); break; } @@ -3495,7 +3500,7 @@ find_wrap: _r_str_copy (path, RTL_NUMBER_OF (path), XML_PROFILE); WCHAR title[MAX_PATH]; - _r_str_printf (title, RTL_NUMBER_OF (title), L"%s %s...", app.LocaleString (IDS_IMPORT), path); + _r_str_printf (title, RTL_NUMBER_OF (title), L"%s %s...", _r_locale_getstring (IDS_IMPORT), path); OPENFILENAME ofn = {0}; @@ -3512,7 +3517,7 @@ find_wrap: { if (!_app_profile_load_check (path, XmlProfileV3, TRUE)) { - app.ShowErrorMessage (hwnd, L"Import failure!", ERROR_INVALID_DATA, NULL); + _r_show_errormessage (hwnd, L"Import failure!", ERROR_INVALID_DATA, NULL); } else { @@ -3537,7 +3542,7 @@ find_wrap: _r_str_copy (path, RTL_NUMBER_OF (path), XML_PROFILE); WCHAR title[MAX_PATH]; - _r_str_printf (title, RTL_NUMBER_OF (title), L"%s %s...", app.LocaleString (IDS_EXPORT), path); + _r_str_printf (title, RTL_NUMBER_OF (title), L"%s %s...", _r_locale_getstring (IDS_EXPORT), path); OPENFILENAME ofn = {0}; @@ -3556,7 +3561,7 @@ find_wrap: // added information for export profile failure (issue #707) if (!_r_fs_copy (config.profile_path, path, 0)) - app.ShowErrorMessage (hwnd, L"Export failure!", GetLastError (), NULL); + _r_show_errormessage (hwnd, L"Export failure!", GetLastError (), NULL); } break; @@ -3564,10 +3569,10 @@ find_wrap: case IDM_ALWAYSONTOP_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"AlwaysOnTop", _APP_ALWAYSONTOP); + BOOLEAN new_val = !_r_config_getboolean (L"AlwaysOnTop", _APP_ALWAYSONTOP); _r_menu_checkitem (GetMenu (hwnd), ctrl_id, 0, MF_BYCOMMAND, new_val); - app.ConfigSetBoolean (L"AlwaysOnTop", new_val); + _r_config_setboolean (L"AlwaysOnTop", new_val); _r_wnd_top (hwnd, new_val); @@ -3576,10 +3581,10 @@ find_wrap: case IDM_AUTOSIZECOLUMNS_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"AutoSizeColumns", TRUE); + BOOLEAN new_val = !_r_config_getboolean (L"AutoSizeColumns", TRUE); _r_menu_checkitem (GetMenu (hwnd), ctrl_id, 0, MF_BYCOMMAND, new_val); - app.ConfigSetBoolean (L"AutoSizeColumns", new_val); + _r_config_setboolean (L"AutoSizeColumns", new_val); if (new_val) _app_listviewresize (hwnd, (INT)_r_tab_getlparam (hwnd, IDC_TAB, INVALID_INT), FALSE); @@ -3589,10 +3594,10 @@ find_wrap: case IDM_SHOWFILENAMESONLY_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"ShowFilenames", TRUE); + BOOLEAN new_val = !_r_config_getboolean (L"ShowFilenames", TRUE); _r_menu_checkitem (GetMenu (hwnd), ctrl_id, 0, MF_BYCOMMAND, new_val); - app.ConfigSetBoolean (L"ShowFilenames", new_val); + _r_config_setboolean (L"ShowFilenames", new_val); // regroup apps for (auto it = apps.begin (); it != apps.end (); ++it) @@ -3629,10 +3634,10 @@ find_wrap: case IDM_ENABLESPECIALGROUP_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsEnableSpecialGroup", TRUE); + BOOLEAN new_val = !_r_config_getboolean (L"IsEnableSpecialGroup", TRUE); _r_menu_checkitem (GetMenu (hwnd), ctrl_id, 0, MF_BYCOMMAND, new_val); - app.ConfigSetBoolean (L"IsEnableSpecialGroup", new_val); + _r_config_setboolean (L"IsEnableSpecialGroup", new_val); // regroup apps for (auto it = apps.begin (); it != apps.end (); ++it) @@ -3687,7 +3692,7 @@ find_wrap: view_type = LV_VIEW_DETAILS; _r_menu_checkitem (GetMenu (hwnd), IDM_VIEW_ICON, IDM_VIEW_TILE, MF_BYCOMMAND, ctrl_id); - app.ConfigSetInteger (L"ViewType", view_type); + _r_config_setinteger (L"ViewType", view_type); INT listview_id = (INT)_r_tab_getlparam (hwnd, IDC_TAB, INVALID_INT); @@ -3718,7 +3723,7 @@ find_wrap: icon_size = SHIL_SYSSMALL; _r_menu_checkitem (GetMenu (hwnd), IDM_SIZE_SMALL, IDM_SIZE_EXTRALARGE, MF_BYCOMMAND, ctrl_id); - app.ConfigSetInteger (L"IconSize", icon_size); + _r_config_setinteger (L"IconSize", icon_size); INT listview_id = (INT)_r_tab_getlparam (hwnd, IDC_TAB, INVALID_INT); @@ -3735,10 +3740,10 @@ find_wrap: case IDM_ICONSISHIDDEN: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsIconsHidden", FALSE); + BOOLEAN new_val = !_r_config_getboolean (L"IsIconsHidden", FALSE); _r_menu_checkitem (GetMenu (hwnd), ctrl_id, 0, MF_BYCOMMAND, new_val); - app.ConfigSetBoolean (L"IsIconsHidden", new_val); + _r_config_setboolean (L"IsIconsHidden", new_val); for (auto it = apps.begin (); it != apps.end (); ++it) { @@ -3781,11 +3786,11 @@ find_wrap: cf.nSizeMin = 8; cf.lpLogFont = &lf; - app.ConfigGetFont (L"Font", hwnd, &lf); + _r_config_getfont (L"Font", hwnd, &lf); if (ChooseFont (&cf)) { - app.ConfigSetFont (L"Font", hwnd, &lf); + _r_config_setfont (L"Font", hwnd, &lf); SAFE_DELETE_OBJECT (config.hfont); @@ -3856,7 +3861,7 @@ find_wrap: if (_wfp_isfiltersapplying ()) break; - app.ConfigInit (); + _r_config_initialize (); _app_profile_load (hwnd, NULL); _app_refreshstatus (hwnd, INVALID_INT); @@ -3899,7 +3904,7 @@ find_wrap: INT new_state = _r_calc_clamp (INT, ctrl_id - IDM_BLOCKLIST_SPY_DISABLE, 0, 2); - app.ConfigSetInteger (L"BlocklistSpyState", new_state); + _r_config_setinteger (L"BlocklistSpyState", new_state); _app_ruleblocklistset (hwnd, new_state, INVALID_INT, INVALID_INT, TRUE); } @@ -3909,7 +3914,7 @@ find_wrap: INT new_state = _r_calc_clamp (INT, ctrl_id - IDM_BLOCKLIST_UPDATE_DISABLE, 0, 2); - app.ConfigSetInteger (L"BlocklistUpdateState", new_state); + _r_config_setinteger (L"BlocklistUpdateState", new_state); _app_ruleblocklistset (hwnd, INVALID_INT, new_state, INVALID_INT, TRUE); } @@ -3919,7 +3924,7 @@ find_wrap: INT new_state = _r_calc_clamp (INT, ctrl_id - IDM_BLOCKLIST_EXTRA_DISABLE, 0, 2); - app.ConfigSetInteger (L"BlocklistExtraState", new_state); + _r_config_setinteger (L"BlocklistExtraState", new_state); _app_ruleblocklistset (hwnd, INVALID_INT, INVALID_INT, new_state, TRUE); } @@ -3929,10 +3934,10 @@ find_wrap: case IDM_TRAY_ENABLELOG_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsLogEnabled", FALSE); + BOOLEAN new_val = !_r_config_getboolean (L"IsLogEnabled", FALSE); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, ctrl_id, NULL, 0, new_val ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); - app.ConfigSetBoolean (L"IsLogEnabled", new_val); + _r_config_setboolean (L"IsLogEnabled", new_val); _app_loginit (new_val); @@ -3941,20 +3946,20 @@ find_wrap: case IDM_TRAY_ENABLEUILOG_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsLogUiEnabled", FALSE); + BOOLEAN new_val = !_r_config_getboolean (L"IsLogUiEnabled", FALSE); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, ctrl_id, NULL, 0, new_val ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); - app.ConfigSetBoolean (L"IsLogUiEnabled", new_val); + _r_config_setboolean (L"IsLogUiEnabled", new_val); break; } case IDM_TRAY_ENABLENOTIFICATIONS_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE); + BOOLEAN new_val = !_r_config_getboolean (L"IsNotificationsEnabled", TRUE); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, ctrl_id, NULL, 0, new_val ? TBSTATE_PRESSED | TBSTATE_ENABLED : TBSTATE_ENABLED, I_IMAGENONE); - app.ConfigSetBoolean (L"IsNotificationsEnabled", new_val); + _r_config_setboolean (L"IsNotificationsEnabled", new_val); _app_notifyrefresh (config.hnotification, TRUE); @@ -3963,18 +3968,18 @@ find_wrap: case IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsNotificationsSound", TRUE); + BOOLEAN new_val = !_r_config_getboolean (L"IsNotificationsSound", TRUE); - app.ConfigSetBoolean (L"IsNotificationsSound", new_val); + _r_config_setboolean (L"IsNotificationsSound", new_val); break; } case IDM_TRAY_NOTIFICATIONONTRAY_CHK: { - BOOLEAN new_val = !app.ConfigGetBoolean (L"IsNotificationsOnTray", FALSE); + BOOLEAN new_val = !_r_config_getboolean (L"IsNotificationsOnTray", FALSE); - app.ConfigSetBoolean (L"IsNotificationsOnTray", new_val); + _r_config_setboolean (L"IsNotificationsOnTray", new_val); if (IsWindowVisible (config.hnotification)) _app_notifysetpos (config.hnotification, TRUE); @@ -3984,7 +3989,7 @@ find_wrap: case IDM_TRAY_LOGSHOW: { - if (app.ConfigGetBoolean (L"IsLogUiEnabled", FALSE)) + if (_r_config_getboolean (L"IsLogUiEnabled", FALSE)) { _r_wnd_toggle (hwnd, TRUE); @@ -4003,13 +4008,14 @@ find_wrap: PR_STRING viewerPath; PR_STRING processPath; - logPath = _r_path_expand (app.ConfigGetString (L"LogPath", LOG_PATH_DEFAULT)); + logPath = _r_path_expand (_r_config_getstring (L"LogPath", LOG_PATH_DEFAULT)); - if (!logPath || !_r_fs_exists (logPath->Buffer)) + if (!logPath) + return FALSE; + + if (!_r_fs_exists (logPath->Buffer)) { - if (logPath) - _r_obj_dereference (logPath); - + _r_obj_dereference (logPath); return FALSE; } @@ -4022,10 +4028,10 @@ find_wrap: { processPath = _r_format_string (L"%s \"%s\"", _r_obj_getstring (viewerPath), logPath->Buffer); - _r_sys_createprocess (NULL, _r_obj_getstring (processPath), NULL); + _r_sys_createprocess (NULL, processPath->Buffer, NULL); - _r_obj_dereference (viewerPath); _r_obj_dereference (processPath); + _r_obj_dereference (viewerPath); } _r_obj_dereference (logPath); @@ -4036,11 +4042,11 @@ find_wrap: case IDM_TRAY_LOGCLEAR: { - PR_STRING path = _r_path_expand (app.ConfigGetString (L"LogPath", LOG_PATH_DEFAULT)); + PR_STRING path = _r_path_expand (_r_config_getstring (L"LogPath", LOG_PATH_DEFAULT)); if (_r_fs_isvalidhandle (config.hlogfile) || (path && _r_fs_exists (path->Buffer)) || !log_arr.empty ()) { - if (app.ShowConfirmMessage (hwnd, NULL, app.LocaleString (IDS_QUESTION), L"ConfirmLogClear")) + if (_r_show_confirmmessage (hwnd, NULL, _r_locale_getstring (IDS_QUESTION), L"ConfirmLogClear")) { _app_freelogstack (); @@ -4060,7 +4066,7 @@ find_wrap: PR_STRING processPath; LPCWSTR logPath; - logPath = app.GetDebugLogPath (); + logPath = _r_app_getlogpath (); if (_r_fs_exists (logPath)) { @@ -4082,10 +4088,10 @@ find_wrap: case IDM_TRAY_LOGCLEAR_ERR: { - if (!app.ShowConfirmMessage (hwnd, NULL, app.LocaleString (IDS_QUESTION), L"ConfirmLogClear")) + if (!_r_show_confirmmessage (hwnd, NULL, _r_locale_getstring (IDS_QUESTION), L"ConfirmLogClear")) break; - LPCWSTR path = app.GetDebugLogPath (); + LPCWSTR path = _r_app_getlogpath (); if (!_r_fs_exists (path)) break; @@ -4705,9 +4711,9 @@ find_wrap: if (!(selected = (INT)SendDlgItemMessage (hwnd, listview_id, LVM_GETSELECTEDCOUNT, 0, 0))) break; - _r_str_printf (messageText, RTL_NUMBER_OF (messageText), app.LocaleString (IDS_QUESTION_DELETE), selected); + _r_str_printf (messageText, RTL_NUMBER_OF (messageText), _r_locale_getstring (IDS_QUESTION_DELETE), selected); - if (app.ShowMessage (hwnd, MB_YESNO | MB_ICONEXCLAMATION, NULL, NULL, messageText) != IDYES) + if (_r_show_message (hwnd, MB_YESNO | MB_ICONEXCLAMATION, NULL, NULL, messageText) != IDYES) break; count = _r_listview_getitemcount (hwnd, listview_id, FALSE) - 1; @@ -4870,7 +4876,7 @@ find_wrap: case IDM_PURGE_TIMERS: { - if (!_app_istimersactive () || app.ShowMessage (hwnd, MB_YESNO | MB_ICONEXCLAMATION, NULL, NULL, app.LocaleString (IDS_QUESTION_TIMERS)) != IDYES) + if (!_app_istimersactive () || _r_show_message (hwnd, MB_YESNO | MB_ICONEXCLAMATION, NULL, NULL, _r_locale_getstring (IDS_QUESTION_TIMERS)) != IDYES) break; OBJECTS_APP_VECTOR rules; @@ -4953,7 +4959,7 @@ find_wrap: InetPton (ptr_log->af, RM_AD, &ptr_log->remote_addr); ptr_log->remote_port = RP_AD; - ptr_log->path = _r_obj_createstring (app.GetAppBinaryPath ()); + ptr_log->path = _r_obj_createstring (_r_app_getbinarypath ()); ptr_log->filter_name = _r_obj_createstring (FN_AD); //_app_formataddress (ptr_log->af, ptr_log->protocol, &ptr_log->remote_addr, 0, &ptr_log->remote_fmt, FMTADDR_USE_PROTOCOL | FMTADDR_RESOLVE_HOST); @@ -4991,7 +4997,7 @@ find_wrap: IN_ADDR ipv4_local = {0}; PR_STRING ntPath = NULL; - _r_path_ntpathfromdos (app.GetAppBinaryPath (), &ntPath); + _r_path_ntpathfromdos (_r_app_getbinarypath (), &ntPath); UINT16 layer_id = 0; UINT64 filter_id = 0; @@ -5054,9 +5060,9 @@ find_wrap: INT APIENTRY wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, INT nCmdShow) { - MSG msg = {0}; + MSG msg; - if (app.Initialize (APP_NAME, APP_NAME_SHORT, APP_VERSION, APP_COPYRIGHT)) + if (_r_app_initialize (APP_NAME, APP_NAME_SHORT, APP_VERSION, APP_COPYRIGHT)) { // parse arguments { @@ -5132,9 +5138,9 @@ INT APIENTRY wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdL } } - if (app.CreateMainWindow (IDD_MAIN, IDI_MAIN, &DlgProc)) + if (_r_app_createwindow (IDD_MAIN, IDI_MAIN, &DlgProc)) { - HACCEL haccel = LoadAccelerators (app.GetHINSTANCE (), MAKEINTRESOURCE (IDA_MAIN)); + HACCEL haccel = LoadAccelerators (_r_app_gethinstance (), MAKEINTRESOURCE (IDA_MAIN)); if (haccel) { diff --git a/src/notifications.cpp b/src/notifications.cpp index 518d5dfd..056bd794 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -9,7 +9,7 @@ HFONT hfont_text = NULL; VOID _app_notifycreatewindow () { - config.hnotification = CreateDialog (app.GetHINSTANCE (), MAKEINTRESOURCE (IDD_NOTIFICATION), NULL, &NotificationProc); + config.hnotification = CreateDialog (NULL, MAKEINTRESOURCE (IDD_NOTIFICATION), NULL, &NotificationProc); } BOOLEAN _app_notifycommand (HWND hwnd, INT button_id, time_t seconds) @@ -25,7 +25,7 @@ BOOLEAN _app_notifycommand (HWND hwnd, INT button_id, time_t seconds) OBJECTS_APP_VECTOR rules; INT listview_id = _app_getlistview_id (ptr_app->type); - INT item_pos = _app_getposition (app.GetHWND (), listview_id, app_hash); + INT item_pos = _app_getposition (_r_app_gethwnd (), listview_id, app_hash); if (button_id == IDC_ALLOW_BTN || button_id == IDC_BLOCK_BTN) { @@ -34,14 +34,14 @@ BOOLEAN _app_notifycommand (HWND hwnd, INT button_id, time_t seconds) if (ptr_app->is_enabled && seconds) { - _app_timer_set (app.GetHWND (), ptr_app, seconds); + _app_timer_set (_r_app_gethwnd (), ptr_app, seconds); } else { if (item_pos != INVALID_INT) { _r_fastlock_acquireshared (&lock_checkbox); - _app_setappiteminfo (app.GetHWND (), listview_id, item_pos, app_hash, ptr_app); + _app_setappiteminfo (_r_app_gethwnd (), listview_id, item_pos, app_hash, ptr_app); _r_fastlock_releaseshared (&lock_checkbox); } } @@ -66,13 +66,13 @@ BOOLEAN _app_notifycommand (HWND hwnd, INT button_id, time_t seconds) _app_freeapps_vec (&rules); - _app_refreshstatus (app.GetHWND (), listview_id); + _app_refreshstatus (_r_app_gethwnd (), listview_id); _app_profile_save (); - if (listview_id && (INT)_r_tab_getlparam (app.GetHWND (), IDC_TAB, INVALID_INT) == listview_id) + if (listview_id && (INT)_r_tab_getlparam (_r_app_gethwnd (), IDC_TAB, INVALID_INT) == listview_id) { - _app_listviewsort (app.GetHWND (), listview_id, INVALID_INT, FALSE); - _r_listview_redraw (app.GetHWND (), listview_id, INVALID_INT); + _app_listviewsort (_r_app_gethwnd (), listview_id, INVALID_INT, FALSE); + _r_listview_redraw (_r_app_gethwnd (), listview_id, INVALID_INT); } return TRUE; @@ -82,7 +82,7 @@ BOOLEAN _app_notifyadd (HWND hwnd, PITEM_LOG ptr_log, PITEM_APP ptr_app) { // check for last display time time_t current_time = _r_unixtime_now (); - time_t notification_timeout = app.ConfigGetLong64 (L"NotificationsTimeout", NOTIFY_TIMEOUT_DEFAULT); + time_t notification_timeout = _r_config_getlong64 (L"NotificationsTimeout", NOTIFY_TIMEOUT_DEFAULT); if (notification_timeout && ((current_time - ptr_app->last_notify) <= notification_timeout)) return FALSE; @@ -97,7 +97,7 @@ BOOLEAN _app_notifyadd (HWND hwnd, PITEM_LOG ptr_log, PITEM_APP ptr_app) ptr_app->pnotification = (PITEM_LOG)_r_obj_reference (ptr_log); - if (app.ConfigGetBoolean (L"IsNotificationsSound", TRUE)) + if (_r_config_getboolean (L"IsNotificationsSound", TRUE)) _app_notifyplaysound (); if (!_r_wnd_isundercursor (hwnd)) @@ -172,7 +172,7 @@ PITEM_LOG _app_notifyget_obj (SIZE_T app_hash) BOOLEAN _app_notifyshow (HWND hwnd, PITEM_LOG ptr_log, BOOLEAN is_forced, BOOLEAN is_safety) { - if (!app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE)) + if (!_r_config_getboolean (L"IsNotificationsEnabled", TRUE)) return FALSE; PITEM_APP ptr_app = _app_getappitem (ptr_log->app_hash); @@ -189,7 +189,7 @@ BOOLEAN _app_notifyshow (HWND hwnd, PITEM_LOG ptr_log, BOOLEAN is_forced, BOOLEA PR_STRING localizedString = NULL; LPCWSTR emptyString; - if (app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE)) + if (_r_config_getboolean (L"IsCertificatesEnabled", FALSE)) { if (ptr_app->is_signed) { @@ -201,16 +201,16 @@ BOOLEAN _app_notifyshow (HWND hwnd, PITEM_LOG ptr_log, BOOLEAN is_forced, BOOLEA } else { - signatureString = _r_obj_createstring (app.LocaleString (IDS_SIGN_UNSIGNED)); + signatureString = _r_obj_createstring (_r_locale_getstring (IDS_SIGN_UNSIGNED)); } } else { - signatureString = _r_obj_createstring (app.LocaleString (IDS_SIGN_UNSIGNED)); + signatureString = _r_obj_createstring (_r_locale_getstring (IDS_SIGN_UNSIGNED)); } } - _r_str_printf (windowTitle, RTL_NUMBER_OF (windowTitle), L"%s - " APP_NAME, app.LocaleString (IDS_NOTIFY_TITLE)); + _r_str_printf (windowTitle, RTL_NUMBER_OF (windowTitle), L"%s - " APP_NAME, _r_locale_getstring (IDS_NOTIFY_TITLE)); SetWindowText (hwnd, windowTitle); @@ -221,34 +221,34 @@ BOOLEAN _app_notifyshow (HWND hwnd, PITEM_LOG ptr_log, BOOLEAN is_forced, BOOLEA remoteAddressString = _app_formataddress (ptr_log->af, 0, &ptr_log->remote_addr, 0, FMTADDR_RESOLVE_HOST); remotePortString = _app_formatport (ptr_log->remote_port, FALSE); directionString = _app_getdirectionname (ptr_log->direction, ptr_log->is_loopback, TRUE); - emptyString = app.LocaleString (IDS_STATUS_EMPTY); + emptyString = _r_locale_getstring (IDS_STATUS_EMPTY); _r_format_dateex (dateString, RTL_NUMBER_OF (dateString), ptr_log->timestamp, FDTF_SHORTDATE | FDTF_LONGTIME); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_NAME))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_NAME))); _r_ctrl_settabletext (hwnd, IDC_FILE_ID, _r_obj_getstring (localizedString), IDC_FILE_TEXT, _r_path_getbasename (_r_obj_getstring (ptr_app->display_name))); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_SIGNATURE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_SIGNATURE))); _r_ctrl_settabletext (hwnd, IDC_SIGNATURE_ID, _r_obj_getstring (localizedString), IDC_SIGNATURE_TEXT, _r_obj_getstringordefault (signatureString, emptyString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_ADDRESS))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_ADDRESS))); _r_ctrl_settabletext (hwnd, IDC_ADDRESS_ID, _r_obj_getstring (localizedString), IDC_ADDRESS_TEXT, _r_obj_getstringordefault (remoteAddressString, emptyString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_PORT))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_PORT))); _r_ctrl_settabletext (hwnd, IDC_PORT_ID, _r_obj_getstring (localizedString), IDC_PORT_TEXT, _r_obj_getstringordefault (remotePortString, emptyString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_DIRECTION))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_DIRECTION))); _r_ctrl_settabletext (hwnd, IDC_DIRECTION_ID, _r_obj_getstring (localizedString), IDC_DIRECTION_TEXT, _r_obj_getstringordefault (directionString, emptyString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_FILTER))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_FILTER))); _r_ctrl_settabletext (hwnd, IDC_FILTER_ID, _r_obj_getstring (localizedString), IDC_FILTER_TEXT, _r_obj_getstringordefault (ptr_log->filter_name, emptyString)); - _r_obj_movereference (&localizedString, _r_format_string (L"%s:", app.LocaleString (IDS_DATE))); + _r_obj_movereference (&localizedString, _r_format_string (L"%s:", _r_locale_getstring (IDS_DATE))); _r_ctrl_settabletext (hwnd, IDC_DATE_ID, _r_obj_getstring (localizedString), IDC_DATE_TEXT, dateString); - _r_ctrl_settext (hwnd, IDC_RULES_BTN, app.LocaleString (IDS_TRAY_RULES)); - _r_ctrl_settext (hwnd, IDC_ALLOW_BTN, app.LocaleString (IDS_ACTION_ALLOW)); - _r_ctrl_settext (hwnd, IDC_BLOCK_BTN, app.LocaleString (IDS_ACTION_BLOCK)); + _r_ctrl_settext (hwnd, IDC_RULES_BTN, _r_locale_getstring (IDS_TRAY_RULES)); + _r_ctrl_settext (hwnd, IDC_ALLOW_BTN, _r_locale_getstring (IDS_ACTION_ALLOW)); + _r_ctrl_settext (hwnd, IDC_BLOCK_BTN, _r_locale_getstring (IDS_ACTION_BLOCK)); _r_ctrl_enable (hwnd, IDC_RULES_BTN, !is_safety); _r_ctrl_enable (hwnd, IDC_ALLOW_BTN, !is_safety); @@ -297,20 +297,17 @@ VOID _app_notifyhide (HWND hwnd) // Play notification sound even if system have "nosound" mode VOID _app_notifyplaysound () { - BOOLEAN result = FALSE; - static WCHAR notify_snd_path[MAX_PATH] = {0}; + static PR_STRING path = NULL; - if (_r_str_isempty (notify_snd_path) || !_r_fs_exists (notify_snd_path)) + if (_r_str_isempty (path) || !_r_fs_exists (path->Buffer)) { - notify_snd_path[0] = UNICODE_NULL; - #define NOTIFY_SOUND_NAME L"MailBeep" HKEY hkey; if (RegOpenKeyEx (HKEY_CURRENT_USER, L"AppEvents\\Schemes\\Apps\\.Default\\" NOTIFY_SOUND_NAME L"\\.Default", 0, KEY_READ, &hkey) == ERROR_SUCCESS) { - PR_STRING path = _r_reg_querystring (hkey, NULL); + _r_obj_movereference (&path, _r_reg_querystring (hkey, NULL)); if (path) { @@ -318,28 +315,19 @@ VOID _app_notifyplaysound () if (expandedString) _r_obj_movereference (&path, expandedString); - - _r_str_copy (notify_snd_path, RTL_NUMBER_OF (notify_snd_path), _r_obj_getstring (path)); - _r_obj_dereference (path); - - result = TRUE; } RegCloseKey (hkey); } } - else - { - result = TRUE; - } - if (!result || !PlaySound (notify_snd_path, NULL, SND_ASYNC | SND_NODEFAULT | SND_NOWAIT | SND_FILENAME | SND_SENTRY)) + if (_r_str_isempty (path) || !PlaySound (path->Buffer, NULL, SND_ASYNC | SND_NODEFAULT | SND_NOWAIT | SND_FILENAME | SND_SENTRY)) PlaySound (NOTIFY_SOUND_NAME, NULL, SND_ASYNC | SND_NODEFAULT | SND_NOWAIT | SND_SENTRY); } VOID _app_notifyrefresh (HWND hwnd, BOOLEAN is_safety) { - if (!app.ConfigGetBoolean (L"IsNotificationsEnabled", TRUE) || !IsWindowVisible (hwnd)) + if (!_r_config_getboolean (L"IsNotificationsEnabled", TRUE) || !IsWindowVisible (hwnd)) { _app_notifyhide (hwnd); return; @@ -373,7 +361,7 @@ VOID _app_notifysetpos (HWND hwnd, BOOLEAN is_forced) } } - BOOLEAN is_intray = app.ConfigGetBoolean (L"IsNotificationsOnTray", FALSE); + BOOLEAN is_intray = _r_config_getboolean (L"IsNotificationsOnTray", FALSE); if (is_intray) { @@ -442,8 +430,8 @@ HFONT _app_notifyfontinit (HWND hwnd, PLOGFONT plf, LONG height, LONG weight, LP VOID _app_notifyfontset (HWND hwnd) { - SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM)app.GetSharedImage (NULL, SIH_EXCLAMATION, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON))); - SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM)app.GetSharedImage (NULL, SIH_EXCLAMATION, _r_dc_getsystemmetrics (hwnd, SM_CXICON))); + SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM)_r_app_getsharedimage (NULL, SIH_EXCLAMATION, _r_dc_getsystemmetrics (hwnd, SM_CXSMICON))); + SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM)_r_app_getsharedimage (NULL, SIH_EXCLAMATION, _r_dc_getsystemmetrics (hwnd, SM_CXICON))); INT title_font_height = 12; INT text_font_height = 9; @@ -482,10 +470,12 @@ VOID _app_notifyfontset (HWND hwnd) _r_ctrl_setbuttonmargins (hwnd, IDC_BLOCK_BTN); _r_ctrl_setbuttonmargins (hwnd, IDC_LATER_BTN); - _r_wnd_addstyle (hwnd, IDC_RULES_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_ALLOW_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_BLOCK_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); - _r_wnd_addstyle (hwnd, IDC_LATER_BTN, app.IsClassicUI () ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + BOOLEAN is_classic = _r_app_isclassicui (); + + _r_wnd_addstyle (hwnd, IDC_RULES_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_ALLOW_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_BLOCK_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); + _r_wnd_addstyle (hwnd, IDC_LATER_BTN, is_classic ? WS_EX_STATICEDGE : 0, WS_EX_STATICEDGE, GWL_EXSTYLE); InvalidateRect (hwnd, NULL, TRUE); } @@ -675,11 +665,11 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp SetBkMode (drawInfo->hDC, TRANSPARENT); // draw background - DrawGradient (drawInfo->hDC, &drawInfo->rcItem, app.ConfigGetUlong (L"NotificationBackground1", NOTIFY_GRADIENT_1), app.ConfigGetUlong (L"NotificationBackground2", NOTIFY_GRADIENT_2), GRADIENT_FILL_RECT_H); + DrawGradient (drawInfo->hDC, &drawInfo->rcItem, _r_config_getulong (L"NotificationBackground1", NOTIFY_GRADIENT_1), _r_config_getulong (L"NotificationBackground2", NOTIFY_GRADIENT_2), GRADIENT_FILL_RECT_H); // draw title text WCHAR text[128]; - _r_str_printf (text, RTL_NUMBER_OF (text), app.LocaleString (IDS_NOTIFY_HEADER), APP_NAME); + _r_str_printf (text, RTL_NUMBER_OF (text), _r_locale_getstring (IDS_NOTIFY_HEADER), APP_NAME); COLORREF clr_prev = SetTextColor (drawInfo->hDC, RGB (255, 255, 255)); DrawTextEx (drawInfo->hDC, text, (INT)_r_str_length (text), &textRect, DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOCLIP | DT_NOPREFIX, NULL); @@ -754,13 +744,13 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp if (ctrl_id == IDC_RULES_BTN) { - AppendMenu (hsubmenu, MF_STRING, IDM_DISABLENOTIFICATIONS, app.LocaleString (IDS_DISABLENOTIFICATIONS)); + AppendMenu (hsubmenu, MF_STRING, IDM_DISABLENOTIFICATIONS, _r_locale_getstring (IDS_DISABLENOTIFICATIONS)); _app_generate_rulesmenu (hsubmenu, _app_notifyget_id (hwnd, FALSE)); } else if (ctrl_id == IDC_ALLOW_BTN) { - AppendMenu (hsubmenu, MF_STRING, IDC_ALLOW_BTN, app.LocaleString (IDS_ACTION_ALLOW)); + AppendMenu (hsubmenu, MF_STRING, IDC_ALLOW_BTN, _r_locale_getstring (IDS_ACTION_ALLOW)); AppendMenu (hsubmenu, MF_SEPARATOR, 0, NULL); _app_generate_timermenu (hsubmenu, 0); @@ -804,7 +794,7 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp if (listview_id) { - INT item_id = _app_getposition (app.GetHWND (), listview_id, ptr_log->app_hash); + INT item_id = _app_getposition (_r_app_gethwnd (), listview_id, ptr_log->app_hash); if (item_id != INVALID_INT) { @@ -814,7 +804,7 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp nmlvgit.iItem = item_id; nmlvgit.lParam = 0; - PR_STRING string = _app_gettooltip (app.GetHWND (), &nmlvgit); + PR_STRING string = _app_gettooltip (_r_app_gethwnd (), &nmlvgit); if (string) { @@ -829,19 +819,19 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp } else if (ctrl_id == IDC_RULES_BTN) { - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_NOTIFY_TOOLTIP)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_NOTIFY_TOOLTIP)); } else if (ctrl_id == IDC_ALLOW_BTN) { - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_ACTION_ALLOW_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_ACTION_ALLOW_HINT)); } else if (ctrl_id == IDC_BLOCK_BTN) { - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_ACTION_BLOCK_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_ACTION_BLOCK_HINT)); } else if (ctrl_id == IDC_LATER_BTN) { - _r_str_copy (buffer, RTL_NUMBER_OF (buffer), app.LocaleString (IDS_ACTION_LATER_HINT)); + _r_str_copy (buffer, RTL_NUMBER_OF (buffer), _r_locale_getstring (IDS_ACTION_LATER_HINT)); } else { @@ -903,28 +893,28 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp _app_ruleenable (ptr_rule, TRUE); } - INT listview_id = (INT)_r_tab_getlparam (app.GetHWND (), IDC_TAB, INVALID_INT); + INT listview_id = (INT)_r_tab_getlparam (_r_app_gethwnd (), IDC_TAB, INVALID_INT); INT app_listview_id = _app_getlistview_id (ptr_app->type); INT rule_listview_id = _app_getlistview_id (ptr_rule->type); { - INT item_pos = _app_getposition (app.GetHWND (), app_listview_id, ptr_log->app_hash); + INT item_pos = _app_getposition (_r_app_gethwnd (), app_listview_id, ptr_log->app_hash); if (item_pos != INVALID_INT) { _r_fastlock_acquireshared (&lock_checkbox); - _app_setappiteminfo (app.GetHWND (), app_listview_id, item_pos, ptr_log->app_hash, ptr_app); + _app_setappiteminfo (_r_app_gethwnd (), app_listview_id, item_pos, ptr_log->app_hash, ptr_app); _r_fastlock_releaseshared (&lock_checkbox); } } { - INT item_pos = _app_getposition (app.GetHWND (), rule_listview_id, rule_idx); + INT item_pos = _app_getposition (_r_app_gethwnd (), rule_listview_id, rule_idx); if (item_pos != INVALID_INT) { _r_fastlock_acquireshared (&lock_checkbox); - _app_setruleiteminfo (app.GetHWND (), rule_listview_id, item_pos, ptr_rule, FALSE); + _app_setruleiteminfo (_r_app_gethwnd (), rule_listview_id, item_pos, ptr_rule, FALSE); _r_fastlock_releaseshared (&lock_checkbox); } } @@ -939,11 +929,11 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp if (listview_id == app_listview_id || listview_id == rule_listview_id) { - _app_listviewsort (app.GetHWND (), listview_id, INVALID_INT, FALSE); - _r_listview_redraw (app.GetHWND (), listview_id, INVALID_INT); + _app_listviewsort (_r_app_gethwnd (), listview_id, INVALID_INT, FALSE); + _r_listview_redraw (_r_app_gethwnd (), listview_id, INVALID_INT); } - _app_refreshstatus (app.GetHWND (), listview_id); + _app_refreshstatus (_r_app_gethwnd (), listview_id); _app_profile_save (); _r_obj_dereference (ptr_app); @@ -990,9 +980,9 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp INT listview_id = _app_getlistview_id (ptr_app->type); if (listview_id) - _app_showitem (app.GetHWND (), listview_id, _app_getposition (app.GetHWND (), listview_id, ptr_log->app_hash), INVALID_INT); + _app_showitem (_r_app_gethwnd (), listview_id, _app_getposition (_r_app_gethwnd (), listview_id, ptr_log->app_hash), INVALID_INT); - _r_wnd_toggle (app.GetHWND (), TRUE); + _r_wnd_toggle (_r_app_gethwnd (), TRUE); _r_obj_dereference (ptr_app); } @@ -1040,8 +1030,8 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp case IDM_EDITRULES: { - _r_wnd_toggle (app.GetHWND (), TRUE); - _app_settab_id (app.GetHWND (), _app_getlistview_id (DataRuleCustom)); + _r_wnd_toggle (_r_app_gethwnd (), TRUE); + _app_settab_id (_r_app_gethwnd (), _app_getlistview_id (DataRuleCustom)); break; } @@ -1101,12 +1091,12 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp _app_ruleenable (ptr_rule, TRUE); - if (DialogBoxParam (NULL, MAKEINTRESOURCE (IDD_EDITOR), app.GetHWND (), &EditorProc, (LPARAM)ptr_rule)) + if (DialogBoxParam (NULL, MAKEINTRESOURCE (IDD_EDITOR), _r_app_gethwnd (), &EditorProc, (LPARAM)ptr_rule)) { SIZE_T rule_idx = rules_arr.size (); rules_arr.emplace_back ((PITEM_RULE)_r_obj_reference (ptr_rule)); - INT listview_id = (INT)_r_tab_getlparam (app.GetHWND (), IDC_TAB, INVALID_INT); + INT listview_id = (INT)_r_tab_getlparam (_r_app_gethwnd (), IDC_TAB, INVALID_INT); // set rule information INT rules_listview_id = _app_getlistview_id (ptr_rule->type); @@ -1117,13 +1107,13 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp _r_fastlock_acquireshared (&lock_checkbox); - _r_listview_additem (app.GetHWND (), rules_listview_id, item_id, 0, _r_obj_getstringorempty (ptr_rule->name), _app_getruleicon (ptr_rule), _app_getrulegroup (ptr_rule), rule_idx); - _app_setruleiteminfo (app.GetHWND (), rules_listview_id, item_id, ptr_rule, TRUE); + _r_listview_additem (_r_app_gethwnd (), rules_listview_id, item_id, 0, _r_obj_getstringorempty (ptr_rule->name), _app_getruleicon (ptr_rule), _app_getrulegroup (ptr_rule), rule_idx); + _app_setruleiteminfo (_r_app_gethwnd (), rules_listview_id, item_id, ptr_rule, TRUE); _r_fastlock_releaseshared (&lock_checkbox); if (rules_listview_id == listview_id) - _app_listviewsort (app.GetHWND (), listview_id, INVALID_INT, FALSE); + _app_listviewsort (_r_app_gethwnd (), listview_id, INVALID_INT, FALSE); } // set app information @@ -1135,23 +1125,23 @@ INT_PTR CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp if (app_listview_id) { - INT item_pos = _app_getposition (app.GetHWND (), app_listview_id, app_hash); + INT item_pos = _app_getposition (_r_app_gethwnd (), app_listview_id, app_hash); if (item_pos != INVALID_INT) { _r_fastlock_acquireshared (&lock_checkbox); - _app_setappiteminfo (app.GetHWND (), app_listview_id, item_pos, app_hash, ptr_app); + _app_setappiteminfo (_r_app_gethwnd (), app_listview_id, item_pos, app_hash, ptr_app); _r_fastlock_releaseshared (&lock_checkbox); } if (app_listview_id == listview_id) - _app_listviewsort (app.GetHWND (), listview_id, INVALID_INT, FALSE); + _app_listviewsort (_r_app_gethwnd (), listview_id, INVALID_INT, FALSE); } _r_obj_dereference (ptr_app); } - _app_refreshstatus (app.GetHWND (), listview_id); + _app_refreshstatus (_r_app_gethwnd (), listview_id); _app_profile_save (); } diff --git a/src/profile.cpp b/src/profile.cpp index 4c3d0aa3..c07cdec9 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -172,7 +172,7 @@ SIZE_T _app_addapplication (HWND hwnd, LPCWSTR path, time_t timestamp, time_t ti _r_obj_movereference (&ptr_app->display_name, _app_getdisplayname (app_hash, ptr_app)); // get signature information - if (app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE)) + if (_r_config_getboolean (L"IsCertificatesEnabled", FALSE)) { signatureString = _app_getsignatureinfo (app_hash, ptr_app); @@ -350,34 +350,34 @@ COLORREF _app_getappcolor (INT listview_id, SIZE_T app_hash) BOOLEAN is_networklist = (listview_id >= IDC_NETWORK && listview_id <= IDC_LOG); BOOLEAN is_editorlist = (listview_id == IDC_RULE_APPS_ID); - if (app.ConfigGetBoolean (L"IsHighlightInvalid", TRUE, L"colors") && !_app_isappexists (ptr_app)) + if (_r_config_getboolean (L"IsHighlightInvalid", TRUE, L"colors") && !_app_isappexists (ptr_app)) colorValue = L"ColorInvalid"; - else if (app.ConfigGetBoolean (L"IsHighlightTimer", TRUE, L"colors") && _app_istimeractive (ptr_app)) + else if (_r_config_getboolean (L"IsHighlightTimer", TRUE, L"colors") && _app_istimeractive (ptr_app)) colorValue = L"ColorTimer"; - else if (!is_networklist && !ptr_app->is_silent && app.ConfigGetBoolean (L"IsHighlightConnection", TRUE, L"colors") && _app_isapphaveconnection (app_hash)) + else if (!is_networklist && !ptr_app->is_silent && _r_config_getboolean (L"IsHighlightConnection", TRUE, L"colors") && _app_isapphaveconnection (app_hash)) colorValue = L"ColorConnection"; - else if (app.ConfigGetBoolean (L"IsHighlightSigned", TRUE, L"colors") && !ptr_app->is_silent && app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE) && ptr_app->is_signed) + else if (_r_config_getboolean (L"IsHighlightSigned", TRUE, L"colors") && !ptr_app->is_silent && _r_config_getboolean (L"IsCertificatesEnabled", FALSE) && ptr_app->is_signed) colorValue = L"ColorSigned"; - else if ((!is_profilelist || !app.ConfigGetBoolean (L"IsEnableSpecialGroup", TRUE)) && (app.ConfigGetBoolean (L"IsHighlightSpecial", TRUE, L"colors") && _app_isapphaverule (app_hash))) + else if ((!is_profilelist || !_r_config_getboolean (L"IsEnableSpecialGroup", TRUE)) && (_r_config_getboolean (L"IsHighlightSpecial", TRUE, L"colors") && _app_isapphaverule (app_hash))) colorValue = L"ColorSpecial"; - else if (is_profilelist && app.ConfigGetBoolean (L"IsHighlightSilent", TRUE, L"colors") && ptr_app->is_silent) + else if (is_profilelist && _r_config_getboolean (L"IsHighlightSilent", TRUE, L"colors") && ptr_app->is_silent) colorValue = L"ColorSilent"; - else if (!is_profilelist && !is_editorlist && app.ConfigGetBoolean (L"IsHighlightService", TRUE, L"colors") && ptr_app->type == DataAppService) + else if (!is_profilelist && !is_editorlist && _r_config_getboolean (L"IsHighlightService", TRUE, L"colors") && ptr_app->type == DataAppService) colorValue = L"ColorService"; - else if (!is_profilelist && !is_editorlist && app.ConfigGetBoolean (L"IsHighlightPackage", TRUE, L"colors") && ptr_app->type == DataAppUWP) + else if (!is_profilelist && !is_editorlist && _r_config_getboolean (L"IsHighlightPackage", TRUE, L"colors") && ptr_app->type == DataAppUWP) colorValue = L"ColorPackage"; - else if (app.ConfigGetBoolean (L"IsHighlightPico", TRUE, L"colors") && ptr_app->type == DataAppPico) + else if (_r_config_getboolean (L"IsHighlightPico", TRUE, L"colors") && ptr_app->type == DataAppPico) colorValue = L"ColorPico"; - else if (app.ConfigGetBoolean (L"IsHighlightSystem", TRUE, L"colors") && ptr_app->is_system) + else if (_r_config_getboolean (L"IsHighlightSystem", TRUE, L"colors") && ptr_app->is_system) colorValue = L"ColorSystem"; _r_obj_dereference (ptr_app); @@ -420,12 +420,12 @@ VOID _app_freeapplication (SIZE_T app_hash) if (rule_listview_id) { - INT item_pos = _app_getposition (app.GetHWND (), rule_listview_id, index); + INT item_pos = _app_getposition (_r_app_gethwnd (), rule_listview_id, index); if (item_pos != INVALID_INT) { _r_fastlock_acquireshared (&lock_checkbox); - _app_setruleiteminfo (app.GetHWND (), rule_listview_id, item_pos, ptr_rule, FALSE); + _app_setruleiteminfo (_r_app_gethwnd (), rule_listview_id, item_pos, ptr_rule, FALSE); _r_fastlock_releaseshared (&lock_checkbox); } } @@ -494,7 +494,7 @@ VOID _app_getcount (PITEM_STATUS ptr_status) INT _app_getappgroup (SIZE_T app_hash, PITEM_APP ptr_app) { // apps with special rule - if (app.ConfigGetBoolean (L"IsEnableSpecialGroup", TRUE) && _app_isapphaverule (app_hash)) + if (_r_config_getboolean (L"IsEnableSpecialGroup", TRUE) && _app_isapphaverule (app_hash)) return 1; if (!ptr_app->is_enabled) @@ -528,10 +528,10 @@ COLORREF _app_getrulecolor (INT listview_id, SIZE_T rule_idx) LPCWSTR colorValue = NULL; - if (app.ConfigGetBoolean (L"IsHighlightInvalid", TRUE, L"colors") && ptr_rule->is_enabled && ptr_rule->is_haveerrors) + if (_r_config_getboolean (L"IsHighlightInvalid", TRUE, L"colors") && ptr_rule->is_enabled && ptr_rule->is_haveerrors) colorValue = L"ColorInvalid"; - else if (app.ConfigGetBoolean (L"IsHighlightSpecial", TRUE, L"colors") && !ptr_rule->apps->empty ()) + else if (_r_config_getboolean (L"IsHighlightSpecial", TRUE, L"colors") && !ptr_rule->apps->empty ()) colorValue = L"ColorSpecial"; _r_obj_dereference (ptr_rule); @@ -600,14 +600,14 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) } // signature information - if (app.ConfigGetBoolean (L"IsCertificatesEnabled", FALSE) && ptr_app->is_signed) + if (_r_config_getboolean (L"IsCertificatesEnabled", FALSE) && ptr_app->is_signed) { PR_STRING signatureString = _app_getsignatureinfo (lparam, ptr_app); if (signatureString) { if (!_r_str_isempty (signatureString)) - _r_string_appendformat (&infoString, SZ_TAB L"%s: %s\r\n", app.LocaleString (IDS_SIGNATURE), signatureString->Buffer); + _r_string_appendformat (&infoString, SZ_TAB L"%s: %s\r\n", _r_locale_getstring (IDS_SIGNATURE), signatureString->Buffer); _r_obj_dereference (signatureString); } @@ -615,7 +615,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) if (!_r_str_isempty (infoString)) { - _r_string_insertformat (&infoString, 0, L"%s:\r\n", app.LocaleString (IDS_FILE)); + _r_string_insertformat (&infoString, 0, L"%s:\r\n", _r_locale_getstring (IDS_FILE)); _r_string_append (&string, infoString->Buffer); } @@ -628,7 +628,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) WCHAR intervalString[128]; _r_format_interval (intervalString, RTL_NUMBER_OF (intervalString), ptr_app->timer - _r_unixtime_now (), 3); - _r_string_appendformat (&string, L"%s:" SZ_TAB_CRLF L"%s\r\n", app.LocaleString (IDS_TIMELEFT), intervalString); + _r_string_appendformat (&string, L"%s:" SZ_TAB_CRLF L"%s\r\n", _r_locale_getstring (IDS_TIMELEFT), intervalString); } // app rules @@ -638,7 +638,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) if (appRulesString) { if (!_r_str_isempty (appRulesString)) - _r_string_appendformat (&string, L"%s:" SZ_TAB_CRLF L"%s\r\n", app.LocaleString (IDS_RULE), appRulesString->Buffer); + _r_string_appendformat (&string, L"%s:" SZ_TAB_CRLF L"%s\r\n", _r_locale_getstring (IDS_RULE), appRulesString->Buffer); _r_obj_dereference (appRulesString); } @@ -652,33 +652,33 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) // app type if (ptr_app->type == DataAppNetwork) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_NETWORK)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_NETWORK)); else if (ptr_app->type == DataAppPico) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_PICO)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_PICO)); else if (!is_appslist && ptr_app->type == DataAppService) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_SERVICE)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_SERVICE)); else if (!is_appslist && ptr_app->type == DataAppUWP) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_PACKAGE)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_PACKAGE)); // app settings if (ptr_app->is_system) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_SYSTEM)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_SYSTEM)); if (_app_isapphaveconnection (lparam)) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_CONNECTION)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_CONNECTION)); if (is_appslist && ptr_app->is_silent) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_SILENT)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_SILENT)); if (!_app_isappexists (ptr_app)) - _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", app.LocaleString (IDS_HIGHLIGHT_INVALID)); + _r_string_appendformat (¬esString, SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_HIGHLIGHT_INVALID)); if (!_r_str_isempty (notesString)) { - _r_string_insertformat (¬esString, 0, L"%s:\r\n", app.LocaleString (IDS_NOTES)); + _r_string_insertformat (¬esString, 0, L"%s:\r\n", _r_locale_getstring (IDS_NOTES)); _r_string_append2 (&string, notesString); } @@ -700,7 +700,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) PR_STRING ruleRemoteString = NULL; PR_STRING ruleLocalString = NULL; - empty = app.LocaleString (IDS_STATUS_EMPTY); + empty = _r_locale_getstring (IDS_STATUS_EMPTY); if (!_r_str_isempty (ptr_rule->rule_remote)) ruleRemoteString = _r_obj_reference (ptr_rule->rule_remote); @@ -712,10 +712,10 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) string = _r_format_string (L"%s (#%" TEXT (PR_SIZE_T) L")\r\n%s (" SZ_DIRECTION_REMOTE L"):\r\n%s%s\r\n%s (" SZ_DIRECTION_LOCAL L"):\r\n%s%s", _r_obj_getstringordefault (ptr_rule->name, empty), lparam, - app.LocaleString (IDS_RULE), + _r_locale_getstring (IDS_RULE), SZ_TAB, _r_obj_getstringordefault (ruleRemoteString, empty), - app.LocaleString (IDS_RULE), + _r_locale_getstring (IDS_RULE), SZ_TAB, _r_obj_getstringordefault (ruleLocalString, empty) ); @@ -731,7 +731,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) if (ruleAppsString) { if (!_r_str_isempty (ruleAppsString)) - _r_string_appendformat (&string, L"\r\n%s:\r\n%s%s", app.LocaleString (IDS_TAB_APPS), SZ_TAB, ruleAppsString->Buffer); + _r_string_appendformat (&string, L"\r\n%s:\r\n%s%s", _r_locale_getstring (IDS_TAB_APPS), SZ_TAB, ruleAppsString->Buffer); _r_obj_dereference (ruleAppsString); } @@ -740,7 +740,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) // rule notes if (ptr_rule->is_readonly && ptr_rule->type == DataRuleCustom) { - _r_string_appendformat (&string, SZ_TAB L"\r\n%s:\r\n" SZ_TAB L"%s\r\n", app.LocaleString (IDS_NOTES), SZ_RULE_INTERNAL_TITLE); + _r_string_appendformat (&string, SZ_TAB L"\r\n%s:\r\n" SZ_TAB L"%s\r\n", _r_locale_getstring (IDS_NOTES), SZ_RULE_INTERNAL_TITLE); } _r_obj_dereference (ptr_rule); @@ -758,20 +758,20 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) PR_STRING localAddressString; PR_STRING remoteAddressString; - empty = app.LocaleString (IDS_STATUS_EMPTY); + empty = _r_locale_getstring (IDS_STATUS_EMPTY); localAddressString = _app_formataddress (ptr_network->af, 0, &ptr_network->local_addr, ptr_network->local_port, 0); remoteAddressString = _app_formataddress (ptr_network->af, 0, &ptr_network->remote_addr, ptr_network->remote_port, 0); string = _r_format_string (L"%s\r\n%s (" SZ_DIRECTION_LOCAL L"):\r\n" SZ_TAB L"%s\r\n%s (" SZ_DIRECTION_REMOTE L"):\r\n" SZ_TAB L"%s\r\n%s:\r\n" SZ_TAB L"%s\r\n%s:\r\n" SZ_TAB L"%s", _r_obj_getstringordefault (ptr_network->path, empty), - app.LocaleString (IDS_ADDRESS), + _r_locale_getstring (IDS_ADDRESS), _r_obj_getstringordefault (localAddressString, empty), - app.LocaleString (IDS_ADDRESS), + _r_locale_getstring (IDS_ADDRESS), _r_obj_getstringordefault (remoteAddressString, empty), - app.LocaleString (IDS_PROTOCOL), + _r_locale_getstring (IDS_PROTOCOL), _app_getprotoname (ptr_network->protocol, ptr_network->af, empty), - app.LocaleString (IDS_STATE), + _r_locale_getstring (IDS_STATE), _app_getconnectionstatusname (ptr_network->state, empty) ); @@ -799,7 +799,7 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) _r_format_dateex (dateString, RTL_NUMBER_OF (dateString), ptr_log->timestamp, FDTF_LONGDATE | FDTF_LONGTIME); - empty = app.LocaleString (IDS_STATUS_EMPTY); + empty = _r_locale_getstring (IDS_STATUS_EMPTY); localAddressString = _app_formataddress (ptr_log->af, 0, &ptr_log->local_addr, ptr_log->local_port, 0); remoteAddressString = _app_formataddress (ptr_log->af, 0, &ptr_log->remote_addr, ptr_log->remote_port, 0); @@ -807,19 +807,19 @@ PR_STRING _app_gettooltip (HWND hwnd, LPNMLVGETINFOTIP lpnmlv) string = _r_format_string (L"%s\r\n%s:\r\n" SZ_TAB L"%s\r\n%s (" SZ_DIRECTION_LOCAL L"):\r\n" SZ_TAB L"%s\r\n%s (" SZ_DIRECTION_REMOTE L"):\r\n" SZ_TAB L"%s\r\n%s:\r\n" SZ_TAB L"%s\r\n%s:\r\n" SZ_TAB L"%s\r\n%s:\r\n" SZ_TAB L"%s\r\n%s:\r\n" SZ_TAB L"%s", _r_obj_getstringordefault (ptr_log->path, empty), - app.LocaleString (IDS_DATE), + _r_locale_getstring (IDS_DATE), dateString, - app.LocaleString (IDS_ADDRESS), + _r_locale_getstring (IDS_ADDRESS), _r_obj_getstringordefault (localAddressString, empty), - app.LocaleString (IDS_ADDRESS), + _r_locale_getstring (IDS_ADDRESS), _r_obj_getstringordefault (remoteAddressString, empty), - app.LocaleString (IDS_PROTOCOL), + _r_locale_getstring (IDS_PROTOCOL), _app_getprotoname (ptr_log->protocol, ptr_log->af, empty), - app.LocaleString (IDS_FILTER), + _r_locale_getstring (IDS_FILTER), _r_obj_getstringordefault (ptr_log->filter_name, empty), - app.LocaleString (IDS_DIRECTION), + _r_locale_getstring (IDS_DIRECTION), _r_obj_getstringorempty (directionString), - app.LocaleString (IDS_STATE), + _r_locale_getstring (IDS_STATE), (ptr_log->is_allow ? SZ_STATE_ALLOW : SZ_STATE_BLOCK) ); @@ -893,7 +893,7 @@ VOID _app_setruleiteminfo (HWND hwnd, INT listview_id, INT item, PITEM_RULE ptr_ directionString = _app_getdirectionname (ptr_rule->direction, FALSE, TRUE); _r_listview_setitem (hwnd, listview_id, item, 0, ruleNamePtr, ruleIconId, ruleGroupId); - _r_listview_setitem (hwnd, listview_id, item, 1, ptr_rule->protocol ? _app_getprotoname (ptr_rule->protocol, AF_UNSPEC, NULL) : app.LocaleString (IDS_ANY)); + _r_listview_setitem (hwnd, listview_id, item, 1, ptr_rule->protocol ? _app_getprotoname (ptr_rule->protocol, AF_UNSPEC, NULL) : _r_locale_getstring (IDS_ANY)); _r_listview_setitem (hwnd, listview_id, item, 2, _r_obj_getstringorempty (directionString)); _r_listview_setitemcheck (hwnd, listview_id, item, ptr_rule->is_enabled); @@ -920,7 +920,7 @@ VOID _app_setruleiteminfo (HWND hwnd, INT listview_id, INT item, PITEM_RULE ptr_ if (app_listview_id) { - item_pos = _app_getposition (app.GetHWND (), app_listview_id, app_hash); + item_pos = _app_getposition (_r_app_gethwnd (), app_listview_id, app_hash); if (item_pos != INVALID_INT) _app_setappiteminfo (hwnd, app_listview_id, item_pos, app_hash, ptr_app); @@ -1445,12 +1445,12 @@ BOOLEAN _app_profile_load_check (LPCWSTR path, ENUM_TYPE_XML type, BOOLEAN is_st VOID _app_profile_load_fallback () { if (!_app_isappfound (config.my_hash)) - _app_addapplication (NULL, app.GetAppBinaryPath (), 0, 0, 0, FALSE, TRUE); + _app_addapplication (NULL, _r_app_getbinarypath (), 0, 0, 0, FALSE, TRUE); _app_setappinfo (config.my_hash, InfoIsUndeletable, TRUE); // disable deletion for this shit ;) - if (!app.ConfigGetBoolean (L"IsInternalRulesDisabled", FALSE)) + if (!_r_config_getboolean (L"IsInternalRulesDisabled", FALSE)) { if (!_app_isappfound (config.ntoskrnl_hash)) _app_addapplication (NULL, PROC_SYSTEM_NAME, 0, 0, 0, FALSE, FALSE); @@ -1465,9 +1465,9 @@ VOID _app_profile_load_fallback () VOID _app_profile_load_helper (pugi::xml_node& root, ENUM_TYPE_DATA type, UINT version) { - INT blocklist_spy_state = _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistSpyState", 2), 0, 2); - INT blocklist_update_state = _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistUpdateState", 0), 0, 2); - INT blocklist_extra_state = _r_calc_clamp (INT, app.ConfigGetInteger (L"BlocklistExtraState", 0), 0, 2); + INT blocklist_spy_state = _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistSpyState", 2), 0, 2); + INT blocklist_update_state = _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistUpdateState", 0), 0, 2); + INT blocklist_extra_state = _r_calc_clamp (INT, _r_config_getinteger (L"BlocklistExtraState", 0), 0, 2); for (pugi::xml_node item = root.child (L"item"); item; item = item.next_sibling (L"item")) { @@ -1682,7 +1682,7 @@ VOID _app_profile_load_internal (LPCWSTR path, LPCWSTR path_backup, time_t* ptim if (path_backup) { DWORD size = 0; - PVOID pbuffer = _r_loadresource (app.GetHINSTANCE (), path_backup, RT_RCDATA, &size); + PVOID pbuffer = _r_loadresource (NULL, path_backup, RT_RCDATA, &size); if (pbuffer) load_backup = doc_backup.load_buffer (pbuffer, size, PUGIXML_LOAD_FLAGS, PUGIXML_LOAD_ENCODING); @@ -1703,7 +1703,7 @@ VOID _app_profile_load_internal (LPCWSTR path, LPCWSTR path_backup, time_t* ptim // show only syntax, memory and i/o errors... if (!load_original && load_original.status != pugi::status_file_not_found && load_original.status != pugi::status_no_document_element) - app.LogErrorV (UID, L"pugi::load_file", 0, L"status: %d,offset: %" TEXT (PR_PTRDIFF) L",text: %hs,file: %s", load_original.status, load_original.offset, load_original.description (), path); + _r_logerror_v (UID, L"pugi::load_file", 0, L"status: %d,offset: %" TEXT (PR_PTRDIFF) L",text: %hs,file: %s", load_original.status, load_original.offset, load_original.description (), path); if (load_original && root) { @@ -1755,7 +1755,7 @@ VOID _app_profile_load (HWND hwnd, LPCWSTR path_custom) _app_freerules_vec (&rules_arr); // generate uwp apps list (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) _app_generate_packages (); // generate services list @@ -1777,7 +1777,7 @@ VOID _app_profile_load (HWND hwnd, LPCWSTR path_custom) { // show only syntax, memory and i/o errors... if (result.status != pugi::status_file_not_found && result.status != pugi::status_no_document_element) - app.LogErrorV (UID, L"pugi::load_file", 0, L"status: %d,offset: %" TEXT (PR_PTRDIFF) L",text: %hs,file: %s", result.status, result.offset, result.description (), !_r_str_isempty (path_custom) ? path_custom : config.profile_path); + _r_logerror_v (UID, L"pugi::load_file", 0, L"status: %d,offset: %" TEXT (PR_PTRDIFF) L",text: %hs,file: %s", result.status, result.offset, result.description (), !_r_str_isempty (path_custom) ? path_custom : config.profile_path); } else { @@ -1814,7 +1814,7 @@ VOID _app_profile_load (HWND hwnd, LPCWSTR path_custom) _app_profile_load_fallback (); // load internal rules (new!) - if (!app.ConfigGetBoolean (L"IsInternalRulesDisabled", FALSE)) + if (!_r_config_getboolean (L"IsInternalRulesDisabled", FALSE)) _app_profile_load_internal (config.profile_internal_path, MAKEINTRESOURCE (IDR_PROFILE_INTERNAL), &config.profile_internal_timestamp); if (hwnd) @@ -1911,7 +1911,7 @@ VOID _app_profile_load (HWND hwnd, LPCWSTR path_custom) VOID _app_profile_save () { time_t current_time = _r_unixtime_now (); - BOOLEAN is_backuprequired = app.ConfigGetBoolean (L"IsBackupProfile", TRUE) && (!_r_fs_exists (config.profile_path_backup) || ((current_time - app.ConfigGetLong64 (L"BackupTimestamp", 0)) >= app.ConfigGetLong64 (L"BackupPeriod", BACKUP_HOURS_PERIOD))); + BOOLEAN is_backuprequired = _r_config_getboolean (L"IsBackupProfile", TRUE) && (!_r_fs_exists (config.profile_path_backup) || ((current_time - _r_config_getlong64 (L"BackupTimestamp", 0)) >= _r_config_getlong64 (L"BackupPeriod", BACKUP_HOURS_PERIOD))); pugi::xml_document doc; pugi::xml_node root = doc.append_child (L"root"); @@ -2110,7 +2110,7 @@ VOID _app_profile_save () if (is_backuprequired) { doc.save_file (config.profile_path_backup, L"\t", PUGIXML_SAVE_FLAGS, PUGIXML_SAVE_ENCODING); - app.ConfigSetLong64 (L"BackupTimestamp", current_time); + _r_config_setlong64 (L"BackupTimestamp", current_time); } } } diff --git a/src/security.cpp b/src/security.cpp index 86e7cbf4..9856b74e 100644 --- a/src/security.cpp +++ b/src/security.cpp @@ -188,7 +188,7 @@ PACL _app_createaccesscontrollist (PACL pAcl, BOOLEAN is_secure) if (code == ERROR_SUCCESS) return pNewDacl; - app.LogError (0, L"SetEntriesInAcl", code, NULL); + _r_logerror (0, L"SetEntriesInAcl", code, NULL); } return NULL; @@ -203,7 +203,7 @@ VOID _app_setsecurityinfoforengine (HANDLE hengine) if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmEngineGetSecurityInfo", code, NULL); + _r_logerror (0, L"FwpmEngineGetSecurityInfo", code, NULL); return; } @@ -309,19 +309,19 @@ VOID _app_setsecurityinfoforengine (HANDLE hengine) if (code != ERROR_SUCCESS) { - app.LogError (0, L"SetEntriesInAcl", code, NULL); + _r_logerror (0, L"SetEntriesInAcl", code, NULL); } else { code = FwpmEngineSetSecurityInfo (hengine, DACL_SECURITY_INFORMATION, NULL, NULL, pNewDacl, NULL); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmEngineSetSecurityInfo", code, NULL); + _r_logerror (0, L"FwpmEngineSetSecurityInfo", code, NULL); code = FwpmNetEventsSetSecurityInfo (hengine, DACL_SECURITY_INFORMATION, NULL, NULL, pNewDacl, NULL); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmEngineSetSecurityInfo", code, NULL); + _r_logerror (0, L"FwpmEngineSetSecurityInfo", code, NULL); LocalFree (pNewDacl); } @@ -340,7 +340,7 @@ VOID _app_setsecurityinfoforprovider (HANDLE hengine, LPCGUID lpguid, BOOLEAN is if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmProviderGetSecurityInfoByKey", code, NULL); + _r_logerror (0, L"FwpmProviderGetSecurityInfoByKey", code, NULL); return; } @@ -353,7 +353,7 @@ VOID _app_setsecurityinfoforprovider (HANDLE hengine, LPCGUID lpguid, BOOLEAN is code = FwpmProviderSetSecurityInfoByKey (hengine, lpguid, DACL_SECURITY_INFORMATION, NULL, NULL, pNewDacl, NULL); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmProviderSetSecurityInfoByKey", code, L"DACL_SECURITY_INFORMATION"); + _r_logerror (0, L"FwpmProviderSetSecurityInfoByKey", code, L"DACL_SECURITY_INFORMATION"); LocalFree (pNewDacl); } @@ -371,7 +371,7 @@ VOID _app_setsecurityinfoforsublayer (HANDLE hengine, LPCGUID lpguid, BOOLEAN is if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmSubLayerGetSecurityInfoByKey", code, NULL); + _r_logerror (0, L"FwpmSubLayerGetSecurityInfoByKey", code, NULL); return; } @@ -384,7 +384,7 @@ VOID _app_setsecurityinfoforsublayer (HANDLE hengine, LPCGUID lpguid, BOOLEAN is code = FwpmSubLayerSetSecurityInfoByKey (hengine, lpguid, DACL_SECURITY_INFORMATION, NULL, NULL, pNewDacl, NULL); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmSubLayerSetSecurityInfoByKey", code, NULL); + _r_logerror (0, L"FwpmSubLayerSetSecurityInfoByKey", code, NULL); LocalFree (pNewDacl); } @@ -402,7 +402,7 @@ VOID _app_setsecurityinfoforfilter (HANDLE hengine, LPCGUID lpguid, BOOLEAN is_s if (code != ERROR_SUCCESS) { - app.LogErrorV (0, L"FwpmFilterSetSecurityInfoByKey", code, L"#%" TEXT (PRIu32), line); + _r_logerror_v (0, L"FwpmFilterSetSecurityInfoByKey", code, L"#%" TEXT (PRIu32), line); return; } @@ -415,7 +415,7 @@ VOID _app_setsecurityinfoforfilter (HANDLE hengine, LPCGUID lpguid, BOOLEAN is_s code = FwpmFilterSetSecurityInfoByKey (hengine, lpguid, DACL_SECURITY_INFORMATION, NULL, NULL, pNewDacl, NULL); if (code != ERROR_SUCCESS) - app.LogErrorV (0, L"FwpmFilterSetSecurityInfoByKey", code, L"#%" TEXT (PRIu32), line); + _r_logerror_v (0, L"FwpmFilterSetSecurityInfoByKey", code, L"#%" TEXT (PRIu32), line); LocalFree (pNewDacl); } diff --git a/src/timer.cpp b/src/timer.cpp index 7e9e0cfb..5418a47f 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -128,7 +128,7 @@ BOOLEAN _app_istimersactive () VOID CALLBACK _app_timer_callback (PVOID lpParameter, BOOLEAN TimerOrWaitFired) { - HWND hwnd = app.GetHWND (); + HWND hwnd = _r_app_gethwnd (); SIZE_T app_hash = (SIZE_T)lpParameter; PITEM_APP ptr_app = _app_getappitem (app_hash); @@ -157,6 +157,6 @@ VOID CALLBACK _app_timer_callback (PVOID lpParameter, BOOLEAN TimerOrWaitFired) _r_listview_redraw (hwnd, listview_id, INVALID_INT); - if (app.ConfigGetBoolean (L"IsNotificationsTimer", TRUE)) - _r_tray_popupformat (hwnd, UID, NIIF_INFO | (app.ConfigGetBoolean (L"IsNotificationsSound", TRUE) ? 0 : NIIF_NOSOUND), APP_NAME, app.LocaleString (IDS_STATUS_TIMER_DONE), _r_obj_getstringordefault (ptr_app->display_name, SZ_EMPTY)); + if (_r_config_getboolean (L"IsNotificationsTimer", TRUE)) + _r_tray_popupformat (hwnd, UID, NIIF_INFO | (_r_config_getboolean (L"IsNotificationsSound", TRUE) ? 0 : NIIF_NOSOUND), APP_NAME, _r_locale_getstring (IDS_STATUS_TIMER_DONE), _r_obj_getstringordefault (ptr_app->display_name, SZ_EMPTY)); } diff --git a/src/wfp.cpp b/src/wfp.cpp index df6fb6f5..693a5b61 100644 --- a/src/wfp.cpp +++ b/src/wfp.cpp @@ -107,7 +107,7 @@ HANDLE _wfp_getenginehandle () if (code != ERROR_SUCCESS) { - app.LogError (UID, L"FwpmEngineOpen", code, NULL); + _r_logerror (UID, L"FwpmEngineOpen", code, NULL); } else { @@ -187,7 +187,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) is_intransact = FALSE; } - app.LogError (UID, L"FwpmProviderAdd", code, NULL); + _r_logerror (UID, L"FwpmProviderAdd", code, NULL); result = FALSE; goto DoExit; @@ -207,7 +207,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) sublayer.providerKey = (LPGUID)&GUID_WfpProvider; sublayer.subLayerKey = GUID_WfpSublayer; - sublayer.weight = (UINT16)app.ConfigGetUinteger (L"SublayerWeight", SUBLAYER_WEIGHT_DEFAULT); // highest weight for UINT16 + sublayer.weight = (UINT16)_r_config_getuinteger (L"SublayerWeight", SUBLAYER_WEIGHT_DEFAULT); // highest weight for UINT16 if (!config.is_filterstemporary) sublayer.flags = FWPM_SUBLAYER_FLAG_PERSISTENT; @@ -222,7 +222,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) is_intransact = FALSE; } - app.LogError (UID, L"FwpmSubLayerAdd", code, NULL); + _r_logerror (UID, L"FwpmSubLayerAdd", code, NULL); result = FALSE; goto DoExit; @@ -244,7 +244,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) // set security information if (is_providerexist || is_sublayerexist) { - BOOLEAN is_secure = app.ConfigGetBoolean (L"IsSecureFilters", TRUE); + BOOLEAN is_secure = _r_config_getboolean (L"IsSecureFilters", TRUE); _app_setsecurityinfoforprovider (hengine, &GUID_WfpProvider, is_secure); _app_setsecurityinfoforsublayer (hengine, &GUID_WfpSublayer, is_secure); @@ -253,7 +253,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) // set engine options if (is_full) { - static BOOLEAN is_win8 = _r_sys_validversion (6, 2); + BOOLEAN is_win8 = _r_sys_isosversiongreaterorequal (WINDOWS_8); FWP_VALUE val; @@ -267,7 +267,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_COLLECT_NET_EVENTS"); + _r_logerror (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_COLLECT_NET_EVENTS"); } else { @@ -281,16 +281,16 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) FWPM_NET_EVENT_KEYWORD_INBOUND_BCAST; // 1903+ - if (_r_sys_validversionex (10, 0, 18362, VER_GREATER_EQUAL)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_10_19H1)) val.uint32 |= FWPM_NET_EVENT_KEYWORD_PORT_SCANNING_DROP; code = FwpmEngineSetOption (hengine, FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS, &val); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS"); + _r_logerror (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS"); // enables the connection monitoring feature and starts logging creation and deletion events (and notifying any subscribers) - if (app.ConfigGetBoolean (L"IsMonitorIPSecConnections", TRUE)) + if (_r_config_getboolean (L"IsMonitorIPSecConnections", TRUE)) { val.type = FWP_UINT32; val.uint32 = 1; @@ -298,7 +298,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) code = FwpmEngineSetOption (hengine, FWPM_ENGINE_MONITOR_IPSEC_CONNECTIONS, &val); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_MONITOR_IPSEC_CONNECTIONS"); + _r_logerror (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_MONITOR_IPSEC_CONNECTIONS"); } } @@ -309,7 +309,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) } // packet queuing (win8+) - if (is_win8 && app.ConfigGetBoolean (L"IsPacketQueuingEnabled", TRUE)) + if (is_win8 && _r_config_getboolean (L"IsPacketQueuingEnabled", TRUE)) { // enables inbound or forward packet queuing independently. when enabled, the system is able to evenly distribute cpu load to multiple cpus for site-to-site ipsec tunnel scenarios. val.type = FWP_UINT32; @@ -318,7 +318,7 @@ BOOLEAN _wfp_initialize (HANDLE hengine, BOOLEAN is_full) code = FwpmEngineSetOption (hengine, FWPM_ENGINE_PACKET_QUEUING, &val); if (code != ERROR_SUCCESS) - app.LogError (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_PACKET_QUEUING"); + _r_logerror (0, L"FwpmEngineSetOption", code, L"FWPM_ENGINE_PACKET_QUEUING"); } } @@ -387,13 +387,13 @@ VOID _wfp_uninitialize (HANDLE hengine, BOOLEAN is_full) code = FwpmSubLayerDeleteByKey (hengine, &GUID_WfpSublayer); if (code != ERROR_SUCCESS && code != FWP_E_SUBLAYER_NOT_FOUND) - app.LogError (UID, L"FwpmSubLayerDeleteByKey", code, NULL); + _r_logerror (UID, L"FwpmSubLayerDeleteByKey", code, NULL); // destroy provider code = FwpmProviderDeleteByKey (hengine, &GUID_WfpProvider); if (code != ERROR_SUCCESS && code != FWP_E_PROVIDER_NOT_FOUND) - app.LogError (UID, L"FwpmProviderDeleteByKey", code, NULL); + _r_logerror (UID, L"FwpmProviderDeleteByKey", code, NULL); if (is_intransact) _wfp_transact_commit (hengine, __LINE__); @@ -495,7 +495,7 @@ VOID _wfp_installfilters (HANDLE hengine) _wfp_transact_commit (hengine, __LINE__); // secure filters - BOOLEAN is_secure = app.ConfigGetBoolean (L"IsSecureFilters", TRUE); + BOOLEAN is_secure = _r_config_getboolean (L"IsSecureFilters", TRUE); if (is_secure) { @@ -521,7 +521,7 @@ BOOLEAN _wfp_transact_start (HANDLE hengine, UINT line) if (code != ERROR_SUCCESS) { - app.LogErrorV (UID, L"FwpmTransactionBegin", code, L"#%" TEXT (PRIu32), line); + _r_logerror_v (UID, L"FwpmTransactionBegin", code, L"#%" TEXT (PRIu32), line); return FALSE; } @@ -536,7 +536,7 @@ BOOLEAN _wfp_transact_commit (HANDLE hengine, UINT line) { FwpmTransactionAbort (hengine); - app.LogErrorV (UID, L"FwpmTransactionCommit", code, L"#%" TEXT (PRIu32), line); + _r_logerror_v (UID, L"FwpmTransactionCommit", code, L"#%" TEXT (PRIu32), line); return FALSE; } @@ -552,7 +552,7 @@ BOOLEAN _wfp_deletefilter (HANDLE hengine, LPCGUID pfilter_id) { PR_STRING guidString = _r_str_fromguid ((LPGUID)pfilter_id); - app.LogError (UID, L"FwpmFilterDeleteByKey", code, _r_obj_getstringordefault (guidString, SZ_EMPTY)); + _r_logerror (UID, L"FwpmFilterDeleteByKey", code, _r_obj_getstringordefault (guidString, SZ_EMPTY)); if (guidString) _r_obj_dereference (guidString); @@ -584,7 +584,7 @@ DWORD _wfp_createfilter (HANDLE hengine, LPCWSTR name, FWPM_FILTER_CONDITION* lp filter.flags = FWPM_FILTER_FLAG_PERSISTENT; // filter is indexed to help enable faster lookup during classification (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) filter.flags |= FWPM_FILTER_FLAG_INDEXED; } @@ -621,7 +621,7 @@ DWORD _wfp_createfilter (HANDLE hengine, LPCWSTR name, FWPM_FILTER_CONDITION* lp } else { - app.LogError (UID, L"FwpmFilterAdd", code, fltr_desc); + _r_logerror (UID, L"FwpmFilterAdd", code, fltr_desc); } return code; @@ -681,7 +681,7 @@ BOOLEAN _wfp_destroyfilters_array (HANDLE hengine, GUIDS_VEC* ptr_filters, UINT if (ptr_filters->empty ()) return FALSE; - BOOLEAN is_enabled = _app_initinterfacestate (app.GetHWND (), FALSE); + BOOLEAN is_enabled = _app_initinterfacestate (_r_app_gethwnd (), FALSE); _r_fastlock_acquireshared (&lock_transaction); @@ -700,7 +700,7 @@ BOOLEAN _wfp_destroyfilters_array (HANDLE hengine, GUIDS_VEC* ptr_filters, UINT _r_fastlock_releaseshared (&lock_transaction); - _app_restoreinterfacestate (app.GetHWND (), is_enabled); + _app_restoreinterfacestate (_r_app_gethwnd (), is_enabled); return TRUE; } @@ -736,7 +736,7 @@ BOOLEAN _wfp_createrulefilter (HANDLE hengine, LPCWSTR name, SIZE_T app_hash, PR if (!ptr_app) { - app.LogErrorV (0, TEXT (__FUNCTION__), 0, L"App \"%" TEXT (PR_SIZE_T) L"\" not found!", app_hash); + _r_logerror_v (0, TEXT (__FUNCTION__), 0, L"App \"%" TEXT (PR_SIZE_T) L"\" not found!", app_hash); return FALSE; } @@ -757,7 +757,7 @@ BOOLEAN _wfp_createrulefilter (HANDLE hengine, LPCWSTR name, SIZE_T app_hash, PR } else { - app.LogError (0, TEXT (__FUNCTION__), 0, _r_obj_getstring (ptr_app->display_name)); + _r_logerror (0, TEXT (__FUNCTION__), 0, _r_obj_getstring (ptr_app->display_name)); _r_obj_dereference (ptr_app); return FALSE; @@ -778,7 +778,7 @@ BOOLEAN _wfp_createrulefilter (HANDLE hengine, LPCWSTR name, SIZE_T app_hash, PR } else { - app.LogError (0, TEXT (__FUNCTION__), 0, _r_obj_getstring (ptr_app->display_name)); + _r_logerror (0, TEXT (__FUNCTION__), 0, _r_obj_getstring (ptr_app->display_name)); _r_obj_dereference (ptr_app); return FALSE; @@ -804,7 +804,7 @@ BOOLEAN _wfp_createrulefilter (HANDLE hengine, LPCWSTR name, SIZE_T app_hash, PR // do not log file not found to error log if (code != ERROR_FILE_NOT_FOUND && code != ERROR_PATH_NOT_FOUND) - app.LogError (0, L"FwpmGetAppIdFromFileName", code, path); + _r_logerror (0, L"FwpmGetAppIdFromFileName", code, path); _r_obj_dereference (ptr_app); @@ -1027,7 +1027,7 @@ BOOLEAN _wfp_create4filters (HANDLE hengine, OBJECTS_RULE_VECTOR* ptr_rules, UIN if (ptr_rules->empty ()) return FALSE; - BOOLEAN is_enabled = _app_initinterfacestate (app.GetHWND (), FALSE); + BOOLEAN is_enabled = _app_initinterfacestate (_r_app_gethwnd (), FALSE); if (!is_intransact && _wfp_isfiltersapplying ()) is_intransact = TRUE; @@ -1153,7 +1153,7 @@ BOOLEAN _wfp_create4filters (HANDLE hengine, OBJECTS_RULE_VECTOR* ptr_rules, UIN { _wfp_transact_commit (hengine, line); - BOOLEAN is_secure = app.ConfigGetBoolean (L"IsSecureFilters", TRUE); + BOOLEAN is_secure = _r_config_getboolean (L"IsSecureFilters", TRUE); if (is_secure) { @@ -1177,7 +1177,7 @@ BOOLEAN _wfp_create4filters (HANDLE hengine, OBJECTS_RULE_VECTOR* ptr_rules, UIN _r_fastlock_releaseshared (&lock_transaction); } - _app_restoreinterfacestate (app.GetHWND (), is_enabled); + _app_restoreinterfacestate (_r_app_gethwnd (), is_enabled); return TRUE; } @@ -1187,7 +1187,7 @@ BOOLEAN _wfp_create3filters (HANDLE hengine, OBJECTS_APP_VECTOR* ptr_apps, UINT if (ptr_apps->empty ()) return FALSE; - BOOLEAN is_enabled = _app_initinterfacestate (app.GetHWND (), FALSE); + BOOLEAN is_enabled = _app_initinterfacestate (_r_app_gethwnd (), FALSE); FWP_ACTION_TYPE action = FWP_ACTION_PERMIT; if (!is_intransact && _wfp_isfiltersapplying ()) @@ -1246,7 +1246,7 @@ BOOLEAN _wfp_create3filters (HANDLE hengine, OBJECTS_APP_VECTOR* ptr_apps, UINT { _wfp_transact_commit (hengine, line); - BOOLEAN is_secure = app.ConfigGetBoolean (L"IsSecureFilters", TRUE); + BOOLEAN is_secure = _r_config_getboolean (L"IsSecureFilters", TRUE); if (is_secure) { @@ -1267,14 +1267,14 @@ BOOLEAN _wfp_create3filters (HANDLE hengine, OBJECTS_APP_VECTOR* ptr_apps, UINT _r_fastlock_releaseshared (&lock_transaction); } - _app_restoreinterfacestate (app.GetHWND (), is_enabled); + _app_restoreinterfacestate (_r_app_gethwnd (), is_enabled); return TRUE; } BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) { - BOOLEAN is_enabled = _app_initinterfacestate (app.GetHWND (), FALSE); + BOOLEAN is_enabled = _app_initinterfacestate (_r_app_gethwnd (), FALSE); if (!is_intransact && _wfp_isfiltersapplying ()) is_intransact = TRUE; @@ -1302,7 +1302,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) FWPM_FILTER_CONDITION fwfc[3] = {0}; // add loopback connections permission - if (app.ConfigGetBoolean (L"AllowLoopbackConnections", TRUE)) + if (_r_config_getboolean (L"AllowLoopbackConnections", TRUE)) { // match all loopback (localhost) data fwfc[0].fieldKey = FWPM_CONDITION_FLAGS; @@ -1311,7 +1311,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) fwfc[0].conditionValue.uint32 = FWP_CONDITION_FLAG_IS_LOOPBACK; // tests if the network traffic is (non-)app container loopback traffic (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) { fwfc[0].matchType = FWP_MATCH_FLAGS_ANY_SET; fwfc[0].conditionValue.uint32 |= FWP_CONDITION_FLAG_IS_APPCONTAINER_LOOPBACK; @@ -1420,7 +1420,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) // firewall service rules // https://msdn.microsoft.com/en-us/library/gg462153.aspx - if (app.ConfigGetBoolean (L"AllowIPv6", TRUE)) + if (_r_config_getboolean (L"AllowIPv6", TRUE)) { // allows 6to4 tunneling, which enables ipv6 to run over an ipv4 network fwfc[0].fieldKey = FWPM_CONDITION_IP_PROTOCOL; @@ -1453,7 +1453,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) // prevent port scanning using stealth discards and silent drops // https://docs.microsoft.com/ru-ru/windows/desktop/FWP/preventing-port-scanning - if (app.ConfigGetBoolean (L"UseStealthMode", TRUE)) + if (_r_config_getboolean (L"UseStealthMode", TRUE)) { // blocks udp port scanners fwfc[0].fieldKey = FWPM_CONDITION_FLAGS; @@ -1462,7 +1462,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) fwfc[0].conditionValue.uint32 = FWP_CONDITION_FLAG_IS_LOOPBACK; // tests if the network traffic is (non-)app container loopback traffic (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) fwfc[0].conditionValue.uint32 |= FWP_CONDITION_FLAG_IS_APPCONTAINER_LOOPBACK; fwfc[1].fieldKey = FWPM_CONDITION_ICMP_TYPE; @@ -1482,7 +1482,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) // configure outbound layer { - FWP_ACTION_TYPE action = app.ConfigGetBoolean (L"BlockOutboundConnections", TRUE) ? FWP_ACTION_BLOCK : FWP_ACTION_PERMIT; + FWP_ACTION_TYPE action = _r_config_getboolean (L"BlockOutboundConnections", TRUE) ? FWP_ACTION_BLOCK : FWP_ACTION_PERMIT; _wfp_createfilter (hengine, L"BlockConnectionsV4", NULL, 0, FILTER_WEIGHT_LOWEST, &FWPM_LAYER_ALE_AUTH_CONNECT_V4, NULL, action, 0, &filter_ids); _wfp_createfilter (hengine, L"BlockConnectionsV6", NULL, 0, FILTER_WEIGHT_LOWEST, &FWPM_LAYER_ALE_AUTH_CONNECT_V6, NULL, action, 0, &filter_ids); @@ -1494,7 +1494,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) // configure inbound layer { - FWP_ACTION_TYPE action = (app.ConfigGetBoolean (L"UseStealthMode", TRUE) || app.ConfigGetBoolean (L"BlockInboundConnections", TRUE)) ? FWP_ACTION_BLOCK : FWP_ACTION_PERMIT; + FWP_ACTION_TYPE action = (_r_config_getboolean (L"UseStealthMode", TRUE) || _r_config_getboolean (L"BlockInboundConnections", TRUE)) ? FWP_ACTION_BLOCK : FWP_ACTION_PERMIT; _wfp_createfilter (hengine, L"BlockRecvAcceptConnectionsV4", NULL, 0, FILTER_WEIGHT_LOWEST, &FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V4, NULL, action, 0, &filter_ids); _wfp_createfilter (hengine, L"BlockRecvAcceptConnectionsV6", NULL, 0, FILTER_WEIGHT_LOWEST, &FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V6, NULL, action, 0, &filter_ids); @@ -1504,7 +1504,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) } // install boot-time filters (enforced at boot-time, even before "base filtering engine" service starts) - if (app.ConfigGetBoolean (L"InstallBoottimeFilters", TRUE) && !config.is_filterstemporary) + if (_r_config_getboolean (L"InstallBoottimeFilters", TRUE) && !config.is_filterstemporary) { fwfc[0].fieldKey = FWPM_CONDITION_FLAGS; fwfc[0].matchType = FWP_MATCH_FLAGS_ALL_SET; @@ -1512,7 +1512,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) fwfc[0].conditionValue.uint32 = FWP_CONDITION_FLAG_IS_LOOPBACK; // tests if the network traffic is (non-)app container loopback traffic (win8+) - if (_r_sys_validversion (6, 2)) + if (_r_sys_isosversiongreaterorequal (WINDOWS_8)) { fwfc[0].matchType = FWP_MATCH_FLAGS_ANY_SET; fwfc[0].conditionValue.uint32 |= FWP_CONDITION_FLAG_IS_APPCONTAINER_LOOPBACK; @@ -1553,7 +1553,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) { _wfp_transact_commit (hengine, line); - BOOLEAN is_secure = app.ConfigGetBoolean (L"IsSecureFilters", TRUE); + BOOLEAN is_secure = _r_config_getboolean (L"IsSecureFilters", TRUE); if (is_secure) { @@ -1564,7 +1564,7 @@ BOOLEAN _wfp_create2filters (HANDLE hengine, UINT line, BOOLEAN is_intransact) _r_fastlock_releaseshared (&lock_transaction); } - _app_restoreinterfacestate (app.GetHWND (), is_enabled); + _app_restoreinterfacestate (_r_app_gethwnd (), is_enabled); return TRUE; } @@ -1580,7 +1580,7 @@ SIZE_T _wfp_dumpfilters (HANDLE hengine, LPCGUID pprovider_id, GUIDS_VEC* ptr_fi if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmFilterCreateEnumHandle", code, NULL); + _r_logerror (0, L"FwpmFilterCreateEnumHandle", code, NULL); return 0; } else @@ -1591,7 +1591,7 @@ SIZE_T _wfp_dumpfilters (HANDLE hengine, LPCGUID pprovider_id, GUIDS_VEC* ptr_fi if (code != ERROR_SUCCESS) { - app.LogError (0, L"FwpmFilterEnum", code, NULL); + _r_logerror (0, L"FwpmFilterEnum", code, NULL); } else { @@ -1673,14 +1673,14 @@ BOOLEAN _mps_firewallapi (PBOOLEAN pis_enabled, PBOOLEAN pis_enable) } else { - app.LogErrorV (0, L"put_FirewallEnabled", hr, L"%d", type); + _r_logerror_v (0, L"put_FirewallEnabled", hr, L"%d", type); } } } } else { - app.LogError (0, L"CoCreateInstance", hr, L"INetFwPolicy2"); + _r_logerror (0, L"CoCreateInstance", hr, L"INetFwPolicy2"); } if (pNetFwPolicy2) @@ -1702,7 +1702,7 @@ VOID _mps_changeconfig2 (BOOLEAN is_enable) if (!scm) { - app.LogError (0, L"OpenSCManager", GetLastError (), NULL); + _r_logerror (0, L"OpenSCManager", GetLastError (), NULL); } else { @@ -1722,7 +1722,7 @@ VOID _mps_changeconfig2 (BOOLEAN is_enable) DWORD code = GetLastError (); if (code != ERROR_ACCESS_DENIED) - app.LogError (0, L"OpenService", code, name); + _r_logerror (0, L"OpenService", code, name); } else { @@ -1735,7 +1735,7 @@ VOID _mps_changeconfig2 (BOOLEAN is_enable) } if (!ChangeServiceConfig (sc, SERVICE_NO_CHANGE, is_enable ? SERVICE_AUTO_START : SERVICE_DISABLED, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) - app.LogError (0, L"ChangeServiceConfig", GetLastError (), name); + _r_logerror (0, L"ChangeServiceConfig", GetLastError (), name); CloseServiceHandle (sc); } @@ -1750,7 +1750,7 @@ VOID _mps_changeconfig2 (BOOLEAN is_enable) if (!sc) { - app.LogError (0, L"OpenService", GetLastError (), name); + _r_logerror (0, L"OpenService", GetLastError (), name); } else { @@ -1759,14 +1759,14 @@ VOID _mps_changeconfig2 (BOOLEAN is_enable) if (!QueryServiceStatusEx (sc, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssp, sizeof (ssp), &dwBytesNeeded)) { - app.LogError (0, L"QueryServiceStatusEx", GetLastError (), name); + _r_logerror (0, L"QueryServiceStatusEx", GetLastError (), name); } else { if (ssp.dwCurrentState != SERVICE_RUNNING) { if (!StartService (sc, 0, NULL)) - app.LogError (0, L"StartService", GetLastError (), name); + _r_logerror (0, L"StartService", GetLastError (), name); } CloseServiceHandle (sc);