Greetings from Software Guru Associates:

I know methods that allows user to query the MAC address in a NIC card
at runtime. You need to do some research in DDK for NIC MAC. All the
information about the MAC address that tied into NIC card are locate in
Registry. 

Mike


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 24, 2003 4:04 PM
To: [EMAIL PROTECTED]
Subject: RE: [WinPcap-users] Cannot get the local MAC Address


Greetings,

I hear your frustration and I feel your pain.  A few weeks ago, I was
looking for the same thing.  In the end, I decided to settle for the
approach of using Win32 IPHlpAPI functions to pair the IP addresses and
MAC addresses, and then used the IP address information from
pcap_findalldevs() to pair up the MAC address returned from M$ to the
adapter information returned from WinPcap... not the most elegant
solution, but it works reliably.

SLH.

> 
> Hello,
> 
> I'm sorry to insist but I'm still looking for a solution to
> retrieve the MAC
> address using WinpCat lib.
> I browsed the Winpcap source code and I found (Packet32.c) different
> exemples of how to use the PacketRequest() method.
> With the snapshop below, I can retrieve some information like 
> the "vendor
> description" (OID_GEN_VENDOR_DESCRIPTION) but not the MAC 
> address (either
> using CURRENT or PERMANENT OID).
> I also found in the mailing list archive some emails exchanged on this
> topic.
> I tried to compile the "code" found in
> http://www.mail-archive.com/[EMAIL PROTECTED]/ms
> g00314.html
> but I got an "undefined symbol": "prmacaddr"
> I also found another code example (ViewNIC.zip) to retrieve 
> both the IP and
> the MAC address but If I'm correct this tool uses SNMP to do that.
> I'm just wondering if there is a way to get both the IP and the MAC
> addresses on the local host using Winpcap using for instance 
> PacketRequest
> or another method. I would appreciate if someone could help 
> me and/or send
> me some code examples.
> Thanks for your help,
> Pierre.
> 
> 
>   BOOLEAN    status;
>   ULONG      
> ioCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1);
>   PPACKET_OID_DATA  oidData;
> 
>   oidData=(PPACKET_OID_DATA)GlobalAllocPtr(GMEM_MOVEABLE |
> GMEM_ZEROINIT,
> 256);
> 
>   LPADAPTER lpAdapter = 
> PacketOpenAdapter((char*)(LPCSTR)localAdapters.GetAt(i));
>   PacketSetHwFilter(lpAdapter,NDIS_PACKET_TYPE_ALL_LOCAL);
> 
>   //oidData->Oid = OID_802_3_CURRENT_ADDRESS;
>   oidData->Oid = OID_802_3_PERMANENT_ADDRESS;
>   oidData->Length = 256;
>   ZeroMemory(oidData->Data,256);
>   status = PacketRequest(lpAdapter,FALSE,oidData);
>   if(status==0 || ((char*)oidData->Data)[0]==0)
>   {
>     AfxMessageBox("Cannot retrieve the MAC Address");
>   }
>   else
>   {
>     AfxMessageBox((char*)(oidData->Data));
>   }
> 
> 
> 
> 
> ==================================================================
>  This is the WinPcap users list. It is archived at  
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> 
>  To unsubscribe use
>  mailto: [EMAIL PROTECTED]
> ==================================================================
> 


======================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

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


================================================================= This is the WinPcap 
users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

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

Reply via email to