summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--3rd_party/libsrp6a-sha512/cstr.h2
-rw-r--r--3rd_party/libsrp6a-sha512/t_defines.h4
-rw-r--r--3rd_party/libsrp6a-sha512/t_misc.c12
-rw-r--r--3rd_party/libsrp6a-sha512/t_truerand.c8
-rw-r--r--common/userpref.c12
-rw-r--r--src/afc.c2
-rw-r--r--src/idevice.c4
-rw-r--r--src/lockdown-cu.c2
-rw-r--r--src/lockdown.c2
-rw-r--r--src/notification_proxy.c2
-rw-r--r--tools/afcclient.c18
-rw-r--r--tools/idevicebackup.c6
-rw-r--r--tools/idevicebackup2.c22
-rw-r--r--tools/idevicebtlogger.c4
-rw-r--r--tools/idevicecrashreport.c14
-rw-r--r--tools/idevicedate.c6
-rw-r--r--tools/idevicedebug.c4
-rw-r--r--tools/idevicedebugserverproxy.c4
-rw-r--r--tools/idevicedevmodectl.c6
-rw-r--r--tools/idevicediagnostics.c4
-rw-r--r--tools/ideviceenterrecovery.c4
-rw-r--r--tools/ideviceimagemounter.c4
-rw-r--r--tools/ideviceinfo.c4
-rw-r--r--tools/idevicename.c4
-rw-r--r--tools/idevicenotificationproxy.c4
-rw-r--r--tools/idevicepair.c6
-rw-r--r--tools/ideviceprovision.c6
-rw-r--r--tools/idevicescreenshot.c4
-rw-r--r--tools/idevicesyslog.c4
29 files changed, 89 insertions, 89 deletions
diff --git a/3rd_party/libsrp6a-sha512/cstr.h b/3rd_party/libsrp6a-sha512/cstr.h
index ae7d71a..29afea7 100644
--- a/3rd_party/libsrp6a-sha512/cstr.h
+++ b/3rd_party/libsrp6a-sha512/cstr.h
@@ -38,7 +38,7 @@
38#define _MSVC15DEXPORT 38#define _MSVC15DEXPORT
39#define _MSVC20EXPORT 39#define _MSVC20EXPORT
40#define _DLLAPI 40#define _DLLAPI
41#if defined(WINDOWS) || defined(WIN32) 41#if defined(WINDOWS) || defined(_WIN32)
42#define _CDECL _cdecl 42#define _CDECL _cdecl
43#else 43#else
44#define _CDECL 44#define _CDECL
diff --git a/3rd_party/libsrp6a-sha512/t_defines.h b/3rd_party/libsrp6a-sha512/t_defines.h
index 447263f..a2a5fe5 100644
--- a/3rd_party/libsrp6a-sha512/t_defines.h
+++ b/3rd_party/libsrp6a-sha512/t_defines.h
@@ -65,7 +65,7 @@
65#define _MSVC15DEXPORT 65#define _MSVC15DEXPORT
66#define _MSVC20EXPORT 66#define _MSVC20EXPORT
67#define _DLLAPI 67#define _DLLAPI
68#if defined(WINDOWS) || defined(WIN32) 68#if defined(WINDOWS) || defined(_WIN32)
69#define _CDECL _cdecl 69#define _CDECL _cdecl
70#else 70#else
71#define _CDECL 71#define _CDECL
@@ -122,7 +122,7 @@ char *strchr(), *strrchr(), *strtok();
122#define USE_SGTTY 122#define USE_SGTTY
123#endif 123#endif
124 124
125#ifdef WIN32 125#ifdef _WIN32
126#define USE_FTIME 1 126#define USE_FTIME 1
127#define USE_RENAME 1 127#define USE_RENAME 1
128#define NO_FCHMOD 1 128#define NO_FCHMOD 1
diff --git a/3rd_party/libsrp6a-sha512/t_misc.c b/3rd_party/libsrp6a-sha512/t_misc.c
index 3a2cda1..abd8e55 100644
--- a/3rd_party/libsrp6a-sha512/t_misc.c
+++ b/3rd_party/libsrp6a-sha512/t_misc.c
@@ -38,7 +38,7 @@
38#include <sys/stat.h> 38#include <sys/stat.h>
39#include <fcntl.h> 39#include <fcntl.h>
40 40
41#ifdef WIN32 41#ifdef _WIN32
42#include <process.h> 42#include <process.h>
43#include <io.h> 43#include <io.h>
44#endif 44#endif
@@ -207,7 +207,7 @@ t_initrand()
207#if defined(OPENSSL) /* OpenSSL has nifty win32 entropy-gathering code */ 207#if defined(OPENSSL) /* OpenSSL has nifty win32 entropy-gathering code */
208#if OPENSSL_VERSION_NUMBER >= 0x00905100 208#if OPENSSL_VERSION_NUMBER >= 0x00905100
209 r = RAND_status(); 209 r = RAND_status();
210#if defined(WINDOWS) || defined(WIN32) 210#if defined(WINDOWS) || defined(_WIN32)
211 if(r) /* Don't do the Unix-y stuff on Windows if possible */ 211 if(r) /* Don't do the Unix-y stuff on Windows if possible */
212 return; 212 return;
213#else 213#else
@@ -220,7 +220,7 @@ t_initrand()
220 if(r > 0) { 220 if(r > 0) {
221 yarrow_add_entropy(entropy, r, &g_rng); 221 yarrow_add_entropy(entropy, r, &g_rng);
222 memset(entropy, 0, sizeof(entropy)); 222 memset(entropy, 0, sizeof(entropy));
223# if defined(WINDOWS) || defined(WIN32) 223# if defined(WINDOWS) || defined(_WIN32)
224 /* Don't do the Unix-y stuff on Windows if possible */ 224 /* Don't do the Unix-y stuff on Windows if possible */
225 yarrow_ready(&g_rng); 225 yarrow_ready(&g_rng);
226 return; 226 return;
@@ -228,13 +228,13 @@ t_initrand()
228 } 228 }
229#endif 229#endif
230 230
231#if !defined(WINDOWS) && !defined(WIN32) 231#if !defined(WINDOWS) && !defined(_WIN32)
232 i = open("/dev/urandom", O_RDONLY); 232 i = open("/dev/urandom", O_RDONLY);
233 if(i > 0) { 233 if(i > 0) {
234 r += read(i, preseed.devrand, sizeof(preseed.devrand)); 234 r += read(i, preseed.devrand, sizeof(preseed.devrand));
235 close(i); 235 close(i);
236 } 236 }
237#endif /* !WINDOWS && !WIN32 */ 237#endif /* !WINDOWS && !_WIN32 */
238 238
239 /* Resort to truerand only if desperate for some Real entropy */ 239 /* Resort to truerand only if desperate for some Real entropy */
240 if(r == 0) 240 if(r == 0)
@@ -250,7 +250,7 @@ t_initrand()
250 preseed.subsec = t.tv_usec; 250 preseed.subsec = t.tv_usec;
251#endif 251#endif
252 preseed.pid = getpid(); 252 preseed.pid = getpid();
253#ifndef WIN32 253#ifndef _WIN32
254 preseed.ppid = getppid(); 254 preseed.ppid = getppid();
255#endif 255#endif
256 t_envhash(preseed.envh); 256 t_envhash(preseed.envh);
diff --git a/3rd_party/libsrp6a-sha512/t_truerand.c b/3rd_party/libsrp6a-sha512/t_truerand.c
index f995ed7..cd27d0d 100644
--- a/3rd_party/libsrp6a-sha512/t_truerand.c
+++ b/3rd_party/libsrp6a-sha512/t_truerand.c
@@ -54,7 +54,7 @@
54 54
55#include "t_defines.h" 55#include "t_defines.h"
56 56
57#ifdef WIN32 57#ifdef _WIN32
58 58
59# ifdef CRYPTOLIB 59# ifdef CRYPTOLIB
60 60
@@ -69,7 +69,7 @@ raw_truerand()
69 return truerand(); 69 return truerand();
70} 70}
71 71
72# else /* !CRYPTOLIB && WIN32 */ 72# else /* !CRYPTOLIB && _WIN32 */
73 73
74#include <windows.h> 74#include <windows.h>
75#include <wtypes.h> 75#include <wtypes.h>
@@ -128,7 +128,7 @@ raw_truerand() {
128 128
129# endif /* CRYPTOLIB */ 129# endif /* CRYPTOLIB */
130 130
131#else /* !WIN32 */ 131#else /* !_WIN32 */
132 132
133#include <signal.h> 133#include <signal.h>
134#include <setjmp.h> 134#include <setjmp.h>
@@ -238,4 +238,4 @@ raw_n_truerand(int n)
238 return v % n; 238 return v % n;
239} 239}
240 240
241#endif /* !CRYPTOLIB || !WIN32 */ 241#endif /* !CRYPTOLIB || !_WIN32 */
diff --git a/common/userpref.c b/common/userpref.c
index 48bcfcb..9c2c563 100644
--- a/common/userpref.c
+++ b/common/userpref.c
@@ -32,7 +32,7 @@
32#ifdef HAVE_SYS_TYPES_H 32#ifdef HAVE_SYS_TYPES_H
33#include <sys/types.h> 33#include <sys/types.h>
34#endif 34#endif
35#ifndef WIN32 35#ifndef _WIN32
36#include <pwd.h> 36#include <pwd.h>
37#endif 37#endif
38#include <unistd.h> 38#include <unistd.h>
@@ -69,7 +69,7 @@
69#include <sys/stat.h> 69#include <sys/stat.h>
70#include <errno.h> 70#include <errno.h>
71 71
72#ifdef WIN32 72#ifdef _WIN32
73#include <shlobj.h> 73#include <shlobj.h>
74#endif 74#endif
75 75
@@ -93,7 +93,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
93}; 93};
94#endif 94#endif
95 95
96#ifdef WIN32 96#ifdef _WIN32
97#define DIR_SEP '\\' 97#define DIR_SEP '\\'
98#define DIR_SEP_S "\\" 98#define DIR_SEP_S "\\"
99#else 99#else
@@ -103,7 +103,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
103 103
104#define USERPREF_CONFIG_EXTENSION ".plist" 104#define USERPREF_CONFIG_EXTENSION ".plist"
105 105
106#ifdef WIN32 106#ifdef _WIN32
107#define USERPREF_CONFIG_DIR "Apple"DIR_SEP_S"Lockdown" 107#define USERPREF_CONFIG_DIR "Apple"DIR_SEP_S"Lockdown"
108#else 108#else
109#define USERPREF_CONFIG_DIR "lockdown" 109#define USERPREF_CONFIG_DIR "lockdown"
@@ -113,7 +113,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
113 113
114static char *__config_dir = NULL; 114static char *__config_dir = NULL;
115 115
116#ifdef WIN32 116#ifdef _WIN32
117static char *userpref_utf16_to_utf8(wchar_t *unistr, long len, long *items_read, long *items_written) 117static char *userpref_utf16_to_utf8(wchar_t *unistr, long len, long *items_read, long *items_written)
118{ 118{
119 if (!unistr || (len <= 0)) return NULL; 119 if (!unistr || (len <= 0)) return NULL;
@@ -155,7 +155,7 @@ const char *userpref_get_config_dir()
155 if (__config_dir) 155 if (__config_dir)
156 return __config_dir; 156 return __config_dir;
157 157
158#ifdef WIN32 158#ifdef _WIN32
159 wchar_t path[MAX_PATH+1]; 159 wchar_t path[MAX_PATH+1];
160 HRESULT hr; 160 HRESULT hr;
161 LPITEMIDLIST pidl = NULL; 161 LPITEMIDLIST pidl = NULL;
diff --git a/src/afc.c b/src/afc.c
index 1b4070b..d9b35b7 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -338,7 +338,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **bytes, uint32_t
338 free(buf); 338 free(buf);
339 339
340 debug_info("WARNING: Unknown operation code received 0x%llx param1=%lld", header.operation, param1); 340 debug_info("WARNING: Unknown operation code received 0x%llx param1=%lld", header.operation, param1);
341#ifndef WIN32 341#ifndef _WIN32
342 fprintf(stderr, "%s: WARNING: Unknown operation code received 0x%llx param1=%lld", __func__, (long long)header.operation, (long long)param1); 342 fprintf(stderr, "%s: WARNING: Unknown operation code received 0x%llx param1=%lld", __func__, (long long)header.operation, (long long)param1);
343#endif 343#endif
344 344
diff --git a/src/idevice.c b/src/idevice.c
index d4ecf60..b14db66 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -30,7 +30,7 @@
30#include <errno.h> 30#include <errno.h>
31#include <time.h> 31#include <time.h>
32 32
33#ifdef WIN32 33#ifdef _WIN32
34#include <winsock2.h> 34#include <winsock2.h>
35#include <ws2tcpip.h> 35#include <ws2tcpip.h>
36#include <windows.h> 36#include <windows.h>
@@ -1338,7 +1338,7 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection)
1338 if (ssl_error == 0 || ssl_error != SSL_ERROR_WANT_READ) { 1338 if (ssl_error == 0 || ssl_error != SSL_ERROR_WANT_READ) {
1339 break; 1339 break;
1340 } 1340 }
1341#ifdef WIN32 1341#ifdef _WIN32
1342 Sleep(100); 1342 Sleep(100);
1343#else 1343#else
1344 struct timespec ts = { 0, 100000000 }; 1344 struct timespec ts = { 0, 100000000 };
diff --git a/src/lockdown-cu.c b/src/lockdown-cu.c
index 1afc2c5..e0af5e2 100644
--- a/src/lockdown-cu.c
+++ b/src/lockdown-cu.c
@@ -653,7 +653,7 @@ lockdownd_error_t lockdownd_cu_pairing_create(lockdownd_client_t client, lockdow
653 CFStringGetCString(cname, hostname, sizeof(hostname), kCFStringEncodingUTF8); 653 CFStringGetCString(cname, hostname, sizeof(hostname), kCFStringEncodingUTF8);
654 CFRelease(cname); 654 CFRelease(cname);
655#else 655#else
656#ifdef WIN32 656#ifdef _WIN32
657 DWORD hostname_len = sizeof(hostname); 657 DWORD hostname_len = sizeof(hostname);
658 GetComputerName(hostname, &hostname_len); 658 GetComputerName(hostname, &hostname_len);
659#else 659#else
diff --git a/src/lockdown.c b/src/lockdown.c
index 256bff0..be55934 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -43,7 +43,7 @@
43#include "common/userpref.h" 43#include "common/userpref.h"
44#include "asprintf.h" 44#include "asprintf.h"
45 45
46#ifdef WIN32 46#ifdef _WIN32
47#include <windows.h> 47#include <windows.h>
48#define sleep(x) Sleep(x*1000) 48#define sleep(x) Sleep(x*1000)
49#endif 49#endif
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index c5f29f5..9d983ba 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -31,7 +31,7 @@
31#include "property_list_service.h" 31#include "property_list_service.h"
32#include "common/debug.h" 32#include "common/debug.h"
33 33
34#ifdef WIN32 34#ifdef _WIN32
35#include <windows.h> 35#include <windows.h>
36#define sleep(x) Sleep(x*1000) 36#define sleep(x) Sleep(x*1000)
37#endif 37#endif
diff --git a/tools/afcclient.c b/tools/afcclient.c
index 8f49831..1c14bf2 100644
--- a/tools/afcclient.c
+++ b/tools/afcclient.c
@@ -39,7 +39,7 @@
39#include <dirent.h> 39#include <dirent.h>
40#include <time.h> 40#include <time.h>
41 41
42#ifdef WIN32 42#ifdef _WIN32
43#include <windows.h> 43#include <windows.h>
44#include <sys/time.h> 44#include <sys/time.h>
45#include <conio.h> 45#include <conio.h>
@@ -95,7 +95,7 @@ static size_t curdir_len = 0;
95static int file_exists(const char* path) 95static int file_exists(const char* path)
96{ 96{
97 struct stat tst; 97 struct stat tst;
98#ifdef WIN32 98#ifdef _WIN32
99 return (stat(path, &tst) == 0); 99 return (stat(path, &tst) == 0);
100#else 100#else
101 return (lstat(path, &tst) == 0); 101 return (lstat(path, &tst) == 0);
@@ -105,7 +105,7 @@ static int file_exists(const char* path)
105static int is_directory(const char* path) 105static int is_directory(const char* path)
106{ 106{
107 struct stat tst; 107 struct stat tst;
108#ifdef WIN32 108#ifdef _WIN32
109 return (stat(path, &tst) == 0) && S_ISDIR(tst.st_mode); 109 return (stat(path, &tst) == 0) && S_ISDIR(tst.st_mode);
110#else 110#else
111 return (lstat(path, &tst) == 0) && S_ISDIR(tst.st_mode); 111 return (lstat(path, &tst) == 0) && S_ISDIR(tst.st_mode);
@@ -138,7 +138,7 @@ static void print_usage(int argc, char **argv, int is_error)
138} 138}
139 139
140#ifndef HAVE_READLINE 140#ifndef HAVE_READLINE
141#ifdef WIN32 141#ifdef _WIN32
142#define BS_CC '\b' 142#define BS_CC '\b'
143#else 143#else
144#define BS_CC 0x7f 144#define BS_CC 0x7f
@@ -175,7 +175,7 @@ int stop_requested = 0;
175static void handle_signal(int sig) 175static void handle_signal(int sig)
176{ 176{
177 stop_requested++; 177 stop_requested++;
178#ifdef WIN32 178#ifdef _WIN32
179 GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); 179 GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
180#else 180#else
181 kill(getpid(), SIGINT); 181 kill(getpid(), SIGINT);
@@ -483,7 +483,7 @@ static void print_file_info(afc_client_t afc, const char* path, int list_verbose
483 printf(" "); 483 printf(" ");
484 printf("%10lld", (long long)st.st_size); 484 printf("%10lld", (long long)st.st_size);
485 printf(" "); 485 printf(" ");
486#ifdef WIN32 486#ifdef _WIN32
487 strftime(timebuf, 64, "%d %b %Y %H:%M:%S", localtime(&t)); 487 strftime(timebuf, 64, "%d %b %Y %H:%M:%S", localtime(&t));
488#else 488#else
489 strftime(timebuf, 64, "%d %h %Y %H:%M:%S", localtime(&t)); 489 strftime(timebuf, 64, "%d %h %Y %H:%M:%S", localtime(&t));
@@ -774,7 +774,7 @@ static uint8_t get_single_file(afc_client_t afc, const char *srcpath, const char
774 774
775static int __mkdir(const char* path) 775static int __mkdir(const char* path)
776{ 776{
777#ifdef WIN32 777#ifdef _WIN32
778 return mkdir(path); 778 return mkdir(path);
779#else 779#else
780 return mkdir(path, 0755); 780 return mkdir(path, 0755);
@@ -1483,7 +1483,7 @@ int main(int argc, char** argv)
1483 }; 1483 };
1484 1484
1485 signal(SIGTERM, handle_signal); 1485 signal(SIGTERM, handle_signal);
1486#ifndef WIN32 1486#ifndef _WIN32
1487 signal(SIGQUIT, handle_signal); 1487 signal(SIGQUIT, handle_signal);
1488 signal(SIGPIPE, SIG_IGN); 1488 signal(SIGPIPE, SIG_IGN);
1489#endif 1489#endif
@@ -1561,7 +1561,7 @@ int main(int argc, char** argv)
1561 idevice_events_subscribe(&context, device_event_cb, NULL); 1561 idevice_events_subscribe(&context, device_event_cb, NULL);
1562 1562
1563 while (!connected && !stop_requested) { 1563 while (!connected && !stop_requested) {
1564#ifdef WIN32 1564#ifdef _WIN32
1565 Sleep(100); 1565 Sleep(100);
1566#else 1566#else
1567 usleep(100000); 1567 usleep(100000);
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index c0537b8..5de2d68 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -51,7 +51,7 @@
51#define LOCK_ATTEMPTS 50 51#define LOCK_ATTEMPTS 50
52#define LOCK_WAIT 200000 52#define LOCK_WAIT 200000
53 53
54#ifdef WIN32 54#ifdef _WIN32
55#include <windows.h> 55#include <windows.h>
56#define sleep(x) Sleep(x*1000) 56#define sleep(x) Sleep(x*1000)
57#endif 57#endif
@@ -642,7 +642,7 @@ int main(int argc, char *argv[])
642 /* we need to exit cleanly on running backups and restores or we cause havok */ 642 /* we need to exit cleanly on running backups and restores or we cause havok */
643 signal(SIGINT, clean_exit); 643 signal(SIGINT, clean_exit);
644 signal(SIGTERM, clean_exit); 644 signal(SIGTERM, clean_exit);
645#ifndef WIN32 645#ifndef _WIN32
646 signal(SIGQUIT, clean_exit); 646 signal(SIGQUIT, clean_exit);
647 signal(SIGPIPE, SIG_IGN); 647 signal(SIGPIPE, SIG_IGN);
648#endif 648#endif
@@ -1352,7 +1352,7 @@ files_out:
1352 file_info_path = mobilebackup_build_path(backup_directory, hash, ".mddata"); 1352 file_info_path = mobilebackup_build_path(backup_directory, hash, ".mddata");
1353 1353
1354 /* determine file size */ 1354 /* determine file size */
1355#ifdef WIN32 1355#ifdef _WIN32
1356 struct _stati64 fst; 1356 struct _stati64 fst;
1357 if (_stati64(file_info_path, &fst) != 0) 1357 if (_stati64(file_info_path, &fst) != 0)
1358#else 1358#else
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 19d21a6..804f9f4 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -54,7 +54,7 @@
54#define LOCK_ATTEMPTS 50 54#define LOCK_ATTEMPTS 50
55#define LOCK_WAIT 200000 55#define LOCK_WAIT 200000
56 56
57#ifdef WIN32 57#ifdef _WIN32
58#include <windows.h> 58#include <windows.h>
59#include <conio.h> 59#include <conio.h>
60#define sleep(x) Sleep(x*1000) 60#define sleep(x) Sleep(x*1000)
@@ -178,7 +178,7 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil
178 178
179static int __mkdir(const char* path, int mode) 179static int __mkdir(const char* path, int mode)
180{ 180{
181#ifdef WIN32 181#ifdef _WIN32
182 return mkdir(path); 182 return mkdir(path);
183#else 183#else
184 return mkdir(path, mode); 184 return mkdir(path, mode);
@@ -207,7 +207,7 @@ static int mkdir_with_parents(const char *dir, int mode)
207 return res; 207 return res;
208} 208}
209 209
210#ifdef WIN32 210#ifdef _WIN32
211static int win32err_to_errno(int err_value) 211static int win32err_to_errno(int err_value)
212{ 212{
213 switch (err_value) { 213 switch (err_value) {
@@ -224,7 +224,7 @@ static int win32err_to_errno(int err_value)
224static int remove_file(const char* path) 224static int remove_file(const char* path)
225{ 225{
226 int e = 0; 226 int e = 0;
227#ifdef WIN32 227#ifdef _WIN32
228 if (!DeleteFile(path)) { 228 if (!DeleteFile(path)) {
229 e = win32err_to_errno(GetLastError()); 229 e = win32err_to_errno(GetLastError());
230 } 230 }
@@ -239,7 +239,7 @@ static int remove_file(const char* path)
239static int remove_directory(const char* path) 239static int remove_directory(const char* path)
240{ 240{
241 int e = 0; 241 int e = 0;
242#ifdef WIN32 242#ifdef _WIN32
243 if (!RemoveDirectory(path)) { 243 if (!RemoveDirectory(path)) {
244 e = win32err_to_errno(GetLastError()); 244 e = win32err_to_errno(GetLastError());
245 } 245 }
@@ -773,7 +773,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
773 uint32_t bytes = 0; 773 uint32_t bytes = 0;
774 char *localfile = string_build_path(backup_dir, path, NULL); 774 char *localfile = string_build_path(backup_dir, path, NULL);
775 char buf[32768]; 775 char buf[32768];
776#ifdef WIN32 776#ifdef _WIN32
777 struct _stati64 fst; 777 struct _stati64 fst;
778#else 778#else
779 struct stat fst; 779 struct stat fst;
@@ -784,7 +784,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
784 int errcode = -1; 784 int errcode = -1;
785 int result = -1; 785 int result = -1;
786 uint32_t length; 786 uint32_t length;
787#ifdef WIN32 787#ifdef _WIN32
788 uint64_t total; 788 uint64_t total;
789 uint64_t sent; 789 uint64_t sent;
790#else 790#else
@@ -815,7 +815,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
815 goto leave_proto_err; 815 goto leave_proto_err;
816 } 816 }
817 817
818#ifdef WIN32 818#ifdef _WIN32
819 if (_stati64(localfile, &fst) < 0) 819 if (_stati64(localfile, &fst) < 0)
820#else 820#else
821 if (stat(localfile, &fst) < 0) 821 if (stat(localfile, &fst) < 0)
@@ -1348,7 +1348,7 @@ static void mb2_copy_directory_by_path(const char *src, const char *dst)
1348 } 1348 }
1349} 1349}
1350 1350
1351#ifdef WIN32 1351#ifdef _WIN32
1352#define BS_CC '\b' 1352#define BS_CC '\b'
1353#define my_getch getch 1353#define my_getch getch
1354#else 1354#else
@@ -1535,7 +1535,7 @@ int main(int argc, char *argv[])
1535 /* we need to exit cleanly on running backups and restores or we cause havok */ 1535 /* we need to exit cleanly on running backups and restores or we cause havok */
1536 signal(SIGINT, clean_exit); 1536 signal(SIGINT, clean_exit);
1537 signal(SIGTERM, clean_exit); 1537 signal(SIGTERM, clean_exit);
1538#ifndef WIN32 1538#ifndef _WIN32
1539 signal(SIGQUIT, clean_exit); 1539 signal(SIGQUIT, clean_exit);
1540 signal(SIGPIPE, SIG_IGN); 1540 signal(SIGPIPE, SIG_IGN);
1541#endif 1541#endif
@@ -2324,7 +2324,7 @@ checkpoint:
2324 /* device wants to know how much disk space is available on the computer */ 2324 /* device wants to know how much disk space is available on the computer */
2325 uint64_t freespace = 0; 2325 uint64_t freespace = 0;
2326 int res = -1; 2326 int res = -1;
2327#ifdef WIN32 2327#ifdef _WIN32
2328 if (GetDiskFreeSpaceEx(backup_directory, (PULARGE_INTEGER)&freespace, NULL, NULL)) { 2328 if (GetDiskFreeSpaceEx(backup_directory, (PULARGE_INTEGER)&freespace, NULL, NULL)) {
2329 res = 0; 2329 res = 0;
2330 } 2330 }
diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c
index 8de6b22..ca68b59 100644
--- a/tools/idevicebtlogger.c
+++ b/tools/idevicebtlogger.c
@@ -36,7 +36,7 @@
36#include <assert.h> 36#include <assert.h>
37#include <fcntl.h> 37#include <fcntl.h>
38 38
39#ifdef WIN32 39#ifdef _WIN32
40#include <windows.h> 40#include <windows.h>
41#define sleep(x) Sleep(x*1000) 41#define sleep(x) Sleep(x*1000)
42#else 42#else
@@ -334,7 +334,7 @@ int main(int argc, char *argv[])
334 334
335 signal(SIGINT, clean_exit); 335 signal(SIGINT, clean_exit);
336 signal(SIGTERM, clean_exit); 336 signal(SIGTERM, clean_exit);
337#ifndef WIN32 337#ifndef _WIN32
338 signal(SIGQUIT, clean_exit); 338 signal(SIGQUIT, clean_exit);
339 signal(SIGPIPE, SIG_IGN); 339 signal(SIGPIPE, SIG_IGN);
340#endif 340#endif
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index e900fe8..9814b79 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -31,7 +31,7 @@
31#include <string.h> 31#include <string.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <getopt.h> 33#include <getopt.h>
34#ifndef WIN32 34#ifndef _WIN32
35#include <signal.h> 35#include <signal.h>
36#endif 36#endif
37#include <libimobiledevice-glue/utils.h> 37#include <libimobiledevice-glue/utils.h>
@@ -42,7 +42,7 @@
42#include <libimobiledevice/afc.h> 42#include <libimobiledevice/afc.h>
43#include <plist/plist.h> 43#include <plist/plist.h>
44 44
45#ifdef WIN32 45#ifdef _WIN32
46#include <windows.h> 46#include <windows.h>
47#define S_IFLNK S_IFREG 47#define S_IFLNK S_IFREG
48#define S_IFSOCK S_IFREG 48#define S_IFSOCK S_IFREG
@@ -59,7 +59,7 @@ static int remove_all = 0;
59static int file_exists(const char* path) 59static int file_exists(const char* path)
60{ 60{
61 struct stat tst; 61 struct stat tst;
62#ifdef WIN32 62#ifdef _WIN32
63 return (stat(path, &tst) == 0); 63 return (stat(path, &tst) == 0);
64#else 64#else
65 return (lstat(path, &tst) == 0); 65 return (lstat(path, &tst) == 0);
@@ -153,7 +153,7 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
153 strcpy(((char*)source_filename) + device_directory_length, list[k]); 153 strcpy(((char*)source_filename) + device_directory_length, list[k]);
154 154
155 /* assemble absolute target filename */ 155 /* assemble absolute target filename */
156#ifdef WIN32 156#ifdef _WIN32
157 /* replace every ':' with '-' since ':' is an illegal character for file names in windows */ 157 /* replace every ':' with '-' since ':' is an illegal character for file names in windows */
158 char* current_pos = strchr(list[k], ':'); 158 char* current_pos = strchr(list[k], ':');
159 while (current_pos) { 159 while (current_pos) {
@@ -212,7 +212,7 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
212 remove(target_filename); 212 remove(target_filename);
213 } 213 }
214 214
215#ifndef WIN32 215#ifndef _WIN32
216 /* use relative filename */ 216 /* use relative filename */
217 char* b = strrchr(fileinfo[i+1], '/'); 217 char* b = strrchr(fileinfo[i+1], '/');
218 if (b == NULL) { 218 if (b == NULL) {
@@ -240,7 +240,7 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
240 /* recurse into child directories */ 240 /* recurse into child directories */
241 if (S_ISDIR(stbuf.st_mode)) { 241 if (S_ISDIR(stbuf.st_mode)) {
242 if (!remove_all) { 242 if (!remove_all) {
243#ifdef WIN32 243#ifdef _WIN32
244 mkdir(target_filename); 244 mkdir(target_filename);
245#else 245#else
246 mkdir(target_filename, 0755); 246 mkdir(target_filename, 0755);
@@ -375,7 +375,7 @@ int main(int argc, char* argv[])
375 { NULL, 0, NULL, 0} 375 { NULL, 0, NULL, 0}
376 }; 376 };
377 377
378#ifndef WIN32 378#ifndef _WIN32
379 signal(SIGPIPE, SIG_IGN); 379 signal(SIGPIPE, SIG_IGN);
380#endif 380#endif
381 381
diff --git a/tools/idevicedate.c b/tools/idevicedate.c
index d05f63e..31b0cf7 100644
--- a/tools/idevicedate.c
+++ b/tools/idevicedate.c
@@ -33,7 +33,7 @@
33#if HAVE_LANGINFO_CODESET 33#if HAVE_LANGINFO_CODESET
34#include <langinfo.h> 34#include <langinfo.h>
35#endif 35#endif
36#ifndef WIN32 36#ifndef _WIN32
37#include <signal.h> 37#include <signal.h>
38#endif 38#endif
39 39
@@ -43,7 +43,7 @@
43#ifdef _DATE_FMT 43#ifdef _DATE_FMT
44#define DATE_FMT_LANGINFO nl_langinfo (_DATE_FMT) 44#define DATE_FMT_LANGINFO nl_langinfo (_DATE_FMT)
45#else 45#else
46#ifdef WIN32 46#ifdef _WIN32
47#define DATE_FMT_LANGINFO "%a %b %#d %H:%M:%S %Z %Y" 47#define DATE_FMT_LANGINFO "%a %b %#d %H:%M:%S %Z %Y"
48#else 48#else
49#define DATE_FMT_LANGINFO "%a %b %e %H:%M:%S %Z %Y" 49#define DATE_FMT_LANGINFO "%a %b %e %H:%M:%S %Z %Y"
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
104 { NULL, 0, NULL, 0} 104 { NULL, 0, NULL, 0}
105 }; 105 };
106 106
107#ifndef WIN32 107#ifndef _WIN32
108 signal(SIGPIPE, SIG_IGN); 108 signal(SIGPIPE, SIG_IGN);
109#endif 109#endif
110 /* parse cmdline args */ 110 /* parse cmdline args */
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 36c594e..3f2e289 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -34,7 +34,7 @@
34#include <libgen.h> 34#include <libgen.h>
35#include <getopt.h> 35#include <getopt.h>
36 36
37#ifdef WIN32 37#ifdef _WIN32
38#include <windows.h> 38#include <windows.h>
39#define sleep(x) Sleep(x*1000) 39#define sleep(x) Sleep(x*1000)
40#endif 40#endif
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
239 /* map signals */ 239 /* map signals */
240 signal(SIGINT, on_signal); 240 signal(SIGINT, on_signal);
241 signal(SIGTERM, on_signal); 241 signal(SIGTERM, on_signal);
242#ifndef WIN32 242#ifndef _WIN32
243 signal(SIGQUIT, on_signal); 243 signal(SIGQUIT, on_signal);
244 signal(SIGPIPE, SIG_IGN); 244 signal(SIGPIPE, SIG_IGN);
245#endif 245#endif
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index 9fe7051..fb082b3 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -32,7 +32,7 @@
32#include <getopt.h> 32#include <getopt.h>
33#include <errno.h> 33#include <errno.h>
34#include <signal.h> 34#include <signal.h>
35#ifdef WIN32 35#ifdef _WIN32
36#include <winsock2.h> 36#include <winsock2.h>
37#include <windows.h> 37#include <windows.h>
38#else 38#else
@@ -219,7 +219,7 @@ int main(int argc, char *argv[])
219 { NULL, 0, NULL, 0} 219 { NULL, 0, NULL, 0}
220 }; 220 };
221 221
222#ifndef WIN32 222#ifndef _WIN32
223 struct sigaction sa; 223 struct sigaction sa;
224 struct sigaction si; 224 struct sigaction si;
225 memset(&sa, '\0', sizeof(struct sigaction)); 225 memset(&sa, '\0', sizeof(struct sigaction));
diff --git a/tools/idevicedevmodectl.c b/tools/idevicedevmodectl.c
index bd1de6a..6bf1a1c 100644
--- a/tools/idevicedevmodectl.c
+++ b/tools/idevicedevmodectl.c
@@ -32,11 +32,11 @@
32#include <sys/stat.h> 32#include <sys/stat.h>
33#include <unistd.h> 33#include <unistd.h>
34#include <errno.h> 34#include <errno.h>
35#ifndef WIN32 35#ifndef _WIN32
36#include <signal.h> 36#include <signal.h>
37#endif 37#endif
38 38
39#ifdef WIN32 39#ifdef _WIN32
40#include <windows.h> 40#include <windows.h>
41#define __usleep(x) Sleep(x/1000) 41#define __usleep(x) Sleep(x/1000)
42#else 42#else
@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
259 { NULL, 0, NULL, 0} 259 { NULL, 0, NULL, 0}
260 }; 260 };
261 261
262#ifndef WIN32 262#ifndef _WIN32
263 signal(SIGPIPE, SIG_IGN); 263 signal(SIGPIPE, SIG_IGN);
264#endif 264#endif
265 /* parse cmdline args */ 265 /* parse cmdline args */
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c
index e699bc4..365c0a4 100644
--- a/tools/idevicediagnostics.c
+++ b/tools/idevicediagnostics.c
@@ -31,7 +31,7 @@
31#include <getopt.h> 31#include <getopt.h>
32#include <errno.h> 32#include <errno.h>
33#include <time.h> 33#include <time.h>
34#ifndef WIN32 34#ifndef _WIN32
35#include <signal.h> 35#include <signal.h>
36#endif 36#endif
37 37
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
113 { NULL, 0, NULL, 0} 113 { NULL, 0, NULL, 0}
114 }; 114 };
115 115
116#ifndef WIN32 116#ifndef _WIN32
117 signal(SIGPIPE, SIG_IGN); 117 signal(SIGPIPE, SIG_IGN);
118#endif 118#endif
119 /* parse cmdline args */ 119 /* parse cmdline args */
diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c
index 29cc5c9..65eb882 100644
--- a/tools/ideviceenterrecovery.c
+++ b/tools/ideviceenterrecovery.c
@@ -30,7 +30,7 @@
30#include <stdlib.h> 30#include <stdlib.h>
31#include <getopt.h> 31#include <getopt.h>
32#include <errno.h> 32#include <errno.h>
33#ifndef WIN32 33#ifndef _WIN32
34#include <signal.h> 34#include <signal.h>
35#endif 35#endif
36 36
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
70 { NULL, 0, NULL, 0} 70 { NULL, 0, NULL, 0}
71 }; 71 };
72 72
73#ifndef WIN32 73#ifndef _WIN32
74 signal(SIGPIPE, SIG_IGN); 74 signal(SIGPIPE, SIG_IGN);
75#endif 75#endif
76 /* parse cmdline args */ 76 /* parse cmdline args */
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index 511583e..8d6fc95 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -36,7 +36,7 @@
36#include <time.h> 36#include <time.h>
37#include <sys/time.h> 37#include <sys/time.h>
38#include <inttypes.h> 38#include <inttypes.h>
39#ifndef WIN32 39#ifndef _WIN32
40#include <signal.h> 40#include <signal.h>
41#endif 41#endif
42 42
@@ -183,7 +183,7 @@ int main(int argc, char **argv)
183 size_t image_size = 0; 183 size_t image_size = 0;
184 char *image_sig_path = NULL; 184 char *image_sig_path = NULL;
185 185
186#ifndef WIN32 186#ifndef _WIN32
187 signal(SIGPIPE, SIG_IGN); 187 signal(SIGPIPE, SIG_IGN);
188#endif 188#endif
189 parse_opts(argc, argv); 189 parse_opts(argc, argv);
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index fd45763..20cc916 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -31,7 +31,7 @@
31#include <errno.h> 31#include <errno.h>
32#include <stdlib.h> 32#include <stdlib.h>
33#include <getopt.h> 33#include <getopt.h>
34#ifndef WIN32 34#ifndef _WIN32
35#include <signal.h> 35#include <signal.h>
36#endif 36#endif
37 37
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
152 { NULL, 0, NULL, 0} 152 { NULL, 0, NULL, 0}
153 }; 153 };
154 154
155#ifndef WIN32 155#ifndef _WIN32
156 signal(SIGPIPE, SIG_IGN); 156 signal(SIGPIPE, SIG_IGN);
157#endif 157#endif
158 158
diff --git a/tools/idevicename.c b/tools/idevicename.c
index 69b76f6..248bda3 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -30,7 +30,7 @@
30#include <unistd.h> 30#include <unistd.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <getopt.h> 32#include <getopt.h>
33#ifndef WIN32 33#ifndef _WIN32
34#include <signal.h> 34#include <signal.h>
35#endif 35#endif
36 36
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
72 const char* udid = NULL; 72 const char* udid = NULL;
73 int use_network = 0; 73 int use_network = 0;
74 74
75#ifndef WIN32 75#ifndef _WIN32
76 signal(SIGPIPE, SIG_IGN); 76 signal(SIGPIPE, SIG_IGN);
77#endif 77#endif
78 78
diff --git a/tools/idevicenotificationproxy.c b/tools/idevicenotificationproxy.c
index 00da916..192192a 100644
--- a/tools/idevicenotificationproxy.c
+++ b/tools/idevicenotificationproxy.c
@@ -33,7 +33,7 @@
33#include <errno.h> 33#include <errno.h>
34#include <signal.h> 34#include <signal.h>
35 35
36#ifdef WIN32 36#ifdef _WIN32
37#include <windows.h> 37#include <windows.h>
38#define sleep(x) Sleep(x*1000) 38#define sleep(x) Sleep(x*1000)
39#else 39#else
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
125 125
126 signal(SIGINT, clean_exit); 126 signal(SIGINT, clean_exit);
127 signal(SIGTERM, clean_exit); 127 signal(SIGTERM, clean_exit);
128#ifndef WIN32 128#ifndef _WIN32
129 signal(SIGQUIT, clean_exit); 129 signal(SIGQUIT, clean_exit);
130 signal(SIGPIPE, SIG_IGN); 130 signal(SIGPIPE, SIG_IGN);
131#endif 131#endif
diff --git a/tools/idevicepair.c b/tools/idevicepair.c
index 94d3f04..884c690 100644
--- a/tools/idevicepair.c
+++ b/tools/idevicepair.c
@@ -32,7 +32,7 @@
32#include <getopt.h> 32#include <getopt.h>
33#include <ctype.h> 33#include <ctype.h>
34#include <unistd.h> 34#include <unistd.h>
35#ifdef WIN32 35#ifdef _WIN32
36#include <windows.h> 36#include <windows.h>
37#include <conio.h> 37#include <conio.h>
38#else 38#else
@@ -50,7 +50,7 @@ static char *udid = NULL;
50 50
51#ifdef HAVE_WIRELESS_PAIRING 51#ifdef HAVE_WIRELESS_PAIRING
52 52
53#ifdef WIN32 53#ifdef _WIN32
54#define BS_CC '\b' 54#define BS_CC '\b'
55#define my_getch getch 55#define my_getch getch
56#else 56#else
@@ -293,7 +293,7 @@ int main(int argc, char **argv)
293 } 293 }
294 } 294 }
295 295
296#ifndef WIN32 296#ifndef _WIN32
297 signal(SIGPIPE, SIG_IGN); 297 signal(SIGPIPE, SIG_IGN);
298#endif 298#endif
299 299
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c
index 4080a28..97417eb 100644
--- a/tools/ideviceprovision.c
+++ b/tools/ideviceprovision.c
@@ -32,11 +32,11 @@
32#include <getopt.h> 32#include <getopt.h>
33#include <sys/stat.h> 33#include <sys/stat.h>
34#include <errno.h> 34#include <errno.h>
35#ifndef WIN32 35#ifndef _WIN32
36#include <signal.h> 36#include <signal.h>
37#endif 37#endif
38 38
39#ifdef WIN32 39#ifdef _WIN32
40#include <windows.h> 40#include <windows.h>
41#else 41#else
42#include <arpa/inet.h> 42#include <arpa/inet.h>
@@ -314,7 +314,7 @@ int main(int argc, char *argv[])
314 { NULL, 0, NULL, 0} 314 { NULL, 0, NULL, 0}
315 }; 315 };
316 316
317#ifndef WIN32 317#ifndef _WIN32
318 signal(SIGPIPE, SIG_IGN); 318 signal(SIGPIPE, SIG_IGN);
319#endif 319#endif
320 /* parse cmdline args */ 320 /* parse cmdline args */
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c
index 0e694c7..bfaa059 100644
--- a/tools/idevicescreenshot.c
+++ b/tools/idevicescreenshot.c
@@ -32,7 +32,7 @@
32#include <errno.h> 32#include <errno.h>
33#include <time.h> 33#include <time.h>
34#include <unistd.h> 34#include <unistd.h>
35#ifndef WIN32 35#ifndef _WIN32
36#include <signal.h> 36#include <signal.h>
37#endif 37#endif
38 38
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
142 { NULL, 0, NULL, 0} 142 { NULL, 0, NULL, 0}
143 }; 143 };
144 144
145#ifndef WIN32 145#ifndef _WIN32
146 signal(SIGPIPE, SIG_IGN); 146 signal(SIGPIPE, SIG_IGN);
147#endif 147#endif
148 /* parse cmdline args */ 148 /* parse cmdline args */
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index a0e641d..dbd7b01 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -34,7 +34,7 @@
34#include <unistd.h> 34#include <unistd.h>
35#include <getopt.h> 35#include <getopt.h>
36 36
37#ifdef WIN32 37#ifdef _WIN32
38#include <windows.h> 38#include <windows.h>
39#define sleep(x) Sleep(x*1000) 39#define sleep(x) Sleep(x*1000)
40#endif 40#endif
@@ -537,7 +537,7 @@ int main(int argc, char *argv[])
537 537
538 signal(SIGINT, clean_exit); 538 signal(SIGINT, clean_exit);
539 signal(SIGTERM, clean_exit); 539 signal(SIGTERM, clean_exit);
540#ifndef WIN32 540#ifndef _WIN32
541 signal(SIGQUIT, clean_exit); 541 signal(SIGQUIT, clean_exit);
542 signal(SIGPIPE, SIG_IGN); 542 signal(SIGPIPE, SIG_IGN);
543#endif 543#endif