Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing prom



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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >accessing prom (From: Dmitry Markman <email@hidden>)
 >Re: accessing prom (From: Justin Walker <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.