Module: wine Branch: master Commit: 8d3af5690493a515f60adfbb77b6232baf7faaa5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8d3af5690493a515f60adfbb77...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Feb 13 16:57:12 2017 +0300
pstorec: Fix QueryInterface() of IPStore.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
configure | 1 + configure.ac | 1 + dlls/pstorec/pstorec.c | 7 ++-- dlls/pstorec/tests/Makefile.in | 4 +++ dlls/pstorec/tests/pstorec.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 3 deletions(-)
diff --git a/configure b/configure index b2abca4..35273b0 100755 --- a/configure +++ b/configure @@ -18249,6 +18249,7 @@ wine_fn_config_test dlls/propsys/tests propsys_test wine_fn_config_dll psapi enable_psapi implib wine_fn_config_test dlls/psapi/tests psapi_test wine_fn_config_dll pstorec enable_pstorec clean +wine_fn_config_test dlls/pstorec/tests pstorec_test wine_fn_config_dll qcap enable_qcap wine_fn_config_test dlls/qcap/tests qcap_test wine_fn_config_dll qedit enable_qedit clean diff --git a/configure.ac b/configure.ac index 8bffab9..367851d 100644 --- a/configure.ac +++ b/configure.ac @@ -3306,6 +3306,7 @@ WINE_CONFIG_TEST(dlls/propsys/tests) WINE_CONFIG_DLL(psapi,,[implib]) WINE_CONFIG_TEST(dlls/psapi/tests) WINE_CONFIG_DLL(pstorec,,[clean]) +WINE_CONFIG_TEST(dlls/pstorec/tests) WINE_CONFIG_DLL(qcap) WINE_CONFIG_TEST(dlls/qcap/tests) WINE_CONFIG_DLL(qedit,,[clean]) diff --git a/dlls/pstorec/pstorec.c b/dlls/pstorec/pstorec.c index 593629b..02cd803 100644 --- a/dlls/pstorec/pstorec.c +++ b/dlls/pstorec/pstorec.c @@ -24,6 +24,7 @@ #include "windef.h" #include "winbase.h" #include "winuser.h" +#include "initguid.h" #include "ole2.h" #include "pstore.h"
@@ -67,13 +68,13 @@ static HRESULT WINAPI PStore_fnQueryInterface( { PStore_impl *This = impl_from_IPStore(iface);
- TRACE("%p %s\n",This,debugstr_guid(riid)); + TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObj);
*ppvObj = NULL;
- if (IsEqualIID(riid, &IID_IUnknown)) + if (IsEqualIID(riid, &IID_IPStore) || IsEqualIID(riid, &IID_IUnknown)) { - *ppvObj = This; + *ppvObj = &This->IPStore_iface; }
if (*ppvObj) diff --git a/dlls/pstorec/tests/Makefile.in b/dlls/pstorec/tests/Makefile.in new file mode 100644 index 0000000..2287f0f --- /dev/null +++ b/dlls/pstorec/tests/Makefile.in @@ -0,0 +1,4 @@ +TESTDLL = pstorec.dll + +C_SRCS = \ + pstorec.c diff --git a/dlls/pstorec/tests/pstorec.c b/dlls/pstorec/tests/pstorec.c new file mode 100644 index 0000000..bc30b19 --- /dev/null +++ b/dlls/pstorec/tests/pstorec.c @@ -0,0 +1,72 @@ +/* + * Protected Storage Tests + * + * Copyright 2017 Nikolay Sivov + * + * 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> + +#define COBJMACROS +#include "windef.h" +#include "initguid.h" +#include "ole2.h" +#include "pstore.h" + +#include "wine/test.h" + +static HRESULT (WINAPI *pPStoreCreateInstance)(IPStore **store, PST_PROVIDERID *id, void *reserved, DWORD flags); + +static void test_PStoreCreateInstance(void) +{ + IPStore *store; + IUnknown *unk; + HRESULT hr; + + if (!pPStoreCreateInstance) + { + win_skip("PStoreCreateInstance is not available\n"); + return; + } + + hr = pPStoreCreateInstance(&store, NULL, NULL, 0); + if (hr == E_NOTIMPL) + { + /* this function does not work starting with Win8 */ + win_skip("PStoreCreateInstance is not implemented on this system\n"); + return; + } + ok(hr == S_OK, "Unexpected return value %#x.\n", hr); + + hr = IPStore_QueryInterface(store, &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Unexpected return value %#x.\n", hr); + IUnknown_Release(unk); + + hr = IPStore_QueryInterface(store, &IID_IPStore, (void **)&unk); + ok(hr == S_OK, "Unexpected return value %#x.\n", hr); + IUnknown_Release(unk); + + IPStore_Release(store); +} + +START_TEST(pstorec) +{ + HMODULE module = LoadLibraryA("pstorec"); + + pPStoreCreateInstance = (void *)GetProcAddress(module, "PStoreCreateInstance"); + + test_PStoreCreateInstance(); +}