Commit 3f0ee3ea authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

sapi: Implement ISpRegDataKey CreateKey.

parent 7cd6a6d9
......@@ -29,6 +29,7 @@
static void test_data_key(void)
{
ISpRegDataKey *data_key;
ISpDataKey *sub;
HRESULT hr;
HKEY key;
LONG res;
......@@ -41,11 +42,18 @@ static void test_data_key(void)
NULL, &key, NULL );
ok( res == ERROR_SUCCESS, "got %ld\n", res );
hr = ISpRegDataKey_CreateKey( data_key, L"Testing", &sub );
ok( hr == E_HANDLE, "got %08lx\n", hr );
hr = ISpRegDataKey_SetKey( data_key, key, FALSE );
ok( hr == S_OK, "got %08lx\n", hr );
hr = ISpRegDataKey_SetKey( data_key, key, FALSE );
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08lx\n", hr );
hr = ISpRegDataKey_CreateKey( data_key, L"Testing", &sub );
ok( hr == S_OK, "got %08lx\n", hr );
ISpDataKey_Release(sub);
ISpRegDataKey_Release( data_key );
}
......
......@@ -145,8 +145,28 @@ static HRESULT WINAPI data_key_OpenKey( ISpRegDataKey *iface,
static HRESULT WINAPI data_key_CreateKey( 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 res;
TRACE( "%p, %s, %p\n", This, debugstr_w(name), sub_key );
res = RegCreateKeyExW( This->key, name, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL );
if (res != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(res);
hr = data_key_create(NULL, &IID_ISpRegDataKey, (void**)&spregkey);
if (SUCCEEDED(hr))
{
hr = ISpRegDataKey_SetKey(spregkey, key, FALSE);
if (SUCCEEDED(hr))
hr = ISpRegDataKey_QueryInterface(spregkey, &IID_ISpDataKey, (void**)sub_key);
ISpRegDataKey_Release(spregkey);
}
return hr;
}
static HRESULT WINAPI data_key_DeleteKey( ISpRegDataKey *iface, LPCWSTR name )
......
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