环境
作者:桑相
QQ:438788593
交流群:227246737
操作系统:Windows 10
iTunes版本:12.5.3.16 (x64)
手机型号:iPhone 6 plus 金色
手机系统版本:10.1.1
目前需要的DLL
CoreFoundation.dll
iTunesMobileDevice.dll
AirTrafficHost.dll
AVFoundationCF.dll
iTunes.dll
加载DLL
注意:因为iTunes是64位的,所以我的主程序也是写的64位的
struct ios_connect_info {
HANDLE hDevice;
unsigned int state;
};
#define LoadLibraryModule(lib_hmodule, fun_pointer, fun_type, fun_name) \
fun_pointer = (fun_type)GetProcAddress(lib_hmodule, fun_name); \
if(!fun_pointer) { break;}
#define FreeLibraryHandle(lib_handle) \
if(lib_handle) FreeLibrary(lib_handle);
#define itunes_AppleApplicationSupport_reg _T("SOFTWARE\\Apple Inc.\\Apple Application Support")
#define itunes_AppleMobileDeviceSupport_reg _T("SOFTWARE\\Apple Inc.\\Apple Mobile Device Support")
#define itunes_iTunes_reg _T("SOFTWARE\\Apple Computer, Inc.\\iTunes")
typedef int(*func_AMDServiceConnectionSend)(HANDLE conn, char* data, UINT len);
typedef int(*func_AMDServiceConnectionReceive)(HANDLE conn, void* data, UINT len);
typedef void(*func_AMDServiceConnectionInvalidate)(HANDLE conn);
typedef int(*func_AMDeviceGetInterfaceType)(HANDLE handle);
typedef HANDLE(*func_AMDeviceRetain)(HANDLE handle);
typedef int(*func_AMDeviceNotificationSubscribe)(void(*callback)(ios_connect_info* state), UINT uint1, UINT uint2, UINT uint3, HANDLE *notify);
typedef int(*func_AMDeviceConnect)(HANDLE handle);
typedef HANDLE(*func_AMDeviceCopyDeviceIdentifier)(HANDLE handle);
typedef int(*func_AMDeviceDisconnect)(HANDLE handle);
typedef int(*func_AMDeviceIsPaired)(HANDLE handle);
typedef int(*func_AMDeviceValidatePairing)(HANDLE handle);
typedef int(*func_AMDeviceStartSession)(HANDLE handle);
typedef int(*func_AMDeviceStopSession)(HANDLE handle);
typedef int(*func_AMDeviceSetValue)(HANDLE handle, HANDLE cfstring1, HANDLE cfstring2);
typedef CFTypeRef(*func_AMDeviceCopyValue)(HANDLE handle, HANDLE cfstring1, HANDLE cfstring2);
typedef CFStringRef(*func_CFStringMakeConstantString)(const char* data);
typedef CFIndex(*func_CFGetTypeID)(CFTypeRef data);
typedef CFIndex(*func_CFDictionaryGetTypeID)();
typedef CFIndex(*func_CFDictionaryGetCount)(CFDictionaryRef theDict);
typedef void(*func_CFDictionaryGetKeysAndValues)(CFDictionaryRef theDict, CFTypeRef *keys, CFTypeRef *values);
typedef CFIndex(*func_CFArrayGetTypeID)();
typedef CFIndex(*func_CFArrayGetCount)(CFArrayRef theArray);
typedef CFTypeRef(*func_CFArrayGetValueAtIndex)(CFArrayRef theArray, CFIndex idx);
typedef CFIndex(*func_CFStringGetTypeID)();
typedef CFIndex(*func_CFStringGetLength)(CFStringRef data);
typedef bool(*func_CFStringGetCString)(HANDLE cfstring, char* byteString, UINT len, UINT encode);
typedef CFBooleanRef(*func_CFBooleanGetValue)(CFBooleanRef data);
typedef CFIndex(*func_CFBooleanGetTypeID)();
typedef CFIndex(*func_CFNumberGetTypeID)();
typedef CFIndex(*func_CFNumberGetValue)(CFTypeRef data, int type, void *valuePtr);
typedef CFNumberType(*func_CFNumberGetType)(CFTypeRef data);
typedef CFIndex(*func_CFNumberGetByteSize)(CFTypeRef data);
typedef CFIndex(*func_CFDataGetTypeID)();
typedef CFIndex(*func_CFDataGetLength)(CFDataRef theData);
typedef const uint8_t* (*func_CFDataGetBytePtr)(CFDataRef theData);
typedef void(*func_CFDataGetBytes)(CFDataRef theData, CFRange range, uint8_t *buffer);
typedef CFIndex(*func_CFDateGetTypeID)();
typedef CFDateRef(*func_CFDateCreate)(CFAllocatorRef allocator, CFAbsoluteTime at);
typedef CFAbsoluteTime(*func_CFDateGetAbsoluteTime)(CFDateRef theDate);
typedef CFTimeInterval(*func_CFDateGetTimeIntervalSinceDate)(CFDateRef theDate, CFDateRef otherDate);
typedef CFComparisonResult(*func_CFDateCompare)(CFDateRef theDate, CFDateRef otherDate, void *context);
typedef CFNumberRef(*func_CFNumberCreate)(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
typedef CFDataRef(*func_CFDataCreate)(CFAllocatorRef allocator, const uint8_t *bytes, CFIndex length);
typedef CFPropertyListRef(*func_CFPropertyListCreateFromXMLData)(CFAllocatorRef allocator, CFDataRef xmlData, CFOptionFlags mutabilityOption, CFStringRef *errorString);
typedef CFWriteStreamRef(*func_CFWriteStreamCreateWithAllocatedBuffers)(CFAllocatorRef alloc, CFAllocatorRef bufferAllocator);
typedef bool(*func_CFWriteStreamOpen)(CFWriteStreamRef stream);
typedef CFIndex(*func_CFPropertyListWriteToStream)(CFPropertyListRef propertyList, CFWriteStreamRef stream, CFPropertyListFormat format, CFStringRef *errorString);
typedef CFTypeRef(*func_CFWriteStreamCopyProperty)(CFWriteStreamRef stream, CFStringRef propertyName);
typedef void(*func_CFWriteStreamClose)(CFWriteStreamRef stream);
typedef void(*func_CFRelease)(CFTypeRef cf);
typedef CFMutableArrayRef(*func_CFArrayCreateMutable)(CFAllocatorRef allocator, CFIndex capacity, CFArrayCallBacks