Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with getting Mac address
Message
De
04/06/2012 14:39:28
 
 
À
04/06/2012 08:05:22
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
01545209
Message ID:
01545255
Vues:
47
>Hi All,
>I find this code from UT. I use it for copy-protect. But I have trouble with notebooks with this code. I think so It's about wireless ethernet. I tried to get information with when wireless working and without, no succeeded.
>
>Any idea?
>
>		Local pGUID,rGUID
>		Declare Integer CoCreateGuid In 'OLE32.dll' ;
>			string @pguid
>		Declare Integer StringFromGUID2 In 'OLE32.dll' ;
>			string rguid, String @lpsz, Integer cchMax
>		pGUID=Replicate(Chr(0),16)
>		rGUID=Replicate(Chr(0),80)
>		If Val(Os(3))>=5 &&"5." $ Os() && 2000/XP
>			Declare Integer UuidCreateSequential In 'RPCRT4.dll'  String @ Uuid
>			lcMacAddress = Iif( UuidCreateSequential(@pGUID) = 0 ;
>				and StringFromGUID2(pGUID,@rGUID,40) # 0, ;
>				substr(Strconv(Left(rGUID,76),6),26,12), "" )
>		Else
>			lcMacAddress = Iif( CoCreateGuid(@pGUID) = 0 ;
>				and StringFromGUID2(pGUID,@rGUID,40) # 0, ;
>				substr(Strconv(Left(rGUID,76),6),26,12), "" )
>		Endif
>		lcinfstr=m.lcinfstr + Nvl(lcMacAddress,"")
>
Without looking at your code at all, bear in mind that most modern PCs have multiple network MAC addresses. For example, the computer I'm using right now has 7:

- Two hardwire gigabit adapters
- One VirtualBox virtual adapter
- Four tunnel adapters (these all have a MAC address of 00-00-00-00-00-00-00-E0 so they can be identified)

And, this computer doesn't even have any wireless!

If your code asks for just a single MAC address, I'm not sure you can reliably know which one you're getting. I'm pretty sure you need to enumerate all of the MAC addresses, then check if any of them is the one you want.

I think there was a discussion here some time ago about this but I can't search. Maybe someone else can, if not maybe Googling [vfp enumerate mac addresses] can help.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform