diff --git a/src/editor.cpp b/src/editor.cpp index 1b05009b..a9db0906 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -267,6 +267,32 @@ INT_PTR CALLBACK EditorPagesProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa _r_ctrl_enable (hwnd, IDC_RULE_PROTOCOL_ID, !ptr_rule->is_readonly); } + // family (ports-only) + if (GetDlgItem (hwnd, IDC_RULE_VERSION_ID)) + { + _r_ctrl_settextformat (hwnd, IDC_RULE_VERSION, L"%s:", _r_locale_getstring (IDS_PORTVERSION)); + + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_INSERTSTRING, 0, (LPARAM)_r_locale_getstring (IDS_ANY)); + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_SETITEMDATA, 0, (LPARAM)AF_UNSPEC); + + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_INSERTSTRING, 1, (LPARAM)L"IPv4"); + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_SETITEMDATA, 1, (LPARAM)AF_INET); + + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_INSERTSTRING, 2, (LPARAM)L"IPv6"); + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_SETITEMDATA, 2, (LPARAM)AF_INET6); + + if (ptr_rule->af == AF_UNSPEC) + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_SETCURSEL, (WPARAM)0, 0); + + else if (ptr_rule->af == AF_INET) + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_SETCURSEL, (WPARAM)1, 0); + + else if (ptr_rule->af == AF_INET6) + SendDlgItemMessage (hwnd, IDC_RULE_VERSION_ID, CB_SETCURSEL, (WPARAM)2, 0); + + _r_ctrl_enable (hwnd, IDC_RULE_VERSION_ID, !ptr_rule->is_readonly); + } + // rule (remote) if (GetDlgItem (hwnd, IDC_RULE_REMOTE_ID)) { @@ -1056,6 +1082,7 @@ INT_PTR CALLBACK EditorProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) } ptr_rule->protocol = (UINT8)SendDlgItemMessage (hpage_general, IDC_RULE_PROTOCOL_ID, CB_GETITEMDATA, SendDlgItemMessage (hpage_general, IDC_RULE_PROTOCOL_ID, CB_GETCURSEL, 0, 0), 0); + ptr_rule->af = (ADDRESS_FAMILY)SendDlgItemMessage (hpage_general, IDC_RULE_VERSION_ID, CB_GETITEMDATA, SendDlgItemMessage (hpage_general, IDC_RULE_VERSION_ID, CB_GETCURSEL, 0, 0), 0); ptr_rule->direction = _r_calc_clamp (FWP_DIRECTION, _r_ctrl_isradiobuttonchecked (hpage_general, IDC_RULE_DIRECTION_OUTBOUND, IDC_RULE_DIRECTION_ANY) - IDC_RULE_DIRECTION_OUTBOUND, (INT)FWP_DIRECTION_OUTBOUND, (INT)FWP_DIRECTION_MAX); ptr_rule->is_block = _r_ctrl_isradiobuttonchecked (hpage_general, IDC_RULE_ACTION_BLOCK, IDC_RULE_ACTION_ALLOW) == IDC_RULE_ACTION_BLOCK; diff --git a/src/resource.hpp b/src/resource.hpp index dbf93bdf..8496df0d 100644 --- a/src/resource.hpp +++ b/src/resource.hpp @@ -165,109 +165,111 @@ #define IDC_RULE_ACTION_ALLOW 212 #define IDC_RULE_PROTOCOL 213 #define IDC_RULE_PROTOCOL_ID 214 -#define IDC_RULE_REMOTE 215 -#define IDC_RULE_REMOTE_ID 216 -#define IDC_RULE_REMOTE_ADD 217 -#define IDC_RULE_REMOTE_EDIT 218 -#define IDC_RULE_REMOTE_DELETE 219 -#define IDC_RULE_LOCAL 220 -#define IDC_RULE_LOCAL_ID 221 -#define IDC_RULE_LOCAL_ADD 222 -#define IDC_RULE_LOCAL_EDIT 223 -#define IDC_RULE_LOCAL_DELETE 224 -#define IDC_RULE_APPS_ID 225 -#define IDC_RULE_APPS_HINT 226 -#define IDC_RULE 227 -#define IDC_RULE_ID 228 -#define IDC_RULE_HINT 229 -#define IDC_ENABLE_CHK 230 +#define IDC_RULE_VERSION 215 +#define IDC_RULE_VERSION_ID 216 +#define IDC_RULE_REMOTE 217 +#define IDC_RULE_REMOTE_ID 218 +#define IDC_RULE_REMOTE_ADD 219 +#define IDC_RULE_REMOTE_EDIT 220 +#define IDC_RULE_REMOTE_DELETE 221 +#define IDC_RULE_LOCAL 222 +#define IDC_RULE_LOCAL_ID 223 +#define IDC_RULE_LOCAL_ADD 224 +#define IDC_RULE_LOCAL_EDIT 225 +#define IDC_RULE_LOCAL_DELETE 226 +#define IDC_RULE_APPS_ID 227 +#define IDC_RULE_APPS_HINT 228 +#define IDC_RULE 229 +#define IDC_RULE_ID 230 +#define IDC_RULE_HINT 231 +#define IDC_ENABLE_CHK 232 // Main Menu -#define IDM_SETTINGS 231 -#define IDM_ADD_FILE 232 -#define IDM_IMPORT 233 -#define IDM_EXPORT 234 -#define IDM_EXIT 235 -#define IDM_PURGE_UNUSED 236 -#define IDM_PURGE_TIMERS 237 -#define IDM_FIND 238 -#define IDM_FINDNEXT 239 -#define IDM_REFRESH 240 -#define IDM_ALWAYSONTOP_CHK 241 -#define IDM_SHOWFILENAMESONLY_CHK 242 -#define IDM_AUTOSIZECOLUMNS_CHK 243 -#define IDM_VIEW_ICON 244 -#define IDM_VIEW_DETAILS 245 -#define IDM_VIEW_TILE 246 -#define IDM_SIZE_SMALL 247 -#define IDM_SIZE_LARGE 248 -#define IDM_SIZE_EXTRALARGE 249 -#define IDM_ICONSISHIDDEN 250 -#define IDM_FONT 251 -#define IDM_CONNECTIONS_TITLE 252 -#define IDM_RULE_BLOCKOUTBOUND 253 -#define IDM_RULE_BLOCKINBOUND 254 -#define IDM_RULE_ALLOWLOOPBACK 255 -#define IDM_RULE_ALLOW6TO4 256 -#define IDM_SECURITY_TITLE 257 -#define IDM_SECUREFILTERS_CHK 258 -#define IDM_USESTEALTHMODE_CHK 259 -#define IDM_INSTALLBOOTTIMEFILTERS_CHK 260 -#define IDM_ADVANCED_TITLE 261 -#define IDM_USENETWORKRESOLUTION_CHK 262 -#define IDM_USECERTIFICATES_CHK 263 -#define IDM_USEREFRESHDEVICES_CHK 264 -#define IDM_BLOCKLIST_SPY_TITLE 265 -#define IDM_BLOCKLIST_SPY_DISABLE 266 -#define IDM_BLOCKLIST_SPY_ALLOW 267 -#define IDM_BLOCKLIST_SPY_BLOCK 268 -#define IDM_BLOCKLIST_UPDATE_TITLE 269 -#define IDM_BLOCKLIST_UPDATE_DISABLE 270 -#define IDM_BLOCKLIST_UPDATE_ALLOW 271 -#define IDM_BLOCKLIST_UPDATE_BLOCK 272 -#define IDM_BLOCKLIST_EXTRA_TITLE 273 -#define IDM_BLOCKLIST_EXTRA_DISABLE 274 -#define IDM_BLOCKLIST_EXTRA_ALLOW 275 -#define IDM_BLOCKLIST_EXTRA_BLOCK 276 -#define IDM_WEBSITE 277 -#define IDM_CHECKUPDATES 278 -#define IDM_DONATE 279 -#define IDM_ABOUT 280 +#define IDM_SETTINGS 233 +#define IDM_ADD_FILE 234 +#define IDM_IMPORT 235 +#define IDM_EXPORT 236 +#define IDM_EXIT 237 +#define IDM_PURGE_UNUSED 238 +#define IDM_PURGE_TIMERS 239 +#define IDM_FIND 240 +#define IDM_FINDNEXT 241 +#define IDM_REFRESH 242 +#define IDM_ALWAYSONTOP_CHK 243 +#define IDM_SHOWFILENAMESONLY_CHK 244 +#define IDM_AUTOSIZECOLUMNS_CHK 245 +#define IDM_VIEW_ICON 246 +#define IDM_VIEW_DETAILS 247 +#define IDM_VIEW_TILE 248 +#define IDM_SIZE_SMALL 249 +#define IDM_SIZE_LARGE 250 +#define IDM_SIZE_EXTRALARGE 251 +#define IDM_ICONSISHIDDEN 252 +#define IDM_FONT 253 +#define IDM_CONNECTIONS_TITLE 254 +#define IDM_RULE_BLOCKOUTBOUND 255 +#define IDM_RULE_BLOCKINBOUND 256 +#define IDM_RULE_ALLOWLOOPBACK 257 +#define IDM_RULE_ALLOW6TO4 258 +#define IDM_SECURITY_TITLE 259 +#define IDM_SECUREFILTERS_CHK 260 +#define IDM_USESTEALTHMODE_CHK 261 +#define IDM_INSTALLBOOTTIMEFILTERS_CHK 262 +#define IDM_ADVANCED_TITLE 263 +#define IDM_USENETWORKRESOLUTION_CHK 264 +#define IDM_USECERTIFICATES_CHK 265 +#define IDM_USEREFRESHDEVICES_CHK 266 +#define IDM_BLOCKLIST_SPY_TITLE 267 +#define IDM_BLOCKLIST_SPY_DISABLE 268 +#define IDM_BLOCKLIST_SPY_ALLOW 269 +#define IDM_BLOCKLIST_SPY_BLOCK 270 +#define IDM_BLOCKLIST_UPDATE_TITLE 271 +#define IDM_BLOCKLIST_UPDATE_DISABLE 272 +#define IDM_BLOCKLIST_UPDATE_ALLOW 273 +#define IDM_BLOCKLIST_UPDATE_BLOCK 274 +#define IDM_BLOCKLIST_EXTRA_TITLE 275 +#define IDM_BLOCKLIST_EXTRA_DISABLE 276 +#define IDM_BLOCKLIST_EXTRA_ALLOW 277 +#define IDM_BLOCKLIST_EXTRA_BLOCK 278 +#define IDM_WEBSITE 279 +#define IDM_CHECKUPDATES 280 +#define IDM_DONATE 281 +#define IDM_ABOUT 282 // Tray Menu -#define IDM_TRAY_SHOW 281 -#define IDM_TRAY_START 282 -#define IDM_TRAY_ENABLENOTIFICATIONS_CHK 283 -#define IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK 284 -#define IDM_TRAY_NOTIFICATIONONTRAY_CHK 285 -#define IDM_TRAY_ENABLELOG_CHK 286 -#define IDM_TRAY_ENABLEUILOG_CHK 287 -#define IDM_TRAY_LOGSHOW 288 -#define IDM_TRAY_LOGCLEAR 289 -#define IDM_TRAY_LOGSHOW_ERR 290 -#define IDM_TRAY_LOGCLEAR_ERR 291 -#define IDM_TRAY_SETTINGS 292 -#define IDM_TRAY_WEBSITE 293 -#define IDM_TRAY_ABOUT 294 -#define IDM_TRAY_EXIT 295 +#define IDM_TRAY_SHOW 283 +#define IDM_TRAY_START 284 +#define IDM_TRAY_ENABLENOTIFICATIONS_CHK 285 +#define IDM_TRAY_ENABLENOTIFICATIONSSOUND_CHK 286 +#define IDM_TRAY_NOTIFICATIONONTRAY_CHK 287 +#define IDM_TRAY_ENABLELOG_CHK 288 +#define IDM_TRAY_ENABLEUILOG_CHK 289 +#define IDM_TRAY_LOGSHOW 290 +#define IDM_TRAY_LOGCLEAR 291 +#define IDM_TRAY_LOGSHOW_ERR 292 +#define IDM_TRAY_LOGCLEAR_ERR 293 +#define IDM_TRAY_SETTINGS 294 +#define IDM_TRAY_WEBSITE 295 +#define IDM_TRAY_ABOUT 296 +#define IDM_TRAY_EXIT 297 // Listview Menu -#define IDM_DISABLENOTIFICATIONS 296 -#define IDM_EDITRULES 297 -#define IDM_OPENRULESEDITOR 298 -#define IDM_COPY 299 -#define IDM_COPY2 300 -#define IDM_CHECK 301 -#define IDM_UNCHECK 302 -#define IDM_DELETE 303 -#define IDM_DISABLETIMER 304 -#define IDM_PROPERTIES 305 -#define IDM_NETWORK_CLOSE 306 +#define IDM_DISABLENOTIFICATIONS 298 +#define IDM_EDITRULES 299 +#define IDM_OPENRULESEDITOR 300 +#define IDM_COPY 301 +#define IDM_COPY2 302 +#define IDM_CHECK 303 +#define IDM_UNCHECK 304 +#define IDM_DELETE 305 +#define IDM_DISABLETIMER 306 +#define IDM_PROPERTIES 307 +#define IDM_NETWORK_CLOSE 308 -#define IDM_NOTIMER 307 +#define IDM_NOTIMER 309 -#define IDM_SELECT_ALL 308 -#define IDM_ZOOM 309 +#define IDM_SELECT_ALL 310 +#define IDM_ZOOM 311 #define IDX_LANGUAGE 1000 #define IDX_TIMER 1200 diff --git a/src/resource.rc b/src/resource.rc index 2a48dc1c..593e93f3 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -243,7 +243,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "Ms Shell Dlg" BEGIN GROUPBOX "", IDC_RULE_NAME, 6, 6, 274, 32, WS_GROUP - EDITTEXT IDC_RULE_NAME_ID, 12, 18, 132, 12, WS_TABSTOP | ES_AUTOHSCROLL + EDITTEXT IDC_RULE_NAME_ID, 12, 18, 262, 12, WS_TABSTOP | ES_AUTOHSCROLL GROUPBOX "", IDC_RULE_DIRECTION, 6, 40, 274, 52, WS_GROUP AUTORADIOBUTTON "", IDC_RULE_DIRECTION_OUTBOUND, 12, 52, 246, 10 @@ -254,8 +254,11 @@ BEGIN AUTORADIOBUTTON "", IDC_RULE_ACTION_BLOCK, 12, 106, 246, 10 AUTORADIOBUTTON "", IDC_RULE_ACTION_ALLOW, 12, 118, 246, 10 - GROUPBOX "", IDC_RULE_PROTOCOL, 6, 136, 274, 34, WS_GROUP - COMBOBOX IDC_RULE_PROTOCOL_ID, 12, 150, 132, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + GROUPBOX "", IDC_RULE_PROTOCOL, 6, 136, 134, 34, WS_GROUP + COMBOBOX IDC_RULE_PROTOCOL_ID, 12, 150, 122, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + + GROUPBOX "", IDC_RULE_VERSION, 146, 136, 134, 34, WS_GROUP + COMBOBOX IDC_RULE_VERSION_ID, 152, 150, 122, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END IDD_EDITOR_RULE DIALOGEX 0, 0, 292, 210