• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IOServiceGetMatchingService函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IOServiceGetMatchingService函数的典型用法代码示例。如果您正苦于以下问题:C++ IOServiceGetMatchingService函数的具体用法?C++ IOServiceGetMatchingService怎么用?C++ IOServiceGetMatchingService使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IOServiceGetMatchingService函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: diskfile_device_size

off_t diskfile_device_size(const char *path) {
  // Get the path within /dev
  if (strncmp(path, DEV_PREFIX, strlen(DEV_PREFIX)) != 0)
    return 0;
  const char *bsdname = path + strlen(DEV_PREFIX);

  // Find the matching IOService
  CFMutableDictionaryRef matching = IOBSDNameMatching(kIOMasterPortDefault, 0,
    bsdname);
  // Consumes the matching dictionary
  io_service_t match = IOServiceGetMatchingService(kIOMasterPortDefault,
    matching);
  if (!match)
    return 0;

  // Get the size property
  CFNumberRef cfsize = IORegistryEntryCreateCFProperty(match,
    CFSTR(kIOMediaSizeKey), kCFAllocatorDefault, 0);
  IOObjectRelease(match);
  if (!cfsize)
    return 0;

  long long size;
  if (!CFNumberGetValue(cfsize, kCFNumberLongLongType, &size))
    return 0;

  return size;
}
开发者ID:dothan009,项目名称:diskfile,代码行数:28,代码来源:mac-size.c


示例2: getDataPort

io_connect_t getDataPort(void)
{
  kern_return_t     kr;
  io_service_t      serviceObject;

  if (dataPort) return dataPort;

  // Look up a registered IOService object whose class is AppleLMUController
  serviceObject = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleLMUController"));

  if (!serviceObject)
  {
    printf("getLightSensors() error: failed to find ambient light sensor\n");
    return 0;
  }

  // Create a connection to the IOService object
  kr = IOServiceOpen(serviceObject, mach_task_self(), 0, &dataPort);
  IOObjectRelease(serviceObject);

  if (kr != KERN_SUCCESS)
  {
    printf("getLightSensors() error: failed to open IoService object\n");
    return 0;
  }

  return dataPort;
}
开发者ID:BaleroCMS,项目名称:macbook-brightness,代码行数:28,代码来源:displaybrightness.c


示例3: get_ff

static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret)
{
    io_service_t service;
    CFMutableDictionaryRef matching;
    CFTypeRef type;

    matching = IOServiceMatching(kIOHIDDeviceKey);
    if(!matching) {
        WARN("IOServiceMatching failed, force feedback disabled\n");
        return DIERR_DEVICENOTREG;
    }

    type = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDLocationIDKey));
    if(!matching) {
        CFRelease(matching);
        WARN("IOHIDDeviceGetProperty failed, force feedback disabled\n");
        return DIERR_DEVICENOTREG;
    }

    CFDictionaryAddValue(matching, CFSTR(kIOHIDLocationIDKey), type);

    service = IOServiceGetMatchingService(kIOMasterPortDefault, matching);

    if(!ret)
        return FFIsForceFeedback(service) == FF_OK ? S_OK : S_FALSE;

    return osx_to_win32_hresult(FFCreateDevice(service, ret));
}
开发者ID:cournape,项目名称:wine,代码行数:28,代码来源:joystick_osx.c


示例4: AllocateHIDObjectFromIOHIDDeviceRef

//---------------------------------------------------------------------------------
//
// AllocateHIDObjectFromIOHIDDeviceRef( )
//
//	returns:
//		NULL, or acceptable io_object_t
//
//---------------------------------------------------------------------------------
io_service_t AllocateHIDObjectFromIOHIDDeviceRef(IOHIDDeviceRef inIOHIDDeviceRef) {
	io_service_t result = 0L;
	if ( inIOHIDDeviceRef ) {
		// Set up the matching criteria for the devices we're interested in.
		// We are interested in instances of class IOHIDDevice.
		// matchingDict is consumed below( in IOServiceGetMatchingService )
		// so we have no leak here.
		CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOHIDDeviceKey);
		if ( matchingDict ) {
			// Add a key for locationID to our matching dictionary.  This works for matching to
			// IOHIDDevices, so we will only look for a device attached to that particular port
			// on the machine.
			CFTypeRef tCFTypeRef = IOHIDDeviceGetProperty( inIOHIDDeviceRef, CFSTR(kIOHIDLocationIDKey) );
			if ( tCFTypeRef ) {
				CFDictionaryAddValue(matchingDict, CFSTR(kIOHIDLocationIDKey), tCFTypeRef);
				// CFRelease( tCFTypeRef );	// don't release objects that we "Get".
				
				// IOServiceGetMatchingService assumes that we already know that there is only one device
				// that matches.  This way we don't have to do the whole iteration dance to look at each
				// device that matches.  This is a new API in 10.2
				result = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
			}
			
			// Note: We're not leaking the matchingDict.
			// One reference is consumed by IOServiceGetMatchingServices
		}
	}
	
	return (result);
}   // AllocateHIDObjectFromIOHIDDeviceRef
开发者ID:Leonan8995,项目名称:Xenomia,代码行数:38,代码来源:ImmrHIDUtilAddOn.c


示例5: darwin_init

static int darwin_init(void)
{
	kern_return_t err;

	/* Note the actual security happens in the kernel module.
	 * This check is just candy to be able to get nicer output
	 */
	if (getuid() != 0) {
		/* Fun's reserved for root */
		errno = EPERM;
		return -1;
	}

	/* Get the DirectHW driver service */
	iokit_uc = IOServiceGetMatchingService(kIOMasterPortDefault,
					IOServiceMatching("DirectHWService"));

	if (!iokit_uc) {
		printf("DirectHW.kext not loaded.\n");
		errno = ENOSYS;
		return -1;
	}

	/* Create an instance */
	err = IOServiceOpen(iokit_uc, mach_task_self(), 0, &connect);

	/* Should not go further if error with service open */
	if (err != KERN_SUCCESS) {
		printf("Could not create DirectHW instance.\n");
		errno = ENOSYS;
		return -1;
	}

	return 0;
}
开发者ID:bpmilne,项目名称:rwmem,代码行数:35,代码来源:DirectHW.c


示例6: copy_device_imei

CFStringRef copy_device_imei() {
    CFMutableDictionaryRef matching;
    io_service_t service;
    CFDataRef imeiData;
    const void *imeiDataPtr;
    CFStringRef imeiString;
    
    matching = IOServiceNameMatching("baseband");
    service = IOServiceGetMatchingService(kIOMasterPortDefault, matching);
    
    if(!service) {
        return NULL;
    }
    
    imeiData = IORegistryEntryCreateCFProperty(service, CFSTR("device-imei"), kCFAllocatorDefault, 0);
    if(!imeiData) {
        printf("unable to find device-imei property\n");
        IOObjectRelease(service);
        return NULL;
    }
    
    imeiDataPtr = CFDataGetBytePtr(imeiData);
    imeiString = CFStringCreateWithCString(kCFAllocatorDefault, imeiDataPtr, kCFStringEncodingUTF8);
    
    CFRelease(imeiData);
    IOObjectRelease(service);
    
    return imeiString;
}
开发者ID:0bj3ct1veC,项目名称:iphone-dataprotection,代码行数:29,代码来源:registry.c


示例7: connect_to_keystore

static io_connect_t connect_to_keystore(void)
{
    io_registry_entry_t apple_key_bag_service;
    kern_return_t result;
    io_connect_t keystore = MACH_PORT_NULL;

    apple_key_bag_service = IOServiceGetMatchingService(kIOMasterPortDefault,
                                                        IOServiceMatching(kAppleKeyStoreServiceName));

    if (apple_key_bag_service == IO_OBJECT_NULL) {
        fprintf(stderr, "Failed to get service.\n");
        return keystore;
    }

    result = IOServiceOpen(apple_key_bag_service, mach_task_self(), 0, &keystore);
    if (KERN_SUCCESS != result)
        fprintf(stderr, "Failed to open keystore\n");

    if (keystore != MACH_PORT_NULL) {
        IOReturn kernResult = IOConnectCallMethod(keystore,
                                                  kAppleKeyStoreUserClientOpen, NULL, 0, NULL, 0, NULL, NULL,
                                                  NULL, NULL);
        if (kernResult) {
            fprintf(stderr, "Failed to open AppleKeyStore: %x\n", kernResult);
        }
    }
	return keystore;
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:28,代码来源:si-33-keychain-backup.c


示例8: OSX_ProbeTargetDrive

uint16_t OSX_ProbeTargetDrive(const char* id3args_drive, char* mcdi_data) {
	uint16_t mcdi_data_len = 0;
	io_object_t	cdobject = MACH_PORT_NULL;
	
	if (strncmp(id3args_drive, "disk", 4) != 0) {
		OSX_ScanForCDDrive();
		exit(0);
	}
	cdobject = IOServiceGetMatchingService(kIOMasterPortDefault, IOBSDNameMatching (kIOMasterPortDefault, 0, id3args_drive) );

	if (cdobject == MACH_PORT_NULL) {
		fprintf(stdout, "No device found at %s; searching for possible drives...\n", id3args_drive);
		OSX_ScanForCDDrive();
		
	} else if (IOObjectConformsTo(cdobject, kIOCDMediaClass) == false) {
		fprintf (stdout, "No cd present in drive at %s\n", id3args_drive );
		IOObjectRelease(cdobject);
		cdobject = MACH_PORT_NULL;
		OSX_ScanForCDDrive();
	} else {
		//we now have a cd object
		OSX_ReadCDTOC(cdobject);
		if (cdTOC != NULL) {
			uint8_t cdType = DetermineCDType(cdTOC);
			if (cdType == CDOBJECT_AUDIOCD) {
				mcdi_data_len = FormMCDIdata(mcdi_data);
			}
		}
	}

	IOObjectRelease(cdobject);
	cdobject = MACH_PORT_NULL;
	return mcdi_data_len;
}
开发者ID:DanDrusch,项目名称:atomicparsley,代码行数:34,代码来源:CDtoc.cpp


示例9: getPstateTable

int getPstateTable(PSTATE_CTL_INFO* info){
	int count = 0;
	io_service_t	IOService  = IOServiceGetMatchingService(0, IOServiceMatching(SERVICE_NAME));
	if (! IOService )
		return 0;

	CFDictionaryRef CDictionary = (CFDictionaryRef) IORegistryEntryCreateCFProperty(IOService,					
				CFSTR("Characteristics"),kCFAllocatorDefault,0);

	CFArrayRef PSArray = CFArrayCreateCopy(kCFAllocatorDefault, 
								(CFArrayRef) CFDictionaryGetValue(CDictionary, CFSTR("PStates")));
	if (PSArray) {
		count = CFArrayGetCount(PSArray);
		for( int k = 0; k < count; k++ ){
			CFDictionaryRef PSDictionary = CFDictionaryCreateCopy(kCFAllocatorDefault,
																  (CFDictionaryRef) CFArrayGetValueAtIndex(PSArray, k));
			info->frequency = GetNumber(CFSTR("Frequency"), PSDictionary);
			info->voltage = GetNumber(CFSTR("Voltage"), PSDictionary);
			info->fid = GetNumber(CFSTR("FID"), PSDictionary);
			info->did = GetNumber(CFSTR("DID"), PSDictionary);
			info->vid = GetNumber(CFSTR("VID"), PSDictionary);
			info->pstate = k;
			info++;
			CFRelease(PSDictionary);
		}
		CFRelease(PSArray);
	}
	CFRelease(CDictionary);
	return count;
}
开发者ID:andyvand,项目名称:Intel-OS-X-LAN-Driver,代码行数:30,代码来源:KextIntf.c


示例10: main

int main(int argc, char** argv) {
    char* service_name = "AppleOscarGyro";
    int client_type = 0;

    io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(service_name));
    if (service == MACH_PORT_NULL) {
        printf("can't find service\n");
        return 0;
    }

    IOServiceOpen(service, mach_task_self(), client_type, &conn);
    if (conn == MACH_PORT_NULL) {
        printf("can't connect to service\n");
        return 0;
    }

    OSSpinLockLock(&lock);

    pthread_t t;
    io_connect_t arg = conn;
    pthread_create(&t, NULL, (void*) go, (void*) &arg);

    usleep(100000);

    OSSpinLockUnlock(&lock);

    close_it(conn);

    pthread_join(t, NULL);

    return 0;
}
开发者ID:wzw19890321,项目名称:OSX_vul,代码行数:32,代码来源:appleoscargyro.c


示例11: main

int main(int argc, char** argv) {
  char* service_name = "IntelAccelerator";
  int client_type = 4;

  io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(service_name));
  if (service == MACH_PORT_NULL) {
    printf("can't find service\n");
    return 0;
  }

  IOServiceOpen(service, mach_task_self(), client_type, &conn);
  if (conn == MACH_PORT_NULL) {
    printf("can't connect to service\n");
    return 0;
  }

  pthread_t t;
  io_connect_t arg = conn;
  pthread_create(&t, NULL, (void*) go, (void*) &arg);

  usleep(100000);

  start = 1;

  close_it(conn);

  pthread_join(t, NULL);

  return 0;
}
开发者ID:ik2ploit,项目名称:OSX_vul,代码行数:30,代码来源:ioparallel_close.c


示例12: genFDEStatusForBSDName

void genFDEStatusForBSDName(const std::string& bsd_name,
                            const std::string& uuid,
                            QueryData& results) {

  auto matching_dict =
      IOBSDNameMatching(kIOMasterPortDefault, kNilOptions, bsd_name.c_str());
  if (matching_dict == nullptr) {
    CFRelease(matching_dict);
    return;
  }

  auto service =
      IOServiceGetMatchingService(kIOMasterPortDefault, matching_dict);
  if (!service) {
    IOObjectRelease(service);
    return;
  }

  CFMutableDictionaryRef properties;
  IORegistryEntryCreateCFProperties(
      service, &properties, kCFAllocatorDefault, kNilOptions);

  Row r;

  r["name"] = kDeviceNamePrefix + bsd_name;
  r["uuid"] = uuid;

  auto encrypted = getIOKitProperty(properties, kCoreStorageIsEncryptedKey_);
  r["encrypted"] = (encrypted.empty()) ? "0" : encrypted;
  r["type"] = (r.at("encrypted") == "1") ? kEncryptionType : std::string();

  results.push_back(r);
  CFRelease(properties);
  IOObjectRelease(service);
}
开发者ID:aaronshaf,项目名称:osquery,代码行数:35,代码来源:disk_encryption.cpp


示例13: genACPITables

QueryData genACPITables(QueryContext& context) {
  QueryData results;

  auto matching = IOServiceMatching(kIOACPIClassName_);
  if (matching == nullptr) {
    // No ACPI platform expert service found.
    return {};
  }

  auto service = IOServiceGetMatchingService(kIOMasterPortDefault, matching);
  if (service == 0) {
    return {};
  }

  CFTypeRef table = IORegistryEntryCreateCFProperty(
      service, CFSTR(kIOACPIPropertyName_), kCFAllocatorDefault, 0);
  if (table == nullptr) {
    IOObjectRelease(service);
    return {};
  }

  CFDictionaryApplyFunction((CFDictionaryRef)table, genACPITable, &results);

  CFRelease(table);
  IOObjectRelease(service);
  return results;
}
开发者ID:JessicaWhite17,项目名称:osquery,代码行数:27,代码来源:acpi_tables.cpp


示例14: IOServiceGetMatchingService

std::string LLAppViewerMacOSX::generateSerialNumber()
{
	char serial_md5[MD5HEX_STR_SIZE];		// Flawfinder: ignore
	serial_md5[0] = 0;

	// JC: Sample code from http://developer.apple.com/technotes/tn/tn1103.html
	CFStringRef serialNumber = NULL;
	io_service_t    platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
																 IOServiceMatching("IOPlatformExpertDevice"));
	if (platformExpert) {
		serialNumber = (CFStringRef) IORegistryEntryCreateCFProperty(platformExpert,
																	 CFSTR(kIOPlatformSerialNumberKey),
																	 kCFAllocatorDefault, 0);		
		IOObjectRelease(platformExpert);
	}
	
	if (serialNumber)
	{
		char buffer[MAX_STRING];		// Flawfinder: ignore
		if (CFStringGetCString(serialNumber, buffer, MAX_STRING, kCFStringEncodingASCII))
		{
			LLMD5 md5( (unsigned char*)buffer );
			md5.hex_digest(serial_md5);
		}
		CFRelease(serialNumber);
	}

	return serial_md5;
}
开发者ID:Boy,项目名称:netbook,代码行数:29,代码来源:llappviewermacosx.cpp


示例15: copy_bluetooth_mac_address

CFStringRef copy_bluetooth_mac_address() {
    io_service_t service;
    CFDataRef macaddrData;
    CFStringRef macaddr;
    unsigned char macaddrBytes[6];
    
    service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceNameMatching("bluetooth"));
    if(!service) {
        printf("unable to find bluetooth service\n");
        return NULL;
    }
    
    macaddrData= IORegistryEntryCreateCFProperty(service, CFSTR("local-mac-address"), kCFAllocatorDefault, 0);
    if(macaddrData == NULL) {
        printf("bluetooth local-mac-address not found\n");
        IOObjectRelease(service);
        return NULL;
    }
    CFDataGetBytes(macaddrData, CFRangeMake(0,6), macaddrBytes);
    
    macaddr = CFStringCreateWithFormat(kCFAllocatorDefault,
                                        NULL,
                                        CFSTR("%02x:%02x:%02x:%02x:%02x:%02x"),
                                        macaddrBytes[0],
                                        macaddrBytes[1],
                                        macaddrBytes[2],
                                        macaddrBytes[3],
                                        macaddrBytes[4],
                                        macaddrBytes[5]);

    return macaddr;
}
开发者ID:0bj3ct1veC,项目名称:iphone-dataprotection,代码行数:32,代码来源:registry.c


示例16: hook_get_pointer_acceleration_multiplier

UIOHOOK_API long int hook_get_pointer_acceleration_multiplier() {
	#if defined USE_IOKIT || defined USE_COREFOUNDATION
	bool successful = false;
	double multiplier;
	#endif

	long int value = -1;

	#ifdef USE_IOKIT
	if (!successful) {
		io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(kIOHIDSystemClass));

		if (service) {
			kern_return_t kren_ret = kIOReturnError;
			io_connect_t connection;

			kren_ret = IOServiceOpen(service, mach_task_self(), kIOHIDParamConnectType, &connection);
			if (kren_ret == kIOReturnSuccess) {
				// IOByteCount size = sizeof(multiplier);

				kren_ret = IOHIDGetAccelerationWithKey(connection, CFSTR(kIOHIDMouseAccelerationType), &multiplier);
				if (kren_ret == kIOReturnSuccess) {
					// Calculate the greatest common factor.

					unsigned long denominator = 1000000, d = denominator;
					unsigned long numerator = multiplier * denominator, gcf = numerator;

					while (d != 0) {
						unsigned long i = gcf % d;
						gcf = d;
						d = i;
					}

					value = denominator / gcf;
					successful = true;

					logger(LOG_LEVEL_INFO,	"%s [%u]: IOHIDGetAccelerationWithKey: %li.\n",
							__FUNCTION__, __LINE__, value);
				}
			}
		}
	}
	#endif

	#ifdef USE_COREFOUNDATION
	if (!successful) {
		CFTypeRef pref_val = CFPreferencesCopyValue(CFSTR("com.apple.mouse.scaling"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
		if (pref_val != NULL && CFGetTypeID(pref_val) == CFNumberGetTypeID()) {
			if (CFNumberGetValue((CFNumberRef) pref_val, kCFNumberSInt32Type, &multiplier)) {
				value = (long) multiplier;

				logger(LOG_LEVEL_INFO,	"%s [%u]: CFPreferencesCopyValue: %li.\n",
						__FUNCTION__, __LINE__, value);
			}
		}
	}
	#endif

	return value;
}
开发者ID:stak,项目名称:libuiohook,代码行数:60,代码来源:system_properties.c


示例17: lookup_mac_address

CFStringRef lookup_mac_address(const char* serviceName)
{
    unsigned char macaddrBytes[6];
    CFStringRef res = NULL;

    io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceNameMatching(serviceName));
    
    if(service)
    {
        CFDataRef macData = IORegistryEntryCreateCFProperty(service, CFSTR("local-mac-address"), kCFAllocatorDefault, 0);
        if(macData != NULL)
        {
            CFDataGetBytes(macData, CFRangeMake(0,6), macaddrBytes);
    
            res = CFStringCreateWithFormat(kCFAllocatorDefault,
                                        NULL,
                                        CFSTR("%02x:%02x:%02x:%02x:%02x:%02x"),
                                        macaddrBytes[0],
                                        macaddrBytes[1],
                                        macaddrBytes[2],
                                        macaddrBytes[3],
                                        macaddrBytes[4],
                                        macaddrBytes[5]);
            CFRelease(macData);
        }
        IOObjectRelease(service);
    }
    return res;
}
开发者ID:0bj3ct1veC,项目名称:iphone-dataprotection,代码行数:29,代码来源:registry.c


示例18: connectSmartBatteryManager

io_connect_t    connectSmartBatteryManager(uint32_t options, IOReturn *outret)
{
    io_service_t            smartbattman_entry = MACH_PORT_NULL;
    io_connect_t            manager_connect = MACH_PORT_NULL;
    IOReturn                ret;

    smartbattman_entry = IOServiceGetMatchingService( MACH_PORT_NULL,
                            IOServiceNameMatching(kBatteryManagerName) );


    if (MACH_PORT_NULL == smartbattman_entry) {
        return MACH_PORT_NULL;
    }

    ret = IOServiceOpen( smartbattman_entry,            /* service */
                         mach_task_self(),              /* owning task */
                         options,                       /* type - kBatteryExclusiveAccessType or not*/
                         &manager_connect);             /* connect */


    if (outret) *outret = ret;

    if(kIOReturnSuccess != ret) {
        return MACH_PORT_NULL;
    }
    
    IOObjectRelease(smartbattman_entry);
    return manager_connect;
}
开发者ID:hashier,项目名称:caffeinate_fix,代码行数:29,代码来源:SmartBatteryUserClient.c


示例19: is_optical_media

/*
 * Given disk2s1, look up "disk2" is IOKit and attempt to determine if
 * it is an optical device.
 */
int is_optical_media(const char *bsdname)
{
	CFMutableDictionaryRef matchingDict;
	int ret = 0;
	io_service_t service, start;
    kern_return_t   kernResult;
    io_iterator_t   iter;

	if ((matchingDict = IOBSDNameMatching(kIOMasterPortDefault, 0, bsdname))  == NULL)
        return(0);

	start = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
	if (IO_OBJECT_NULL == start)
		return (0);

	service = start;

	// Create an iterator across all parents of the service object passed in.
	// since only disk2 would match with ConfirmsTo, and not disk2s1, so
    // we search the parents until we find "Whole", ie, disk2.
	kernResult = IORegistryEntryCreateIterator(service,
                       kIOServicePlane,
                       kIORegistryIterateRecursively | kIORegistryIterateParents,
                       &iter);

	if (KERN_SUCCESS == kernResult) {
        Boolean isWholeMedia = false;
        IOObjectRetain(service);
        do {

			// Lookup "Whole" if we can
			if (IOObjectConformsTo(service, kIOMediaClass)) {
				CFTypeRef wholeMedia;
				wholeMedia = IORegistryEntryCreateCFProperty(service,
													 CFSTR(kIOMediaWholeKey),
                                                     kCFAllocatorDefault,
                                                     0);
				if (wholeMedia) {
					isWholeMedia = CFBooleanGetValue(wholeMedia);
					CFRelease(wholeMedia);
				}
			}

			// If we found "Whole", check the service type.
			if (isWholeMedia &&
				( (IOObjectConformsTo(service, kIOCDMediaClass)) ||
				  (IOObjectConformsTo(service, kIODVDMediaClass)) )) {
				ret = 1; // Is optical, skip
			}

            IOObjectRelease(service);
        } while ((service = IOIteratorNext(iter)) && !isWholeMedia);
        IOObjectRelease(iter);
	}

	IOObjectRelease(start);
	return ret;
}
开发者ID:cbreak-black,项目名称:zfs,代码行数:62,代码来源:libzfs_import.c


示例20: setPstate

void setPstate(unsigned int newState){
	io_service_t	IOService  = IOServiceGetMatchingService(0, IOServiceMatching(SERVICE_NAME));
	if (! IOService )
		return;

	integer_t state = newState;
	IORegistryEntrySetCFProperty(IOService, CFSTR("P-State"),
		CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &state));
}
开发者ID:andyvand,项目名称:Intel-OS-X-LAN-Driver,代码行数:9,代码来源:KextIntf.c



注:本文中的IOServiceGetMatchingService函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IOServiceGetMatchingServices函数代码示例发布时间:2022-05-30
下一篇:
C++ IOServiceClose函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap