Skip to content

Commit

Permalink
sapi: Return dump object in ISpObjectTokenEnumBuilder Next
Browse files Browse the repository at this point in the history
CW-Bug-Id: #20616
  • Loading branch information
alesliehughes authored and ivyl committed May 11, 2022
1 parent 9120b41 commit 3807be2
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion dlls/sapi/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct token_enum
WCHAR *req, *opt;
ULONG count;
HKEY key;
DWORD index;
};

static struct token_enum *impl_from_ISpObjectTokenEnumBuilder( ISpObjectTokenEnumBuilder *iface )
Expand Down Expand Up @@ -705,6 +706,12 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
ULONG *fetched )
{
struct token_enum *This = impl_from_ISpObjectTokenEnumBuilder( iface );
struct object_token *object;
HRESULT hr;
DWORD retCode;
WCHAR subKeyName[128];
DWORD size_sub = sizeof(subKeyName);
HKEY sub_key;

TRACE( "(%p)->(%lu %p %p)\n", This, num, tokens, fetched );

Expand All @@ -713,7 +720,27 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
FIXME( "semi-stub: Returning an empty enumerator\n" );

if (fetched) *fetched = 0;
return S_FALSE;
*tokens = NULL;

retCode = RegEnumKeyExW(This->key, This->index, subKeyName, &size_sub, NULL, NULL, NULL, NULL);
if (retCode != ERROR_SUCCESS)
return S_FALSE;

This->index++;

if( RegOpenKeyExW( This->key, subKeyName, 0, KEY_READ, &sub_key ) != ERROR_SUCCESS )
return E_FAIL;

hr = token_create( NULL, &IID_ISpObjectToken, (void**)tokens );
if (FAILED(hr))
return hr;

object = impl_from_ISpObjectToken( *tokens );
object->token_key = sub_key;
object->token_id = heap_strdupW( subKeyName );

if (fetched) *fetched = 1;
return hr;
}

static HRESULT WINAPI token_enum_Skip( ISpObjectTokenEnumBuilder *iface,
Expand Down Expand Up @@ -882,6 +909,7 @@ HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj )
This->init = FALSE;
This->count = 0;
This->key = NULL;
This->index = 0;

hr = ISpObjectTokenEnumBuilder_QueryInterface( &This->ISpObjectTokenEnumBuilder_iface, iid, obj );

Expand Down

0 comments on commit 3807be2

Please sign in to comment.