/ Check-in [0ea9e472]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid using the GetVersionEx functions if they are considered deprecated.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | vs2013
Files: files | file ages | folders
SHA1:0ea9e4722be10221c99cce5bc48d13c7b34e739f
User & Date: mistachkin 2013-11-27 03:01:34
Context
2013-11-27
04:00
Avoid using the GetVersionEx functions if they are considered deprecated. check-in: afdca299 user: mistachkin tags: trunk
03:01
Avoid using the GetVersionEx functions if they are considered deprecated. Closed-Leaf check-in: 0ea9e472 user: mistachkin tags: vs2013
01:23
Add additional test cases for skip-scan. check-in: 1ae4915d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

    55     55   ** Make sure at least one set of Win32 APIs is available.
    56     56   */
    57     57   #if !defined(SQLITE_WIN32_HAS_ANSI) && !defined(SQLITE_WIN32_HAS_WIDE)
    58     58   #  error "At least one of SQLITE_WIN32_HAS_ANSI and SQLITE_WIN32_HAS_WIDE\
    59     59    must be defined."
    60     60   #endif
    61     61   
           62  +/*
           63  +** Define the required Windows SDK version constants if they are not
           64  +** already available.
           65  +*/
           66  +#ifndef NTDDI_WIN8
           67  +#  define NTDDI_WIN8                        0x06020000
           68  +#endif
           69  +
           70  +#ifndef NTDDI_WINBLUE
           71  +#  define NTDDI_WINBLUE                     0x06030000
           72  +#endif
           73  +
           74  +/*
           75  +** Check if the GetVersionEx[AW] functions should be considered deprecated
           76  +** and avoid using them in that case.  It should be noted here that if the
           77  +** value of the SQLITE_WIN32_GETVERSIONEX pre-processor macro is zero
           78  +** (whether via this block or via being manually specified), that implies
           79  +** the underlying operating system will always be based on the Windows NT
           80  +** Kernel.
           81  +*/
           82  +#ifndef SQLITE_WIN32_GETVERSIONEX
           83  +#  if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WINBLUE
           84  +#    define SQLITE_WIN32_GETVERSIONEX   0
           85  +#  else
           86  +#    define SQLITE_WIN32_GETVERSIONEX   1
           87  +#  endif
           88  +#endif
           89  +
    62     90   /*
    63     91   ** This constant should already be defined (in the "WinDef.h" SDK file).
    64     92   */
    65     93   #ifndef MAX_PATH
    66     94   #  define MAX_PATH                      (260)
    67     95   #endif
    68     96   
................................................................................
   690    718     { "GetTickCount",            (SYSCALL)GetTickCount,            0 },
   691    719   #else
   692    720     { "GetTickCount",            (SYSCALL)0,                       0 },
   693    721   #endif
   694    722   
   695    723   #define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
   696    724   
   697         -#if defined(SQLITE_WIN32_HAS_ANSI)
          725  +#if defined(SQLITE_WIN32_HAS_ANSI) && defined(SQLITE_WIN32_GETVERSIONEX) && \
          726  +        SQLITE_WIN32_GETVERSIONEX
   698    727     { "GetVersionExA",           (SYSCALL)GetVersionExA,           0 },
   699    728   #else
   700    729     { "GetVersionExA",           (SYSCALL)0,                       0 },
   701    730   #endif
   702    731   
   703    732   #define osGetVersionExA ((BOOL(WINAPI*)( \
   704    733           LPOSVERSIONINFOA))aSyscall[34].pCurrent)
   705    734   
   706         -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
          735  +#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
          736  +        defined(SQLITE_WIN32_GETVERSIONEX) && SQLITE_WIN32_GETVERSIONEX
   707    737     { "GetVersionExW",           (SYSCALL)GetVersionExW,           0 },
   708    738   #else
   709    739     { "GetVersionExW",           (SYSCALL)0,                       0 },
   710    740   #endif
   711    741   
   712    742   #define osGetVersionExW ((BOOL(WINAPI*)( \
   713    743           LPOSVERSIONINFOW))aSyscall[35].pCurrent)
................................................................................
  1256   1286   ** Here is an interesting observation:  Win95, Win98, and WinME lack
  1257   1287   ** the LockFileEx() API.  But we can still statically link against that
  1258   1288   ** API as long as we don't call it when running Win95/98/ME.  A call to
  1259   1289   ** this routine is used to determine if the host is Win95/98/ME or
  1260   1290   ** WinNT/2K/XP so that we will know whether or not we can safely call
  1261   1291   ** the LockFileEx() API.
  1262   1292   */
  1263         -#ifndef NTDDI_WIN8
  1264         -#  define NTDDI_WIN8                        0x06020000
  1265         -#endif
  1266   1293   
  1267         -#if SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI)
         1294  +#if !defined(SQLITE_WIN32_GETVERSIONEX) || !SQLITE_WIN32_GETVERSIONEX
         1295  +# define osIsNT()  (1)
         1296  +#elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI)
  1268   1297   # define osIsNT()  (1)
  1269   1298   #elif !defined(SQLITE_WIN32_HAS_WIDE)
  1270   1299   # define osIsNT()  (0)
  1271   1300   #else
  1272   1301     static int osIsNT(void){
  1273   1302       if( sqlite3_os_type==0 ){
  1274   1303   #if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN8