Updated sapi-iteration-tokens patchset

Make the tests pass (GetId).
Stop new crash in "Beneath a Steel Sky".
This commit is contained in:
Alistair Leslie-Hughes 2021-09-28 13:51:49 +10:00
parent 0ff86943ed
commit 47a1fa55d6
3 changed files with 91 additions and 7 deletions

View File

@ -3088,7 +3088,7 @@ fi
# | * [#51775] sapi: Allow iteration of Token objects.
# |
# | Modified files:
# | * dlls/sapi/sapi.rgs, dlls/sapi/token.c
# | * dlls/sapi/sapi.rgs, dlls/sapi/tests/token.c, dlls/sapi/token.c
# |
if test "$enable_sapi_iteration_tokens" -eq 1; then
patch_apply sapi-iteration-tokens/0001-sapi-Implement-ISpRegDataKey-CreateKey.patch
@ -3098,6 +3098,7 @@ if test "$enable_sapi_iteration_tokens" -eq 1; then
patch_apply sapi-iteration-tokens/0006-sapi-Implement-ISpObjectToken-GetId.patch
patch_apply sapi-iteration-tokens/0007-sapi-Implement-ISpObjectToken-OpenKey.patch
patch_apply sapi-iteration-tokens/0008-sapi-Add-default-voice-registry-key.patch
patch_apply sapi-iteration-tokens/0009-sapi-Return-dump-object-in-ISpObjectTokenEnumBuilder.patch
fi
# Patchset secur32-InitializeSecurityContextW

View File

@ -1,14 +1,50 @@
From c2a21bbb02715a43fda52ad4326d8783272df234 Mon Sep 17 00:00:00 2001
From d1e31dceb931ff2a40e606f7aa9acf46d79ca074 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
Subject: [PATCH] sapi: Implement ISpObjectToken GetId
---
dlls/sapi/token.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
dlls/sapi/tests/token.c | 7 ++++---
dlls/sapi/token.c | 27 ++++++++++++++++++++++++---
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c
index 47196d42dc7..042dfbaa84a 100644
--- a/dlls/sapi/tests/token.c
+++ b/dlls/sapi/tests/token.c
@@ -185,11 +185,11 @@ static void test_object_token(void)
ok( hr == S_OK, "got %08x\n", hr );
hr = ISpObjectToken_GetId( token, NULL );
- todo_wine ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr );
+ ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr );
tempW = (LPWSTR)0xdeadbeef;
hr = ISpObjectToken_GetId( token, &tempW );
- todo_wine ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr );
+ ok( hr == SPERR_UNINITIALIZED, "got %08x\n", hr );
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)
ok( hr == SPERR_ALREADY_INITIALIZED, "got %08x\n", hr );
hr = ISpObjectToken_GetId( token, NULL );
- todo_wine ok( hr == E_POINTER, "got %08x\n", hr );
+ ok( hr == E_POINTER, "got %08x\n", hr );
hr = ISpObjectToken_GetCategory( token, NULL );
todo_wine ok( hr == E_POINTER, "got %08x\n", hr );
@@ -297,6 +297,7 @@ static void test_object_token(void)
ISpObjectToken_Release( token );
}
+
START_TEST(token)
{
CoInitialize( NULL );
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
index d16478d0064..4b9ca15fe11 100644
index d16478d0064..93ce6549e65 100644
--- a/dlls/sapi/token.c
+++ b/dlls/sapi/token.c
@@ -70,6 +70,7 @@ struct object_token
@ -43,7 +79,7 @@ index d16478d0064..4b9ca15fe11 100644
heap_free( This );
}
@@ -1053,8 +1055,19 @@ static HRESULT WINAPI token_SetId( ISpObjectToken *iface,
@@ -1053,8 +1055,27 @@ static HRESULT WINAPI token_SetId( ISpObjectToken *iface,
static HRESULT WINAPI token_GetId( ISpObjectToken *iface,
LPWSTR *token_id )
{
@ -56,6 +92,14 @@ index d16478d0064..4b9ca15fe11 100644
+ if (!This->token_key)
+ return SPERR_UNINITIALIZED;
+
+ if (!token_id)
+ return E_POINTER;
+
+ if (!This->token_id)
+ {
+ FIXME("Loading default category not supported.\n");
+ return E_POINTER;
+ }
+ *token_id = CoTaskMemAlloc( (wcslen(This->token_id) + 1) * sizeof(WCHAR));
+ if (!*token_id)
+ return E_OUTOFMEMORY;

View File

@ -0,0 +1,39 @@
From 0111782f2507d26c8cfc5401ad1291638b172696 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 28 Sep 2021 14:41:16 +1000
Subject: [PATCH] sapi: Return dump object in ISpObjectTokenEnumBuilder Next
---
dlls/sapi/token.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c
index 686e6ade490..c322d560ec3 100644
--- a/dlls/sapi/token.c
+++ b/dlls/sapi/token.c
@@ -705,6 +705,7 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
ULONG *fetched )
{
struct token_enum *This = impl_from_ISpObjectTokenEnumBuilder( iface );
+ HRESULT hr;
TRACE( "(%p)->(%u %p %p)\n", This, num, tokens, fetched );
@@ -712,8 +713,12 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
FIXME( "semi-stub: Returning an empty enumerator\n" );
- if (fetched) *fetched = 0;
- return S_FALSE;
+ hr = token_create( NULL, &IID_ISpObjectToken, (void**)tokens );
+ if (FAILED(hr))
+ return hr;
+
+ if (fetched) *fetched = 1;
+ return hr;
}
static HRESULT WINAPI token_enum_Skip( ISpObjectTokenEnumBuilder *iface,
--
2.33.0