• 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: accessing prom
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing prom


  • Subject: Re: accessing prom
  • From: Dmitry Markman <email@hidden>
  • Date: Sat, 21 May 2005 21:12:17 -0400

thank you very much Justin

the following code does the job

    {
            const char          *computerSerialNumber = NULL;
            CFTypeRef           CFComputerSerialNumber = NULL;
            io_object_t         ioEntry;
            io_iterator_t       ioIterator;
            kern_return_t       kernResult;
            mach_port_t         masterPort;
            kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);

if(kernResult == KERN_SUCCESS)
{
kernResult = IORegistryCreateIterator (masterPort,kIOServicePlane,0,&ioIterator);
}
if(kernResult == KERN_SUCCESS)
{
ioEntry = IOIteratorNext(ioIterator);
if(ioEntry != 0)
{
CFComputerSerialNumber = IORegistryEntrySearchCFProperty(ioEntry,kIOServicePlane,CFSTR (kIOPlatformSerialNumberKey),kCFAllocatorDefault,0);
IOObjectRelease(ioEntry);
}
IOObjectRelease(ioIterator);
}
if(CFComputerSerialNumber != NULL)
{
if(CFStringGetTypeID() == CFGetTypeID (CFComputerSerialNumber))
{
computerSerialNumber = CFStringGetCStringPtr ((CFStringRef)CFComputerSerialNumber,kCFStringEncodingMacRoman);
}
CFRelease(CFComputerSerialNumber);
}
if(computerSerialNumber != NULL) printf("Serial Number: % s\n",computerSerialNumber);
}


however I suppose that there is a more elegant way by using some matching facility







On May 21, 2005, at 4:10 PM, Justin Walker wrote:


On May 21, 2005, at 8:52, Dmitry Markman wrote:


Hi
is it  possible to access PROM data?
specifically we need to obtain computer's serial number
thanks


I don't know how to do that, but 'ioreg -l' will show you the system's serial number (IOPlatformSerialNumber). Digging through the source may help; I took a quick look (IOKitTools project), but nothing said "here I am" ;-/


Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
Some people have a mental horizon of radius zero, and
call it their point of view.
  -- David Hilbert
--------

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


Dmitry Markman

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: accessing prom
      • From: Justin Walker <email@hidden>
References: 
 >accessing prom (From: Dmitry Markman <email@hidden>)
 >Re: accessing prom (From: Justin Walker <email@hidden>)

  • Prev by Date: Re: accessing prom
  • Next by Date: bind() not working for outbound socket connections...
  • Previous by thread: Re: accessing prom
  • Next by thread: Re: accessing prom
  • Index(es):
    • Date
    • Thread