Im using the program below, running as Win32 console application. The
WinPcap version is 3.1 beta4 (packet.dll version 3.1.0.24) running on
Win2000, SP4. (For clarity, I have removed all stuff not related to
WinPcap.)

The program runs fine when running stand-alone. However, when running under
the Visual Studio.NET 2003 debugger, the call to pcap_findalldevs_ex causes
an error "Unhandled exception at 0x6a55ac84: 0xC0000005: Access violation
reading location 0x6a55ac84." This happens whenever a breakpoint is set
anywhere before the call to pcap_findalldevs_ex. When no breakpoint is set,
the program runs ok.

I have seen some similar problems reportd in older threads, but I have not
found any solution. Does anybody have a clue?

Bernard

int _tmain(int argc, _TCHAR* argv[])
{
   pcap_if_t *alldevs;
   pcap_if_t *xcpdev;
   char errbuf[PCAP_ERRBUF_SIZE+1];
   u_char packet[1500];
   int i;

   printf("Starting _tmain\n");

   /* Retrieve the interfaces list */
   if (pcap_findalldevs_ex("rpcap://", NULL, &alldevs, errbuf) == -1)
   {
      fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n",errbuf);
      exit(1);
   }

   /* Scan the list printing every entry */
   for(xcpdev=alldevs;xcpdev;xcpdev=xcpdev->next)
   {
      pcap_addr_t *a = xcpdev->addresses;
      if (a && a->addr)
      {
         if (((struct sockaddr_in *)a->addr)->sin_addr.s_addr == 0x02B2A8C0)
         {
            printf("\tDescription: %s\n",xcpdev->description);
            break;
         }
      }
   }

   if (!xcpdev)
   {
      printf("Not found adapter with IP address 192.168.178.2\n");
      return 2;
   }

    /* Open the output device */
    if ( (fp= pcap_open(xcpdev->name,       // name of the device
                        100,                // portion of the packet to
capture (only the first 100 bytes)
                        PCAP_OPENFLAG_PROMISCUOUS,  // promiscuous mode
                        1000,               // read timeout
                        NULL,               // authentication on the remote
machine
                        errbuf              // error buffer
                        ) ) == NULL)
    {
        fprintf(stderr,"\nUnable to open the adapter. %s is not supported by
WinPcap\n", argv[1]);
        return -2;
    }

/* ... do dome receive and transmit here ... */
}

-- 
+++ Sparen Sie mit GMX DSL +++ http://www.gmx.net/de/go/dsl
AKTION fr Wechsler: DSL-Tarife ab 3,99 EUR/Monat + Startguthaben


==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/winpcap-users@winpcap.polito.it/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]
==================================================================

Reply via email to