2012-09-25 04:43:58 +02:00
|
|
|
/* OLEDB Database tests
|
|
|
|
*
|
|
|
|
* Copyright 2012 Alistair Leslie-Hughes
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
#include <stdarg.h>
|
2013-08-02 07:44:43 +02:00
|
|
|
#include <stdio.h>
|
2012-09-25 04:43:58 +02:00
|
|
|
|
|
|
|
#define COBJMACROS
|
2013-08-22 12:44:17 +02:00
|
|
|
#define CONST_VTABLE
|
2015-06-06 16:19:05 +02:00
|
|
|
#define DBINITCONSTANTS
|
2012-09-25 04:43:58 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "msdadc.h"
|
|
|
|
#include "msdasc.h"
|
2013-08-01 05:48:13 +02:00
|
|
|
#include "msdaguid.h"
|
2013-06-19 00:20:38 +02:00
|
|
|
#include "initguid.h"
|
2015-06-06 16:19:05 +02:00
|
|
|
#include "oledb.h"
|
2013-08-19 03:13:34 +02:00
|
|
|
#include "oledberr.h"
|
2020-03-15 07:26:36 +01:00
|
|
|
#include "msdasql.h"
|
2012-09-25 04:43:58 +02:00
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2013-06-19 00:20:38 +02:00
|
|
|
DEFINE_GUID(CSLID_MSDAER, 0xc8b522cf,0x5cf3,0x11ce,0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d);
|
|
|
|
|
|
|
|
static WCHAR initstring_default[] = {'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y',';',0};
|
|
|
|
|
2015-06-06 15:09:49 +02:00
|
|
|
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
|
|
|
|
static void _expect_ref(IUnknown* obj, ULONG ref, int line)
|
|
|
|
{
|
2016-05-17 20:22:12 +02:00
|
|
|
ULONG rc;
|
|
|
|
IUnknown_AddRef(obj);
|
|
|
|
rc = IUnknown_Release(obj);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok_(__FILE__, line)(rc == ref, "expected refcount %ld, got %ld\n", ref, rc);
|
2015-06-06 15:09:49 +02:00
|
|
|
}
|
|
|
|
|
2012-12-26 17:53:45 +01:00
|
|
|
static void test_GetDataSource(WCHAR *initstring)
|
2012-09-25 04:43:58 +02:00
|
|
|
{
|
|
|
|
IDataInitialize *datainit = NULL;
|
2012-12-26 17:53:45 +01:00
|
|
|
IDBInitialize *dbinit = NULL;
|
|
|
|
HRESULT hr;
|
2012-09-25 04:43:58 +02:00
|
|
|
|
2013-06-03 08:26:32 +02:00
|
|
|
trace("Data Source: %s\n", wine_dbgstr_w(initstring));
|
|
|
|
|
2012-09-25 04:43:58 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize,(void**)&datainit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2012-12-26 17:53:45 +01:00
|
|
|
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(datainit, 1);
|
|
|
|
|
2012-12-26 17:53:45 +01:00
|
|
|
/* a failure to create data source here may indicate provider is simply not present */
|
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, initstring, &IID_IDBInitialize, (IUnknown**)&dbinit);
|
2012-09-25 04:43:58 +02:00
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
IDBProperties *props = NULL;
|
|
|
|
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(datainit, 1);
|
|
|
|
EXPECT_REF(dbinit, 1);
|
|
|
|
|
2012-09-25 04:43:58 +02:00
|
|
|
hr = IDBInitialize_QueryInterface(dbinit, &IID_IDBProperties, (void**)&props);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2012-09-25 04:43:58 +02:00
|
|
|
if(SUCCEEDED(hr))
|
2013-06-03 08:26:32 +02:00
|
|
|
{
|
|
|
|
ULONG cnt;
|
|
|
|
DBPROPINFOSET *pInfoset;
|
|
|
|
OLECHAR *ary;
|
|
|
|
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(dbinit, 2);
|
|
|
|
EXPECT_REF(props, 2);
|
2013-06-03 08:26:32 +02:00
|
|
|
hr = IDBProperties_GetPropertyInfo(props, 0, NULL, &cnt, &pInfoset, &ary);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-06-03 08:26:32 +02:00
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ULONG i;
|
|
|
|
for(i =0; i < pInfoset->cPropertyInfos; i++)
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
trace("(0x%04lx) '%s' %d\n", pInfoset->rgPropertyInfos[i].dwPropertyID, wine_dbgstr_w(pInfoset->rgPropertyInfos[i].pwszDescription),
|
2013-06-03 08:26:32 +02:00
|
|
|
pInfoset->rgPropertyInfos[i].vtType);
|
|
|
|
}
|
|
|
|
|
2015-06-05 12:23:02 +02:00
|
|
|
CoTaskMemFree(pInfoset);
|
2014-05-04 18:34:27 +02:00
|
|
|
CoTaskMemFree(ary);
|
2013-06-03 08:26:32 +02:00
|
|
|
}
|
|
|
|
|
2012-09-25 04:43:58 +02:00
|
|
|
IDBProperties_Release(props);
|
2013-06-03 08:26:32 +02:00
|
|
|
}
|
|
|
|
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(dbinit, 1);
|
2012-09-25 04:43:58 +02:00
|
|
|
IDBInitialize_Release(dbinit);
|
|
|
|
}
|
|
|
|
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(datainit, 1);
|
2012-09-25 04:43:58 +02:00
|
|
|
IDataInitialize_Release(datainit);
|
|
|
|
}
|
|
|
|
|
2015-06-06 16:19:05 +02:00
|
|
|
/* IDBProperties stub */
|
|
|
|
static HRESULT WINAPI dbprops_QI(IDBProperties *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
if (IsEqualIID(riid, &IID_IDBProperties) || IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
*obj = iface;
|
|
|
|
IDBProperties_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*obj = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI dbprops_AddRef(IDBProperties *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI dbprops_Release(IDBProperties *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI dbprops_GetProperties(IDBProperties *iface, ULONG cPropertyIDSets,
|
|
|
|
const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertySets, DBPROPSET **prgPropertySets)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI dbprops_GetPropertyInfo(IDBProperties *iface, ULONG cPropertyIDSets,
|
|
|
|
const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets,
|
|
|
|
OLECHAR **ppDescBuffer)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI dbprops_SetProperties(IDBProperties *iface, ULONG set_count, DBPROPSET propsets[])
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(set_count == 1, "got %lu\n", set_count);
|
2015-06-06 16:19:05 +02:00
|
|
|
|
|
|
|
ok(IsEqualIID(&propsets->guidPropertySet, &DBPROPSET_DBINIT), "set guid %s\n", wine_dbgstr_guid(&propsets->guidPropertySet));
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(propsets->cProperties == 2, "got propcount %lu\n", propsets->cProperties);
|
2015-06-06 16:19:05 +02:00
|
|
|
|
|
|
|
if (propsets->cProperties == 2) {
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(propsets->rgProperties[0].dwPropertyID == DBPROP_INIT_DATASOURCE, "got propid[0] %lu\n", propsets->rgProperties[0].dwPropertyID);
|
|
|
|
ok(propsets->rgProperties[0].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[0] %lu\n", propsets->rgProperties[0].dwOptions);
|
|
|
|
ok(propsets->rgProperties[0].dwStatus == 0, "got status[0] %lu\n", propsets->rgProperties[0].dwStatus);
|
2015-06-06 16:19:05 +02:00
|
|
|
ok(V_VT(&propsets->rgProperties[0].vValue) == VT_BSTR, "got vartype[0] %u\n", V_VT(&propsets->rgProperties[0].vValue));
|
|
|
|
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(propsets->rgProperties[1].dwPropertyID == DBPROP_INIT_PROVIDERSTRING, "got propid[1] %lu\n", propsets->rgProperties[1].dwPropertyID);
|
|
|
|
ok(propsets->rgProperties[1].dwOptions == DBPROPOPTIONS_REQUIRED, "got options[1] %lu\n", propsets->rgProperties[1].dwOptions);
|
|
|
|
ok(propsets->rgProperties[1].dwStatus == 0, "got status[1] %lu\n", propsets->rgProperties[1].dwStatus);
|
2015-06-06 16:19:05 +02:00
|
|
|
ok(V_VT(&propsets->rgProperties[1].vValue) == VT_BSTR, "got vartype[1] %u\n", V_VT(&propsets->rgProperties[1].vValue));
|
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IDBPropertiesVtbl dbpropsvtbl = {
|
|
|
|
dbprops_QI,
|
|
|
|
dbprops_AddRef,
|
|
|
|
dbprops_Release,
|
|
|
|
dbprops_GetProperties,
|
|
|
|
dbprops_GetPropertyInfo,
|
|
|
|
dbprops_SetProperties
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDBProperties dbprops = { &dbpropsvtbl };
|
|
|
|
|
|
|
|
/* IPersist stub */
|
|
|
|
static HRESULT WINAPI dbpersist_QI(IPersist *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
if (IsEqualIID(riid, &IID_IPersist) || IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
*obj = iface;
|
|
|
|
IPersist_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*obj = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI dbpersist_AddRef(IPersist *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI dbpersist_Release(IPersist *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI dbpersist_GetClassID(IPersist *iface, CLSID *clsid)
|
|
|
|
{
|
|
|
|
static const WCHAR msdasqlW[] = {'M','S','D','A','S','Q','L',0};
|
|
|
|
return CLSIDFromProgID(msdasqlW, clsid);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IPersistVtbl dbpersistvtbl = {
|
|
|
|
dbpersist_QI,
|
|
|
|
dbpersist_AddRef,
|
|
|
|
dbpersist_Release,
|
|
|
|
dbpersist_GetClassID
|
|
|
|
};
|
|
|
|
|
|
|
|
static IPersist dbpersist = { &dbpersistvtbl };
|
|
|
|
|
|
|
|
/* IDBInitialize stub */
|
|
|
|
static HRESULT WINAPI dbinit_QI(IDBInitialize *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
if (IsEqualIID(riid, &IID_IDBInitialize) || IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
*obj = iface;
|
|
|
|
IDBInitialize_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(riid, &IID_IPersist)) {
|
|
|
|
*obj = &dbpersist;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(riid, &IID_IDBProperties)) {
|
|
|
|
*obj = &dbprops;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*obj = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI dbinit_AddRef(IDBInitialize *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI dbinit_Release(IDBInitialize *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI dbinit_Initialize(IDBInitialize *iface)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI dbinit_Uninitialize(IDBInitialize *iface)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IDBInitializeVtbl dbinitvtbl = {
|
|
|
|
dbinit_QI,
|
|
|
|
dbinit_AddRef,
|
|
|
|
dbinit_Release,
|
|
|
|
dbinit_Initialize,
|
|
|
|
dbinit_Uninitialize
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDBInitialize dbinittest = { &dbinitvtbl };
|
|
|
|
|
|
|
|
static void test_GetDataSource2(WCHAR *initstring)
|
|
|
|
{
|
|
|
|
IDataInitialize *datainit = NULL;
|
|
|
|
IDBInitialize *dbinit = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize,(void**)&datainit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2015-06-06 16:19:05 +02:00
|
|
|
|
|
|
|
dbinit = &dbinittest;
|
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, initstring, &IID_IDBInitialize, (IUnknown**)&dbinit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2015-06-06 16:19:05 +02:00
|
|
|
|
|
|
|
IDataInitialize_Release(datainit);
|
|
|
|
}
|
|
|
|
|
2012-12-26 17:53:45 +01:00
|
|
|
static void test_database(void)
|
|
|
|
{
|
|
|
|
static WCHAR initstring_jet[] = {'P','r','o','v','i','d','e','r','=','M','i','c','r','o','s','o','f','t','.',
|
2012-12-28 11:59:23 +01:00
|
|
|
'J','e','t','.','O','L','E','D','B','.','4','.','0',';',
|
2013-02-10 17:01:23 +01:00
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y',';',
|
|
|
|
'P','e','r','s','i','s','t',' ','S','e','c','u','r','i','t','y',' ','I','n','f','o','=','F','a','l','s','e',';',0};
|
2013-06-17 13:48:14 +02:00
|
|
|
static WCHAR initstring_lower[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','d','u','m','m','y',';',0};
|
2015-06-06 16:19:05 +02:00
|
|
|
static WCHAR customprop[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','d','u','m','m','y',';',
|
|
|
|
'c','u','s','t','o','m','p','r','o','p','=','1','2','3','.','4',';',0};
|
2016-08-09 09:36:22 +02:00
|
|
|
static WCHAR extended_prop[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','d','u','m','m','y',';',
|
|
|
|
'E','x','t','e','n','d','e','d',' ','P','r','o','p','e','r','t','i','e','s','=','\"','D','R','I','V','E','R','=','A',
|
|
|
|
' ','W','i','n','e',' ','O','D','B','C',' ','d','r','i','v','e','r',';','U','I','D','=','w','i','n','e',';','\"',';',0};
|
2017-02-02 00:03:20 +01:00
|
|
|
static WCHAR extended_prop2[] = {'d','a','t','a',' ','s','o','u','r','c','e','=','\'','d','u','m','m','y','\'',';',
|
|
|
|
'c','u','s','t','o','m','p','r','o','p','=','\'','1','2','3','.','4','\'',';',0};
|
2012-12-26 17:53:45 +01:00
|
|
|
IDataInitialize *datainit = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-02-10 17:01:23 +01:00
|
|
|
hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize, (void**)&datainit);
|
2012-12-26 17:53:45 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
win_skip("Unable to load oledb library\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
IDataInitialize_Release(datainit);
|
|
|
|
|
|
|
|
test_GetDataSource(NULL);
|
|
|
|
test_GetDataSource(initstring_jet);
|
|
|
|
test_GetDataSource(initstring_default);
|
2013-06-17 13:48:14 +02:00
|
|
|
test_GetDataSource(initstring_lower);
|
2015-06-06 16:19:05 +02:00
|
|
|
test_GetDataSource2(customprop);
|
2016-08-09 09:36:22 +02:00
|
|
|
test_GetDataSource2(extended_prop);
|
2017-02-02 00:03:20 +01:00
|
|
|
test_GetDataSource2(extended_prop2);
|
2012-12-26 17:53:45 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 14:48:35 +01:00
|
|
|
static void free_dispparams(DISPPARAMS *params)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < params->cArgs && params->rgvarg; i++)
|
|
|
|
VariantClear(¶ms->rgvarg[i]);
|
|
|
|
CoTaskMemFree(params->rgvarg);
|
|
|
|
CoTaskMemFree(params->rgdispidNamedArgs);
|
|
|
|
}
|
|
|
|
|
2013-06-19 00:20:38 +02:00
|
|
|
static void test_errorinfo(void)
|
|
|
|
{
|
2016-06-03 08:55:36 +02:00
|
|
|
ICreateErrorInfo *createerror;
|
|
|
|
ERRORINFO info, info2, info3;
|
2016-11-15 18:26:48 +01:00
|
|
|
IErrorInfo *errorinfo, *errorinfo2;
|
2016-06-03 08:55:36 +02:00
|
|
|
IErrorRecords *errrecs;
|
2016-11-15 18:26:48 +01:00
|
|
|
IUnknown *unk = NULL, *unk2;
|
|
|
|
DISPPARAMS dispparams;
|
2016-11-16 14:48:35 +01:00
|
|
|
DISPID dispid;
|
2016-06-03 08:55:36 +02:00
|
|
|
DWORD context;
|
|
|
|
ULONG cnt = 0;
|
2016-11-16 14:48:35 +01:00
|
|
|
VARIANT arg;
|
2016-06-03 08:55:36 +02:00
|
|
|
HRESULT hr;
|
|
|
|
GUID guid;
|
|
|
|
BSTR str;
|
2013-06-19 00:20:38 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = CoCreateInstance(&CSLID_MSDAER, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-06-19 00:20:38 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IUnknown_QueryInterface(unk, &IID_IErrorInfo, (void**)&errorinfo);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-06-19 00:20:38 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IErrorInfo_GetGUID(errorinfo, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IErrorInfo_GetSource(errorinfo, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IErrorInfo_GetDescription(errorinfo, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IErrorInfo_GetHelpFile(errorinfo, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IErrorInfo_GetHelpContext(errorinfo, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
memset(&guid, 0xac, sizeof(guid));
|
|
|
|
hr = IErrorInfo_GetGUID(errorinfo, &guid);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
ok(IsEqualGUID(&guid, &GUID_NULL), "got wrong guid\n");
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
str = (BSTR)0x1;
|
|
|
|
hr = IErrorInfo_GetSource(errorinfo, &str);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_FAIL, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
str = (BSTR)0x1;
|
|
|
|
hr = IErrorInfo_GetDescription(errorinfo, &str);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_FAIL, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
str = (BSTR)0x1;
|
|
|
|
hr = IErrorInfo_GetHelpFile(errorinfo, &str);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_FAIL, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
context = 1;
|
|
|
|
hr = IErrorInfo_GetHelpContext(errorinfo, &context);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_FAIL, "got %08lx\n", hr);
|
|
|
|
ok(context == 0, "got %ld\n", context);
|
2013-08-19 03:13:34 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
IErrorInfo_Release(errorinfo);
|
|
|
|
|
|
|
|
hr = IErrorInfo_QueryInterface(errorinfo, &IID_ICreateErrorInfo, (void**)&createerror);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got %08lx\n", hr);
|
2013-06-14 02:23:43 +02:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IUnknown_QueryInterface(unk, &IID_IErrorRecords, (void**)&errrecs);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
2016-11-15 18:26:48 +01:00
|
|
|
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
|
|
|
ok(cnt == 0, "Got unexpected record count %lu\n", cnt);
|
2016-11-15 18:26:48 +01:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, &info3);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == DB_E_BADRECORDNUM, "got %08lx\n", hr);
|
2016-11-15 18:26:48 +01:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetCustomErrorObject(errrecs, 0, &IID_IUnknown, &unk2);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == DB_E_BADRECORDNUM, "got %08lx\n", hr);
|
2016-11-15 18:26:48 +01:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetErrorInfo(errrecs, 0, 0, &errorinfo2);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == DB_E_BADRECORDNUM, "got %08lx\n", hr);
|
2016-11-15 18:26:48 +01:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetErrorParameters(errrecs, 0, &dispparams);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == DB_E_BADRECORDNUM, "got %08lx\n", hr);
|
2016-11-15 18:26:48 +01:00
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
memset(&info, 0, sizeof(ERRORINFO));
|
|
|
|
info.dwMinor = 1;
|
|
|
|
memset(&info2, 0, sizeof(ERRORINFO));
|
|
|
|
info2.dwMinor = 2;
|
|
|
|
memset(&info3, 0, sizeof(ERRORINFO));
|
|
|
|
|
|
|
|
hr = IErrorRecords_AddErrorRecord(errrecs, NULL, 268435456, NULL, NULL, 0);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
|
|
|
hr = IErrorRecords_AddErrorRecord(errrecs, &info, 1, NULL, NULL, 0);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
|
|
|
ok(cnt == 1, "expected 1 got %ld\n", cnt);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
2016-11-15 18:26:49 +01:00
|
|
|
/* Record does not contain custom error object. */
|
|
|
|
unk2 = (void*)0xdeadbeef;
|
|
|
|
hr = IErrorRecords_GetCustomErrorObject(errrecs, 0, &IID_IUnknown, &unk2);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-11-15 18:26:49 +01:00
|
|
|
ok(unk2 == NULL, "Got custom object %p.\n", unk2);
|
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
hr = IErrorRecords_AddErrorRecord(errrecs, &info2, 2, NULL, NULL, 0);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
|
|
|
ok(cnt == 2, "expected 2 got %ld\n", cnt);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 100, &info3);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == DB_E_BADRECORDNUM, "got %08lx\n", hr);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
|
|
|
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, &info3);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
|
|
|
ok(info3.dwMinor == 2, "expected 2 got %ld\n", info3.dwMinor);
|
2016-06-03 08:55:36 +02:00
|
|
|
|
2016-11-16 14:48:35 +01:00
|
|
|
hr = IErrorRecords_GetErrorParameters(errrecs, 0, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2016-11-16 14:48:35 +01:00
|
|
|
|
|
|
|
memset(&dispparams, 0xcc, sizeof(dispparams));
|
|
|
|
hr = IErrorRecords_GetErrorParameters(errrecs, 0, &dispparams);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-11-16 14:48:35 +01:00
|
|
|
ok(dispparams.rgvarg == NULL, "Got arguments %p\n", dispparams.rgvarg);
|
|
|
|
ok(dispparams.rgdispidNamedArgs == NULL, "Got named arguments %p\n", dispparams.rgdispidNamedArgs);
|
|
|
|
ok(dispparams.cArgs == 0, "Got argument count %u\n", dispparams.cArgs);
|
|
|
|
ok(dispparams.cNamedArgs == 0, "Got named argument count %u\n", dispparams.cNamedArgs);
|
|
|
|
|
|
|
|
V_VT(&arg) = VT_BSTR;
|
|
|
|
V_BSTR(&arg) = SysAllocStringLen(NULL, 0);
|
|
|
|
dispid = 0x123;
|
|
|
|
|
|
|
|
dispparams.rgvarg = &arg;
|
|
|
|
dispparams.cArgs = 1;
|
|
|
|
dispparams.rgdispidNamedArgs = &dispid;
|
|
|
|
dispparams.cNamedArgs = 1;
|
|
|
|
hr = IErrorRecords_AddErrorRecord(errrecs, &info2, 0, &dispparams, NULL, 0);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-11-16 14:48:35 +01:00
|
|
|
|
|
|
|
memset(&dispparams, 0, sizeof(dispparams));
|
|
|
|
hr = IErrorRecords_GetErrorParameters(errrecs, 0, &dispparams);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2016-11-16 14:48:35 +01:00
|
|
|
|
|
|
|
ok(V_VT(&dispparams.rgvarg[0]) == VT_BSTR, "Got arg type %d\n", V_VT(&dispparams.rgvarg[0]));
|
|
|
|
ok(V_BSTR(&dispparams.rgvarg[0]) != V_BSTR(&arg), "Got arg bstr %d\n", V_VT(&dispparams.rgvarg[0]));
|
|
|
|
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(dispparams.rgdispidNamedArgs[0] == 0x123, "Got named argument %ld\n", dispparams.rgdispidNamedArgs[0]);
|
2016-11-16 14:48:35 +01:00
|
|
|
ok(dispparams.cArgs == 1, "Got argument count %u\n", dispparams.cArgs);
|
|
|
|
ok(dispparams.cNamedArgs == 1, "Got named argument count %u\n", dispparams.cNamedArgs);
|
|
|
|
|
2020-11-27 09:14:44 +01:00
|
|
|
EXPECT_REF(errrecs, 2);
|
|
|
|
EXPECT_REF(errorinfo, 2);
|
|
|
|
hr = IErrorRecords_GetErrorInfo(errrecs, 0, 0, &errorinfo2);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2020-11-27 09:14:44 +01:00
|
|
|
ok(errorinfo == errorinfo2, "different object\n");
|
|
|
|
EXPECT_REF(errorinfo, 3);
|
|
|
|
IErrorInfo_Release(errorinfo2);
|
|
|
|
|
2016-11-16 14:48:35 +01:00
|
|
|
free_dispparams(&dispparams);
|
|
|
|
VariantClear(&arg);
|
|
|
|
|
2016-06-03 08:55:36 +02:00
|
|
|
IErrorRecords_Release(errrecs);
|
|
|
|
IUnknown_Release(unk);
|
2013-06-19 00:20:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_initializationstring(void)
|
|
|
|
{
|
2013-12-26 22:49:32 +01:00
|
|
|
static const WCHAR initstring_msdasql[] = {'P','r','o','v','i','d','e','r','=','M','S','D','A','S','Q','L','.','1',';',
|
2013-06-19 00:20:38 +02:00
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y', 0};
|
2015-11-03 22:27:34 +01:00
|
|
|
static const WCHAR initstring_msdasql2[] = {'p','R','o','V','i','D','e','R','=','M','S','D','A','S','Q','L','.','1',';',
|
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y', 0};
|
2013-12-26 22:49:32 +01:00
|
|
|
static const WCHAR initstring_sqloledb[] = {'P','r','o','v','i','d','e','r','=','S','Q','L','O','L','E','D','B','.','1',';',
|
2013-06-19 00:20:38 +02:00
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y', 0};
|
2017-04-20 12:05:32 +02:00
|
|
|
static const WCHAR initstring_mode[] = {'P','r','o','v','i','d','e','r','=','M','S','D','A','S','Q','L','.','1',';',
|
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y',';',
|
|
|
|
'M','o','d','e','=','i','n','v','a','l','i','d',0};
|
|
|
|
static const WCHAR initstring_mode2[] = {'P','r','o','v','i','d','e','r','=','M','S','D','A','S','Q','L','.','1',';',
|
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y',';',
|
|
|
|
'M','o','d','e','=','W','r','i','t','e','R','e','a','d',0};
|
|
|
|
static const WCHAR initstring_mode3[] = {'P','r','o','v','i','d','e','r','=','M','S','D','A','S','Q','L','.','1',';',
|
|
|
|
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y',';',
|
|
|
|
'M','o','d','e','=','R','e','a','d','W','R','I','T','E',0};
|
2013-06-19 00:20:38 +02:00
|
|
|
IDataInitialize *datainit = NULL;
|
2015-06-06 15:09:49 +02:00
|
|
|
IDBInitialize *dbinit;
|
2013-06-19 00:20:38 +02:00
|
|
|
HRESULT hr;
|
|
|
|
WCHAR *initstring = NULL;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize,(void**)&datainit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-06-19 00:20:38 +02:00
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(datainit, 1);
|
|
|
|
|
|
|
|
dbinit = NULL;
|
2013-06-19 00:20:38 +02:00
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, initstring_default,
|
|
|
|
&IID_IDBInitialize, (IUnknown**)&dbinit);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
2015-06-06 15:09:49 +02:00
|
|
|
EXPECT_REF(datainit, 1);
|
|
|
|
EXPECT_REF(dbinit, 1);
|
|
|
|
|
2013-06-19 00:20:38 +02:00
|
|
|
hr = IDataInitialize_GetInitializationString(datainit, (IUnknown*)dbinit, 0, &initstring);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-06-19 00:20:38 +02:00
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
trace("Init String: %s\n", wine_dbgstr_w(initstring));
|
|
|
|
todo_wine ok(!lstrcmpW(initstring_msdasql, initstring) ||
|
|
|
|
!lstrcmpW(initstring_sqloledb, initstring), "got %s\n", wine_dbgstr_w(initstring));
|
|
|
|
CoTaskMemFree(initstring);
|
|
|
|
}
|
|
|
|
|
|
|
|
IDBInitialize_Release(dbinit);
|
2015-11-03 22:27:34 +01:00
|
|
|
|
|
|
|
/* mixed casing string */
|
|
|
|
dbinit = NULL;
|
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, (WCHAR*)initstring_msdasql2,
|
|
|
|
&IID_IDBInitialize, (IUnknown**)&dbinit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2015-11-03 22:27:34 +01:00
|
|
|
IDBInitialize_Release(dbinit);
|
2017-04-20 12:05:32 +02:00
|
|
|
|
|
|
|
/* Invalid Mode value */
|
|
|
|
dbinit = NULL;
|
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, (WCHAR *)initstring_mode,
|
|
|
|
&IID_IDBInitialize, (IUnknown **)&dbinit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(FAILED(hr), "got 0x%08lx\n", hr);
|
2017-04-20 12:05:32 +02:00
|
|
|
|
|
|
|
dbinit = NULL;
|
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, (WCHAR *)initstring_mode2,
|
|
|
|
&IID_IDBInitialize, (IUnknown **)&dbinit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(FAILED(hr), "got 0x%08lx\n", hr);
|
2017-04-20 12:05:32 +02:00
|
|
|
|
|
|
|
dbinit = NULL;
|
|
|
|
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, (WCHAR *)initstring_mode3,
|
|
|
|
&IID_IDBInitialize, (IUnknown **)&dbinit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2017-04-20 12:05:32 +02:00
|
|
|
IDBInitialize_Release(dbinit);
|
2013-06-19 00:20:38 +02:00
|
|
|
}
|
2015-06-06 15:09:49 +02:00
|
|
|
else
|
|
|
|
ok(dbinit == NULL, "got %p\n", dbinit);
|
2013-06-19 00:20:38 +02:00
|
|
|
|
|
|
|
IDataInitialize_Release(datainit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-01 05:48:13 +02:00
|
|
|
static void test_rowposition(void)
|
|
|
|
{
|
2013-08-02 07:44:43 +02:00
|
|
|
IEnumConnectionPoints *enum_points;
|
|
|
|
IConnectionPointContainer *cpc;
|
|
|
|
IConnectionPoint *cp;
|
2013-08-01 05:48:13 +02:00
|
|
|
IRowPosition *rowpos;
|
|
|
|
HRESULT hr;
|
2013-08-02 07:44:43 +02:00
|
|
|
IID iid;
|
2013-08-01 05:48:13 +02:00
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_OLEDB_ROWPOSITIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IRowPosition, (void**)&rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-01 05:48:13 +02:00
|
|
|
|
2013-08-02 07:44:43 +02:00
|
|
|
hr = IRowPosition_QueryInterface(rowpos, &IID_IConnectionPointContainer, (void**)&cpc);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2013-08-02 07:44:43 +02:00
|
|
|
|
|
|
|
hr = IConnectionPointContainer_EnumConnectionPoints(cpc, &enum_points);
|
2022-02-21 08:08:09 +01:00
|
|
|
todo_wine
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2013-08-02 07:44:43 +02:00
|
|
|
if (hr == S_OK) {
|
|
|
|
hr = IEnumConnectionPoints_Next(enum_points, 1, &cp, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2013-08-02 07:44:43 +02:00
|
|
|
hr = IConnectionPoint_GetConnectionInterface(cp, &iid);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2014-01-25 15:24:41 +01:00
|
|
|
ok(IsEqualIID(&iid, &IID_IRowPositionChange), "got %s\n", wine_dbgstr_guid(&iid));
|
2013-08-02 07:44:43 +02:00
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
|
|
|
|
hr = IEnumConnectionPoints_Next(enum_points, 1, &cp, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_FALSE, "got 0x%08lx\n", hr);
|
2013-08-02 07:44:43 +02:00
|
|
|
|
|
|
|
IEnumConnectionPoints_Release(enum_points);
|
|
|
|
}
|
|
|
|
IConnectionPointContainer_Release(cpc);
|
2013-08-01 05:48:13 +02:00
|
|
|
IRowPosition_Release(rowpos);
|
|
|
|
}
|
|
|
|
|
2013-08-22 12:44:17 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
IRowset IRowset_iface;
|
|
|
|
IChapteredRowset IChapteredRowset_iface;
|
|
|
|
} test_rset_t;
|
|
|
|
|
|
|
|
static test_rset_t test_rset;
|
|
|
|
|
|
|
|
static HRESULT WINAPI rset_QI(IRowset *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IRowset))
|
|
|
|
{
|
|
|
|
*obj = &test_rset.IRowset_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(riid, &IID_IChapteredRowset))
|
|
|
|
{
|
|
|
|
*obj = &test_rset.IChapteredRowset_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-01-25 15:24:41 +01:00
|
|
|
ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
|
2013-08-22 12:44:17 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI rset_AddRef(IRowset *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI rset_Release(IRowset *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI rset_AddRefRows(IRowset *iface, DBCOUNTITEM cRows,
|
|
|
|
const HROW rghRows[], DBREFCOUNT rgRefCounts[], DBROWSTATUS rgRowStatus[])
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
trace("AddRefRows: %Id\n", rghRows[0]);
|
2013-08-26 06:47:28 +02:00
|
|
|
return S_OK;
|
2013-08-22 12:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI rset_GetData(IRowset *iface, HROW hRow, HACCESSOR hAccessor, void *pData)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI rset_GetNextRows(IRowset *iface, HCHAPTER hReserved, DBROWOFFSET lRowsOffset,
|
|
|
|
DBROWCOUNT cRows, DBCOUNTITEM *pcRowObtained, HROW **prghRows)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI rset_ReleaseRows(IRowset *iface, DBCOUNTITEM cRows, const HROW rghRows[], DBROWOPTIONS rgRowOptions[],
|
|
|
|
DBREFCOUNT rgRefCounts[], DBROWSTATUS rgRowStatus[])
|
|
|
|
{
|
2013-08-26 06:47:28 +02:00
|
|
|
return S_OK;
|
2013-08-22 12:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI rset_RestartPosition(IRowset *iface, HCHAPTER hReserved)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IRowsetVtbl rset_vtbl = {
|
|
|
|
rset_QI,
|
|
|
|
rset_AddRef,
|
|
|
|
rset_Release,
|
|
|
|
rset_AddRefRows,
|
|
|
|
rset_GetData,
|
|
|
|
rset_GetNextRows,
|
|
|
|
rset_ReleaseRows,
|
|
|
|
rset_RestartPosition
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI chrset_QI(IChapteredRowset *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
return IRowset_QueryInterface(&test_rset.IRowset_iface, riid, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI chrset_AddRef(IChapteredRowset *iface)
|
|
|
|
{
|
|
|
|
return IRowset_AddRef(&test_rset.IRowset_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI chrset_Release(IChapteredRowset *iface)
|
|
|
|
{
|
|
|
|
return IRowset_Release(&test_rset.IRowset_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI chrset_AddRefChapter(IChapteredRowset *iface, HCHAPTER chapter, DBREFCOUNT *refcount)
|
|
|
|
{
|
2013-08-26 06:47:28 +02:00
|
|
|
return S_OK;
|
2013-08-22 12:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI chrset_ReleaseChapter(IChapteredRowset *iface, HCHAPTER chapter, DBREFCOUNT *refcount)
|
|
|
|
{
|
2013-08-26 06:47:28 +02:00
|
|
|
return S_OK;
|
2013-08-22 12:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IChapteredRowsetVtbl chrset_vtbl = {
|
|
|
|
chrset_QI,
|
|
|
|
chrset_AddRef,
|
|
|
|
chrset_Release,
|
|
|
|
chrset_AddRefChapter,
|
|
|
|
chrset_ReleaseChapter
|
|
|
|
};
|
|
|
|
|
|
|
|
static void init_test_rset(void)
|
|
|
|
{
|
|
|
|
test_rset.IRowset_iface.lpVtbl = &rset_vtbl;
|
|
|
|
test_rset.IChapteredRowset_iface.lpVtbl = &chrset_vtbl;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_rowpos_initialize(void)
|
|
|
|
{
|
|
|
|
IRowPosition *rowpos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_OLEDB_ROWPOSITIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IRowPosition, (void**)&rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-22 12:44:17 +02:00
|
|
|
|
|
|
|
init_test_rset();
|
|
|
|
hr = IRowPosition_Initialize(rowpos, (IUnknown*)&test_rset.IRowset_iface);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-22 12:44:17 +02:00
|
|
|
|
|
|
|
IRowPosition_Release(rowpos);
|
|
|
|
}
|
|
|
|
|
2013-08-23 08:33:09 +02:00
|
|
|
static HRESULT WINAPI onchange_QI(IRowPositionChange *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IRowPositionChange))
|
|
|
|
{
|
|
|
|
*obj = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI onchange_AddRef(IRowPositionChange *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI onchange_Release(IRowPositionChange *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI onchange_OnRowPositionChange(IRowPositionChange *iface, DBREASON reason,
|
|
|
|
DBEVENTPHASE phase, BOOL cant_deny)
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
trace("%ld %ld %d\n", reason, phase, cant_deny);
|
2013-08-23 08:33:09 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IRowPositionChangeVtbl onchange_vtbl = {
|
|
|
|
onchange_QI,
|
|
|
|
onchange_AddRef,
|
|
|
|
onchange_Release,
|
|
|
|
onchange_OnRowPositionChange
|
|
|
|
};
|
|
|
|
|
|
|
|
static IRowPositionChange onchangesink = { &onchange_vtbl };
|
|
|
|
|
|
|
|
static void init_onchange_sink(IRowPosition *rowpos)
|
|
|
|
{
|
|
|
|
IConnectionPointContainer *cpc;
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
DWORD cookie;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = IRowPosition_QueryInterface(rowpos, &IID_IConnectionPointContainer, (void**)&cpc);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
hr = IConnectionPointContainer_FindConnectionPoint(cpc, &IID_IRowPositionChange, &cp);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
hr = IConnectionPoint_Advise(cp, (IUnknown*)&onchangesink, &cookie);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
IConnectionPointContainer_Release(cpc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_rowpos_clearrowposition(void)
|
|
|
|
{
|
2013-08-23 08:33:59 +02:00
|
|
|
DBPOSITIONFLAGS flags;
|
2013-08-23 08:33:09 +02:00
|
|
|
IRowPosition *rowpos;
|
2013-08-23 08:33:59 +02:00
|
|
|
HCHAPTER chapter;
|
2013-08-23 08:33:35 +02:00
|
|
|
IUnknown *unk;
|
2013-08-23 08:33:09 +02:00
|
|
|
HRESULT hr;
|
2013-08-23 08:33:59 +02:00
|
|
|
HROW row;
|
2013-08-23 08:33:09 +02:00
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_OLEDB_ROWPOSITIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IRowPosition, (void**)&rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
|
|
|
|
hr = IRowPosition_ClearRowPosition(rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_UNEXPECTED, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
|
2013-08-23 08:33:35 +02:00
|
|
|
hr = IRowPosition_GetRowset(rowpos, &IID_IStream, &unk);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_UNEXPECTED, "got %08lx\n", hr);
|
2013-08-23 08:33:35 +02:00
|
|
|
|
2013-08-23 08:33:59 +02:00
|
|
|
chapter = 1;
|
|
|
|
row = 1;
|
|
|
|
flags = DBPOSITION_OK;
|
|
|
|
hr = IRowPosition_GetRowPosition(rowpos, &chapter, &row, &flags);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_UNEXPECTED, "got %08lx\n", hr);
|
|
|
|
ok(chapter == DB_NULL_HCHAPTER, "got %Id\n", chapter);
|
|
|
|
ok(row == DB_NULL_HROW, "got %Id\n", row);
|
|
|
|
ok(flags == DBPOSITION_NOROW, "got %ld\n", flags);
|
2013-08-23 08:33:59 +02:00
|
|
|
|
2013-08-23 08:33:09 +02:00
|
|
|
init_test_rset();
|
|
|
|
hr = IRowPosition_Initialize(rowpos, (IUnknown*)&test_rset.IRowset_iface);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
|
2013-08-23 08:33:59 +02:00
|
|
|
chapter = 1;
|
|
|
|
row = 1;
|
|
|
|
flags = DBPOSITION_OK;
|
|
|
|
hr = IRowPosition_GetRowPosition(rowpos, &chapter, &row, &flags);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
|
|
|
ok(chapter == DB_NULL_HCHAPTER, "got %Id\n", chapter);
|
|
|
|
ok(row == DB_NULL_HROW, "got %Id\n", row);
|
|
|
|
ok(flags == DBPOSITION_NOROW, "got %ld\n", flags);
|
2013-08-23 08:33:59 +02:00
|
|
|
|
2013-08-23 08:33:35 +02:00
|
|
|
hr = IRowPosition_GetRowset(rowpos, &IID_IRowset, &unk);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:35 +02:00
|
|
|
|
2013-08-23 08:33:09 +02:00
|
|
|
init_onchange_sink(rowpos);
|
|
|
|
hr = IRowPosition_ClearRowPosition(rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-23 08:33:09 +02:00
|
|
|
|
2013-08-23 08:33:59 +02:00
|
|
|
chapter = 1;
|
|
|
|
row = 1;
|
|
|
|
flags = DBPOSITION_OK;
|
|
|
|
hr = IRowPosition_GetRowPosition(rowpos, &chapter, &row, &flags);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
|
|
|
ok(chapter == DB_NULL_HCHAPTER, "got %Id\n", chapter);
|
|
|
|
ok(row == DB_NULL_HROW, "got %Id\n", row);
|
|
|
|
ok(flags == DBPOSITION_NOROW, "got %ld\n", flags);
|
2013-08-23 08:33:59 +02:00
|
|
|
|
2013-08-23 08:33:09 +02:00
|
|
|
IRowPosition_Release(rowpos);
|
|
|
|
}
|
|
|
|
|
2013-08-26 06:47:28 +02:00
|
|
|
static void test_rowpos_setrowposition(void)
|
|
|
|
{
|
|
|
|
IRowPosition *rowpos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_OLEDB_ROWPOSITIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IRowPosition, (void**)&rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-26 06:47:28 +02:00
|
|
|
|
|
|
|
init_test_rset();
|
|
|
|
hr = IRowPosition_Initialize(rowpos, (IUnknown*)&test_rset.IRowset_iface);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-26 06:47:28 +02:00
|
|
|
|
|
|
|
hr = IRowPosition_ClearRowPosition(rowpos);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-26 06:47:28 +02:00
|
|
|
|
|
|
|
init_onchange_sink(rowpos);
|
|
|
|
hr = IRowPosition_SetRowPosition(rowpos, 0x123, 0x456, DBPOSITION_OK);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-08-26 06:47:28 +02:00
|
|
|
|
|
|
|
IRowPosition_Release(rowpos);
|
|
|
|
}
|
|
|
|
|
2013-09-30 06:05:01 +02:00
|
|
|
static void test_dslocator(void)
|
|
|
|
{
|
|
|
|
IDataSourceLocator *dslocator = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DataLinks, NULL, CLSCTX_INPROC_SERVER, &IID_IDataSourceLocator,(void**)&dslocator);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
2017-02-02 00:03:18 +01:00
|
|
|
IDataInitialize *datainit, *datainit2;
|
2017-03-12 07:26:54 +01:00
|
|
|
IRunnableObject *runable;
|
2018-01-03 05:21:53 +01:00
|
|
|
IProvideClassInfo *info;
|
|
|
|
IMarshal *marshal;
|
|
|
|
IRpcOptions *opts;
|
2013-09-30 06:05:01 +02:00
|
|
|
COMPATIBLE_LONG hwnd = 0;
|
|
|
|
|
2015-06-10 00:14:45 +02:00
|
|
|
if (0) /* Crashes under Window 7 */
|
|
|
|
hr = IDataSourceLocator_get_hWnd(dslocator, NULL);
|
2013-09-30 06:05:01 +02:00
|
|
|
|
|
|
|
hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
ok(hwnd == 0, "got %p\n", (HWND)hwnd);
|
|
|
|
|
|
|
|
hwnd = 0xDEADBEEF;
|
|
|
|
hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
ok(hwnd == 0, "got %p\n", (HWND)hwnd);
|
|
|
|
|
|
|
|
hwnd = 0xDEADBEEF;
|
|
|
|
hr = IDataSourceLocator_put_hWnd(dslocator, hwnd);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
|
2015-06-10 00:14:45 +02:00
|
|
|
hwnd = 0;
|
2013-09-30 06:05:01 +02:00
|
|
|
hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
ok(hwnd == 0xDEADBEEF, "got %p\n", (HWND)hwnd);
|
|
|
|
|
|
|
|
hwnd = 0;
|
|
|
|
hr = IDataSourceLocator_put_hWnd(dslocator, hwnd);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
|
|
|
|
hwnd = 0xDEADBEEF;
|
|
|
|
hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2013-09-30 06:05:01 +02:00
|
|
|
ok(hwnd == 0, "got %p\n", (HWND)hwnd);
|
|
|
|
|
2017-02-02 00:03:18 +01:00
|
|
|
hr = IDataSourceLocator_QueryInterface(dslocator, &IID_IDataInitialize, (void **)&datainit);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2017-02-02 00:03:18 +01:00
|
|
|
|
|
|
|
hr = IDataSourceLocator_QueryInterface(dslocator, &IID_IDataInitialize, (void **)&datainit2);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2017-02-02 00:03:18 +01:00
|
|
|
ok(datainit == datainit2, "Got %p, previous %p\n", datainit, datainit2);
|
|
|
|
|
2017-03-12 07:26:54 +01:00
|
|
|
hr = IDataSourceLocator_QueryInterface(dslocator, &IID_IRunnableObject, (void **)&runable);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got %08lx\n", hr);
|
2017-03-12 07:26:54 +01:00
|
|
|
|
2018-01-03 05:21:53 +01:00
|
|
|
hr = IDataSourceLocator_QueryInterface(dslocator, &IID_IMarshal, (void **)&marshal);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got %08lx\n", hr);
|
2018-01-03 05:21:53 +01:00
|
|
|
|
|
|
|
hr = IDataSourceLocator_QueryInterface(dslocator, &IID_IProvideClassInfo, (void **)&info);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got %08lx\n", hr);
|
2018-01-03 05:21:53 +01:00
|
|
|
|
|
|
|
hr = IDataSourceLocator_QueryInterface(dslocator, &IID_IRpcOptions, (void **)&opts);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got %08lx\n", hr);
|
2018-01-03 05:21:53 +01:00
|
|
|
|
2019-12-17 02:03:03 +01:00
|
|
|
if (winetest_interactive)
|
|
|
|
{
|
|
|
|
IDispatch *disp = NULL;
|
|
|
|
|
|
|
|
hr = IDataSourceLocator_PromptNew(dslocator, NULL);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == E_INVALIDARG, "got %08lx\n", hr);
|
2019-12-17 02:03:03 +01:00
|
|
|
|
|
|
|
hr = IDataSourceLocator_PromptNew(dslocator, &disp);
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(disp != NULL, "got %08lx\n", hr);
|
2019-12-17 02:03:03 +01:00
|
|
|
IDispatch_Release(disp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_FALSE, "got %08lx\n", hr);
|
|
|
|
ok(!disp, "got %08lx\n", hr);
|
2019-12-17 02:03:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-02 00:03:18 +01:00
|
|
|
IDataInitialize_Release(datainit2);
|
|
|
|
IDataInitialize_Release(datainit);
|
|
|
|
|
2013-09-30 06:05:01 +02:00
|
|
|
IDataSourceLocator_Release(dslocator);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 07:26:36 +01:00
|
|
|
static void test_odbc_provider(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IDBProperties *props;
|
|
|
|
DBPROPIDSET propidset;
|
|
|
|
ULONG infocount;
|
|
|
|
DBPROPINFOSET *propinfoset;
|
|
|
|
WCHAR *desc;
|
|
|
|
DBPROPID properties[14] =
|
|
|
|
{
|
|
|
|
DBPROP_AUTH_PASSWORD, DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, DBPROP_AUTH_USERID,
|
|
|
|
DBPROP_INIT_DATASOURCE, DBPROP_INIT_HWND, DBPROP_INIT_LOCATION,
|
|
|
|
DBPROP_INIT_MODE, DBPROP_INIT_PROMPT, DBPROP_INIT_TIMEOUT,
|
|
|
|
DBPROP_INIT_PROVIDERSTRING, DBPROP_INIT_LCID, DBPROP_INIT_CATALOG,
|
|
|
|
DBPROP_INIT_OLEDBSERVICES, DBPROP_INIT_GENERALTIMEOUT
|
|
|
|
};
|
|
|
|
|
|
|
|
hr = CoCreateInstance( &CLSID_MSDASQL, NULL, CLSCTX_ALL, &IID_IDBProperties, (void **)&props);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "Failed to create object 0x%08lx\n", hr);
|
2020-03-15 07:26:36 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
propidset.rgPropertyIDs = NULL;
|
|
|
|
propidset.cPropertyIDs = 0;
|
|
|
|
propidset.guidPropertySet = DBPROPSET_DBINITALL;
|
|
|
|
|
|
|
|
infocount = 0;
|
|
|
|
hr = IDBProperties_GetPropertyInfo(props, 1, &propidset, &infocount, &propinfoset, &desc);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2020-03-15 07:26:36 +01:00
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
ULONG i;
|
|
|
|
DBPROPIDSET propidlist;
|
|
|
|
ULONG propcnt;
|
|
|
|
DBPROPSET *propset;
|
|
|
|
|
|
|
|
ok(IsEqualGUID(&propinfoset->guidPropertySet, &DBPROPSET_DBINIT), "got %s\n",
|
|
|
|
debugstr_guid(&propinfoset->guidPropertySet));
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(propinfoset->cPropertyInfos == 14, "got %ld\n", propinfoset->cPropertyInfos);
|
2020-03-15 07:26:36 +01:00
|
|
|
|
|
|
|
propidlist.guidPropertySet = DBPROPSET_DBINIT;
|
|
|
|
propidlist.cPropertyIDs = propinfoset->cPropertyInfos;
|
|
|
|
propidlist.rgPropertyIDs = CoTaskMemAlloc(propinfoset->cPropertyInfos * sizeof(DBPROP));
|
|
|
|
|
|
|
|
for (i = 0; i < propinfoset->cPropertyInfos; i++)
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(properties[i] == propinfoset->rgPropertyInfos[i].dwPropertyID, "%ld, got %ld\n", i,
|
2020-03-15 07:26:36 +01:00
|
|
|
propinfoset->rgPropertyInfos[i].dwPropertyID);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(propinfoset->rgPropertyInfos[i].vtType != VT_EMPTY, "%ld, got %d\n", i,
|
2020-03-15 07:26:36 +01:00
|
|
|
propinfoset->rgPropertyInfos[i].vtType);
|
|
|
|
|
|
|
|
propidlist.rgPropertyIDs[i] = propinfoset->rgPropertyInfos[i].dwPropertyID;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < propinfoset->cPropertyInfos; i++)
|
|
|
|
VariantClear(&propinfoset->rgPropertyInfos[i].vValues);
|
|
|
|
|
|
|
|
CoTaskMemFree(propinfoset->rgPropertyInfos);
|
|
|
|
CoTaskMemFree(propinfoset);
|
|
|
|
|
|
|
|
hr = IDBProperties_GetProperties(props, 1, &propidlist, &propcnt, &propset);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
|
|
|
ok(propidlist.cPropertyIDs == 14, "got %ld\n", propinfoset->cPropertyInfos);
|
2020-03-15 07:26:36 +01:00
|
|
|
|
|
|
|
for (i = 0; i < propidlist.cPropertyIDs; i++)
|
|
|
|
{
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(properties[i] == propidlist.rgPropertyIDs[i], "%ld, got %ld\n", i,
|
2020-03-15 07:26:36 +01:00
|
|
|
propidlist.rgPropertyIDs[i]);
|
|
|
|
|
|
|
|
propidlist.rgPropertyIDs[i] = propinfoset->rgPropertyInfos[i].dwPropertyID;
|
|
|
|
}
|
|
|
|
|
|
|
|
CoTaskMemFree(propidlist.rgPropertyIDs);
|
|
|
|
CoTaskMemFree(propset);
|
|
|
|
}
|
|
|
|
|
|
|
|
IDBProperties_Release(props);
|
|
|
|
}
|
|
|
|
|
2020-03-18 06:26:06 +01:00
|
|
|
static void test_odbc_enumerator(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
ISourcesRowset *source;
|
|
|
|
IRowset *rowset;
|
|
|
|
|
|
|
|
hr = CoCreateInstance( &CLSID_MSDASQL_ENUMERATOR, NULL, CLSCTX_ALL, &IID_ISourcesRowset, (void **)&source);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "Failed to create object 0x%08lx\n", hr);
|
2020-03-18 06:26:06 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ISourcesRowset_GetSourcesRowset(source, NULL, &IID_IRowset, 0, 0, (IUnknown**)&rowset);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "Failed to create object 0x%08lx\n", hr);
|
2020-03-18 06:26:06 +01:00
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
IAccessor *accessor;
|
|
|
|
IRowsetInfo *info;
|
|
|
|
|
|
|
|
hr = IRowset_QueryInterface(rowset, &IID_IAccessor, (void **)&accessor);
|
2022-03-02 09:04:40 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2020-03-18 06:26:06 +01:00
|
|
|
if (hr == S_OK)
|
|
|
|
IAccessor_Release(accessor);
|
|
|
|
|
|
|
|
hr = IRowset_QueryInterface(rowset, &IID_IRowsetInfo, (void **)&info);
|
2022-03-02 09:04:40 +01:00
|
|
|
todo_wine ok(hr == S_OK, "got %08lx\n", hr);
|
2020-03-18 06:26:06 +01:00
|
|
|
if (hr == S_OK)
|
|
|
|
IRowsetInfo_Release(info);
|
|
|
|
|
|
|
|
IRowset_Release(rowset);
|
|
|
|
}
|
|
|
|
|
|
|
|
ISourcesRowset_Release(source);
|
|
|
|
}
|
|
|
|
|
2012-09-25 04:43:58 +02:00
|
|
|
START_TEST(database)
|
|
|
|
{
|
|
|
|
OleInitialize(NULL);
|
|
|
|
|
|
|
|
test_database();
|
2013-06-19 00:20:38 +02:00
|
|
|
test_errorinfo();
|
|
|
|
test_initializationstring();
|
2013-09-30 06:05:01 +02:00
|
|
|
test_dslocator();
|
2020-03-15 07:26:36 +01:00
|
|
|
test_odbc_provider();
|
2020-03-18 06:26:06 +01:00
|
|
|
test_odbc_enumerator();
|
2012-09-25 04:43:58 +02:00
|
|
|
|
2013-08-01 05:48:13 +02:00
|
|
|
/* row position */
|
|
|
|
test_rowposition();
|
2013-08-22 12:44:17 +02:00
|
|
|
test_rowpos_initialize();
|
2013-08-23 08:33:09 +02:00
|
|
|
test_rowpos_clearrowposition();
|
2013-08-26 06:47:28 +02:00
|
|
|
test_rowpos_setrowposition();
|
2013-08-01 05:48:13 +02:00
|
|
|
|
2012-09-25 04:43:58 +02:00
|
|
|
OleUninitialize();
|
|
|
|
}
|