18bc52629Smistachkin /* 28bc52629Smistachkin ** 2013 November 25 38bc52629Smistachkin ** 48bc52629Smistachkin ** The author disclaims copyright to this source code. In place of 58bc52629Smistachkin ** a legal notice, here is a blessing: 68bc52629Smistachkin ** 78bc52629Smistachkin ** May you do good and not evil. 88bc52629Smistachkin ** May you find forgiveness for yourself and forgive others. 98bc52629Smistachkin ** May you share freely, never taking more than you give. 108bc52629Smistachkin ** 118bc52629Smistachkin ****************************************************************************** 128bc52629Smistachkin ** 138bc52629Smistachkin ** This file contains code that is specific to Windows. 148bc52629Smistachkin */ 15*43f58d6aSdrh #ifndef SQLITE_OS_WIN_H 16*43f58d6aSdrh #define SQLITE_OS_WIN_H 178bc52629Smistachkin 188bc52629Smistachkin /* 19fdf9f045Smistachkin ** Include the primary Windows SDK header file. 208bc52629Smistachkin */ 218bc52629Smistachkin #include "windows.h" 228bc52629Smistachkin 238bc52629Smistachkin #ifdef __CYGWIN__ 248bc52629Smistachkin # include <sys/cygwin.h> 251a8a0d3fSdrh # include <errno.h> /* amalgamator: dontcache */ 268bc52629Smistachkin #endif 278bc52629Smistachkin 288bc52629Smistachkin /* 298bc52629Smistachkin ** Determine if we are dealing with Windows NT. 308bc52629Smistachkin ** 31fdf9f045Smistachkin ** We ought to be able to determine if we are compiling for Windows 9x or 32fdf9f045Smistachkin ** Windows NT using the _WIN32_WINNT macro as follows: 338bc52629Smistachkin ** 348bc52629Smistachkin ** #if defined(_WIN32_WINNT) 358bc52629Smistachkin ** # define SQLITE_OS_WINNT 1 368bc52629Smistachkin ** #else 378bc52629Smistachkin ** # define SQLITE_OS_WINNT 0 388bc52629Smistachkin ** #endif 398bc52629Smistachkin ** 40fdf9f045Smistachkin ** However, Visual Studio 2005 does not set _WIN32_WINNT by default, as 41fdf9f045Smistachkin ** it ought to, so the above test does not work. We'll just assume that 42fdf9f045Smistachkin ** everything is Windows NT unless the programmer explicitly says otherwise 43fdf9f045Smistachkin ** by setting SQLITE_OS_WINNT to 0. 448bc52629Smistachkin */ 458bc52629Smistachkin #if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) 468bc52629Smistachkin # define SQLITE_OS_WINNT 1 478bc52629Smistachkin #endif 488bc52629Smistachkin 498bc52629Smistachkin /* 50fdf9f045Smistachkin ** Determine if we are dealing with Windows CE - which has a much reduced 51fdf9f045Smistachkin ** API. 528bc52629Smistachkin */ 538bc52629Smistachkin #if defined(_WIN32_WCE) 548bc52629Smistachkin # define SQLITE_OS_WINCE 1 558bc52629Smistachkin #else 568bc52629Smistachkin # define SQLITE_OS_WINCE 0 578bc52629Smistachkin #endif 588bc52629Smistachkin 598bc52629Smistachkin /* 608bc52629Smistachkin ** Determine if we are dealing with WinRT, which provides only a subset of 618bc52629Smistachkin ** the full Win32 API. 628bc52629Smistachkin */ 638bc52629Smistachkin #if !defined(SQLITE_OS_WINRT) 648bc52629Smistachkin # define SQLITE_OS_WINRT 0 658bc52629Smistachkin #endif 668bc52629Smistachkin 67ce64d610Smistachkin /* 68ce64d610Smistachkin ** For WinCE, some API function parameters do not appear to be declared as 69ce64d610Smistachkin ** volatile. 70ce64d610Smistachkin */ 71ce64d610Smistachkin #if SQLITE_OS_WINCE 72ce64d610Smistachkin # define SQLITE_WIN32_VOLATILE 73ce64d610Smistachkin #else 74ce64d610Smistachkin # define SQLITE_WIN32_VOLATILE volatile 75ce64d610Smistachkin #endif 76ce64d610Smistachkin 7789ea0d37Smistachkin /* 7889ea0d37Smistachkin ** For some Windows sub-platforms, the _beginthreadex() / _endthreadex() 7989ea0d37Smistachkin ** functions are not available (e.g. those not using MSVC, Cygwin, etc). 8089ea0d37Smistachkin */ 8189ea0d37Smistachkin #if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ 8289ea0d37Smistachkin SQLITE_THREADSAFE>0 && !defined(__CYGWIN__) 8389ea0d37Smistachkin # define SQLITE_OS_WIN_THREADS 1 8489ea0d37Smistachkin #else 8589ea0d37Smistachkin # define SQLITE_OS_WIN_THREADS 0 8689ea0d37Smistachkin #endif 8789ea0d37Smistachkin 88*43f58d6aSdrh #endif /* SQLITE_OS_WIN_H */ 89