Commit 682c1b95 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

sapi: Add a partial implementation of SpObjectTokenCategory::EnumTokens().

parent 6a7259d8
......@@ -49,6 +49,40 @@ static void test_data_key(void)
ISpRegDataKey_Release( data_key );
}
static void test_token_category(void)
{
ISpObjectTokenCategory *cat;
IEnumSpObjectTokens *enum_tokens;
HRESULT hr;
WCHAR bogus[] = {'b','o','g','u','s',0};
ULONG count;
hr = CoCreateInstance( &CLSID_SpObjectTokenCategory, NULL, CLSCTX_INPROC_SERVER,
&IID_ISpObjectTokenCategory, (void **)&cat );
ok( hr == S_OK, "got %08x\n", hr );
hr = ISpObjectTokenCategory_EnumTokens( cat, NULL, NULL, &enum_tokens );
ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr );
hr = ISpObjectTokenCategory_SetId( cat, bogus, FALSE );
ok( hr == SPERR_INVALID_REGISTRY_KEY, "got %08x\n", hr );
hr = ISpObjectTokenCategory_SetId( cat, SPCAT_VOICES, FALSE );
ok( hr == S_OK, "got %08x\n", hr );
hr = ISpObjectTokenCategory_SetId( cat, SPCAT_VOICES, FALSE );
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
hr = ISpObjectTokenCategory_EnumTokens( cat, NULL, NULL, &enum_tokens );
ok( hr == S_OK, "got %08x\n", hr );
hr = IEnumSpObjectTokens_GetCount( enum_tokens, &count );
ok( hr == S_OK, "got %08x\n", hr );
IEnumSpObjectTokens_Release( enum_tokens );
ISpObjectTokenCategory_Release( cat );
}
static void test_token_enum(void)
{
ISpObjectTokenEnumBuilder *token_enum;
......@@ -86,6 +120,7 @@ START_TEST(token)
{
CoInitialize( NULL );
test_data_key();
test_token_category();
test_token_enum();
CoUninitialize();
}
......@@ -455,8 +455,29 @@ static HRESULT WINAPI token_category_EnumTokens( ISpObjectTokenCategory *iface,
LPCWSTR req, LPCWSTR opt,
IEnumSpObjectTokens **enum_tokens )
{
FIXME( "stub\n" );
return E_NOTIMPL;
struct token_category *This = impl_from_ISpObjectTokenCategory( iface );
ISpObjectTokenEnumBuilder *builder;
HRESULT hr;
FIXME( "(%p)->(%s %s %p): semi-stub\n", This, debugstr_w( req ), debugstr_w( opt ), enum_tokens );
if (!This->data_key) return SPERR_UNINITIALIZED;
hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_ALL,
&IID_ISpObjectTokenEnumBuilder, (void **)&builder );
if (FAILED(hr)) return hr;
hr = ISpObjectTokenEnumBuilder_SetAttribs( builder, req, opt );
if (FAILED(hr)) goto fail;
/* FIXME: Build the enumerator */
hr = ISpObjectTokenEnumBuilder_QueryInterface( builder, &IID_IEnumSpObjectTokens,
(void **)enum_tokens );
fail:
ISpObjectTokenEnumBuilder_Release( builder );
return hr;
}
static HRESULT WINAPI token_category_SetDefaultTokenId( ISpObjectTokenCategory *iface,
......
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