www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/08/31/14:30:05

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Getting MAC address within C/C++-program
Date: Sat, 31 Aug 2002 18:55:06 +0100
Lines: 55
Message-ID: <3D7102FA.3E7DBC75@phekda.freeserve.co.uk>
References: <akktt3$1jlh9p$1 AT ID-79865 DOT news DOT dfncis DOT de> <3D706C40 DOT 1C7B6085 AT phekda DOT freeserve DOT co DOT uk> <akqmce$1ii1qd$1 AT ID-79865 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: modem-79.medroxyprogest.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news5.svr.pol.co.uk 1030817774 19594 62.136.88.207 (31 Aug 2002 18:16:14 GMT)
NNTP-Posting-Date: 31 Aug 2002 18:16:14 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Alex Vinokur wrote:
> 
> "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk> wrote in message news:3D706C40 DOT 1C7B6085 AT phekda DOT freeserve DOT co DOT uk...
[snip]
> > You can use RegDos to read the registry on Windows '95, '98 and ME. Then
> > you can obtain the MAC address. See:
> >
> >     http://www.phekda.freeserve.co.uk/richdawe/dl/winnetip.htm
> 
> Here is a fragment of that file :
> 
> ====== BEGIN ======
> Windows 2000
[snip]
> Network Cards
> Like Windows NT, Windows 2000 stores its configuration data in the registry. A list of network cards is stored under this key:
> 
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards
> 
> Each network card has a subkey with values. The "Description" value contains a human-friendly description. The "ServiceName" value
> contains a GUID (globally-unique identifier?) (cf. Windows NT, which has a name here).
> 
> The IP data for the network card is then found off this key:
> 
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
> 
> Each network has a key of the form "{GUID}", e.g. "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", where each "x" represents a hexidecimal
> digit. Each of the GUID keys has values for lease times, subnet masks and IP addresses. For IP addresses there are two possible
> values:
[snip]
> From where can I get MAC Address within my C/C++ program ?

It is possible that there is a MAC address under each {GUID}. I don't know - I
don't have Windows 2000.

Have you looked in the registry using regedit?

But I strongly suggest that you avoid using the registry.

> >
> > There are other methods, but they are for Windows programs. The Winsock
> > Programmer's FAQ details how.
> >
> > You could write a small helper Windows program to return the MAC address.
> 
> The same question : From where can I get MAC Address within my C/C++ program ?

Read the Windows Programmer's FAQ. There is a FAQ on how to obtain MACs.

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019