From 8daa51ce721076b916ca9ad412b36960fba5222c Mon Sep 17 00:00:00 2001 From: Alexey Storozhev Date: Wed, 27 Feb 2013 20:52:09 +0400 Subject: [PATCH 1/2] fixed due to updated libimobiledevice --- idevice-app-runner.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/idevice-app-runner.c b/idevice-app-runner.c index 6b6b016..50dcc1d 100644 --- a/idevice-app-runner.c +++ b/idevice-app-runner.c @@ -217,7 +217,6 @@ int main(int argc, char **argv) idevice_t phone = NULL; lockdownd_client_t client = NULL; idevice_connection_t connection = NULL; - uint16_t port = 0; int res = 0; signal(SIGINT, clean_exit); @@ -247,16 +246,16 @@ int main(int argc, char **argv) goto leave_cleanup; } - uint16_t port2 = 0; + lockdownd_service_descriptor_t service_descriptor = NULL; if ((lockdownd_start_service (client, "com.apple.debugserver", - &port2) != LOCKDOWN_E_SUCCESS) || !port2) { + &service_descriptor) != LOCKDOWN_E_SUCCESS) || !service_descriptor->port) { fprintf(stderr, "Could not start com.apple.debugserver!\n"); goto leave_cleanup; } - if (idevice_connect(phone, port2, &connection) != IDEVICE_E_SUCCESS) { + if (idevice_connect(phone, service_descriptor->port, &connection) != IDEVICE_E_SUCCESS) { fprintf(stderr, "idevice_connect failed!\n"); goto leave_cleanup; } From 81e76bee83d39ffc4b7aec0fc7830f8ffb86e65f Mon Sep 17 00:00:00 2001 From: Alexey Storozhev Date: Tue, 12 Mar 2013 20:50:19 +0400 Subject: [PATCH 2/2] added compatibility with win32 --- idevice-app-runner.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/idevice-app-runner.c b/idevice-app-runner.c index 50dcc1d..efe2162 100644 --- a/idevice-app-runner.c +++ b/idevice-app-runner.c @@ -37,6 +37,17 @@ #include #include +#ifdef WIN32 +# include +# define sleep(x) Sleep(x*1000) +#endif + +#ifdef WIN32 +# define __strdup _strdup +#else +# define __strdup strdup +#endif + char *udid = NULL; char *apppath = NULL; @@ -95,11 +106,11 @@ static void parse_opts(int argc, char **argv) print_usage(argc, argv); exit(2); } - udid = strdup(optarg); + udid = __strdup(optarg); break; case 'r': run_mode = 1; - apppath = strdup(optarg); + apppath = __strdup(optarg); break; case 'd': idevice_set_debug_level(1); @@ -147,7 +158,7 @@ void recv_pkt(idevice_connection_t connection) { int bytes = 0; char buf[16*1024]; - idevice_connection_receive_timeout(connection, buf, sizeof(buf)-1, &bytes, 1000); + idevice_connection_receive_timeout(connection, buf, sizeof(buf)-1, (uint32_t*)&bytes, 1000); #ifdef WITH_DEBUG printf("recv: bytes=%d\n", bytes); #endif @@ -181,7 +192,7 @@ void send_pkt(char* buf, idevice_connection_t connection) { int i; unsigned char csum = 0; - char *buf2 = malloc (32*1024); + char *buf2 = (char *)malloc (32*1024); int cnt = strlen (buf); char *p; @@ -276,7 +287,7 @@ int main(int argc, char **argv) NULL, }; - cmds[0] = malloc(2000); + cmds[0] = (char *)malloc(2000); char* p = cmds[0]; sprintf(p, "A%d,0,", strlen(apppath)*2/* +4 */); p += strlen(p);