Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAC Address Changes
Message
From
10/08/2016 15:29:29
 
 
To
10/08/2016 15:19:53
General information
Forum:
Hardware
Category:
Computer cards
Miscellaneous
Thread ID:
01639275
Message ID:
01639333
Views:
52
>>>>>>>>Hi,
>>>>>>>>
>>>>>>>>I use some code to generate a number based on a PC's hard disk serial number and the MAC address. Recently, I have one client out of a couple hundred that this number changes on sporadically. I wrote a program to display what the serial number and MAC address are and the MAC address has changed from a couple weeks ago. The client says the NIC has not been changed.
>>>>>>>>
>>>>>>>>I thought the MAC address was tied to the NIC. What could cause this to change?
>>>>>>>
>>>>>>>How are you fetching the MAC address?
>>>>>>
>>>>>>VFP code:
>>>>>>
>>>>>>DECLARE INTEGER GetAdaptersInfo IN iphlpapi ; 
>>>>>>STRING @pAdapterInfo, LONG @pOutBufLen 
>>>>>>
>>>>>>LOCAL lcBuffer, lnBufsize 
>>>>>>lnBufsize = 0 
>>>>>>lcBuffer = "" 
>>>>>>= GetAdaptersInfo(@lcBuffer, @lnBufsize) 
>>>>>>lcBuffer = Repli(Chr(0), lnBufsize) 
>>>>>>
>>>>>>IF GetAdaptersInfo(@lcBuffer, @lnBufsize) <> 0 && ERROR_SUCCESS 
>>>>>>* =MESSAGEBOX('MSI Card Not Found',64)
>>>>>>ENDIF 
>>>>>>
>>>>>>LOCAL lnAddrlen, lcAddress, ii
>>>>>>lnAddrlen = Asc(SUBSTR(lcBuffer, 401, 1)) 
>>>>>>lcAddress = SUBSTR(lcBuffer, 405, lnAddrlen) 
>>>>>>lcThisID = ''
>>>>>>lcThisHex = ''
>>>>>>
>>>>>>FOR ii = 1 TO lnAddrLen
>>>>>>	lcThisID = lcThisID + ;
>>>>>>			IIF(ii>1, ',' ,'') + ;
>>>>>>			ALLTRIM(STR(ASC(SUBSTR(lcAddress,ii,1))))
>>>>>>	
>>>>>>	lcThisHex = lcThisHex + ;
>>>>>>			IIF(ii>1,':','') + ;
>>>>>>			RIGHT(TRANSFORM(ASC(SUBSTR(lcAddress,ii,1)),'@0'),2)
>>>>>>ENDFOR
>>>>>> 
>>>>>>RETURN lcThisHex
>>>>>
>>>>>According to the GetAdaptersInfo documentation:
>>>>>
>>>>>In versions prior to Windows 10, the order in which adapters appear in the list returned by this function can be controlled from the Network Connections folder: select the Advanced Settings menu item from the Advanced menu. Starting with Windows 10, the order is unspecified.
>>>>>
>>>>>Is the system returning the address for a different NIC?
>>>>
>>>>I don't know. I'll check if the PC is running windows 10 and if there are multiple NIC s tomorrow
>>>
>>>I'm pretty sure Antonio is on the right track. Even a basic PC has multiple virtual adapters defined, plus "real" ones for wired and wireless network connections.
>>>
>>>ISTR for best results you basically have to enumerate all MAC addresses, then check that the one you want is present. There is some code that uses WMI in Message#1358939.
>>>
>>>Years ago I asked a similar question and someone posted me some code/PoC that also enumerated all MAC addresses. But, I can't find the messages, I can't recall if it was Win32, Registry or something else.
>>
>>Thanks Al,
>>
>>I believe it is the fact that Windows 10 now returns a different adapter randomly with the GetAdaptersInfo() call. I'll be double checking it today and seeing if I can find a solution, possibly using GetAdaptersAddresses if that helps.
>
>I don't know if you're using MAC addresses as part of a copy protection scheme, but with their mutability they're not ideal for that (as you're finding).
>
>Another thing to bear in mind is that with the newest generation of ultrabooks I'm seeing more of them used with so-called mini docking stations. Often these machines have a single (but highly capable) USB-C port, and the docking station converts that into USB3, HDMI/DisplayPort for an external monitor plus wired Ethernet. These are less than $100 so I'm seeing people set up these with external monitors, Ethernet, keyboards, mice etc. at two or more locations and just taking the ultrabook with them from place to place. In that case, the Ethernet MAC address will change at each location.
>
>One piece of information that can be used for this sort of thing is the machine's NetBIOS name, available through SYS( 0 ). Yes, a user can change that but in practice it's a PITA as doing so breaks a lot of stuff. NetBIOS names have to be unique on a given network/subnet, so they don't protect against the same name being used at different locations, but it's useful as one component of simple copy protection schemes against casual piracy.

Thanks Al, this is just a short term solution as the system should be web based by next year (hopefully!). I don't see my clients using ultrabooks in the near future. Thanks for the SYS(0) idea.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform