Commit ca3ffa65 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

sapi: Implement ISpObjectTokenEnumBuilder Item.

parent ff1c9633
......@@ -48,6 +48,20 @@ static struct data_key *impl_from_ISpRegDataKey( ISpRegDataKey *iface )
return CONTAINING_RECORD( iface, struct data_key, ISpRegDataKey_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 );
......@@ -724,8 +738,51 @@ 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, %lu, %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)
{
heap_free(subkey);
return HRESULT_FROM_WIN32(ret);
}
ret = RegOpenKeyExW (This->key, subkey, 0, KEY_READ, &key);
if (ret != ERROR_SUCCESS)
{
heap_free(subkey);
return HRESULT_FROM_WIN32(ret);
}
hr = token_create( NULL, &IID_ISpObjectToken, (void**)&subtoken );
if (FAILED(hr))
return hr;
object = impl_from_ISpObjectToken( subtoken );
object->token_key = key;
object->token_id = subkey;
*token = subtoken;
return hr;
}
static HRESULT WINAPI token_enum_GetCount( ISpObjectTokenEnumBuilder *iface,
......@@ -837,20 +894,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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment