mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-21 15:14:09 +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:
parent
64808e17b2
commit
5d49d33483
|
@ -202,23 +202,23 @@ static void test_object_token(void)
|
||||||
ok( cat == (LPVOID)0xdeadbeef, "got %p\n", cat );
|
ok( cat == (LPVOID)0xdeadbeef, "got %p\n", cat );
|
||||||
|
|
||||||
hr = ISpObjectToken_SetId( token, NULL, NULL, FALSE );
|
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 );
|
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 );
|
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 );
|
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 */
|
/* SetId succeeds even if the key is invalid, but exists */
|
||||||
hr = ISpObjectToken_SetId( token, NULL, L"HKEY_LOCAL_MACHINE\\SOFTWARE", FALSE );
|
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 );
|
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 );
|
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 );
|
hr = ISpObjectToken_GetId( token, NULL );
|
||||||
todo_wine ok( hr == E_POINTER, "got %08x\n", hr );
|
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 */
|
/* NULL appears to auto-detect the category */
|
||||||
hr = ISpObjectToken_SetId( token, NULL, token_id, FALSE );
|
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;
|
tempW = NULL;
|
||||||
hr = ISpObjectToken_GetId( token, &tempW );
|
hr = ISpObjectToken_GetId( token, &tempW );
|
||||||
|
|
|
@ -781,6 +781,8 @@ struct object_token
|
||||||
{
|
{
|
||||||
ISpObjectToken ISpObjectToken_iface;
|
ISpObjectToken ISpObjectToken_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
|
HKEY token_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
|
static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
|
||||||
|
@ -827,6 +829,7 @@ static ULONG WINAPI token_Release( ISpObjectToken *iface )
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
{
|
{
|
||||||
|
if (This->token_key) RegCloseKey( This->token_key );
|
||||||
heap_free( This );
|
heap_free( This );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,8 +926,28 @@ static HRESULT WINAPI token_SetId( ISpObjectToken *iface,
|
||||||
LPCWSTR category_id, LPCWSTR token_id,
|
LPCWSTR category_id, LPCWSTR token_id,
|
||||||
BOOL create )
|
BOOL create )
|
||||||
{
|
{
|
||||||
FIXME( "stub\n" );
|
struct object_token *This = impl_from_ISpObjectToken( iface );
|
||||||
return E_NOTIMPL;
|
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,
|
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->ISpObjectToken_iface.lpVtbl = &token_vtbl;
|
||||||
This->ref = 1;
|
This->ref = 1;
|
||||||
|
|
||||||
|
This->token_key = NULL;
|
||||||
|
|
||||||
hr = ISpObjectToken_QueryInterface( &This->ISpObjectToken_iface, iid, obj );
|
hr = ISpObjectToken_QueryInterface( &This->ISpObjectToken_iface, iid, obj );
|
||||||
|
|
||||||
ISpObjectToken_Release( &This->ISpObjectToken_iface );
|
ISpObjectToken_Release( &This->ISpObjectToken_iface );
|
||||||
|
|
Loading…
Reference in a new issue