mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
107 lines
3.2 KiB
Diff
107 lines
3.2 KiB
Diff
From 8e0713bfe03d37f19c2645a67b05024a86df0af8 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] sapi: Implement ISpObjectTokenEnumBuilder Item
|
|
|
|
---
|
|
dlls/sapi/token.c | 69 ++++++++++++++++++++++++++++++++++++-----------
|
|
1 file changed, 53 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
|
|
index c16572ff1f2..eb6d746cb04 100644
|
|
--- a/dlls/sapi/token.c
|
|
+++ b/dlls/sapi/token.c
|
|
@@ -64,6 +64,20 @@ static struct token_enum *impl_from_ISpObjectTokenEnumBuilder( ISpObjectTokenEnu
|
|
return CONTAINING_RECORD( iface, struct token_enum, ISpObjectTokenEnumBuilder_iface );
|
|
}
|
|
|
|
+struct object_token
|
|
+{
|
|
+ ISpObjectToken ISpObjectToken_iface;
|
|
+ LONG ref;
|
|
+
|
|
+ HKEY token_key;
|
|
+ WCHAR *token_id;
|
|
+};
|
|
+
|
|
+static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
|
|
+{
|
|
+ return CONTAINING_RECORD( iface, struct object_token, ISpObjectToken_iface );
|
|
+}
|
|
+
|
|
static HRESULT WINAPI data_key_QueryInterface( ISpRegDataKey *iface, REFIID iid, void **obj )
|
|
{
|
|
struct data_key *This = impl_from_ISpRegDataKey( iface );
|
|
@@ -725,8 +739,45 @@ static HRESULT WINAPI token_enum_Clone( ISpObjectTokenEnumBuilder *iface,
|
|
static HRESULT WINAPI token_enum_Item( ISpObjectTokenEnumBuilder *iface,
|
|
ULONG index, ISpObjectToken **token )
|
|
{
|
|
- FIXME( "stub\n" );
|
|
- return E_NOTIMPL;
|
|
+ struct token_enum *This = impl_from_ISpObjectTokenEnumBuilder( iface );
|
|
+ struct object_token *object;
|
|
+ ISpObjectToken *subtoken;
|
|
+ HRESULT hr;
|
|
+ WCHAR *subkey;
|
|
+ DWORD size;
|
|
+ LONG ret;
|
|
+ HKEY key;
|
|
+
|
|
+ TRACE( "%p, %d, %p\n", This, index, token );
|
|
+
|
|
+ if (!This->init)
|
|
+ return SPERR_UNINITIALIZED;
|
|
+
|
|
+ RegQueryInfoKeyW(This->key, NULL, NULL, NULL, NULL, &size, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
+ size = (size+1) * sizeof(WCHAR);
|
|
+ subkey = heap_alloc(size);
|
|
+ if (!subkey)
|
|
+ return E_OUTOFMEMORY;
|
|
+
|
|
+ ret = RegEnumKeyExW(This->key, index, subkey, &size, NULL, NULL, NULL, NULL);
|
|
+ if (ret != ERROR_SUCCESS)
|
|
+ return HRESULT_FROM_WIN32(ret);
|
|
+
|
|
+ ret = RegOpenKeyExW (This->key, subkey, 0, KEY_READ, &key);
|
|
+ if (ret != ERROR_SUCCESS)
|
|
+ return HRESULT_FROM_WIN32(ret);
|
|
+ heap_free(subkey);
|
|
+
|
|
+ hr = token_create( NULL, &IID_ISpObjectToken, (void**)&subtoken );
|
|
+ if (FAILED(hr))
|
|
+ return hr;
|
|
+
|
|
+ object = impl_from_ISpObjectToken( subtoken );
|
|
+ object->token_key = key;
|
|
+
|
|
+ *token = subtoken;
|
|
+
|
|
+ return hr;
|
|
}
|
|
|
|
static HRESULT WINAPI token_enum_GetCount( ISpObjectTokenEnumBuilder *iface,
|
|
@@ -838,20 +889,6 @@ HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj )
|
|
return hr;
|
|
}
|
|
|
|
-struct object_token
|
|
-{
|
|
- ISpObjectToken ISpObjectToken_iface;
|
|
- LONG ref;
|
|
-
|
|
- HKEY token_key;
|
|
- WCHAR *token_id;
|
|
-};
|
|
-
|
|
-static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
|
|
-{
|
|
- return CONTAINING_RECORD( iface, struct object_token, ISpObjectToken_iface );
|
|
-}
|
|
-
|
|
static HRESULT WINAPI token_QueryInterface( ISpObjectToken *iface,
|
|
REFIID iid, void **obj )
|
|
{
|
|
--
|
|
2.35.1
|
|
|