msdasql: Add IPersist interface support.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
00b0c57798
commit
097bde4691
|
@ -176,6 +176,7 @@ struct msdasql
|
||||||
IDBProperties IDBProperties_iface;
|
IDBProperties IDBProperties_iface;
|
||||||
IDBInitialize IDBInitialize_iface;
|
IDBInitialize IDBInitialize_iface;
|
||||||
IDBCreateSession IDBCreateSession_iface;
|
IDBCreateSession IDBCreateSession_iface;
|
||||||
|
IPersist IPersist_iface;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
};
|
};
|
||||||
|
@ -200,6 +201,11 @@ static inline struct msdasql *impl_from_IDBCreateSession(IDBCreateSession *iface
|
||||||
return CONTAINING_RECORD(iface, struct msdasql, IDBCreateSession_iface);
|
return CONTAINING_RECORD(iface, struct msdasql, IDBCreateSession_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct msdasql *impl_from_IPersist( IPersist *iface )
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD( iface, struct msdasql, IPersist_iface );
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI msdsql_QueryInterface(IUnknown *iface, REFIID riid, void **out)
|
static HRESULT WINAPI msdsql_QueryInterface(IUnknown *iface, REFIID riid, void **out)
|
||||||
{
|
{
|
||||||
struct msdasql *provider = impl_from_IUnknown(iface);
|
struct msdasql *provider = impl_from_IUnknown(iface);
|
||||||
|
@ -223,6 +229,10 @@ static HRESULT WINAPI msdsql_QueryInterface(IUnknown *iface, REFIID riid, void *
|
||||||
{
|
{
|
||||||
*out = &provider->IDBCreateSession_iface;
|
*out = &provider->IDBCreateSession_iface;
|
||||||
}
|
}
|
||||||
|
else if(IsEqualGUID(&IID_IPersist, riid))
|
||||||
|
{
|
||||||
|
*out = &provider->IPersist_iface;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("(%s, %p)\n", debugstr_guid(riid), out);
|
FIXME("(%s, %p)\n", debugstr_guid(riid), out);
|
||||||
|
@ -455,6 +465,45 @@ static const struct IDBCreateSessionVtbl dbsess_vtbl =
|
||||||
dbsess_CreateSession
|
dbsess_CreateSession
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static HRESULT WINAPI persist_QueryInterface(IPersist *iface, REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
struct msdasql *provider = impl_from_IPersist( iface );
|
||||||
|
return IUnknown_QueryInterface(&provider->MSDASQL_iface, riid, ppv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI persist_AddRef(IPersist *iface)
|
||||||
|
{
|
||||||
|
struct msdasql *provider = impl_from_IPersist( iface );
|
||||||
|
return IUnknown_AddRef(&provider->MSDASQL_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI persist_Release(IPersist *iface)
|
||||||
|
{
|
||||||
|
struct msdasql *provider = impl_from_IPersist( iface );
|
||||||
|
return IUnknown_Release(&provider->MSDASQL_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI persist_GetClassID(IPersist *iface, CLSID *classid)
|
||||||
|
{
|
||||||
|
struct msdasql *provider = impl_from_IPersist( iface );
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p)\n", provider, classid);
|
||||||
|
|
||||||
|
if(!classid)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
*classid = CLSID_MSDASQL;
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IPersistVtbl persistVtbl = {
|
||||||
|
persist_QueryInterface,
|
||||||
|
persist_AddRef,
|
||||||
|
persist_Release,
|
||||||
|
persist_GetClassID
|
||||||
|
};
|
||||||
|
|
||||||
static HRESULT create_msdasql_provider(REFIID riid, void **ppv)
|
static HRESULT create_msdasql_provider(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
struct msdasql *provider;
|
struct msdasql *provider;
|
||||||
|
@ -468,6 +517,7 @@ static HRESULT create_msdasql_provider(REFIID riid, void **ppv)
|
||||||
provider->IDBProperties_iface.lpVtbl = &dbprops_vtbl;
|
provider->IDBProperties_iface.lpVtbl = &dbprops_vtbl;
|
||||||
provider->IDBInitialize_iface.lpVtbl = &dbinit_vtbl;
|
provider->IDBInitialize_iface.lpVtbl = &dbinit_vtbl;
|
||||||
provider->IDBCreateSession_iface.lpVtbl = &dbsess_vtbl;
|
provider->IDBCreateSession_iface.lpVtbl = &dbsess_vtbl;
|
||||||
|
provider->IPersist_iface.lpVtbl = &persistVtbl;
|
||||||
provider->ref = 1;
|
provider->ref = 1;
|
||||||
|
|
||||||
hr = IUnknown_QueryInterface(&provider->MSDASQL_iface, riid, ppv);
|
hr = IUnknown_QueryInterface(&provider->MSDASQL_iface, riid, ppv);
|
||||||
|
|
|
@ -38,6 +38,32 @@ static char mdbpath[MAX_PATH];
|
||||||
|
|
||||||
static const VARTYPE intptr_vartype = (sizeof(void *) == 8 ? VT_I8 : VT_I4);
|
static const VARTYPE intptr_vartype = (sizeof(void *) == 8 ? VT_I8 : VT_I4);
|
||||||
|
|
||||||
|
static void test_msdasql(void)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
IUnknown *unk;
|
||||||
|
IPersist *persist;
|
||||||
|
CLSID classid;
|
||||||
|
|
||||||
|
hr = CoCreateInstance( &CLSID_MSDASQL, NULL, CLSCTX_ALL, &IID_IUnknown, (void **)&unk);
|
||||||
|
ok(hr == S_OK, "Failed to create object 0x%08x\n", hr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IUnknown_QueryInterface(unk, &IID_IPersist, (void**)&persist);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IPersist_GetClassID(persist, &classid);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(IsEqualGUID(&classid, &CLSID_MSDASQL), "got %s\n", debugstr_guid(&classid));
|
||||||
|
|
||||||
|
IPersist_Release(persist);
|
||||||
|
|
||||||
|
IUnknown_Release(unk);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_Properties(void)
|
static void test_Properties(void)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -275,6 +301,7 @@ START_TEST(provider)
|
||||||
|
|
||||||
setup_database();
|
setup_database();
|
||||||
|
|
||||||
|
test_msdasql();
|
||||||
test_Properties();
|
test_Properties();
|
||||||
test_sessions();
|
test_sessions();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue