From 057a2aa844502908eb96f10ad77735a284bb0f38 Mon Sep 17 00:00:00 2001 From: Daniel Collins Date: Sun, 24 Apr 2011 22:01:04 +0000 Subject: [PATCH] Added checkbox to toggle broadcasting to all subnets in configuration program. --- src/ipxconfig.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ipxconfig.cpp b/src/ipxconfig.cpp index c8a190b..77ae7d5 100644 --- a/src/ipxconfig.cpp +++ b/src/ipxconfig.cpp @@ -35,6 +35,7 @@ #define ID_NIC_NODE 6 #define ID_W95_BUG 7 #define ID_UDP_BTN 8 +#define ID_BCAST_ALL 9 #define ID_DIALOG_TXT 1 #define ID_DIALOG_OK 2 @@ -62,6 +63,7 @@ struct reg_value { struct reg_global { uint16_t udp_port; unsigned char w95_bug; + unsigned char bcast_all; } __attribute__((__packed__)); typedef std::vector iface_list; @@ -98,6 +100,7 @@ static struct { HWND global_conf; HWND w95_bug; + HWND bcast_all; HWND button_box; } windows; @@ -187,6 +190,10 @@ static LRESULT CALLBACK main_wproc(HWND window, UINT msg, WPARAM wp, LPARAM lp) addr_input_dialog("UDP port", NULL, 2); break; + case ID_BCAST_ALL: + global_conf.bcast_all = Button_GetCheck(windows.bcast_all) == BST_CHECKED; + break; + default: break; } @@ -401,6 +408,7 @@ int main() { if(!regkey || RegQueryValueEx(regkey, "global", NULL, NULL, (BYTE*)&global_conf, &gsize) != ERROR_SUCCESS || gsize != sizeof(global_conf)) { global_conf.udp_port = PORT; global_conf.w95_bug = 1; + global_conf.bcast_all = 0; } get_nics(); @@ -596,12 +604,13 @@ static void init_windows() { } { - windows.global_conf = create_child(windows.main, 0, 0, 0, text_h + row_h + 10, "BUTTON", "Global settings", BS_GROUPBOX); + windows.global_conf = create_child(windows.main, 0, 0, 0, text_h + 2*row_h + 15, "BUTTON", "Global settings", BS_GROUPBOX); int cbox_w = get_text_width(windows.global_conf, "Enable Win 95 SO_BROADCAST bug"); create_child(windows.global_conf, 10, text_h, btn_w, row_h, "BUTTON", "Set UDP port...", BS_PUSHBUTTON | WS_TABSTOP, 0, ID_UDP_BTN); windows.w95_bug = create_child(windows.global_conf, btn_w+20, text_h, cbox_w, row_h, "BUTTON", "Enable Win 95 SO_BROADCAST bug", BS_AUTOCHECKBOX | WS_TABSTOP, 0, ID_W95_BUG); + windows.bcast_all = create_child(windows.global_conf, btn_w+20, text_h+row_h+5, cbox_w, row_h, "BUTTON", "Send broadcasts to all subnets", BS_AUTOCHECKBOX | WS_TABSTOP, 0, ID_BCAST_ALL); Button_SetCheck(windows.w95_bug, global_conf.w95_bug ? BST_CHECKED : BST_UNCHECKED); }