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]/msg00314.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]
==================================================================