Skip to content

Commit

Permalink
Merge pull request #465 from wixtoolset/robmen/sql-tls1.2
Browse files Browse the repository at this point in the history
Cherry-pick SQL TLS1.2 fixes
  • Loading branch information
barnson authored May 3, 2018
2 parents e6dd234 + bdb57cf commit 90625c4
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/libs/dutil/sqlutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
#define DBINITCONSTANTS
#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

#if SQLNCLI_VER >= 1100
#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_)
#define SQLNCLI_CLSID CLSID_SQLNCLI11
#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_)
extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI11 = { 0x397C2819L,0x8272,0x4532,{ 0xAD,0x3A,0xFB,0x5E,0x43,0xBE,0xAA,0x39 } };
#endif // SQLNCLI_VER >= 1100

// private prototypes
static HRESULT FileSpecToString(
__in const SQL_FILESPEC* psf,
Expand Down Expand Up @@ -52,8 +67,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
Expand Down

0 comments on commit 90625c4

Please sign in to comment.