From 4d923fd4e8d57ee83bc596173bea288148aa3ee6 Mon Sep 17 00:00:00 2001 From: DRISHTI271110 <37221421+DRISHTI271110@users.noreply.github.com> Date: Thu, 12 Apr 2018 10:26:53 +0530 Subject: [PATCH 1/2] For the issue: wixtoolset/issues#5543 For the issue: wixtoolset/issues#5543 SqlExtension Incompatible with TLS 1.2 #5543 --- src/libs/dutil/sqlutil.cpp | 46 +++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/libs/dutil/sqlutil.cpp b/src/libs/dutil/sqlutil.cpp index 7e7b08717..ce2f05bf0 100644 --- a/src/libs/dutil/sqlutil.cpp +++ b/src/libs/dutil/sqlutil.cpp @@ -7,8 +7,47 @@ // correct GUID's get pulled into this object file #include #define DBINITCONSTANTS +#define _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_ #include "sqlutil.h" +#if !defined(SQLNCLI_VER) +#define SQLNCLI_VER 1100 +#endif + +#if SQLNCLI_VER >= 1100 +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#define SQLNCLI_CLSID CLSID_SQLNCLI11 +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#elif SQLNCLI_VER >= 1000 +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#define SQLNCLI_CLSID CLSID_SQLNCLI10 +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#else +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#define SQLNCLI_CLSID CLSID_SQLNCLI +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#endif // SQLNCLI_VER >= 1100 + + +#ifndef _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_ +#define _SQLNCLI_OLEDB_DEPRECATE_WARNING __declspec(deprecated("The SQL Server Native Client OLEDB provider is deprecated and will be removed in a future release of SQL Server Native Client. To disable this warning, define the following symbol in your application: _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_")) +#else +#define _SQLNCLI_OLEDB_DEPRECATE_WARNING +#endif + +#if SQLNCLI_VER >= 1100 +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI11 = { 0x397C2819L,0x8272,0x4532,{ 0xAD,0x3A,0xFB,0x5E,0x43,0xBE,0xAA,0x39 } }; +#endif + +#if SQLNCLI_VER >= 1000 +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI10 = { 0x8F4A6B68L,0x4F36,0x4e3c,{ 0xBE,0x81,0xBC,0x7C,0xA4,0xE9,0xC4,0x5C } }; +#endif + +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI = { 0x85ecafccL,0xbdd9,0x4b03,{ 0x97,0xa8,0xfa,0x65,0xcb,0xe3,0x85,0x9b } }; + + + + // private prototypes static HRESULT FileSpecToString( __in const SQL_FILESPEC* psf, @@ -52,8 +91,13 @@ extern "C" HRESULT DAPI SqlConnectDatabase( memset(rgdbpsetInit, 0, sizeof(rgdbpsetInit)); //obtain access to the SQLOLEDB provider - hr = ::CoCreateInstance(CLSID_SQLOLEDB, NULL, CLSCTX_INPROC_SERVER, + hr = ::CoCreateInstance(SQLNCLI_CLSID, NULL, CLSCTX_INPROC_SERVER, IID_IDBInitialize, (LPVOID*)&pidbInitialize); + if (FAILED(hr)) + { + hr = ::CoCreateInstance(CLSID_SQLOLEDB, NULL, CLSCTX_INPROC_SERVER, + IID_IDBInitialize, (LPVOID*)&pidbInitialize); + } ExitOnFailure(hr, "failed to create IID_IDBInitialize object"); // if there is an instance From bdb57cf62d9e415675aa4044dba80b7b6223bda8 Mon Sep 17 00:00:00 2001 From: DRISHTI271110 <37221421+DRISHTI271110@users.noreply.github.com> Date: Wed, 25 Apr 2018 12:13:24 +0530 Subject: [PATCH 2/2] PR 257 iteration2 https://github.com/wixtoolset/wix4/pull/257/ --- src/libs/dutil/sqlutil.cpp | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/libs/dutil/sqlutil.cpp b/src/libs/dutil/sqlutil.cpp index ce2f05bf0..1a9cfdfe4 100644 --- a/src/libs/dutil/sqlutil.cpp +++ b/src/libs/dutil/sqlutil.cpp @@ -7,9 +7,12 @@ // correct GUID's get pulled into this object file #include #define DBINITCONSTANTS -#define _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_ #include "sqlutil.h" + +//Please note that only SQL native client 11 has TLS1.2 support +#define _SQLNCLI_OLEDB_DEPRECATE_WARNING + #if !defined(SQLNCLI_VER) #define SQLNCLI_VER 1100 #endif @@ -18,35 +21,8 @@ #if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) #define SQLNCLI_CLSID CLSID_SQLNCLI11 #endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) -#elif SQLNCLI_VER >= 1000 -#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) -#define SQLNCLI_CLSID CLSID_SQLNCLI10 -#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) -#else -#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) -#define SQLNCLI_CLSID CLSID_SQLNCLI -#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) -#endif // SQLNCLI_VER >= 1100 - - -#ifndef _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_ -#define _SQLNCLI_OLEDB_DEPRECATE_WARNING __declspec(deprecated("The SQL Server Native Client OLEDB provider is deprecated and will be removed in a future release of SQL Server Native Client. To disable this warning, define the following symbol in your application: _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_")) -#else -#define _SQLNCLI_OLEDB_DEPRECATE_WARNING -#endif - -#if SQLNCLI_VER >= 1100 extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI11 = { 0x397C2819L,0x8272,0x4532,{ 0xAD,0x3A,0xFB,0x5E,0x43,0xBE,0xAA,0x39 } }; -#endif - -#if SQLNCLI_VER >= 1000 -extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI10 = { 0x8F4A6B68L,0x4F36,0x4e3c,{ 0xBE,0x81,0xBC,0x7C,0xA4,0xE9,0xC4,0x5C } }; -#endif - -extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI = { 0x85ecafccL,0xbdd9,0x4b03,{ 0x97,0xa8,0xfa,0x65,0xcb,0xe3,0x85,0x9b } }; - - - +#endif // SQLNCLI_VER >= 1100 // private prototypes static HRESULT FileSpecToString(