1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

sapi: Improve stub for ISpObjectToken::SetId.

Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Myah Caron 2020-09-16 06:23:40 +00:00 committed by Alexandre Julliard
parent 64808e17b2
commit 5d49d33483
2 changed files with 35 additions and 10 deletions

View File

@ -202,23 +202,23 @@ static void test_object_token(void)
ok( cat == (LPVOID)0xdeadbeef, "got %p\n", cat );
hr = ISpObjectToken_SetId( token, NULL, NULL, FALSE );
todo_wine ok( hr == E_POINTER, "got %08x\n", hr );
ok( hr == E_POINTER, "got %08x\n", hr );
hr = ISpObjectToken_SetId( token, L"bogus", NULL, FALSE );
todo_wine ok( hr == E_POINTER, "got %08x\n", hr );
ok( hr == E_POINTER, "got %08x\n", hr );
hr = ISpObjectToken_SetId( token, NULL, L"bogus", FALSE );
todo_wine ok( hr == SPERR_NOT_FOUND, "got %08x\n", hr );
ok( hr == SPERR_NOT_FOUND, "got %08x\n", hr );
hr = ISpObjectToken_SetId( token, NULL, L"HKEY_LOCAL_MACHINE\\SOFTWARE\\winetest bogus", FALSE );
todo_wine ok( hr == SPERR_NOT_FOUND, "got %08x\n", hr );
ok( hr == SPERR_NOT_FOUND, "got %08x\n", hr );
/* SetId succeeds even if the key is invalid, but exists */
hr = ISpObjectToken_SetId( token, NULL, L"HKEY_LOCAL_MACHINE\\SOFTWARE", FALSE );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08x\n", hr );
hr = ISpObjectToken_SetId( token, NULL, NULL, FALSE );
todo_wine ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
hr = ISpObjectToken_SetId( token, NULL, L"bogus", FALSE );
todo_wine ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
hr = ISpObjectToken_GetId( token, NULL );
todo_wine ok( hr == E_POINTER, "got %08x\n", hr );
@ -265,7 +265,7 @@ static void test_object_token(void)
/* NULL appears to auto-detect the category */
hr = ISpObjectToken_SetId( token, NULL, token_id, FALSE );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08x\n", hr );
tempW = NULL;
hr = ISpObjectToken_GetId( token, &tempW );

View File

@ -781,6 +781,8 @@ struct object_token
{
ISpObjectToken ISpObjectToken_iface;
LONG ref;
HKEY token_key;
};
static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
@ -827,6 +829,7 @@ static ULONG WINAPI token_Release( ISpObjectToken *iface )
if (!ref)
{
if (This->token_key) RegCloseKey( This->token_key );
heap_free( This );
}
@ -923,8 +926,28 @@ static HRESULT WINAPI token_SetId( ISpObjectToken *iface,
LPCWSTR category_id, LPCWSTR token_id,
BOOL create )
{
FIXME( "stub\n" );
return E_NOTIMPL;
struct object_token *This = impl_from_ISpObjectToken( iface );
BOOL res;
HRESULT hr;
HKEY root, key;
const WCHAR *subkey;
FIXME( "(%p)->(%s %s %d): semi-stub\n", This, debugstr_w( category_id ),
debugstr_w(token_id), create );
if (This->token_key) return SPERR_ALREADY_INITIALIZED;
if (!token_id) return E_POINTER;
hr = parse_cat_id( token_id, &root, &subkey );
if (hr != S_OK) return SPERR_NOT_FOUND;
res = RegOpenKeyExW( root, subkey, 0, KEY_ALL_ACCESS, &key );
if (res) return SPERR_NOT_FOUND;
This->token_key = key;
return S_OK;
}
static HRESULT WINAPI token_GetId( ISpObjectToken *iface,
@ -1047,6 +1070,8 @@ HRESULT token_create( IUnknown *outer, REFIID iid, void **obj )
This->ISpObjectToken_iface.lpVtbl = &token_vtbl;
This->ref = 1;
This->token_key = NULL;
hr = ISpObjectToken_QueryInterface( &This->ISpObjectToken_iface, iid, obj );
ISpObjectToken_Release( &This->ISpObjectToken_iface );