From bf8469722f7cea547a8b0549532f3fe26d88eb2e Mon Sep 17 00:00:00 2001 From: fbernon Date: Sun, 23 Dec 2007 15:10:27 +0000 Subject: [PATCH] Minor change in Win32 port: add the adapter's vendor description display --- ports/win32/pktdrv.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ports/win32/pktdrv.c b/ports/win32/pktdrv.c index e2c1b91..a6639a4 100644 --- a/ports/win32/pktdrv.c +++ b/ports/win32/pktdrv.c @@ -80,6 +80,8 @@ #define PACKET_ADAPTER_BUFSIZE 512000 #define PACKET_INPUT_BUFSIZE 256000 +#define PACKET_OID_DATA_SIZE 255 + /* Packet Adapter informations */ struct packet_adapter { input_fn input; @@ -172,12 +174,23 @@ init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg) return NULL; } /* set up the selected adapter */ - ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + ETHARP_HWADDR_LEN); pa->lpAdapter = PacketOpenAdapter(AdapterList[adapter_num]); if (!pa->lpAdapter || (pa->lpAdapter->hFile == INVALID_HANDLE_VALUE)) { free(pa); return NULL; } + /* alloc the OID packet */ + ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + PACKET_OID_DATA_SIZE); + if (!ppacket_oid_data) { + free(pa); + return NULL; + } + /* get the description of the selected adapter */ + ppacket_oid_data->Oid = OID_GEN_VENDOR_DESCRIPTION; + ppacket_oid_data->Length = PACKET_OID_DATA_SIZE; + if (PacketRequest(pa->lpAdapter, FALSE, ppacket_oid_data)) { + printf("USE: %s\n", ppacket_oid_data->Data); + } /* get the MAC address of the selected adapter */ ppacket_oid_data->Oid = OID_802_3_PERMANENT_ADDRESS; ppacket_oid_data->Length = ETHARP_HWADDR_LEN;