Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GUID or other unique ID for a computer
Message
From
06/09/2003 08:24:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00826703
Message ID:
00826729
Views:
30
This message has been marked as the solution to the initial question of the thread.
>Is there a unique ID for an individual computer that can be retreived using a FoxPro function or maybe a windows api call? Maybe an ID/serial number for a motherboard, cpu, hard drive or something that does not change frequently that can be retrieved programmatically.

Darrell,
AFAIK there is nothing specifically unique to a computer. To its best network card manufacturer's ID (NIC, MAC address) is highly unique (I was thinking it's always unique but got my lesson seeing it might not be).
CPU serial is useless because it's not used by all CPU manufacturers (ie: AMD doesn't use and I love AMD:) + from BIOS you can disable it.
HDD serial numbers (not the one that format creates - it's easily changeable via code) are very hard to get if ever possible.
Below code returns the NIC address if you see it enough :
function GetMACAddress
Local pGUID,rGUID,lcOldError, lnResult
Declare integer CoCreateGuid in 'OLE32.dll' string @pguid
Declare integer StringFromGUID2 in 'OLE32.dll' ;
  string rguid, string @lpsz, integer cchMax
Declare integer UuidCreateSequential in 'RPCRT4.dll'  string @ Uuid

pGUID=replicate(chr(0),16)
rGUID=replicate(chr(0),80)

lcOldError = On('error')
On Error lnResult = CoCreateGuid(@pGUID)
lnResult = UuidCreateSequential(@pGUID) 
On Error &lcOldError

return substr( iif( lnResult = 0 and ;
	StringFromGUID2(pGUID,@rGUID,40) # 0, ;
    StrConv(left(rGUID,76),6), "" ), 26,12)
PS: GUID is totally different. Each time it's generated it's a different value. Under w2k, XP and later it doesn't contain MAC address. Above winAPI procedures actually get a GUID to extract MAC address but in w2k,XP and later UuidCreateSequential is used to obtain a GUID with MAC in it.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform