diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index ea4bcaa0..a0d3a261 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -6,13 +6,6 @@ // Copyright © 2016 tihmstar. All rights reserved. // -#if defined _WIN32 || defined __CYGWIN__ -#ifndef WIN32 -//make sure WIN32 is defined if compiling for windows -#define WIN32 -#endif -#endif - #include #include @@ -41,7 +34,6 @@ extern "C"{ #include } - //(re)define __mkdir #ifdef __mkdir #undef __mkdir @@ -56,8 +48,12 @@ extern "C"{ #define USEC_PER_SEC 1000000 +#ifdef WIN32 +#define FUTURERESTORE_TMP_PATH "download" +#else #define TMP_PATH "/tmp" #define FUTURERESTORE_TMP_PATH TMP_PATH"/futurerestore" +#endif #define BASEBAND_TMP_PATH FUTURERESTORE_TMP_PATH"/baseband.bbfw" #define BASEBAND_MANIFEST_TMP_PATH FUTURERESTORE_TMP_PATH"/basebandManifest.plist" diff --git a/futurerestore/futurerestore.hpp b/futurerestore/futurerestore.hpp index c9acd85a..550908f5 100644 --- a/futurerestore/futurerestore.hpp +++ b/futurerestore/futurerestore.hpp @@ -9,6 +9,13 @@ #ifndef futurerestore_hpp #define futurerestore_hpp +#if defined _WIN32 || defined __CYGWIN__ +#ifndef WIN32 +//make sure WIN32 is defined if compiling for windows +#define WIN32 +#endif +#endif + #include #include #include diff --git a/futurerestore/main.cpp b/futurerestore/main.cpp index f70a0065..a581c4c8 100644 --- a/futurerestore/main.cpp +++ b/futurerestore/main.cpp @@ -24,6 +24,12 @@ extern "C"{ #include #endif +#ifdef WIN32 +#include +#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +#endif +#endif static struct option longopts[] = { { "apticket", required_argument, NULL, 't' }, @@ -75,6 +81,13 @@ void cmd_help(){ printf(" \t\tWARNING: only use this for device without baseband (eg iPod or some wifi only iPads)\n\n"); } +#ifdef WIN32 + DWORD termFlags; + HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); + if (GetConsoleMode(handle, &termFlags)) + SetConsoleMode(handle, termFlags | ENABLE_VIRTUAL_TERMINAL_PROCESSING); +#endif + using namespace std; using namespace tihmstar; int main_r(int argc, const char * argv[]) {