diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 8c445ea1f6a..688ade783d0 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -49,9 +49,43 @@ static void test_data_key(void) ISpRegDataKey_Release( data_key ); } +static void test_token_enum(void) +{ + ISpObjectTokenEnumBuilder *token_enum; + HRESULT hr; + ISpObjectToken *token; + ULONG count; + + hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpObjectTokenEnumBuilder, (void **)&token_enum ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = ISpObjectTokenEnumBuilder_GetCount( token_enum, &count ); + ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr ); + + hr = ISpObjectTokenEnumBuilder_Next( token_enum, 1, &token, &count ); + ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr ); + + hr = ISpObjectTokenEnumBuilder_SetAttribs( token_enum, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + count = 0xdeadbeef; + hr = ISpObjectTokenEnumBuilder_GetCount( token_enum, &count ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( count == 0, "got %u\n", count ); + + count = 0xdeadbeef; + hr = ISpObjectTokenEnumBuilder_Next( token_enum, 1, &token, &count ); + ok( hr == S_FALSE, "got %08x\n", hr ); + ok( count == 0, "got %u\n", count ); + + ISpObjectTokenEnumBuilder_Release( token_enum ); +} + START_TEST(token) { CoInitialize( NULL ); test_data_key(); + test_token_enum(); CoUninitialize(); } diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 27d3abe6d98..51d2ed1d404 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -293,8 +293,16 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface, ULONG num, ISpObjectToken **tokens, ULONG *fetched ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + struct token_enum *This = impl_from_ISpObjectTokenEnumBuilder( iface ); + + TRACE( "(%p)->(%u %p %p)\n", This, num, tokens, fetched ); + + if (!This->init) return SPERR_UNINITIALIZED; + + FIXME( "semi-stub: Returning an empty enumerator\n" ); + + if (fetched) *fetched = 0; + return S_FALSE; } static HRESULT WINAPI token_enum_Skip( ISpObjectTokenEnumBuilder *iface,