@@ -63,6 +63,7 @@ struct LiveSyncApplicationInfo {
63
63
64
64
typedef unsigned long long afc_file_ref;
65
65
66
+
66
67
struct afc_connection {
67
68
unsigned int handle; /* 0 */
68
69
unsigned int unknown0; /* 4 */
@@ -78,6 +79,8 @@ struct afc_connection {
78
79
unsigned int context; /* 40 */
79
80
};
80
81
82
+ typedef struct afc_connection * AFCConnectionRef;
83
+
81
84
struct afc_dictionary {
82
85
unsigned char unknown[0 ]; /* size unknown */
83
86
};
@@ -88,18 +91,27 @@ struct afc_directory {
88
91
89
92
struct afc_file {
90
93
afc_file_ref file_ref;
91
- afc_connection* afc_conn_p;
94
+ AFCConnectionRef afc_conn_p;
92
95
};
93
96
94
97
struct ApplicationCache {
95
- afc_connection* afc_connection;
98
+ AFCConnectionRef afc_connection;
96
99
bool has_initialized_gdb;
97
100
};
98
101
102
+ typedef HANDLE service_conn_t ;
103
+ typedef service_conn_t * ServiceConnRef;
104
+ typedef struct DeviceInfo * AMDeviceRef;
105
+ struct ServiceInfo {
106
+ HANDLE socket;
107
+ ServiceConnRef connection;
108
+ int connection_id;
109
+ };
110
+
99
111
struct DeviceData {
100
112
DeviceInfo* device_info;
101
113
struct DeviceServerData * device_server_data;
102
- std::map<const char *, HANDLE > services;
114
+ std::map<const char *, ServiceInfo > services;
103
115
int sessions;
104
116
std::map<std::string, ApplicationCache> apps_cache;
105
117
@@ -149,18 +161,18 @@ typedef CFDictionaryRef(__cdecl *cfdictionary_create)(void *, void*, void*, int,
149
161
typedef void *(__cdecl *cfurl_create_with_string)(void *, CFStringRef , void *);
150
162
151
163
typedef unsigned (__cdecl *afc_connection_open)(HANDLE, const char *, void *);
152
- typedef unsigned (__cdecl *afc_connection_close)(afc_connection* );
153
- typedef unsigned (__cdecl *afc_file_info_open)(afc_connection* , const char *, afc_dictionary**);
154
- typedef unsigned (__cdecl *afc_directory_read)(afc_connection* , afc_directory*, char **);
155
- typedef unsigned (__cdecl *afc_directory_open)(afc_connection* , const char *, afc_directory**);
156
- typedef unsigned (__cdecl *afc_directory_close)(afc_connection* , afc_directory*);
157
- typedef unsigned (__cdecl *afc_directory_create)(afc_connection* , const char *);
158
- typedef unsigned (__cdecl *afc_remove_path)(afc_connection* , const char *);
159
- typedef unsigned (__cdecl *afc_fileref_open)(afc_connection* , const char *, unsigned long long , afc_file_ref*);
160
- typedef unsigned (__cdecl *afc_fileref_read)(afc_connection* , afc_file_ref, void *, size_t *);
161
- typedef unsigned (__cdecl *afc_get_device_info_key)(afc_connection* , const char *, char **);
162
- typedef unsigned (__cdecl *afc_fileref_write)(afc_connection* , afc_file_ref, const void *, size_t );
163
- typedef unsigned (__cdecl *afc_fileref_close)(afc_connection* , afc_file_ref);
164
+ typedef unsigned (__cdecl *afc_connection_close)(AFCConnectionRef );
165
+ typedef unsigned (__cdecl *afc_file_info_open)(AFCConnectionRef , const char *, afc_dictionary**);
166
+ typedef unsigned (__cdecl *afc_directory_read)(AFCConnectionRef , afc_directory*, char **);
167
+ typedef unsigned (__cdecl *afc_directory_open)(AFCConnectionRef , const char *, afc_directory**);
168
+ typedef unsigned (__cdecl *afc_directory_close)(AFCConnectionRef , afc_directory*);
169
+ typedef unsigned (__cdecl *afc_directory_create)(AFCConnectionRef , const char *);
170
+ typedef unsigned (__cdecl *afc_remove_path)(AFCConnectionRef , const char *);
171
+ typedef unsigned (__cdecl *afc_fileref_open)(AFCConnectionRef , const char *, unsigned long long , afc_file_ref*);
172
+ typedef unsigned (__cdecl *afc_fileref_read)(AFCConnectionRef , afc_file_ref, void *, size_t *);
173
+ typedef unsigned (__cdecl *afc_get_device_info_key)(AFCConnectionRef , const char *, char **);
174
+ typedef unsigned (__cdecl *afc_fileref_write)(AFCConnectionRef , afc_file_ref, const void *, size_t );
175
+ typedef unsigned (__cdecl *afc_fileref_close)(AFCConnectionRef , afc_file_ref);
164
176
typedef unsigned (__cdecl *device_start_house_arrest)(const DeviceInfo*, CFStringRef , void *, HANDLE*, unsigned int *);
165
177
typedef unsigned (__cdecl *device_lookup_applications)(const DeviceInfo*, CFDictionaryRef , CFDictionaryRef *);
166
178
typedef int (__cdecl *usb_mux_connect_by_port)(int , int , long long *);
@@ -228,14 +240,21 @@ typedef int(__cdecl *usb_mux_connect_by_port)(int, int, long long*);
228
240
229
241
#include < CoreFoundation/CoreFoundation.h>
230
242
243
+ // TODO: handle Windows
244
+
231
245
extern " C"
232
246
{
247
+ CFSocketNativeHandle AMDServiceConnectionGetSocket (ServiceConnRef con);
248
+ long AMDServiceConnectionReceive (ServiceConnRef, void *, long );
249
+ long AMDServiceConnectionSendMessage (ServiceConnRef serviceConnection, CFDictionaryRef message, CFPropertyListFormat format);
250
+ unsigned AMDeviceSecureStartService (AMDeviceRef device, CFStringRef service_name, unsigned int *unknown, ServiceConnRef * handle);
233
251
unsigned AMDeviceNotificationSubscribe (void (*f)(const DevicePointer*), long, long, long, HANDLE*);
234
252
CFStringRef AMDeviceCopyDeviceIdentifier (const DeviceInfo*);
235
253
CFStringRef AMDeviceCopyValue (const DeviceInfo*, CFStringRef , CFStringRef );
236
254
unsigned AMDeviceMountImage (const DeviceInfo*, CFStringRef , CFDictionaryRef , void (*f)(void *, int ), void*);
237
255
unsigned AMDeviceStartService (const DeviceInfo*, CFStringRef , HANDLE*, void *);
238
256
unsigned AMDeviceLookupApplications (const DeviceInfo*, CFDictionaryRef , CFDictionaryRef *);
257
+ unsigned AMDeviceCreateHouseArrestService (const DeviceInfo*, CFStringRef identifier, void * unknown, AFCConnectionRef * handle);
239
258
int AMDeviceGetConnectionID (const DeviceInfo*);
240
259
int AMDeviceGetInterfaceType (const DeviceInfo*);
241
260
unsigned AMDeviceUninstallApplication (HANDLE, CFStringRef , void *, void (*f)(), void*);
@@ -251,17 +270,17 @@ extern "C"
251
270
unsigned AMDeviceSecureInstallApplication (int , const DeviceInfo*, CFURLRef , CFDictionaryRef , void (*f)(), int);
252
271
unsigned AMDeviceStartHouseArrestService (const DeviceInfo*, CFStringRef , void *, HANDLE*, unsigned int *);
253
272
unsigned AFCConnectionOpen (HANDLE, const char *, void *);
254
- unsigned AFCConnectionClose (afc_connection* );
255
- unsigned AFCRemovePath (afc_connection* , const char *);
256
- unsigned AFCFileInfoOpen (afc_connection* , const char *, afc_dictionary**);
257
- unsigned AFCDirectoryRead (afc_connection* , afc_directory*, char **);
258
- unsigned AFCDirectoryOpen (afc_connection* , const char *, afc_directory**);
259
- unsigned AFCDirectoryClose (afc_connection* , afc_directory*);
260
- unsigned AFCDirectoryCreate (afc_connection* , const char *);
261
- unsigned AFCFileRefOpen (afc_connection* , const char *, unsigned long long , afc_file_ref*);
262
- unsigned AFCFileRefRead (afc_connection* , afc_file_ref, void *, size_t *);
263
- unsigned AFCFileRefWrite (afc_connection* , afc_file_ref, const void *, size_t );
264
- unsigned AFCFileRefClose (afc_connection* , afc_file_ref);
273
+ unsigned AFCConnectionClose (AFCConnectionRef );
274
+ unsigned AFCRemovePath (AFCConnectionRef , const char *);
275
+ unsigned AFCFileInfoOpen (AFCConnectionRef , const char *, afc_dictionary**);
276
+ unsigned AFCDirectoryRead (AFCConnectionRef , afc_directory*, char **);
277
+ unsigned AFCDirectoryOpen (AFCConnectionRef , const char *, afc_directory**);
278
+ unsigned AFCDirectoryClose (AFCConnectionRef , afc_directory*);
279
+ unsigned AFCDirectoryCreate (AFCConnectionRef , const char *);
280
+ unsigned AFCFileRefOpen (AFCConnectionRef , const char *, unsigned long long , afc_file_ref*);
281
+ unsigned AFCFileRefRead (AFCConnectionRef , afc_file_ref, void *, size_t *);
282
+ unsigned AFCFileRefWrite (AFCConnectionRef , afc_file_ref, const void *, size_t );
283
+ unsigned AFCFileRefClose (AFCConnectionRef , afc_file_ref);
265
284
unsigned USBMuxConnectByPort (int , int , long long *);
266
285
}
267
286
0 commit comments