fix GetVersionExA is Deprecated warning
This commit is contained in:
parent
fb64892e37
commit
b78bcf8be3
|
@ -18,11 +18,12 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "core_sqlsrv.h"
|
#include "core_sqlsrv.h"
|
||||||
|
#include "VersionHelpers.h"
|
||||||
|
|
||||||
|
|
||||||
// module global variables (initialized in minit and freed in mshutdown)
|
// module global variables (initialized in minit and freed in mshutdown)
|
||||||
HMODULE g_sqlsrv_hmodule = NULL;
|
HMODULE g_sqlsrv_hmodule = NULL;
|
||||||
OSVERSIONINFO g_osversion;
|
bool isVistaOrGreater;
|
||||||
|
|
||||||
|
|
||||||
// core_sqlsrv_minit
|
// core_sqlsrv_minit
|
||||||
|
@ -47,12 +48,7 @@ void core_sqlsrv_minit( _Outptr_ sqlsrv_context** henv_cp, _Inout_ sqlsrv_contex
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// get the version of the OS we're running on. For now this governs certain flags used by
|
// get the version of the OS we're running on. For now this governs certain flags used by
|
||||||
// WideCharToMultiByte. It might be relevant to other things in the future.
|
// WideCharToMultiByte. It might be relevant to other things in the future.
|
||||||
g_osversion.dwOSVersionInfoSize = sizeof( g_osversion );
|
isVistaOrGreater = IsWindowsVistaOrGreater( );
|
||||||
BOOL ver_return = GetVersionEx( &g_osversion );
|
|
||||||
if( !ver_return ) {
|
|
||||||
LOG( SEV_ERROR, "Failed to retrieve Windows version information." );
|
|
||||||
throw core::CoreException();
|
|
||||||
}
|
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
SQLHANDLE henv = SQL_NULL_HANDLE;
|
SQLHANDLE henv = SQL_NULL_HANDLE;
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ struct sqlsrv_encoding {
|
||||||
//*********************************************************************************************************************************
|
//*********************************************************************************************************************************
|
||||||
|
|
||||||
// variables set during initialization
|
// variables set during initialization
|
||||||
extern OSVERSIONINFO g_osversion; // used to determine which OS we're running in
|
extern bool isVistaOrGreater; // used to determine if OS is Vista or Greater
|
||||||
extern HashTable* g_encodings; // encodings supported by this driver
|
extern HashTable* g_encodings; // encodings supported by this driver
|
||||||
|
|
||||||
void core_sqlsrv_minit( _Outptr_ sqlsrv_context** henv_cp, _Inout_ sqlsrv_context** henv_ncp, _In_ error_callback err, _In_z_ const char* driver_func TSRMLS_DC );
|
void core_sqlsrv_minit( _Outptr_ sqlsrv_context** henv_cp, _Inout_ sqlsrv_context** henv_ncp, _In_ error_callback err, _In_z_ const char* driver_func TSRMLS_DC );
|
||||||
|
|
|
@ -155,7 +155,7 @@ size_t sqlsrv_stream_read( _Inout_ php_stream* stream, _Out_writes_bytes_(count)
|
||||||
// convert to UTF-8
|
// convert to UTF-8
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD flags = 0;
|
DWORD flags = 0;
|
||||||
if( g_osversion.dwMajorVersion >= SQLSRV_OS_VISTA_OR_LATER ) {
|
if( isVistaOrGreater ) {
|
||||||
// Vista (and later) will detect invalid UTF-16 characters and raise an error.
|
// Vista (and later) will detect invalid UTF-16 characters and raise an error.
|
||||||
flags = WC_ERR_INVALID_CHARS;
|
flags = WC_ERR_INVALID_CHARS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ bool convert_string_from_utf16( _In_ SQLSRV_ENCODING encoding, _In_reads_bytes_(
|
||||||
// flags set to 0 by default, which means that any invalid characters are dropped rather than causing
|
// flags set to 0 by default, which means that any invalid characters are dropped rather than causing
|
||||||
// an error. This happens only on XP.
|
// an error. This happens only on XP.
|
||||||
DWORD flags = 0;
|
DWORD flags = 0;
|
||||||
if( encoding == CP_UTF8 && g_osversion.dwMajorVersion >= SQLSRV_OS_VISTA_OR_LATER ) {
|
if( encoding == CP_UTF8 && isVistaOrGreater ) {
|
||||||
// Vista (and later) will detect invalid UTF-16 characters and raise an error.
|
// Vista (and later) will detect invalid UTF-16 characters and raise an error.
|
||||||
flags = WC_ERR_INVALID_CHARS;
|
flags = WC_ERR_INVALID_CHARS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ extern HMODULE g_sqlsrv_hmodule; // used for getting the versio
|
||||||
extern sqlsrv_context* g_ss_henv_cp;
|
extern sqlsrv_context* g_ss_henv_cp;
|
||||||
extern sqlsrv_context* g_ss_henv_ncp;
|
extern sqlsrv_context* g_ss_henv_ncp;
|
||||||
|
|
||||||
extern OSVERSIONINFO g_osversion; // used to determine which OS we're running in
|
extern bool isVistaOrGreater; // used to determine if OS is Vista or Greater
|
||||||
|
|
||||||
#define phpext_sqlsrv_ptr &g_sqlsrv_module_entry
|
#define phpext_sqlsrv_ptr &g_sqlsrv_module_entry
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue