[2/2] oledb32: Implement IDataSourceLocator get/put hWnd (resend)
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Sep 10 04:30:15 CDT 2013
Hi,
Changelog:
oledb32: Implement IDataSourceLocator get/put hWnd
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From 4e4d91036d63a7a0640b59e2878e505eac80e932 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 26 Aug 2013 09:49:44 +1000
Subject: [PATCH] Implement IDataSourceLocator get/put hWnd
To: wine-patches <wine-patches at winehq.org>
---
dlls/oledb32/dslocator.c | 15 ++++++++++----
dlls/oledb32/tests/database.c | 48 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/dlls/oledb32/dslocator.c b/dlls/oledb32/dslocator.c
index dcc2fe3..0adde63 100644
--- a/dlls/oledb32/dslocator.c
+++ b/dlls/oledb32/dslocator.c
@@ -42,6 +42,8 @@ typedef struct DSLocatorImpl
IDataSourceLocator IDataSourceLocator_iface;
LONG ref;
+ LONG hwnd;
+
} DSLocatorImpl;
static inline DSLocatorImpl *impl_from_IDataSourceLocator( IDataSourceLocator *iface )
@@ -139,18 +141,22 @@ static HRESULT WINAPI dslocator_get_hWnd(IDataSourceLocator *iface, LONG *phwndP
{
DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
- FIXME("(%p)->(%p)\n",This, phwndParent);
+ TRACE("(%p)->(%p)\n",This, phwndParent);
- return E_NOTIMPL;
+ *phwndParent = This->hwnd;
+
+ return S_OK;
}
static HRESULT WINAPI dslocator_put_hWnd(IDataSourceLocator *iface, LONG phwndParent)
{
DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
- FIXME("(%p)->(%d)\n",This, phwndParent);
+ TRACE("(%p)->(%d)\n",This, phwndParent);
- return E_NOTIMPL;
+ This->hwnd = phwndParent;
+
+ return S_OK;
}
static HRESULT WINAPI dslocator_PromptNew(IDataSourceLocator *iface, IDispatch **ppADOConnection)
@@ -201,6 +207,7 @@ HRESULT create_dslocator(IUnknown *outer, void **obj)
This->IDataSourceLocator_iface.lpVtbl = &DSLocatorVtbl;
This->ref = 1;
+ This->hwnd = 0;
*obj = &This->IDataSourceLocator_iface;
diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c
index d0eb9ff..541119c 100644
--- a/dlls/oledb32/tests/database.c
+++ b/dlls/oledb32/tests/database.c
@@ -243,6 +243,53 @@ static void test_initializationstring(void)
}
}
+static void test_dslocator(void)
+{
+ IDataSourceLocator *dslocator = NULL;
+ HRESULT hr;
+
+ hr = CoCreateInstance(&CLSID_DataLinks, NULL, CLSCTX_INPROC_SERVER, &IID_IDataSourceLocator,(void**)&dslocator);
+ ok(hr == S_OK, "got %08x\n", hr);
+ if(SUCCEEDED(hr))
+ {
+ LONG hwnd = 0;
+
+ /* Crashes under Window 7
+ hr = IDataSourceLocator_get_hWnd(dslocator, NULL);
+ ok(hr == E_INVALIDARG, "got %08x\n", hr);
+ */
+
+ hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(hwnd == 0, "got %08x\n", hwnd);
+
+ hwnd = 0xDEADBEEF;
+ hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(hwnd == 0, "got %08x\n", hwnd);
+
+ hwnd = 0xDEADBEEF;
+ hr = IDataSourceLocator_put_hWnd(dslocator, hwnd);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hwnd = 0xDEADBEEF;
+ hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(hwnd == 0xDEADBEEF, "got %08x\n", hwnd);
+
+ hwnd = 0;
+ hr = IDataSourceLocator_put_hWnd(dslocator, hwnd);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hwnd = 0xDEADBEEF;
+ hr = IDataSourceLocator_get_hWnd(dslocator, &hwnd);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(hwnd == 0, "got %08x\n", hwnd);
+
+ IDataSourceLocator_Release(dslocator);
+ }
+}
+
static void test_rowposition(void)
{
IEnumConnectionPoints *enum_points;
@@ -554,6 +601,7 @@ START_TEST(database)
test_database();
test_errorinfo();
test_initializationstring();
+ test_dslocator();
/* row position */
test_rowposition();
--
1.8.1.2
More information about the wine-patches
mailing list