mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | ** 2013 November 25 |
| 3 | ** |
| 4 | ** The author disclaims copyright to this source code. In place of |
| 5 | ** a legal notice, here is a blessing: |
| 6 | ** |
| 7 | ** May you do good and not evil. |
| 8 | ** May you find forgiveness for yourself and forgive others. |
| 9 | ** May you share freely, never taking more than you give. |
| 10 | ** |
| 11 | ****************************************************************************** |
| 12 | ** |
| 13 | ** This file contains code that is specific to Windows. |
| 14 | */ |
drh | 43f58d6 | 2016-07-09 16:14:45 +0000 | [diff] [blame] | 15 | #ifndef SQLITE_OS_WIN_H |
| 16 | #define SQLITE_OS_WIN_H |
mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 17 | |
| 18 | /* |
mistachkin | fdf9f04 | 2014-05-05 17:43:28 +0000 | [diff] [blame] | 19 | ** Include the primary Windows SDK header file. |
mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 20 | */ |
| 21 | #include "windows.h" |
| 22 | |
| 23 | #ifdef __CYGWIN__ |
| 24 | # include <sys/cygwin.h> |
drh | 1a8a0d3 | 2014-05-05 20:21:52 +0000 | [diff] [blame] | 25 | # include <errno.h> /* amalgamator: dontcache */ |
mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 26 | #endif |
| 27 | |
| 28 | /* |
| 29 | ** Determine if we are dealing with Windows NT. |
| 30 | ** |
mistachkin | fdf9f04 | 2014-05-05 17:43:28 +0000 | [diff] [blame] | 31 | ** We ought to be able to determine if we are compiling for Windows 9x or |
| 32 | ** Windows NT using the _WIN32_WINNT macro as follows: |
mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 33 | ** |
| 34 | ** #if defined(_WIN32_WINNT) |
| 35 | ** # define SQLITE_OS_WINNT 1 |
| 36 | ** #else |
| 37 | ** # define SQLITE_OS_WINNT 0 |
| 38 | ** #endif |
| 39 | ** |
mistachkin | fdf9f04 | 2014-05-05 17:43:28 +0000 | [diff] [blame] | 40 | ** However, Visual Studio 2005 does not set _WIN32_WINNT by default, as |
| 41 | ** it ought to, so the above test does not work. We'll just assume that |
| 42 | ** everything is Windows NT unless the programmer explicitly says otherwise |
| 43 | ** by setting SQLITE_OS_WINNT to 0. |
mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 44 | */ |
| 45 | #if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) |
| 46 | # define SQLITE_OS_WINNT 1 |
| 47 | #endif |
| 48 | |
| 49 | /* |
mistachkin | fdf9f04 | 2014-05-05 17:43:28 +0000 | [diff] [blame] | 50 | ** Determine if we are dealing with Windows CE - which has a much reduced |
| 51 | ** API. |
mistachkin | f3a4c7c | 2013-11-25 09:37:24 +0000 | [diff] [blame] | 52 | */ |
| 53 | #if defined(_WIN32_WCE) |
| 54 | # define SQLITE_OS_WINCE 1 |
| 55 | #else |
| 56 | # define SQLITE_OS_WINCE 0 |
| 57 | #endif |
| 58 | |
| 59 | /* |
| 60 | ** Determine if we are dealing with WinRT, which provides only a subset of |
| 61 | ** the full Win32 API. |
| 62 | */ |
| 63 | #if !defined(SQLITE_OS_WINRT) |
| 64 | # define SQLITE_OS_WINRT 0 |
| 65 | #endif |
| 66 | |
mistachkin | ce64d61 | 2014-08-14 18:31:56 +0000 | [diff] [blame] | 67 | /* |
| 68 | ** For WinCE, some API function parameters do not appear to be declared as |
| 69 | ** volatile. |
| 70 | */ |
| 71 | #if SQLITE_OS_WINCE |
| 72 | # define SQLITE_WIN32_VOLATILE |
| 73 | #else |
| 74 | # define SQLITE_WIN32_VOLATILE volatile |
| 75 | #endif |
| 76 | |
mistachkin | 89ea0d3 | 2015-01-19 20:05:53 +0000 | [diff] [blame] | 77 | /* |
| 78 | ** For some Windows sub-platforms, the _beginthreadex() / _endthreadex() |
| 79 | ** functions are not available (e.g. those not using MSVC, Cygwin, etc). |
| 80 | */ |
| 81 | #if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ |
| 82 | SQLITE_THREADSAFE>0 && !defined(__CYGWIN__) |
| 83 | # define SQLITE_OS_WIN_THREADS 1 |
| 84 | #else |
| 85 | # define SQLITE_OS_WIN_THREADS 0 |
| 86 | #endif |
| 87 | |
drh | 43f58d6 | 2016-07-09 16:14:45 +0000 | [diff] [blame] | 88 | #endif /* SQLITE_OS_WIN_H */ |