sapi: Implement SpDataKey::SetKey().
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c82d274293
commit
41144614c7
|
@ -18667,6 +18667,7 @@ wine_fn_config_dll rtutils enable_rtutils implib
|
|||
wine_fn_config_dll samlib enable_samlib
|
||||
wine_fn_config_dll sane.ds enable_sane_ds clean
|
||||
wine_fn_config_dll sapi enable_sapi clean
|
||||
wine_fn_config_test dlls/sapi/tests sapi_test
|
||||
wine_fn_config_dll scarddlg enable_scarddlg
|
||||
wine_fn_config_dll sccbase enable_sccbase
|
||||
wine_fn_config_dll schannel enable_schannel
|
||||
|
|
|
@ -3448,6 +3448,7 @@ WINE_CONFIG_DLL(rtutils,,[implib])
|
|||
WINE_CONFIG_DLL(samlib)
|
||||
WINE_CONFIG_DLL(sane.ds,,[clean])
|
||||
WINE_CONFIG_DLL(sapi,,[clean])
|
||||
WINE_CONFIG_TEST(dlls/sapi/tests)
|
||||
WINE_CONFIG_DLL(scarddlg)
|
||||
WINE_CONFIG_DLL(sccbase)
|
||||
WINE_CONFIG_DLL(schannel)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
TESTDLL = sapi.dll
|
||||
IMPORTS = ole32 user32 advapi32
|
||||
|
||||
C_SRCS = \
|
||||
token.c
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Speech API (SAPI) token tests.
|
||||
*
|
||||
* Copyright (C) 2017 Huw Davies
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "initguid.h"
|
||||
#include "sapiddk.h"
|
||||
#include "sperror.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static void test_data_key(void)
|
||||
{
|
||||
ISpRegDataKey *data_key;
|
||||
HRESULT hr;
|
||||
HKEY key;
|
||||
LONG res;
|
||||
|
||||
hr = CoCreateInstance( &CLSID_SpDataKey, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ISpRegDataKey, (void **)&data_key );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
res = RegCreateKeyExA( HKEY_CURRENT_USER, "Software\\Winetest\\sapi", 0, NULL, 0, KEY_ALL_ACCESS,
|
||||
NULL, &key, NULL );
|
||||
ok( res == ERROR_SUCCESS, "got %d\n", res );
|
||||
|
||||
hr = ISpRegDataKey_SetKey( data_key, key, FALSE );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
hr = ISpRegDataKey_SetKey( data_key, key, FALSE );
|
||||
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
|
||||
|
||||
ISpRegDataKey_Release( data_key );
|
||||
}
|
||||
|
||||
START_TEST(token)
|
||||
{
|
||||
CoInitialize( NULL );
|
||||
test_data_key();
|
||||
CoUninitialize();
|
||||
}
|
|
@ -39,6 +39,9 @@ struct data_key
|
|||
{
|
||||
ISpRegDataKey ISpRegDataKey_iface;
|
||||
LONG ref;
|
||||
|
||||
HKEY key;
|
||||
BOOL read_only;
|
||||
};
|
||||
|
||||
struct data_key *impl_from_ISpRegDataKey( ISpRegDataKey *iface )
|
||||
|
@ -84,6 +87,7 @@ static ULONG WINAPI data_key_Release( ISpRegDataKey *iface )
|
|||
|
||||
if (!ref)
|
||||
{
|
||||
if (This->key) RegCloseKey( This->key );
|
||||
heap_free( This );
|
||||
}
|
||||
|
||||
|
@ -175,8 +179,15 @@ static HRESULT WINAPI data_key_EnumValues( ISpRegDataKey *iface,
|
|||
static HRESULT WINAPI data_key_SetKey( ISpRegDataKey *iface,
|
||||
HKEY key, BOOL read_only )
|
||||
{
|
||||
FIXME( "stub\n" );
|
||||
return E_NOTIMPL;
|
||||
struct data_key *This = impl_from_ISpRegDataKey( iface );
|
||||
|
||||
TRACE( "(%p)->(%p %d)\n", This, key, read_only );
|
||||
|
||||
if (This->key) return SPERR_ALREADY_INITIALIZED;
|
||||
|
||||
This->key = key;
|
||||
This->read_only = read_only;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
const struct ISpRegDataKeyVtbl data_key_vtbl =
|
||||
|
@ -207,6 +218,8 @@ HRESULT data_key_create( IUnknown *outer, REFIID iid, void **obj )
|
|||
if (!This) return E_OUTOFMEMORY;
|
||||
This->ISpRegDataKey_iface.lpVtbl = &data_key_vtbl;
|
||||
This->ref = 1;
|
||||
This->key = NULL;
|
||||
This->read_only = FALSE;
|
||||
|
||||
hr = ISpRegDataKey_QueryInterface( &This->ISpRegDataKey_iface, iid, obj );
|
||||
|
||||
|
|
Loading…
Reference in New Issue