• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: display Mac id
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: display Mac id


  • Subject: Re: display Mac id
  • From: Laurent Cerveau <email@hidden>
  • Date: Wed, 24 Jun 2009 08:58:04 +0200

You can use IOKit UserLibg get the MAC hardware address. I did not retest it though (it comes from older code) so you probably have to check for small bugs.

laurent

kern_return_t kernResult;
mach_port_t masterPort;
io_service_t tmpService, controllerService;
CFDataRef macAddressData;
CFMutableDictionaryRef classesToMatch;

//Get the master port
kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
//Find the etherner 0 card criteria
classesToMatch = IOBSDNameMatching(masterPort,0,"en0");
//find the corresponding service
tmpService = IOServiceGetMatchingService(masterPort, classesToMatch);
// by asking for it specifically.
kernResult = IORegistryEntryGetParentEntry( tmpService, kIOServicePlane, &controllerService );

//now we get the data and do something with them
macAddressData = (CFDataRef) IORegistryEntryCreateCFProperty ( controllerService,CFSTR(kIOMACAddress), kCFAllocatorDefault, 0);


	//release what is needed
CFRelease(macAddressData);
IOObjectRelease(controllerService);
IOObjectRelease(tmpService);

On Jun 23, 2009, at 9:04 AM, Kiran Kumar wrote:

Hi all,

i am doing project to change MAC Address ,i want to display MACID in
a single textbox like 00:15:e9:4c:c3:d7

or 00-15-e9-4c-c3-d7 can any one help me plz ...




Thanks, kiran

The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: display Mac id
      • From: Kiran Kumar <email@hidden>
    • Re: display Mac id
      • From: Stephen Blinkhorn <email@hidden>
    • Re: display Mac id
      • From: KK <email@hidden>
References: 
 >display Mac id (From: Kiran Kumar <email@hidden>)

  • Prev by Date: Re: about NSThread crash
  • Next by Date: Re: about NSThread crash
  • Previous by thread: display Mac id
  • Next by thread: Re: display Mac id
  • Index(es):
    • Date
    • Thread