Board index » cppbuilder » MAC address of network adapter

MAC address of network adapter


2005-08-14 08:33:54 PM
cppbuilder82
Hello,
Is anybody could tell me how to find the Unique MAC Adresse of the installed
Network boards.
Thanks in advance
JC.Berlani
 
 

Re:MAC address of network adapter

Quote
Is anybody could tell me how to find the Unique MAC
Adresse of the installed
Network boards.
Here you go:
community.borland.com/article/0,1410,26040,00.html
==========================
Stefano Frosio
www.esse-effe.com
==========================
 

Re:MAC address of network adapter

"Stefano Frosio" < XXXX@XXXXX.COM >wrote in
message news: XXXX@XXXXX.COM ...
Quote
Here you go:

community.borland.com/article/0,1410,26040,00.html
There is a 4th way that tends to be better - call the Win32 API
GetAdaptersInfo() function instead. The IP_ADAPTER_INFO structure has an
Address member that is the MAC address.
Gambit
 

{smallsort}

Re:MAC address of network adapter

Yes, I use that method also.
But if it is the question of getting the *unique* hardware
ID based on MAC, than I think that the string:
"444553540000"
... that sometimes can be returned should be skipped.
It has something with modems and dial-up (PPP).
--
Best regards,
Vladimir Stefanovic
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Stefano Frosio" < XXXX@XXXXX.COM >wrote in
message news: XXXX@XXXXX.COM ...

>Here you go:
>
>community.borland.com/article/0,1410,26040,00.html

There is a 4th way that tends to be better - call the Win32 API
GetAdaptersInfo() function instead. The IP_ADAPTER_INFO structure has an
Address member that is the MAC address.


Gambit


 

Re:MAC address of network adapter

GetAdaptersInfo() returns info on all types of network adapters, that
includes, loop-back, NIC, modems, dial-up's and VPN. If your looking for
the NIC then you need to examine the value of IP_ADAPTER_INFO.Type.
"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
Yes, I use that method also.

But if it is the question of getting the *unique* hardware
ID based on MAC, than I think that the string:

 

Re:MAC address of network adapter

Hello,
Thanks for your answer.
I already write a program which use the function GetAdaptersInfo() and I
used it on many computers. But on one new computer type which use Windows XP
too, this
function give me a wrong MAC address . Then I look on microsoft site at the
following address :
msdn.microsoft.com/library/default.asp
and on the top of page there is:
Windows Server 2003 and Windows XP: Use the GetAdaptersAddresses function
instead of GetAdaptersInfo.
I am interested to try this function but unfortunatly I do not find some
declaration like PIP_ADAPTER_ADDRESSES and so on. Is anybody know where we
can find this kind of files descriptions ?
Thanks
JC.Berlani
My operating system is Windows XP
"Stefano Frosio" < XXXX@XXXXX.COM >a écrit dans le
message de news: XXXX@XXXXX.COM ...
Quote
>Is anybody could tell me how to find the Unique MAC
Adresse of the installed
>Network boards.

Here you go:

community.borland.com/article/0,1410,26040,00.html

==========================
Stefano Frosio
www.esse-effe.com
==========================


 

Re:MAC address of network adapter

What do you mean the wrong MAC address? GetAdapterInfo() works fine on all
our machines using XP (home, professional, SP1, SP2) and Win2003. What does
your code look like? As I mentioned before, GetAdapterInfo() can be used to
return information on many different adapters, you need to examine the Type
value of the IP_ADAPTER_INFO structure. Also, I have found that Windows
does not always preserve the order in which your adapters appear in the
list.
"Berlani" < XXXX@XXXXX.COM >wrote in message
Quote
Hello,

Thanks for your answer.
I already write a program which use the function GetAdaptersInfo() and I
used it on many computers. But on one new computer type which use Windows
XP
too, this
function give me a wrong MAC address . Then I look on microsoft site at
the
following address :


msdn.microsoft.com/library/default.asp

and on the top of page there is:

Windows Server 2003 and Windows XP: Use the GetAdaptersAddresses function
instead of GetAdaptersInfo.

I am interested to try this function but unfortunatly I do not find some
declaration like PIP_ADAPTER_ADDRESSES and so on. Is anybody know where we
can find this kind of files descriptions ?

Thanks

JC.Berlani

My operating system is Windows XP
"Stefano Frosio" < XXXX@XXXXX.COM >a écrit dans
le
message de news: XXXX@XXXXX.COM ...
>>Is anybody could tell me how to find the Unique MAC
>Adresse of the installed
>>Network boards.
>
>Here you go:
>
>community.borland.com/article/0,1410,26040,00.html
>
>==========================
>Stefano Frosio
>www.esse-effe.com
>==========================
>
>


 

Re:MAC address of network adapter

Berlani < XXXX@XXXXX.COM >wrote:
Quote
I already write a program which use the function GetAdaptersInfo() and I
used it on many computers. But on one new computer type which use Windows
XP
too, this
function give me a wrong MAC address . Then I look on microsoft site at
the
following address :


msdn.microsoft.com/library/default.asp
us/iphlp/iphlp/getadaptersinfo.asp

The code snippet from that page may not be accurate.
Replace:
printf("\tAdapter Addr: \t%ld\n", pAdapter->Address);
With:
printf("\tAdapter Addr: \t");
for (int i = 0; i < (int) pAdapter->AddressLength; i++)
printf("%02X ", (BYTE) pAdapter->Address[i]);
printf("\n");
The web site where i saw that adjustment is:
www.voidnish.com/FreeTools.aspx
--
JF Jolin