diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common.c | 10 | ||||
-rw-r--r-- | src/idevicerestore.c | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c index f9377ba..a54ae6f 100644 --- a/src/common.c +++ b/src/common.c @@ -506,7 +506,9 @@ char* realpath(const char *filename, char *resolved_name) #ifdef WIN32 #define BS_CC '\b' -#define my_getch getch +#define CTRL_C_CC 0x03 +#define ESC_CC 0x1B +#define my_getch _getch #else #define BS_CC 0x7f static int my_getch(void) @@ -541,6 +543,12 @@ void get_user_input(char *buf, int maxlen, int secure) len--; } } +#ifdef WIN32 + else if (c == CTRL_C_CC || c == ESC_CC) { + c = -1; + break; + } +#endif } if (c < 0) { len = 0; diff --git a/src/idevicerestore.c b/src/idevicerestore.c index f96fc61..7c02eda 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -1499,12 +1499,16 @@ int main(int argc, char* argv[]) { idevicerestore_client = client; +#ifdef WIN32 + signal(SIGINT, handle_signal); + signal(SIGTERM, handle_signal); + signal(SIGABRT, handle_signal); +#else struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sa.sa_handler = handle_signal; sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); -#ifndef WIN32 sigaction(SIGQUIT, &sa, NULL); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, NULL); |