pstorec: Fix QueryInterface() of IPStore.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-02-13 16:57:12 +03:00 committed by Alexandre Julliard
parent be908f2f26
commit 8d3af56904
5 changed files with 82 additions and 3 deletions

1
configure vendored
View File

@ -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

View File

@ -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])

View File

@ -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)

View File

@ -0,0 +1,4 @@
TESTDLL = pstorec.dll
C_SRCS = \
pstorec.c

View File

@ -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();
}