From: "Alex Vinokur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Getting MAC address within C/C++-program Date: Sat, 31 Aug 2002 18:11:55 +0200 Lines: 75 Message-ID: References: <3D706C40 DOT 1C7B6085 AT phekda DOT freeserve DOT co DOT uk> NNTP-Posting-Host: pop03-2-ras1-p2.barak.net.il (212.150.97.2) X-Trace: fu-berlin.de 1030806735 53020493 212.150.97.2 (16 [79865]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Richard Dawe" wrote in message news:3D706C40 DOT 1C7B6085 AT phekda DOT freeserve DOT co DOT uk... > Hello. > > Alex Vinokur wrote: > > Is it possible to get MAC address within C/C++-program ? > > On which operating system? Windows 2000 DJGPP 2.03 > There is no method that will work on DOS and all > versions of Windows. > > 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 This info was supplied by Noël Danjou - thanks. 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: a.. "IpAddress" of type REG_MULTI_SZ (multiple nul-terminated strings), which contains all the static IP addresses or "0.0.0.0" if there are none; b.. "DhcpIpAddress" (optional) of type REG_SZ (nul-terminated string), which contains the dynamic IP address. ====== END ======== From where can I get MAC Address within my C/C++ program ? > > 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 ? >Then your program would run the helper program, to get the MAC address. > > HTH, bye, > > -- > Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ] Thanks, ================== Alex Vinokur mailto:alexvn AT go DOT to http://up.to/alexvn ==================