wine-staging/patches/sapi-iteration-tokens/0006-sapi-Implement-ISpObjectToken-GetId.patch

71 lines
2.1 KiB
Diff
Raw Normal View History

2021-09-22 18:37:01 +10:00
From c2a21bbb02715a43fda52ad4326d8783272df234 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 22 Sep 2021 19:01:44 +1000
Subject: [PATCH 6/8] sapi: Implement ISpObjectToken GetId
---
dlls/sapi/token.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
index d16478d0064..4b9ca15fe11 100644
--- 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 );
}
@@ -1053,8 +1055,19 @@ static HRESULT WINAPI token_SetId( ISpObjectToken *iface,
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;
+
+ *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,
--
2.33.0