iokit

Import IORegistryEntrySearchCFProperty from Macapi.IOKit in Delphi for OSX64

拥有回忆 提交于 2021-02-09 10:42:31
问题 I used this import definition in OSX32 successfully: uses MacApi.ObjectiveC, MacApi.Foundation, Macapi.CoreFoundation, Macapi.Mach, Macapi.IOKit; type io_iterator_t = io_object_t; io_name_t = array[0..127] of AnsiChar; function IORegistryEntrySearchCFProperty(entry: io_registry_entry_t; plane: io_name_t; key: CFStringRef; allocator: CFAllocatorRef; options: IOOptionBits): CFTypeRef; cdecl; external libIOKit name _PU + 'IORegistryEntrySearchCFProperty'; function IOServiceGetMatchingServices

CGDisplayIOServicePort is deprecated in OS X >= 10.9, how to replace?

陌路散爱 提交于 2021-02-06 10:11:51
问题 I did small app to allow quickly change screen resolutions on multiple monitors. I want to show product name as title of the monitor, and it's very simple to find using this code: NSDictionary *deviceInfo = (__bridge NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(dispID), kIODisplayOnlyPreferredName); NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; if([localizedNames count] > 0) { _title = [localizedNames

CGDisplayIOServicePort is deprecated in OS X >= 10.9, how to replace?

霸气de小男生 提交于 2021-02-06 10:10:36
问题 I did small app to allow quickly change screen resolutions on multiple monitors. I want to show product name as title of the monitor, and it's very simple to find using this code: NSDictionary *deviceInfo = (__bridge NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(dispID), kIODisplayOnlyPreferredName); NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; if([localizedNames count] > 0) { _title = [localizedNames

How to allocate memory in a DriverKit system extension and map it to another process?

耗尽温柔 提交于 2021-01-28 04:41:20
问题 I have allocated memory in my application and passed its pointer and size to IOConnectCallStructMethod . Using IOMemoryDescriptor::CreateMapping I have then mapped this memory to the DriverKit system extension process, and it is possible to write to this mapped memory location and read the data from my application. I would now like to do something similar for memory that is allocated in the system extension, and then map it to the application that is using the system extension. I would like

How to allocate memory in a DriverKit system extension and map it to another process?

我的未来我决定 提交于 2021-01-28 04:25:26
问题 I have allocated memory in my application and passed its pointer and size to IOConnectCallStructMethod . Using IOMemoryDescriptor::CreateMapping I have then mapped this memory to the DriverKit system extension process, and it is possible to write to this mapped memory location and read the data from my application. I would now like to do something similar for memory that is allocated in the system extension, and then map it to the application that is using the system extension. I would like

How to distinguish USB hard drives and SSDs from USB keys / pen drives on macOS

北城以北 提交于 2021-01-04 05:42:43
问题 How is it possible for code to distinguish between external USB hard drives and solid-state drives on the one hand versus USB sticks on the other hand? I'm not familiar with macOS APIs (or system calls, interrupts, messaging, and other things) but I'm guessing it would be in I/O Kit or Disk Arbitration? On the Terminal command line you can use system_profiler SPUSBDataType and see this information listed under "Removable Media". 回答1: You can get the removable/ejectable information directly

How to distinguish USB hard drives and SSDs from USB keys / pen drives on macOS

萝らか妹 提交于 2021-01-04 05:41:42
问题 How is it possible for code to distinguish between external USB hard drives and solid-state drives on the one hand versus USB sticks on the other hand? I'm not familiar with macOS APIs (or system calls, interrupts, messaging, and other things) but I'm guessing it would be in I/O Kit or Disk Arbitration? On the Terminal command line you can use system_profiler SPUSBDataType and see this information listed under "Removable Media". 回答1: You can get the removable/ejectable information directly

PCI driver Migrating from IOKit kext to Driverkit dext issues

∥☆過路亽.° 提交于 2020-12-15 05:34:10
问题 I'm migrating my PCI driver from iokit to dext using PCIDriverkit. I download the "MyUserUSBInterfaceDriver" sample, modify compile, sign, and run. the dext can load, but there are many errors: kernel: serviceMatchesCDHash: required cdhash 3...3 in personality does not match service kernel: DK: IOUserServer(sc.knight.MyUserUSBInterfaceDriver-0x1000064ac)::exit(CDHash check failed) kernel: (above:This error Repeat 5 times) ............ ............ ............ ............ ............ ......

macOS. How to get CPU temperature programmatically

最后都变了- 提交于 2020-11-30 06:14:51
问题 I need to get CPU temperature using Swift, but I can't find any information except for this. I think that I should use IOKit.framework but again there's no much information about it. 回答1: using https://github.com/lavoiesl/osx-cpu-temp/blob/master/smc.c I got it to work. You have to do a few things: Simplify main() to something else: double calculate() { SMCOpen(); double temperature = SMCGetTemperature(SMC_KEY_CPU_TEMP); SMCClose(); temperature = convertToFahrenheit(temperature); return