wine-staging/patches/sapi-iteration-tokens/0001-sapi-Implement-ISpRegDataKey-CreateKey.patch
2021-09-22 19:02:18 +10:00

50 lines
1.6 KiB
Diff

From 940ec28d5ed0e8d93d844be1a6148a4e63863907 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 22 Sep 2021 19:01:44 +1000
Subject: [PATCH 1/8] sapi: Implement ISpRegDataKey CreateKey
---
dlls/sapi/token.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
index ba91a425e9e..ffdf62008f5 100644
--- a/dlls/sapi/token.c
+++ b/dlls/sapi/token.c
@@ -145,8 +145,30 @@ 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 );
+
+ if (!This->key) return E_INVALIDARG; /* FIXME */
+
+ 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 (hr == S_OK)
+ {
+ hr = ISpRegDataKey_SetKey(spregkey, key, FALSE);
+ if (hr == S_OK)
+ hr = ISpRegDataKey_QueryInterface(spregkey, &IID_ISpDataKey, (void**)sub_key);
+ ISpRegDataKey_Release(spregkey);
+ }
+
+ return hr;
}
static HRESULT WINAPI data_key_DeleteKey( ISpRegDataKey *iface, LPCWSTR name )
--
2.33.0