2022-03-04 14:58:02 -08:00
|
|
|
From 614d8a2d74f7b5e7fdd2739741dc0fc42e57eebd Mon Sep 17 00:00:00 2001
|
2021-09-22 01:37:01 -07:00
|
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
|
|
Date: Wed, 22 Sep 2021 19:01:44 +1000
|
2021-09-27 20:51:49 -07:00
|
|
|
Subject: [PATCH] sapi: Implement ISpObjectToken GetId
|
2021-09-22 01:37:01 -07:00
|
|
|
|
|
|
|
---
|
2021-09-27 20:51:49 -07:00
|
|
|
dlls/sapi/tests/token.c | 7 ++++---
|
|
|
|
dlls/sapi/token.c | 27 ++++++++++++++++++++++++---
|
|
|
|
2 files changed, 28 insertions(+), 6 deletions(-)
|
2021-09-22 01:37:01 -07:00
|
|
|
|
2021-09-27 20:51:49 -07:00
|
|
|
diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c
|
2022-03-04 14:58:02 -08:00
|
|
|
index 9473d56b4d1..260e059127d 100644
|
2021-09-27 20:51:49 -07:00
|
|
|
--- a/dlls/sapi/tests/token.c
|
|
|
|
+++ b/dlls/sapi/tests/token.c
|
|
|
|
@@ -185,11 +185,11 @@ static void test_object_token(void)
|
2022-03-04 14:58:02 -08:00
|
|
|
ok( hr == S_OK, "got %08lx\n", hr );
|
2021-09-27 20:51:49 -07:00
|
|
|
|
|
|
|
hr = ISpObjectToken_GetId( token, NULL );
|
2022-03-04 14:58:02 -08:00
|
|
|
- todo_wine ok( hr == SPERR_UNINITIALIZED, "got %08lx\n", hr );
|
|
|
|
+ ok( hr == SPERR_UNINITIALIZED, "got %08lx\n", hr );
|
2021-09-27 20:51:49 -07:00
|
|
|
|
|
|
|
tempW = (LPWSTR)0xdeadbeef;
|
|
|
|
hr = ISpObjectToken_GetId( token, &tempW );
|
2022-03-04 14:58:02 -08:00
|
|
|
- todo_wine ok( hr == SPERR_UNINITIALIZED, "got %08lx\n", hr );
|
|
|
|
+ ok( hr == SPERR_UNINITIALIZED, "got %08lx\n", hr );
|
2021-09-27 20:51:49 -07:00
|
|
|
ok( tempW == (LPWSTR)0xdeadbeef, "got %s\n", wine_dbgstr_w(tempW) );
|
|
|
|
|
|
|
|
hr = ISpObjectToken_GetCategory( token, NULL );
|
|
|
|
@@ -220,7 +220,7 @@ static void test_object_token(void)
|
2022-03-04 14:58:02 -08:00
|
|
|
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08lx\n", hr );
|
2021-09-27 20:51:49 -07:00
|
|
|
|
|
|
|
hr = ISpObjectToken_GetId( token, NULL );
|
2022-03-04 14:58:02 -08:00
|
|
|
- todo_wine ok( hr == E_POINTER, "got %08lx\n", hr );
|
|
|
|
+ ok( hr == E_POINTER, "got %08lx\n", hr );
|
2021-09-27 20:51:49 -07:00
|
|
|
|
|
|
|
hr = ISpObjectToken_GetCategory( token, NULL );
|
2022-03-04 14:58:02 -08:00
|
|
|
todo_wine ok( hr == E_POINTER, "got %08lx\n", hr );
|
2021-09-27 20:51:49 -07:00
|
|
|
@@ -297,6 +297,7 @@ static void test_object_token(void)
|
|
|
|
ISpObjectToken_Release( token );
|
|
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
START_TEST(token)
|
|
|
|
{
|
|
|
|
CoInitialize( NULL );
|
2021-09-22 01:37:01 -07:00
|
|
|
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
|
2022-03-04 14:58:02 -08:00
|
|
|
index a514b2995b4..e0fbf200d65 100644
|
2021-09-22 01:37:01 -07:00
|
|
|
--- a/dlls/sapi/token.c
|
|
|
|
+++ b/dlls/sapi/token.c
|
|
|
|
@@ -70,6 +70,7 @@ struct object_token
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
HKEY token_key;
|
|
|
|
+ WCHAR *token_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
|
|
|
|
@@ -765,7 +766,6 @@ static HRESULT WINAPI token_enum_Item( ISpObjectTokenEnumBuilder *iface,
|
|
|
|
ret = RegOpenKeyExW (This->key, subkey, 0, KEY_READ, &key);
|
|
|
|
if (ret != ERROR_SUCCESS)
|
|
|
|
return HRESULT_FROM_WIN32(ret);
|
|
|
|
- heap_free(subkey);
|
|
|
|
|
|
|
|
hr = token_create( NULL, &IID_ISpObjectToken, (void**)&subtoken );
|
|
|
|
if (FAILED(hr))
|
|
|
|
@@ -773,6 +773,7 @@ static HRESULT WINAPI token_enum_Item( ISpObjectTokenEnumBuilder *iface,
|
|
|
|
|
|
|
|
object = impl_from_ISpObjectToken( subtoken );
|
|
|
|
object->token_key = key;
|
|
|
|
+ object->token_id = subkey;
|
|
|
|
|
|
|
|
*token = subtoken;
|
|
|
|
|
|
|
|
@@ -927,6 +928,7 @@ static ULONG WINAPI token_Release( ISpObjectToken *iface )
|
|
|
|
if (!ref)
|
|
|
|
{
|
|
|
|
if (This->token_key) RegCloseKey( This->token_key );
|
|
|
|
+ heap_free(This->token_id);
|
|
|
|
heap_free( This );
|
|
|
|
}
|
|
|
|
|
2021-09-27 20:51:49 -07:00
|
|
|
@@ -1053,8 +1055,27 @@ static HRESULT WINAPI token_SetId( ISpObjectToken *iface,
|
2021-09-22 01:37:01 -07:00
|
|
|
static HRESULT WINAPI token_GetId( ISpObjectToken *iface,
|
|
|
|
LPWSTR *token_id )
|
|
|
|
{
|
|
|
|
- FIXME( "stub\n" );
|
|
|
|
- return E_NOTIMPL;
|
|
|
|
+ struct object_token *This = impl_from_ISpObjectToken( iface );
|
|
|
|
+
|
|
|
|
+ TRACE( "%p, %p\n", This, token_id);
|
|
|
|
+
|
|
|
|
+ if (!This->token_key)
|
|
|
|
+ return SPERR_UNINITIALIZED;
|
|
|
|
+
|
2021-09-27 20:51:49 -07:00
|
|
|
+ if (!token_id)
|
|
|
|
+ return E_POINTER;
|
|
|
|
+
|
|
|
|
+ if (!This->token_id)
|
|
|
|
+ {
|
|
|
|
+ FIXME("Loading default category not supported.\n");
|
|
|
|
+ return E_POINTER;
|
|
|
|
+ }
|
2021-09-22 01:37:01 -07:00
|
|
|
+ *token_id = CoTaskMemAlloc( (wcslen(This->token_id) + 1) * sizeof(WCHAR));
|
|
|
|
+ if (!*token_id)
|
|
|
|
+ return E_OUTOFMEMORY;
|
|
|
|
+
|
|
|
|
+ wcscpy(*token_id, This->token_id);
|
|
|
|
+ return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI token_GetCategory( ISpObjectToken *iface,
|
|
|
|
--
|
2022-03-04 14:58:02 -08:00
|
|
|
2.34.1
|
2021-09-22 01:37:01 -07:00
|
|
|
|