2013/11/4 Simon Slavin <[email protected]>:
> On 4 Nov 2013, at 6:32am, David de Regt <[email protected]> wrote:
>> In Visual Studio 2013, which uses the Windows 8.1 Platform SDK, they've
>> marked GetVersionEx as deprecated, trying to supercede it through to
>> VerifyVersionInfo and some other hardcoded macros based on that call that
>> the new SDK implements. Looking at the SQLite source, it looks like it only
>> uses the GetVersionEx call to test for whether LockFileEx is supported on
>> the current OS (whether it's NT-based or not).
>
> Could you suggest equivalent code which would use VerifyVersionInfo instead ?
> Even a rough guide on where to find documentation on it would be useful.
I would suggest the following patch, which disables the GetVersionEx call
completely in this case: VS2013 doesn't support Win95/98/ME any more,
so runtime detection of the OS is not necessary; we can do this
compile-time, the SQLITE_WIN32_HAS_ANSI macro is already
available for doing that:
Regards,
Jan Nijtmans
Index: src/os_win.c
==================================================================
--- src/os_win.c
+++ src/os_win.c
@@ -36,11 +36,12 @@
/*
** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI) \
+ && !(defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN8)
# define SQLITE_WIN32_HAS_ANSI
#endif
/*
** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
@@ -680,15 +681,11 @@
#endif
#define osGetVersionExA ((BOOL(WINAPI*)( \
LPOSVERSIONINFOA))aSyscall[34].pCurrent)
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
- { "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
-#else
{ "GetVersionExW", (SYSCALL)0, 0 },
-#endif
#define osGetVersionExW ((BOOL(WINAPI*)( \
LPOSVERSIONINFOW))aSyscall[35].pCurrent)
{ "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
@@ -1152,19 +1149,13 @@
#elif !defined(SQLITE_WIN32_HAS_WIDE)
# define osIsNT() (0)
#else
static int osIsNT(void){
if( sqlite3_os_type==0 ){
-#if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN8
- OSVERSIONINFOW sInfo;
- sInfo.dwOSVersionInfoSize = sizeof(sInfo);
- osGetVersionExW(&sInfo);
-#else
OSVERSIONINFOA sInfo;
sInfo.dwOSVersionInfoSize = sizeof(sInfo);
osGetVersionExA(&sInfo);
-#endif
sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
}
return sqlite3_os_type==2;
}
#endif
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users