ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Windows/prefs_editor_gtk.cpp
(Generate patch)

Comparing BasiliskII/src/Windows/prefs_editor_gtk.cpp (file contents):
Revision 1.9 by gbeauche, 2005-11-29T20:54:57Z vs.
Revision 1.10 by gbeauche, 2005-11-29T22:59:44Z

# Line 32 | Line 32
32   #include "xpram.h"
33   #include "prefs.h"
34   #include "prefs_editor.h"
35 + #include "b2ether/inc/b2ether_hl.h"
36  
37  
38   // Global variables
# Line 1321 | Line 1322 | static void create_serial_pane(GtkWidget
1322   static GtkWidget *w_ether;
1323   static GtkWidget *w_ftp_port_list, *w_tcp_port_list;
1324   static const char s_nat_router[] = "NAT/Router module";
1325 + static const char s_ndis_tag[] = "NDIS ";
1326  
1327   // Set sensitivity of widgets
1328   static void set_ethernet_sensitive(void)
# Line 1336 | Line 1338 | static void set_ethernet_sensitive(void)
1338   static void read_ethernet_settings(void)
1339   {
1340          const char *str = gtk_entry_get_text(GTK_ENTRY(w_ether));
1341 <        if (str && strlen(str) > 6 && strncmp(str, "NDIS: ", 6) == 0)
1342 <                PrefsReplaceString("ether", &str[6]);
1341 >        if (str && strlen(str) > sizeof(s_ndis_tag) && strncmp(str, s_ndis_tag, sizeof(s_ndis_tag) - 1) == 0)
1342 >                PrefsReplaceString("ether", &str[sizeof(s_ndis_tag) - 1]);
1343          else
1344                  PrefsRemoveItem("ether");
1345  
# Line 1358 | Line 1360 | static void cb_ether_changed(...)
1360   }
1361  
1362   // Add names of ethernet interfaces
1363 + // XXX use radio buttons instead (None/NDIS/NAT)
1364   static GList *add_ether_names(void)
1365   {
1366          GList *glist = NULL;
1367  
1365        // TODO: Get list of all Ethernet interfaces
1366        glist = g_list_append(glist, (void *)s_nat_router);
1368          glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB));
1369 +        glist = g_list_append(glist, (void *)s_nat_router);
1370 +
1371 +        {       // Get NDIS ethernet adapters (XXX handle "ethermulticastmode")
1372 +                PacketOpenAdapter("", 0);
1373 +                {
1374 +                        ULONG sz;
1375 +                        char names[1024];
1376 +                        sz = sizeof(names);
1377 +                        if (PacketGetAdapterNames(NULL, names, &sz) == ERROR_SUCCESS) {
1378 +                                char *p = names;
1379 +                                while (*p) {
1380 +                                        const char DEVICE_HEADER[] = "\\Device\\B2ether_";
1381 +                                        if (strnicmp(p, DEVICE_HEADER, sizeof(DEVICE_HEADER) - 1) == 0) {
1382 +                                                LPADAPTER fd = PacketOpenAdapter(p + sizeof(DEVICE_HEADER) - 1, 0);
1383 +                                                if (fd) {
1384 +                                                        char str[256];
1385 +                                                        sprintf(str, "%s%s", s_ndis_tag, p + sizeof(DEVICE_HEADER) - 1);
1386 +                                                        glist = g_list_append(glist, strdup(str));
1387 +                                                        PacketCloseAdapter(fd);
1388 +                                                }
1389 +                                        }
1390 +                                        p += strlen(p) + 1;
1391 +                                }
1392 +                        }
1393 +                }
1394 +                PacketCloseAdapter(NULL);
1395 +        }
1396          return glist;
1397   }
1398  
# Line 1392 | Line 1420 | static void create_ethernet_pane(GtkWidg
1420                  else
1421                          str = GetString(STR_NONE_LAB);
1422          }
1423 +        else if (str[0] == '{') {
1424 +                static char s_device[256];
1425 +                sprintf(s_device, "%s%s", s_ndis_tag, str);
1426 +                str = s_device;
1427 +        }
1428          gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
1429          gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
1430          w_ether = GTK_COMBO(combo)->entry;
# Line 1579 | Line 1612 | uint8 XPRAM[XPRAM_SIZE];
1612   void MountVolume(void *fh) { }
1613   void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size) { }
1614   void WarningAlert(const char *text) { }
1615 + void recycle_write_packet(LPPACKET) { }
1616 + VOID CALLBACK packet_read_completion(DWORD, DWORD, LPOVERLAPPED) { }
1617  
1618  
1619   /*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines