From f43b312562c73fe21c64abe3fb6fc040847db8e9 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 10 Nov 2021 17:17:00 +1100 Subject: [PATCH] msdasql: IDBProperties doesn't support DBPROPSET_DATASOURCEINFO property set. Native msado15 queries this to workout if interface IMultipleResults can be used with CreateCommand. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/msdasql/msdasql_main.c | 21 +++++++++++++++++++++ dlls/msdasql/tests/provider.c | 26 ++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/dlls/msdasql/msdasql_main.c b/dlls/msdasql/msdasql_main.c index e58facc47fc..e98945b9777 100644 --- a/dlls/msdasql/msdasql_main.c +++ b/dlls/msdasql/msdasql_main.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msdasql); +DEFINE_GUID(DBPROPSET_DATASOURCEINFO, 0xc8b522bb, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); DEFINE_GUID(DBPROPSET_DBINIT, 0xc8b522bc, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); DEFINE_GUID(DBGUID_DEFAULT, 0xc8b521fb, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); @@ -345,6 +346,26 @@ static HRESULT WINAPI dbprops_GetProperties(IDBProperties *iface, ULONG cPropert } propset = CoTaskMemAlloc(cPropertyIDSets * sizeof(DBPROPSET)); + + if (IsEqualGUID(&rgPropertyIDSets[0].guidPropertySet, &DBPROPSET_DATASOURCEINFO)) + { + TRACE("Propertyset DBPROPSET_DATASOURCEINFO not supported\n"); + propset->guidPropertySet = rgPropertyIDSets[0].guidPropertySet; + propset->cProperties = rgPropertyIDSets[0].cPropertyIDs; + + propset->rgProperties = CoTaskMemAlloc(propset->cProperties * sizeof(DBPROP)); + + for (j=0; j < propset->cProperties; j++) + { + propset->rgProperties[j].dwPropertyID = rgPropertyIDSets[0].rgPropertyIDs[j]; + propset->rgProperties[j].dwStatus = DBPROPSTATUS_NOTSUPPORTED; + } + + *prgPropertySets = propset; + + return DB_E_ERRORSOCCURRED; + } + propset->guidPropertySet = DBPROPSET_DBINIT; for (i=0; i < cPropertyIDSets; i++) diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c index 9b75f40a741..353e2ec58c8 100644 --- a/dlls/msdasql/tests/provider.c +++ b/dlls/msdasql/tests/provider.c @@ -31,6 +31,7 @@ #include "wine/test.h" +DEFINE_GUID(DBPROPSET_DATASOURCEINFO, 0xc8b522bb, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); DEFINE_GUID(DBPROPSET_DBINITALL, 0xc8b522ca, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); DEFINE_GUID(DBPROPSET_DBINIT, 0xc8b522bc, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); @@ -72,9 +73,14 @@ static void test_Properties(void) HRESULT hr; IDBProperties *props; DBPROPIDSET propidset; + DBPROPID propid; ULONG infocount; DBPROPINFOSET *propinfoset; + DBPROPIDSET propidlist; + DBPROPSET *propset; WCHAR *desc; + ULONG propcnt; + ULONG i; DBPROPID properties[14] = { DBPROP_AUTH_PASSWORD, DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, DBPROP_AUTH_USERID, @@ -97,10 +103,6 @@ static void test_Properties(void) if (hr == S_OK) { VARTYPE types[14] = { VT_BSTR, VT_BOOL, VT_BSTR, VT_BSTR, intptr_vartype, VT_BSTR, VT_I4, VT_I2 , VT_I4, VT_BSTR, VT_I4, VT_BSTR, VT_I4, VT_I4 }; - ULONG i; - DBPROPIDSET propidlist; - ULONG propcnt; - DBPROPSET *propset; ok(IsEqualGUID(&propinfoset->guidPropertySet, &DBPROPSET_DBINIT), "got %s\n", debugstr_guid(&propinfoset->guidPropertySet)); ok(propinfoset->cPropertyInfos == 14, "got %d\n", propinfoset->cPropertyInfos); @@ -162,6 +164,22 @@ static void test_Properties(void) CoTaskMemFree(propset); } + propid = DBPROP_MULTIPLERESULTS; + propidlist.rgPropertyIDs = &propid; + propidlist.cPropertyIDs = 1; + propidlist.guidPropertySet = DBPROPSET_DATASOURCEINFO; + + propcnt = 0; + propset = NULL; + hr = IDBProperties_GetProperties(props, 1, &propidlist, &propcnt, &propset); + ok(hr == DB_E_ERRORSOCCURRED, "got 0x%08x\n", hr); + ok(IsEqualGUID(&propset->guidPropertySet, &DBPROPSET_DATASOURCEINFO), "got %s\n", debugstr_guid(&propset->guidPropertySet)); + ok(propset->cProperties == 1, "got %d\n", propset->cProperties); + ok(propset->rgProperties[0].dwPropertyID == DBPROP_MULTIPLERESULTS, "got %d\n", propset->rgProperties[0].dwPropertyID); + ok(propset->rgProperties[0].dwStatus == DBPROPSTATUS_NOTSUPPORTED, "got %d\n", propset->rgProperties[0].dwStatus); + + CoTaskMemFree(propset); + IDBProperties_Release(props); }