diff --git a/WFPExplorer/FilterConditionsPage.cpp b/WFPExplorer/FilterConditionsPage.cpp index 6a504e8..3aac27e 100644 --- a/WFPExplorer/FilterConditionsPage.cpp +++ b/WFPExplorer/FilterConditionsPage.cpp @@ -33,7 +33,7 @@ LRESULT CFilterConditionsPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { auto cm = GetColumnManager(m_List); cm->AddColumn(L"Field", 0, 200); - cm->AddColumn(L"Match", 0, 70); + cm->AddColumn(L"Match", 0, 90); cm->AddColumn(L"Type", 0, 80); cm->AddColumn(L"Value", 0, 170); cm->UpdateColumns(); diff --git a/WFPExplorer/FilterGeneralPage.cpp b/WFPExplorer/FilterGeneralPage.cpp index d97cfad..400e6b1 100644 --- a/WFPExplorer/FilterGeneralPage.cpp +++ b/WFPExplorer/FilterGeneralPage.cpp @@ -16,8 +16,14 @@ LRESULT CFilterGeneralPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { SetDlgItemText(IDC_LAYER, WFPHelper::GetLayerName(m_Engine, m_Filter->layerKey)); SetDlgItemText(IDC_SUBLAYER, WFPHelper::GetSublayerName(m_Engine, m_Filter->subLayerKey)); SetDlgItemText(IDC_ACTIONTYPE, StringHelper::WFPFilterActionTypeToString(m_Filter->action.type)); - if (m_Filter->action.filterType != GUID_NULL) { - SetDlgItemText(IDC_CALLOUT_OR_FILTER, StringHelper::GuidToString(m_Filter->action.filterType)); + if (m_Filter->action.type & FWP_ACTION_FLAG_CALLOUT) { + SetDlgItemText(IDC_CALLOUT_OR_FILTER, WFPHelper::GetCalloutName(m_Engine, m_Filter->action.calloutKey)); + AddIconToButton(IDC_CALLOUT_PROP, IDI_CALLOUT); + } + else { + GetDlgItem(IDC_COFI).ShowWindow(SW_HIDE); + GetDlgItem(IDC_CALLOUT_OR_FILTER).ShowWindow(SW_HIDE); + GetDlgItem(IDC_CALLOUT_PROP).ShowWindow(SW_HIDE); } SetDlgItemText(IDC_WEIGHT, StringHelper::WFPValueToString(m_Filter->weight, true)); SetDlgItemText(IDC_EFFECTIVEWEIGHT, StringHelper::WFPValueToString(m_Filter->effectiveWeight, true)); diff --git a/WFPExplorer/FiltersView.cpp b/WFPExplorer/FiltersView.cpp index b141fb8..5ec538f 100644 --- a/WFPExplorer/FiltersView.cpp +++ b/WFPExplorer/FiltersView.cpp @@ -137,7 +137,7 @@ LRESULT CFiltersView::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam CImageList images; images.Create(16, 16, ILC_COLOR32 | ILC_MASK, 1, 1); - UINT icons[] = { IDI_FILTER, IDI_FILTER_PERMIT, IDI_FILTER_BLOCK, IDI_FILTER_REFRESH }; + UINT icons[] = { IDI_FILTER, IDI_FILTER_PERMIT, IDI_FILTER_BLOCK, IDI_FILTER_REFRESH, IDI_CALLOUT }; for (auto icon : icons) images.AddIcon(AtlLoadIconImage(icon, 0, 16, 16)); m_List.SetImageList(images, LVSIL_SMALL); @@ -244,7 +244,7 @@ int CFiltersView::GetRowImage(HWND, int row, int) const { case FWP_ACTION_PERMIT: return 1; case FWP_ACTION_CONTINUE: return 3; } - return 0; + return 4; } void CFiltersView::OnStateChanged(HWND, int from, int to, UINT oldState, UINT newState) { diff --git a/WFPExplorer/WFPExplorer.rc b/WFPExplorer/WFPExplorer.rc index 943fc7a..7d6f56b 100644 --- a/WFPExplorer/WFPExplorer.rc +++ b/WFPExplorer/WFPExplorer.rc @@ -89,6 +89,7 @@ BEGIN MENUITEM "&Callouts", ID_VIEW_CALLOUTS MENUITEM "Provider Conte&xts", ID_VIEW_PROVIDERCONTEXTS MENUITEM "&Network Events", ID_VIEW_NETWORKEVENTS + MENUITEM "Statistics", ID_VIEW_STATISTICS MENUITEM SEPARATOR MENUITEM "&Refresh", ID_VIEW_REFRESH MENUITEM SEPARATOR @@ -237,9 +238,9 @@ BEGIN LTEXT "Layer:",IDC_STATIC,7,118,30,8 EDITTEXT IDC_LAYER,51,116,290,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE PUSHBUTTON "Layer...",IDC_LAYER_PROP,347,116,63,14 - LTEXT "Action:",IDC_STATIC,7,183,30,8 - LTEXT "Callout/Filter:",IDC_STATIC,158,184,44,8 - EDITTEXT IDC_CALLOUT_OR_FILTER,211,180,199,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + LTEXT "Action:",IDC_STATIC,7,184,30,8 + LTEXT "Callout:",IDC_COFI,138,184,24,8 + EDITTEXT IDC_CALLOUT_OR_FILTER,167,182,176,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE LTEXT "ID:",IDC_STATIC,309,15,12,8 EDITTEXT IDC_ID,327,13,70,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE LTEXT "Weight:",IDC_STATIC,7,160,26,8 @@ -249,9 +250,10 @@ BEGIN LTEXT "Sublayer:",IDC_STATIC,7,139,32,8 EDITTEXT IDC_SUBLAYER,51,137,290,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE PUSHBUTTON "Sublayer...",IDC_SUBLAYER_PROP,347,137,63,14 - EDITTEXT IDC_ACTIONTYPE,51,182,95,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + EDITTEXT IDC_ACTIONTYPE,51,182,81,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE LTEXT "Flags:",IDC_STATIC,7,75,20,8 EDITTEXT IDC_FLAGS,51,75,261,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + PUSHBUTTON "Callout...",IDC_CALLOUT_PROP,347,180,63,14 END IDD_FILTERCONDITIONS DIALOGEX 0, 0, 389, 254 diff --git a/WFPExplorer/WFPHelper.cpp b/WFPExplorer/WFPHelper.cpp index 743b51a..31542ce 100644 --- a/WFPExplorer/WFPHelper.cpp +++ b/WFPExplorer/WFPHelper.cpp @@ -32,6 +32,13 @@ CString WFPHelper::GetLayerName(WFPEngine const& engine, GUID const& key) { return L""; } +CString WFPHelper::GetCalloutName(WFPEngine const& engine, GUID const& key) { + auto callout = engine.GetCalloutByKey(key); + if (auto name = StringHelper::ParseMUIString(callout->displayData.name); !name.IsEmpty()) + return name; + return StringHelper::GuidToString(key); +} + CString WFPHelper::GetSublayerName(WFPEngine const& engine, GUID const& key) { if (key != GUID_NULL) { auto layer = engine.GetSublayerByKey(key); diff --git a/WFPExplorer/WFPHelper.h b/WFPExplorer/WFPHelper.h index 6da3706..a61ac8d 100644 --- a/WFPExplorer/WFPHelper.h +++ b/WFPExplorer/WFPHelper.h @@ -6,6 +6,7 @@ struct WFPHelper abstract final { static CString GetProviderName(WFPEngine const& engine, GUID const& key); static CString GetFilterName(WFPEngine const& engine, GUID const& key); static CString GetLayerName(WFPEngine const& engine, GUID const& key); + static CString GetCalloutName(WFPEngine const& engine, GUID const& key); static CString GetSublayerName(WFPEngine const& engine, GUID const& key); static int ShowLayerProperties(WFPEngine& engine, FWPM_LAYER* layer); static int ShowFilterProperties(WFPEngine& engine, FWPM_FILTER* filter); diff --git a/WFPExplorer/resource.h b/WFPExplorer/resource.h index 32ac227..bb3b601 100644 --- a/WFPExplorer/resource.h +++ b/WFPExplorer/resource.h @@ -51,7 +51,6 @@ #define IDC_NAME 1002 #define IDC_DESC 1003 #define IDC_PROVIDER 1004 -#define IDC_KEY2 1004 #define IDC_SERVICENAME 1004 #define IDC_PROVIDER_PROP 1005 #define IDC_PROVIDERDATA 1005 @@ -68,6 +67,8 @@ #define IDC_EFFECTIVEWEIGHT 1012 #define IDC_SUBLAYER 1013 #define IDC_SUBLAYER_PROP 1014 +#define IDC_LAYER_PROP2 1015 +#define IDC_CALLOUT_PROP 1015 #define IDC_VALUE 1016 #define IDC_FLAGS 1017 #define IDC_TABS 1018 @@ -76,6 +77,7 @@ #define IDC_PERSISTENT 1022 #define IDC_DISABLED 1023 #define IDC_DATASIZE 1024 +#define IDC_COFI 1025 #define ID_WINDOW_CLOSE 32772 #define ID_WINDOW_CLOSE_ALL 32773 #define ID_OPTIONS_ALWAYSONTOP 32775 @@ -99,14 +101,15 @@ #define ID_NEW_PROVIDER 32796 #define ID_EDIT_FIND32797 32797 #define ID_EDIT_FINDNEXT 32798 +#define ID_VIEW_STATISTICS 32801 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 245 -#define _APS_NEXT_COMMAND_VALUE 32801 -#define _APS_NEXT_CONTROL_VALUE 1025 +#define _APS_NEXT_COMMAND_VALUE 32802 +#define _APS_NEXT_CONTROL_VALUE 1026 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif