Commit 3bba4065 authored by Shaun Ren's avatar Shaun Ren Committed by Alexandre Julliard

sapi: Implement ISpRegDataKey::OpenKey.

parent 51e84c02
......@@ -71,10 +71,17 @@ static void test_data_key(void)
ok( !wcscmp( value, L"Test" ), "got %s\n", wine_dbgstr_w(value) );
CoTaskMemFree( value );
hr = ISpRegDataKey_OpenKey( data_key, L"Testing", &sub );
ok( hr == SPERR_NOT_FOUND, "got %08lx\n", hr );
hr = ISpRegDataKey_CreateKey( data_key, L"Testing", &sub );
ok( hr == S_OK, "got %08lx\n", hr );
ISpDataKey_Release(sub);
hr = ISpRegDataKey_OpenKey( data_key, L"Testing", &sub );
ok( hr == S_OK, "got %08lx\n", hr );
ISpDataKey_Release(sub);
ISpRegDataKey_Release( data_key );
hr = CoCreateInstance( &CLSID_SpDataKey, NULL, CLSCTX_INPROC_SERVER,
......
......@@ -186,8 +186,37 @@ static HRESULT WINAPI data_key_GetDWORD( ISpRegDataKey *iface,
static HRESULT WINAPI data_key_OpenKey( ISpRegDataKey *iface,
LPCWSTR name, ISpDataKey **sub_key )
{
FIXME( "stub\n" );
return E_NOTIMPL;
struct data_key *This = impl_from_ISpRegDataKey( iface );
ISpRegDataKey *spregkey;
HRESULT hr;
HKEY key;
LONG ret;
TRACE( "%p, %s, %p\n", This, debugstr_w(name), sub_key );
ret = RegOpenKeyExW( This->key, name, 0, KEY_ALL_ACCESS, &key );
if (ret != ERROR_SUCCESS)
return SPERR_NOT_FOUND;
hr = data_key_create( NULL, &IID_ISpRegDataKey, (void**)&spregkey );
if (FAILED(hr))
{
RegCloseKey( key );
return hr;
}
hr = ISpRegDataKey_SetKey( spregkey, key, FALSE );
if (FAILED(hr))
{
RegCloseKey( key );
ISpRegDataKey_Release( spregkey );
return hr;
}
hr = ISpRegDataKey_QueryInterface( spregkey, &IID_ISpDataKey, (void**)sub_key );
ISpRegDataKey_Release( spregkey );
return hr;
}
static HRESULT WINAPI data_key_CreateKey( ISpRegDataKey *iface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment