From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/sapi/tests/token.c | 8 ++++++++ dlls/sapi/token.c | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index a65669b585a..63f5c651a50 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -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 ); }
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 6993ffdbac1..133d27a2a66 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -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 )
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/sapi/tests/token.c | 10 ++++++++++ dlls/sapi/token.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 63f5c651a50..7778f4e61db 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -33,6 +33,7 @@ static void test_data_key(void) HRESULT hr; HKEY key; LONG res; + WCHAR *value;
hr = CoCreateInstance( &CLSID_SpDataKey, NULL, CLSCTX_INPROC_SERVER, &IID_ISpRegDataKey, (void **)&data_key ); @@ -45,11 +46,20 @@ static void test_data_key(void) hr = ISpRegDataKey_CreateKey( data_key, L"Testing", &sub ); ok( hr == E_HANDLE, "got %08lx\n", hr );
+ hr = ISpRegDataKey_GetStringValue( data_key, L"Voice", &value ); + 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_GetStringValue( data_key, L"Voice", &value ); + ok( hr == SPERR_NOT_FOUND, "got %08lx\n", hr ); + + hr = ISpRegDataKey_GetStringValue( data_key, L"", &value ); + 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); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 133d27a2a66..b5cfc45e5a3 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -117,8 +117,33 @@ static HRESULT WINAPI data_key_SetStringValue( ISpRegDataKey *iface, static HRESULT WINAPI data_key_GetStringValue( ISpRegDataKey *iface, LPCWSTR name, LPWSTR *value ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + struct data_key *This = impl_from_ISpRegDataKey( iface ); + DWORD ret, size; + WCHAR *content; + + TRACE( "%p, %s, %p\n", This, debugstr_w(name), value); + + if (!This->key) + return E_HANDLE; + + size = 0; + ret = RegGetValueW( This->key, NULL, name, RRF_RT_REG_SZ, NULL, NULL, &size ); + if (ret != ERROR_SUCCESS) + return SPERR_NOT_FOUND; + + content = CoTaskMemAlloc(size); + if (!content) + return E_OUTOFMEMORY; + + ret = RegGetValueW( This->key, NULL, name, RRF_RT_REG_SZ, NULL, content, &size ); + if (ret != ERROR_SUCCESS) + { + CoTaskMemFree(content); + return HRESULT_FROM_WIN32(ret); + } + + *value = content; + return S_OK; }
static HRESULT WINAPI data_key_SetDWORD( ISpRegDataKey *iface,
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=124913
Your paranoid android.
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24693. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24693. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24693.