2011-03-31 105 views
1

我需要在10.4上獲得UUID值,但這裏的命令似乎不受支持。如何在OS X 10.4上獲得'IOPlatformUUID'?

ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }' 

上述命令在10.5上正常工作。 10.4不支持嗎?

而且我想在10.4獲取使用下面的代碼UUID,也沒有工作:

void vlm_getSystemUUID_MAC(char * uuid, int bufSize) 
{ 
    io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); 
    CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); 
    IOObjectRelease(ioRegistryRoot); 
    CFStringGetCString(uuidCf, uuid, bufSize, kCFStringEncodingMacRoman); 
    CFRelease(uuidCf); 
} 

和上面的代碼執行以及10.5。

任何幫助,將不勝感激。

回答

0

我相信IOPlatformUUID是第一次加入到Mac OS X 10.5 Leopard中,並且在以前的版本中不可用(有人請糾正我,如果我錯了)。 This blog post提示此更改已在10.5中添加。

要識別運行Mac OS X 10.4及更早版本的Mac,您必須使用IOPlatformSerialNumber和/或內置MAC地址。有關詳細信息和注意事項,請參閱此處:http://developer.apple.com/library/mac/#technotes/tn1103/_index.html

相關問題