Einzelnen Beitrag anzeigen

philipp.hofmann

Registriert seit: 21. Mär 2012
Ort: Hannover
864 Beiträge
 
Delphi 10.4 Sydney
 
#4

AW: Hardware UUID auslesen?

  Alt 11. Aug 2023, 19:20
Ich mache es unter MacOS folgendermaßen:

Delphi-Quellcode:
var PlatformExpert: io_service_t;
    M: CFMutableDictionaryRef;
    SerialNumberAsCFString: CFTypeRef;
    _AnsiChar: PAnsiChar;
begin
  M := IOServiceMatching('IOPlatformExpertDevice');
  PlatformExpert := IOServiceGetMatchingService(kIOMasterPortDefault,CFDictionaryRef(M));
  SerialNumberAsCFString := IORegistryEntryCreateCFProperty(PlatformExpert, CFSTR('IOPlatformSerialNumber'),kCFAllocatorDefault,0);
    _AnsiChar := CFStringGetCStringPtr(SerialNumberAsCFString,0);
    Result := String(AnsiString(_AnsiChar));
    IOObjectRelease(PlatformExpert);
end;
  Mit Zitat antworten Zitat