| 1 | /* Precomp.h -- precompilation file |
| 2 | 2024-01-25 : Igor Pavlov : Public domain */ |
| 3 | |
| 4 | #ifndef ZIP7_INC_PRECOMP_H |
| 5 | #define ZIP7_INC_PRECOMP_H |
| 6 | |
| 7 | /* |
| 8 | this file must be included before another *.h files and before <windows.h>. |
| 9 | this file is included from the following files: |
| 10 | C\*.c |
| 11 | C\Util\*\Precomp.h <- C\Util\*\*.c |
| 12 | CPP\Common\Common.h <- *\StdAfx.h <- *\*.cpp |
| 13 | |
| 14 | this file can set the following macros: |
| 15 | Z7_LARGE_PAGES 1 |
| 16 | Z7_LONG_PATH 1 |
| 17 | Z7_WIN32_WINNT_MIN 0x0500 (or higher) : we require at least win2000+ for 7-Zip |
| 18 | _WIN32_WINNT 0x0500 (or higher) |
| 19 | WINVER _WIN32_WINNT |
| 20 | UNICODE 1 |
| 21 | _UNICODE 1 |
| 22 | */ |
| 23 | |
| 24 | #include "Compiler.h" |
| 25 | |
| 26 | #ifdef _MSC_VER |
| 27 | // #pragma warning(disable : 4206) // nonstandard extension used : translation unit is empty |
| 28 | #if _MSC_VER >= 1912 |
| 29 | // #pragma warning(disable : 5039) // pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception. |
| 30 | #endif |
| 31 | #endif |
| 32 | |
| 33 | /* |
| 34 | // for debug: |
| 35 | #define UNICODE 1 |
| 36 | #define _UNICODE 1 |
| 37 | #define _WIN32_WINNT 0x0500 // win2000 |
| 38 | #ifndef WINVER |
| 39 | #define WINVER _WIN32_WINNT |
| 40 | #endif |
| 41 | */ |
| 42 | |
| 43 | #ifdef _WIN32 |
| 44 | /* |
| 45 | this "Precomp.h" file must be included before <windows.h>, |
| 46 | if we want to define _WIN32_WINNT before <windows.h>. |
| 47 | */ |
| 48 | |
| 49 | #ifndef Z7_LARGE_PAGES |
| 50 | #ifndef Z7_NO_LARGE_PAGES |
| 51 | #define Z7_LARGE_PAGES 1 |
| 52 | #endif |
| 53 | #endif |
| 54 | |
| 55 | #ifndef Z7_LONG_PATH |
| 56 | #ifndef Z7_NO_LONG_PATH |
| 57 | #define Z7_LONG_PATH 1 |
| 58 | #endif |
| 59 | #endif |
| 60 | |
| 61 | #ifndef Z7_DEVICE_FILE |
| 62 | #ifndef Z7_NO_DEVICE_FILE |
| 63 | // #define Z7_DEVICE_FILE 1 |
| 64 | #endif |
| 65 | #endif |
| 66 | |
| 67 | // we don't change macros if included after <windows.h> |
| 68 | #ifndef _WINDOWS_ |
| 69 | |
| 70 | #ifndef Z7_WIN32_WINNT_MIN |
| 71 | #if defined(_M_ARM64) || defined(__aarch64__) |
| 72 | // #define Z7_WIN32_WINNT_MIN 0x0a00 // win10 |
| 73 | #define Z7_WIN32_WINNT_MIN 0x0600 // vista |
| 74 | #elif defined(_M_ARM) && defined(_M_ARMT) && defined(_M_ARM_NT) |
| 75 | // #define Z7_WIN32_WINNT_MIN 0x0602 // win8 |
| 76 | #define Z7_WIN32_WINNT_MIN 0x0600 // vista |
| 77 | #elif defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) || defined(_M_IA64) |
| 78 | #define Z7_WIN32_WINNT_MIN 0x0503 // win2003 |
| 79 | // #elif defined(_M_IX86) || defined(__i386__) |
| 80 | // #define Z7_WIN32_WINNT_MIN 0x0500 // win2000 |
| 81 | #else // x86 and another(old) systems |
| 82 | #define Z7_WIN32_WINNT_MIN 0x0500 // win2000 |
| 83 | // #define Z7_WIN32_WINNT_MIN 0x0502 // win2003 // for debug |
| 84 | #endif |
| 85 | #endif // Z7_WIN32_WINNT_MIN |
| 86 | |
| 87 | |
| 88 | #ifndef Z7_DO_NOT_DEFINE_WIN32_WINNT |
| 89 | #ifdef _WIN32_WINNT |
| 90 | // #error Stop_Compiling_Bad_WIN32_WINNT |
| 91 | #else |
| 92 | #ifndef Z7_NO_DEFINE_WIN32_WINNT |
| 93 | Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER |
| 94 | #define _WIN32_WINNT Z7_WIN32_WINNT_MIN |
| 95 | Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER |
| 96 | #endif |
| 97 | #endif // _WIN32_WINNT |
| 98 | |
| 99 | #ifndef WINVER |
| 100 | #define WINVER _WIN32_WINNT |
| 101 | #endif |
| 102 | #endif // Z7_DO_NOT_DEFINE_WIN32_WINNT |
| 103 | |
| 104 | |
| 105 | #ifndef _MBCS |
| 106 | #ifndef Z7_NO_UNICODE |
| 107 | // UNICODE and _UNICODE are used by <windows.h> and by 7-zip code. |
| 108 | |
| 109 | #ifndef UNICODE |
| 110 | #define UNICODE 1 |
| 111 | #endif |
| 112 | |
| 113 | #ifndef _UNICODE |
| 114 | Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER |
| 115 | #define _UNICODE 1 |
| 116 | Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER |
| 117 | #endif |
| 118 | |
| 119 | #endif // Z7_NO_UNICODE |
| 120 | #endif // _MBCS |
| 121 | #endif // _WINDOWS_ |
| 122 | |
| 123 | // #include "7zWindows.h" |
| 124 | |
| 125 | #endif // _WIN32 |
| 126 | |
| 127 | #endif |