summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Duncan Ogilvie2024-11-27 12:01:18 +0100
committerGravatar Nikias Bassen2024-11-29 14:36:34 +0100
commitbcced6c4f6a79e09ed3961632b2faf81fe873137 (patch)
tree71bb6a70a3438c68229e4906e6bce14974a9aee8
parentba829e6f1a62bdad7866572d1e2cff1836ced742 (diff)
downloadlibimobiledevice-bcced6c4f6a79e09ed3961632b2faf81fe873137.tar.gz
libimobiledevice-bcced6c4f6a79e09ed3961632b2faf81fe873137.tar.bz2
Fix attempts to detect Windows using _WIN32
-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 @@
#define _MSVC15DEXPORT
#define _MSVC20EXPORT
#define _DLLAPI
-#if defined(WINDOWS) || defined(WIN32)
+#if defined(WINDOWS) || defined(_WIN32)
#define _CDECL _cdecl
#else
#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 @@
#define _MSVC15DEXPORT
#define _MSVC20EXPORT
#define _DLLAPI
-#if defined(WINDOWS) || defined(WIN32)
+#if defined(WINDOWS) || defined(_WIN32)
#define _CDECL _cdecl
#else
#define _CDECL
@@ -122,7 +122,7 @@ char *strchr(), *strrchr(), *strtok();
#define USE_SGTTY
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define USE_FTIME 1
#define USE_RENAME 1
#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 @@
#include <sys/stat.h>
#include <fcntl.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <process.h>
#include <io.h>
#endif
@@ -207,7 +207,7 @@ t_initrand()
#if defined(OPENSSL) /* OpenSSL has nifty win32 entropy-gathering code */
#if OPENSSL_VERSION_NUMBER >= 0x00905100
r = RAND_status();
-#if defined(WINDOWS) || defined(WIN32)
+#if defined(WINDOWS) || defined(_WIN32)
if(r) /* Don't do the Unix-y stuff on Windows if possible */
return;
#else
@@ -220,7 +220,7 @@ t_initrand()
if(r > 0) {
yarrow_add_entropy(entropy, r, &g_rng);
memset(entropy, 0, sizeof(entropy));
-# if defined(WINDOWS) || defined(WIN32)
+# if defined(WINDOWS) || defined(_WIN32)
/* Don't do the Unix-y stuff on Windows if possible */
yarrow_ready(&g_rng);
return;
@@ -228,13 +228,13 @@ t_initrand()
}
#endif
-#if !defined(WINDOWS) && !defined(WIN32)
+#if !defined(WINDOWS) && !defined(_WIN32)
i = open("/dev/urandom", O_RDONLY);
if(i > 0) {
r += read(i, preseed.devrand, sizeof(preseed.devrand));
close(i);
}
-#endif /* !WINDOWS && !WIN32 */
+#endif /* !WINDOWS && !_WIN32 */
/* Resort to truerand only if desperate for some Real entropy */
if(r == 0)
@@ -250,7 +250,7 @@ t_initrand()
preseed.subsec = t.tv_usec;
#endif
preseed.pid = getpid();
-#ifndef WIN32
+#ifndef _WIN32
preseed.ppid = getppid();
#endif
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 @@
#include "t_defines.h"
-#ifdef WIN32
+#ifdef _WIN32
# ifdef CRYPTOLIB
@@ -69,7 +69,7 @@ raw_truerand()
return truerand();
}
-# else /* !CRYPTOLIB && WIN32 */
+# else /* !CRYPTOLIB && _WIN32 */
#include <windows.h>
#include <wtypes.h>
@@ -128,7 +128,7 @@ raw_truerand() {
# endif /* CRYPTOLIB */
-#else /* !WIN32 */
+#else /* !_WIN32 */
#include <signal.h>
#include <setjmp.h>
@@ -238,4 +238,4 @@ raw_n_truerand(int n)
return v % n;
}
-#endif /* !CRYPTOLIB || !WIN32 */
+#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 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <pwd.h>
#endif
#include <unistd.h>
@@ -69,7 +69,7 @@
#include <sys/stat.h>
#include <errno.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <shlobj.h>
#endif
@@ -93,7 +93,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
};
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define DIR_SEP '\\'
#define DIR_SEP_S "\\"
#else
@@ -103,7 +103,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
#define USERPREF_CONFIG_EXTENSION ".plist"
-#ifdef WIN32
+#ifdef _WIN32
#define USERPREF_CONFIG_DIR "Apple"DIR_SEP_S"Lockdown"
#else
#define USERPREF_CONFIG_DIR "lockdown"
@@ -113,7 +113,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
static char *__config_dir = NULL;
-#ifdef WIN32
+#ifdef _WIN32
static char *userpref_utf16_to_utf8(wchar_t *unistr, long len, long *items_read, long *items_written)
{
if (!unistr || (len <= 0)) return NULL;
@@ -155,7 +155,7 @@ const char *userpref_get_config_dir()
if (__config_dir)
return __config_dir;
-#ifdef WIN32
+#ifdef _WIN32
wchar_t path[MAX_PATH+1];
HRESULT hr;
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
free(buf);
debug_info("WARNING: Unknown operation code received 0x%llx param1=%lld", header.operation, param1);
-#ifndef WIN32
+#ifndef _WIN32
fprintf(stderr, "%s: WARNING: Unknown operation code received 0x%llx param1=%lld", __func__, (long long)header.operation, (long long)param1);
#endif
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 @@
#include <errno.h>
#include <time.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
@@ -1338,7 +1338,7 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection)
if (ssl_error == 0 || ssl_error != SSL_ERROR_WANT_READ) {
break;
}
-#ifdef WIN32
+#ifdef _WIN32
Sleep(100);
#else
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
CFStringGetCString(cname, hostname, sizeof(hostname), kCFStringEncodingUTF8);
CFRelease(cname);
#else
-#ifdef WIN32
+#ifdef _WIN32
DWORD hostname_len = sizeof(hostname);
GetComputerName(hostname, &hostname_len);
#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 @@
#include "common/userpref.h"
#include "asprintf.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#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 @@
#include "property_list_service.h"
#include "common/debug.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#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 @@
#include <dirent.h>
#include <time.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#include <sys/time.h>
#include <conio.h>
@@ -95,7 +95,7 @@ static size_t curdir_len = 0;
static int file_exists(const char* path)
{
struct stat tst;
-#ifdef WIN32
+#ifdef _WIN32
return (stat(path, &tst) == 0);
#else
return (lstat(path, &tst) == 0);
@@ -105,7 +105,7 @@ static int file_exists(const char* path)
static int is_directory(const char* path)
{
struct stat tst;
-#ifdef WIN32
+#ifdef _WIN32
return (stat(path, &tst) == 0) && S_ISDIR(tst.st_mode);
#else
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)
}
#ifndef HAVE_READLINE
-#ifdef WIN32
+#ifdef _WIN32
#define BS_CC '\b'
#else
#define BS_CC 0x7f
@@ -175,7 +175,7 @@ int stop_requested = 0;
static void handle_signal(int sig)
{
stop_requested++;
-#ifdef WIN32
+#ifdef _WIN32
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
#else
kill(getpid(), SIGINT);
@@ -483,7 +483,7 @@ static void print_file_info(afc_client_t afc, const char* path, int list_verbose
printf(" ");
printf("%10lld", (long long)st.st_size);
printf(" ");
-#ifdef WIN32
+#ifdef _WIN32
strftime(timebuf, 64, "%d %b %Y %H:%M:%S", localtime(&t));
#else
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
static int __mkdir(const char* path)
{
-#ifdef WIN32
+#ifdef _WIN32
return mkdir(path);
#else
return mkdir(path, 0755);
@@ -1483,7 +1483,7 @@ int main(int argc, char** argv)
};
signal(SIGTERM, handle_signal);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, handle_signal);
signal(SIGPIPE, SIG_IGN);
#endif
@@ -1561,7 +1561,7 @@ int main(int argc, char** argv)
idevice_events_subscribe(&context, device_event_cb, NULL);
while (!connected && !stop_requested) {
-#ifdef WIN32
+#ifdef _WIN32
Sleep(100);
#else
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 @@
#define LOCK_ATTEMPTS 50
#define LOCK_WAIT 200000
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#endif
@@ -642,7 +642,7 @@ int main(int argc, char *argv[])
/* we need to exit cleanly on running backups and restores or we cause havok */
signal(SIGINT, clean_exit);
signal(SIGTERM, clean_exit);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, clean_exit);
signal(SIGPIPE, SIG_IGN);
#endif
@@ -1352,7 +1352,7 @@ files_out:
file_info_path = mobilebackup_build_path(backup_directory, hash, ".mddata");
/* determine file size */
-#ifdef WIN32
+#ifdef _WIN32
struct _stati64 fst;
if (_stati64(file_info_path, &fst) != 0)
#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 @@
#define LOCK_ATTEMPTS 50
#define LOCK_WAIT 200000
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#include <conio.h>
#define sleep(x) Sleep(x*1000)
@@ -178,7 +178,7 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil
static int __mkdir(const char* path, int mode)
{
-#ifdef WIN32
+#ifdef _WIN32
return mkdir(path);
#else
return mkdir(path, mode);
@@ -207,7 +207,7 @@ static int mkdir_with_parents(const char *dir, int mode)
return res;
}
-#ifdef WIN32
+#ifdef _WIN32
static int win32err_to_errno(int err_value)
{
switch (err_value) {
@@ -224,7 +224,7 @@ static int win32err_to_errno(int err_value)
static int remove_file(const char* path)
{
int e = 0;
-#ifdef WIN32
+#ifdef _WIN32
if (!DeleteFile(path)) {
e = win32err_to_errno(GetLastError());
}
@@ -239,7 +239,7 @@ static int remove_file(const char* path)
static int remove_directory(const char* path)
{
int e = 0;
-#ifdef WIN32
+#ifdef _WIN32
if (!RemoveDirectory(path)) {
e = win32err_to_errno(GetLastError());
}
@@ -773,7 +773,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
uint32_t bytes = 0;
char *localfile = string_build_path(backup_dir, path, NULL);
char buf[32768];
-#ifdef WIN32
+#ifdef _WIN32
struct _stati64 fst;
#else
struct stat fst;
@@ -784,7 +784,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
int errcode = -1;
int result = -1;
uint32_t length;
-#ifdef WIN32
+#ifdef _WIN32
uint64_t total;
uint64_t sent;
#else
@@ -815,7 +815,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
goto leave_proto_err;
}
-#ifdef WIN32
+#ifdef _WIN32
if (_stati64(localfile, &fst) < 0)
#else
if (stat(localfile, &fst) < 0)
@@ -1348,7 +1348,7 @@ static void mb2_copy_directory_by_path(const char *src, const char *dst)
}
}
-#ifdef WIN32
+#ifdef _WIN32
#define BS_CC '\b'
#define my_getch getch
#else
@@ -1535,7 +1535,7 @@ int main(int argc, char *argv[])
/* we need to exit cleanly on running backups and restores or we cause havok */
signal(SIGINT, clean_exit);
signal(SIGTERM, clean_exit);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, clean_exit);
signal(SIGPIPE, SIG_IGN);
#endif
@@ -2324,7 +2324,7 @@ checkpoint:
/* device wants to know how much disk space is available on the computer */
uint64_t freespace = 0;
int res = -1;
-#ifdef WIN32
+#ifdef _WIN32
if (GetDiskFreeSpaceEx(backup_directory, (PULARGE_INTEGER)&freespace, NULL, NULL)) {
res = 0;
}
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 @@
#include <assert.h>
#include <fcntl.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#else
@@ -334,7 +334,7 @@ int main(int argc, char *argv[])
signal(SIGINT, clean_exit);
signal(SIGTERM, clean_exit);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, clean_exit);
signal(SIGPIPE, SIG_IGN);
#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 @@
#include <string.h>
#include <unistd.h>
#include <getopt.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
#include <libimobiledevice-glue/utils.h>
@@ -42,7 +42,7 @@
#include <libimobiledevice/afc.h>
#include <plist/plist.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define S_IFLNK S_IFREG
#define S_IFSOCK S_IFREG
@@ -59,7 +59,7 @@ static int remove_all = 0;
static int file_exists(const char* path)
{
struct stat tst;
-#ifdef WIN32
+#ifdef _WIN32
return (stat(path, &tst) == 0);
#else
return (lstat(path, &tst) == 0);
@@ -153,7 +153,7 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
strcpy(((char*)source_filename) + device_directory_length, list[k]);
/* assemble absolute target filename */
-#ifdef WIN32
+#ifdef _WIN32
/* replace every ':' with '-' since ':' is an illegal character for file names in windows */
char* current_pos = strchr(list[k], ':');
while (current_pos) {
@@ -212,7 +212,7 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
remove(target_filename);
}
-#ifndef WIN32
+#ifndef _WIN32
/* use relative filename */
char* b = strrchr(fileinfo[i+1], '/');
if (b == NULL) {
@@ -240,7 +240,7 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
/* recurse into child directories */
if (S_ISDIR(stbuf.st_mode)) {
if (!remove_all) {
-#ifdef WIN32
+#ifdef _WIN32
mkdir(target_filename);
#else
mkdir(target_filename, 0755);
@@ -375,7 +375,7 @@ int main(int argc, char* argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
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 @@
#if HAVE_LANGINFO_CODESET
#include <langinfo.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -43,7 +43,7 @@
#ifdef _DATE_FMT
#define DATE_FMT_LANGINFO nl_langinfo (_DATE_FMT)
#else
-#ifdef WIN32
+#ifdef _WIN32
#define DATE_FMT_LANGINFO "%a %b %#d %H:%M:%S %Z %Y"
#else
#define DATE_FMT_LANGINFO "%a %b %e %H:%M:%S %Z %Y"
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
/* 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 @@
#include <libgen.h>
#include <getopt.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#endif
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
/* map signals */
signal(SIGINT, on_signal);
signal(SIGTERM, on_signal);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, on_signal);
signal(SIGPIPE, SIG_IGN);
#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 @@
#include <getopt.h>
#include <errno.h>
#include <signal.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#else
@@ -219,7 +219,7 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
struct sigaction sa;
struct sigaction si;
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 @@
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define __usleep(x) Sleep(x/1000)
#else
@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
/* 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 @@
#include <getopt.h>
#include <errno.h>
#include <time.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
/* 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 @@
#include <stdlib.h>
#include <getopt.h>
#include <errno.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
/* 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 @@
#include <time.h>
#include <sys/time.h>
#include <inttypes.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -183,7 +183,7 @@ int main(int argc, char **argv)
size_t image_size = 0;
char *image_sig_path = NULL;
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
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 @@
#include <errno.h>
#include <stdlib.h>
#include <getopt.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
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 @@
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
const char* udid = NULL;
int use_network = 0;
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
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 @@
#include <errno.h>
#include <signal.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#else
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
signal(SIGINT, clean_exit);
signal(SIGTERM, clean_exit);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, clean_exit);
signal(SIGPIPE, SIG_IGN);
#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 @@
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#include <conio.h>
#else
@@ -50,7 +50,7 @@ static char *udid = NULL;
#ifdef HAVE_WIRELESS_PAIRING
-#ifdef WIN32
+#ifdef _WIN32
#define BS_CC '\b'
#define my_getch getch
#else
@@ -293,7 +293,7 @@ int main(int argc, char **argv)
}
}
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
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 @@
#include <getopt.h>
#include <sys/stat.h>
#include <errno.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#else
#include <arpa/inet.h>
@@ -314,7 +314,7 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
/* 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 @@
#include <errno.h>
#include <time.h>
#include <unistd.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <signal.h>
#endif
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0}
};
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
/* 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 @@
#include <unistd.h>
#include <getopt.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#endif
@@ -537,7 +537,7 @@ int main(int argc, char *argv[])
signal(SIGINT, clean_exit);
signal(SIGTERM, clean_exit);
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGQUIT, clean_exit);
signal(SIGPIPE, SIG_IGN);
#endif