Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2e11e2f3
Commit
2e11e2f3
authored
Sep 11, 2020
by
Myah Caron
Committed by
Alexandre Julliard
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sapi: Improve GetDefaultTokenId stub.
Signed-off-by:
Myah Caron
<
qsniyg@protonmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3f3c0086
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
2 deletions
+91
-2
token.c
dlls/sapi/tests/token.c
+59
-0
token.c
dlls/sapi/token.c
+32
-2
No files found.
dlls/sapi/tests/token.c
View file @
2e11e2f3
...
...
@@ -116,11 +116,70 @@ static void test_token_enum(void)
ISpObjectTokenEnumBuilder_Release
(
token_enum
);
}
static
void
test_default_token_id
(
void
)
{
ISpObjectTokenCategory
*
cat
;
HRESULT
hr
;
LPWSTR
token_id
=
NULL
;
LONG
res
;
WCHAR
regvalue
[
512
];
DWORD
regvalue_size
;
hr
=
CoCreateInstance
(
&
CLSID_SpObjectTokenCategory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_ISpObjectTokenCategory
,
(
void
**
)
&
cat
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
token_id
=
(
LPWSTR
)
0xdeadbeef
;
hr
=
ISpObjectTokenCategory_GetDefaultTokenId
(
cat
,
&
token_id
);
ok
(
hr
==
SPERR_UNINITIALIZED
,
"got %08x
\n
"
,
hr
);
ok
(
token_id
==
(
LPWSTR
)
0xdeadbeef
,
"got %p
\n
"
,
token_id
);
hr
=
ISpObjectTokenCategory_GetDefaultTokenId
(
cat
,
NULL
);
ok
(
hr
==
SPERR_UNINITIALIZED
,
"got %08x
\n
"
,
hr
);
hr
=
ISpObjectTokenCategory_SetId
(
cat
,
SPCAT_AUDIOOUT
,
FALSE
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
ISpObjectTokenCategory_GetDefaultTokenId
(
cat
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got %08x
\n
"
,
hr
);
token_id
=
(
LPWSTR
)
0xdeadbeef
;
hr
=
ISpObjectTokenCategory_GetDefaultTokenId
(
cat
,
&
token_id
);
/* AudioOutput under windows server returns this error */
if
(
hr
==
SPERR_NOT_FOUND
)
{
/* also happens if TokenEnums/Tokens is empty or doesn't exist */
skip
(
"AudioOutput category not found for GetDefaultTokenId
\n
"
);
return
;
}
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
token_id
!=
(
LPWSTR
)
0xdeadbeef
&&
token_id
!=
NULL
,
"got %p
\n
"
,
token_id
);
regvalue_size
=
sizeof
(
regvalue
);
res
=
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
L"SOFTWARE
\\
Microsoft
\\
Speech
\\
AudioOutput"
,
L"DefaultDefaultTokenId"
,
RRF_RT_REG_SZ
,
NULL
,
(
LPVOID
)
&
regvalue
,
&
regvalue_size
);
if
(
res
==
ERROR_FILE_NOT_FOUND
)
{
skip
(
"DefaultDefaultTokenId not found for AudioOutput category (%s)
\n
"
,
wine_dbgstr_w
(
token_id
)
);
}
else
{
ok
(
res
==
ERROR_SUCCESS
,
"got %08x
\n
"
,
res
);
ok
(
!
wcscmp
(
regvalue
,
token_id
),
"GetDefaultTokenId (%s) should be equal to the DefaultDefaultTokenId key (%s)
\n
"
,
wine_dbgstr_w
(
token_id
),
wine_dbgstr_w
(
regvalue
)
);
}
CoTaskMemFree
(
token_id
);
ISpObjectTokenCategory_Release
(
cat
);
}
START_TEST
(
token
)
{
CoInitialize
(
NULL
);
test_data_key
();
test_token_category
();
test_token_enum
();
test_default_token_id
();
CoUninitialize
();
}
dlls/sapi/token.c
View file @
2e11e2f3
...
...
@@ -489,8 +489,38 @@ static HRESULT WINAPI token_category_SetDefaultTokenId( ISpObjectTokenCategory *
static
HRESULT
WINAPI
token_category_GetDefaultTokenId
(
ISpObjectTokenCategory
*
iface
,
LPWSTR
*
id
)
{
FIXME
(
"stub
\n
"
);
return
E_NOTIMPL
;
struct
token_category
*
This
=
impl_from_ISpObjectTokenCategory
(
iface
);
struct
data_key
*
this_data_key
;
LONG
res
;
WCHAR
regvalue
[
512
];
DWORD
regvalue_size
=
sizeof
(
regvalue
);
FIXME
(
"(%p)->(%p): semi-stub
\n
"
,
iface
,
id
);
if
(
!
This
->
data_key
)
return
SPERR_UNINITIALIZED
;
if
(
!
id
)
return
E_POINTER
;
/* todo: check HKCU's DefaultTokenId before */
this_data_key
=
impl_from_ISpRegDataKey
(
This
->
data_key
);
res
=
RegGetValueW
(
this_data_key
->
key
,
NULL
,
L"DefaultDefaultTokenId"
,
RRF_RT_REG_SZ
,
NULL
,
&
regvalue
,
&
regvalue_size
);
if
(
res
==
ERROR_FILE_NOT_FOUND
)
{
return
SPERR_NOT_FOUND
;
}
else
if
(
res
!=
ERROR_SUCCESS
)
{
/* probably not the correct return value */
FIXME
(
"returning %08x
\n
"
,
res
);
return
res
;
}
*
id
=
CoTaskMemAlloc
(
regvalue_size
);
wcscpy
(
*
id
,
regvalue
);
return
S_OK
;
}
const
struct
ISpObjectTokenCategoryVtbl
token_category_vtbl
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment