Last active
December 31, 2015 01:09
-
-
Save serg-z/7911612 to your computer and use it in GitHub Desktop.
UUID on OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void get_platform_uuid(char *buf, int bufSize) | |
| { | |
| io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); | |
| CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); | |
| IOObjectRelease(ioRegistryRoot); | |
| CFStringGetCString(uuidCf, buf, bufSize, kCFStringEncodingMacRoman); | |
| CFRelease(uuidCf); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment