我正在尝试挂钩IOKit框架(ios 10)来更改我的序列号 建立成功,但当我在我的设备上测试结果仍然是我的真实序列号 谁知道为什么? 这是我的源代码
#import <substrate.h>
typedef mach_port_t io_object_t;
typedef io_object_t io_registry_entry_t;
typedef UInt32 IOOptionBits;
extern "C" CFTypeRef IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options);
static CFTypeRef (*orig_registryEntry)(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options);
CFTypeRef replaced_registryEntry(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options) {
CFTypeRef retval = NULL;
if(key == CFSTR("IOPlatformSerialNumber")){
retval = CFDataCreate(kCFAllocatorDefault, (const unsigned char *)"F17JBBBBAAAA", 12);
}
else
retval = orig_registryEntry(entry, key, allocator, options);
return retval;
}
%ctor
{
MSHookFunction((void *)IORegistryEntryCreateCFProperty, (void *)replaced_registryEntry, (void **)&orig_registryEntry);
%init();
}