wine-staging/patches/sapi-iteration-tokens/0004-sapi-EnumTokens-setup-enumeration-members.patch

109 lines
3.7 KiB
Diff
Raw Normal View History

From 5326c101e7cd8f0d0197319fd0d7d652d845c20e Mon Sep 17 00:00:00 2001
2021-09-22 01:37:01 -07:00
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 22 Sep 2021 19:01:44 +1000
Subject: [PATCH] sapi: EnumTokens setup enumeration members
2021-09-22 01:37:01 -07:00
---
dlls/sapi/token.c | 48 ++++++++++++++++++++++++++++++-----------------
1 file changed, 31 insertions(+), 17 deletions(-)
2021-09-22 01:37:01 -07:00
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
index 853dc2fd21f..957ef77b41e 100644
2021-09-22 01:37:01 -07:00
--- a/dlls/sapi/token.c
+++ b/dlls/sapi/token.c
@@ -48,6 +48,22 @@ static struct data_key *impl_from_ISpRegDataKey( ISpRegDataKey *iface )
return CONTAINING_RECORD( iface, struct data_key, ISpRegDataKey_iface );
}
+struct token_enum
+{
+ ISpObjectTokenEnumBuilder ISpObjectTokenEnumBuilder_iface;
+ LONG ref;
+
+ BOOL init;
+ WCHAR *req, *opt;
+ ULONG count;
+ HKEY key;
+};
+
+static struct token_enum *impl_from_ISpObjectTokenEnumBuilder( ISpObjectTokenEnumBuilder *iface )
+{
+ return CONTAINING_RECORD( iface, struct token_enum, ISpObjectTokenEnumBuilder_iface );
+}
+
static HRESULT WINAPI data_key_QueryInterface( ISpRegDataKey *iface, REFIID iid, void **obj )
{
struct data_key *This = impl_from_ISpRegDataKey( iface );
@@ -503,9 +519,11 @@ static HRESULT WINAPI token_category_EnumTokens( ISpObjectTokenCategory *iface,
{
struct token_category *This = impl_from_ISpObjectTokenCategory( iface );
ISpObjectTokenEnumBuilder *builder;
+ struct token_enum *tokenenum;
+ struct data_key *this_data_key;
HRESULT hr;
- FIXME( "(%p)->(%s %s %p): semi-stub\n", This, debugstr_w( req ), debugstr_w( opt ), enum_tokens );
+ TRACE( "(%p)->(%s %s %p)\n", This, debugstr_w( req ), debugstr_w( opt ), enum_tokens );
if (!This->data_key) return SPERR_UNINITIALIZED;
@@ -516,7 +534,15 @@ static HRESULT WINAPI token_category_EnumTokens( ISpObjectTokenCategory *iface,
hr = ISpObjectTokenEnumBuilder_SetAttribs( builder, req, opt );
if (FAILED(hr)) goto fail;
- /* FIXME: Build the enumerator */
+ this_data_key = impl_from_ISpRegDataKey( This->data_key );
+
+ tokenenum = impl_from_ISpObjectTokenEnumBuilder( builder );
+
+ if(!RegOpenKeyExW( this_data_key->key, L"Tokens", 0, KEY_ALL_ACCESS, &tokenenum->key ))
+ {
+ RegQueryInfoKeyW(tokenenum->key, NULL, NULL, NULL, &tokenenum->count, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ }
hr = ISpObjectTokenEnumBuilder_QueryInterface( builder, &IID_IEnumSpObjectTokens,
(void **)enum_tokens );
@@ -611,21 +637,6 @@ HRESULT token_category_create( IUnknown *outer, REFIID iid, void **obj )
return hr;
}
-struct token_enum
-{
- ISpObjectTokenEnumBuilder ISpObjectTokenEnumBuilder_iface;
- LONG ref;
-
- BOOL init;
- WCHAR *req, *opt;
- ULONG count;
-};
-
-static struct token_enum *impl_from_ISpObjectTokenEnumBuilder( ISpObjectTokenEnumBuilder *iface )
-{
- return CONTAINING_RECORD( iface, struct token_enum, ISpObjectTokenEnumBuilder_iface );
-}
-
static HRESULT WINAPI token_enum_QueryInterface( ISpObjectTokenEnumBuilder *iface,
REFIID iid, void **obj )
{
@@ -665,6 +676,8 @@ static ULONG WINAPI token_enum_Release( ISpObjectTokenEnumBuilder *iface )
if (!ref)
{
+ if (This->key)
+ RegCloseKey(This->key);
heap_free( This->req );
heap_free( This->opt );
heap_free( This );
@@ -817,6 +830,7 @@ HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj )
This->opt = NULL;
This->init = FALSE;
This->count = 0;
+ This->key = NULL;
hr = ISpObjectTokenEnumBuilder_QueryInterface( &This->ISpObjectTokenEnumBuilder_iface, iid, obj );
2021-09-22 01:37:01 -07:00
--
2.35.1
2021-09-22 01:37:01 -07:00