Article View: borland.public.cppbuilder.nativeapi
Article #8391Re: get disk serial number
From: Mark Jacobs
Date: Thu, 28 Oct 2004 13:00
Date: Thu, 28 Oct 2004 13:00
34 lines
2152 bytes
2152 bytes
To get the MAC address(es), you can use this routine I wrote :-
AnsiString mjgetnicinfo()
{
IP_ADAPTER_INFO AdapterInfo[16];
AnsiString retv=""; unsigned int ii;
DWORD dwBufLen,dwStatus;
dwBufLen=sizeof(AdapterInfo);
dwStatus=GetAdaptersInfo(AdapterInfo,&dwBufLen);
if (dwStatus!=ERROR_SUCCESS) return "**Could not Obtain NIC Info";
PIP_ADAPTER_INFO pAdapterInfo=AdapterInfo;
do
{
retv+="Name :"+AnsiString(pAdapterInfo->AdapterName)+
"\r\nDescription :"+AnsiString(pAdapterInfo->Description)+"\r\nMAC :";
for (ii=0;ii<pAdapterInfo->AddressLength;++ii)
retv+=IntToHex(pAdapterInfo->Address[ii],2)+" ";
retv+="\r\n"; pAdapterInfo=pAdapterInfo->Next;
}
while (pAdapterInfo);
return retv;
}
HTH,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
"Andrue Cope [TeamB]" <no.spam@not.a.valid.address> wrote in message
news:417fb570@newsgroups.borland.com...
| TBH if you want a unique number I would go with either the CPU serial
| number or the network MAC address. Both are probably easier to obtain
| and change less frequently.
Technical Details
Message-ID:
<4180ed78$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<417fa0fd@newsgroups.borland.com> <417fa38f@newsgroups.borland.com> <417fa9df@newsgroups.borland.com> <417fb570@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bdae4482adfc73e4 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mark Jacobs" <http://www.jacobsm.com/mjmsg?Borland%20Newsgroup> Newsgroups: borland.public.cppbuilder.nativeapi References: <417fa0fd@newsgroups.borland.com> <417fa38f@newsgroups.borland.com> <417fa9df@newsgroups.borland.com> <417fb570@newsgroups.borland.com> Subject: Re: get disk serial number Date: Thu, 28 Oct 2004 14:00:41 +0100 Lines: 36 Organization: DK Computing X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 81.144.157.8 Message-ID: <4180ed78$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1098968440 81.144.157.8 (28 Oct 2004 06:00:40 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail