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
3e2ed9c7
Commit
3e2ed9c7
authored
Dec 25, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Some tests for returned apartment type in implicit MTA case.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
80d2edd5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
compobj.c
dlls/ole32/tests/compobj.c
+48
-0
No files found.
dlls/ole32/tests/compobj.c
View file @
3e2ed9c7
...
...
@@ -617,6 +617,26 @@ static DWORD CALLBACK ole_initialize_thread(LPVOID pv)
return
hr
;
}
#define test_apt_type(t, q, t_t, t_q) _test_apt_type(t, q, t_t, t_q, __LINE__)
static
void
_test_apt_type
(
APTTYPE
expected_type
,
APTTYPEQUALIFIER
expected_qualifier
,
BOOL
todo_type
,
BOOL
todo_qualifier
,
int
line
)
{
APTTYPEQUALIFIER
qualifier
=
~
0u
;
APTTYPE
type
=
~
0u
;
HRESULT
hr
;
if
(
!
pCoGetApartmentType
)
return
;
hr
=
pCoGetApartmentType
(
&
type
,
&
qualifier
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
||
hr
==
CO_E_NOTINITIALIZED
,
"Unexpected return code: 0x%08x
\n
"
,
hr
);
todo_wine_if
(
todo_type
)
ok_
(
__FILE__
,
line
)(
type
==
expected_type
,
"Wrong apartment type %d, expected %d
\n
"
,
type
,
expected_type
);
todo_wine_if
(
todo_qualifier
)
ok_
(
__FILE__
,
line
)(
qualifier
==
expected_qualifier
,
"Wrong apartment qualifier %d, expected %d
\n
"
,
qualifier
,
expected_qualifier
);
}
static
void
test_CoCreateInstance
(
void
)
{
HRESULT
hr
;
...
...
@@ -661,6 +681,8 @@ static void test_CoCreateInstance(void)
/* show that COM doesn't have to be initialized for multi-threaded apartments if another
thread has already done so */
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
info
.
wait
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
ok
(
info
.
wait
!=
NULL
,
"CreateEvent failed with error %d
\n
"
,
GetLastError
());
...
...
@@ -672,6 +694,8 @@ static void test_CoCreateInstance(void)
ok
(
!
WaitForSingleObject
(
info
.
wait
,
10000
),
"wait timed out
\n
"
);
test_apt_type
(
APTTYPE_MTA
,
APTTYPEQUALIFIER_IMPLICIT_MTA
,
TRUE
,
TRUE
);
pUnk
=
(
IUnknown
*
)
0xdeadbeef
;
hr
=
CoCreateInstance
(
rclsid
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
void
**
)
&
pUnk
);
ok
(
hr
==
S_OK
,
"CoCreateInstance should have returned S_OK instead of 0x%08x
\n
"
,
hr
);
...
...
@@ -687,6 +711,8 @@ static void test_CoCreateInstance(void)
CloseHandle
(
thread
);
CloseHandle
(
info
.
wait
);
CloseHandle
(
info
.
stop
);
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
}
static
void
test_CoGetClassObject
(
void
)
...
...
@@ -713,6 +739,8 @@ static void test_CoGetClassObject(void)
/* show that COM doesn't have to be initialized for multi-threaded apartments if another
thread has already done so */
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
info
.
wait
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
ok
(
info
.
wait
!=
NULL
,
"CreateEvent failed with error %d
\n
"
,
GetLastError
());
...
...
@@ -724,6 +752,8 @@ static void test_CoGetClassObject(void)
ok
(
!
WaitForSingleObject
(
info
.
wait
,
10000
),
"wait timed out
\n
"
);
test_apt_type
(
APTTYPE_MTA
,
APTTYPEQUALIFIER_IMPLICIT_MTA
,
TRUE
,
TRUE
);
pUnk
=
(
IUnknown
*
)
0xdeadbeef
;
hr
=
CoGetClassObject
(
rclsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
pUnk
);
if
(
hr
==
REGDB_E_CLASSNOTREG
)
...
...
@@ -745,6 +775,8 @@ static void test_CoGetClassObject(void)
CloseHandle
(
info
.
wait
);
CloseHandle
(
info
.
stop
);
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
if
(
!
pRegOverridePredefKey
)
{
win_skip
(
"RegOverridePredefKey not available
\n
"
);
...
...
@@ -1798,6 +1830,8 @@ static void test_CoGetObjectContext(void)
/* show that COM doesn't have to be initialized for multi-threaded apartments if another
thread has already done so */
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
info
.
wait
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
ok
(
info
.
wait
!=
NULL
,
"CreateEvent failed with error %d
\n
"
,
GetLastError
());
...
...
@@ -1809,6 +1843,8 @@ static void test_CoGetObjectContext(void)
ok
(
!
WaitForSingleObject
(
info
.
wait
,
10000
),
"wait timed out
\n
"
);
test_apt_type
(
APTTYPE_MTA
,
APTTYPEQUALIFIER_IMPLICIT_MTA
,
TRUE
,
TRUE
);
pComThreadingInfo
=
NULL
;
hr
=
pCoGetObjectContext
(
&
IID_IComThreadingInfo
,
(
void
**
)
&
pComThreadingInfo
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got 0x%08x
\n
"
,
hr
);
...
...
@@ -1842,8 +1878,12 @@ static void test_CoGetObjectContext(void)
CloseHandle
(
info
.
wait
);
CloseHandle
(
info
.
stop
);
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
pCoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
test_apt_type
(
APTTYPE_MAINSTA
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
hr
=
pCoGetObjectContext
(
&
IID_IComThreadingInfo
,
(
void
**
)
&
pComThreadingInfo
);
ok_ole_success
(
hr
,
"CoGetObjectContext"
);
...
...
@@ -2028,6 +2068,8 @@ static void test_CoGetContextToken(void)
/* show that COM doesn't have to be initialized for multi-threaded apartments if another
thread has already done so */
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
info
.
wait
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
ok
(
info
.
wait
!=
NULL
,
"CreateEvent failed with error %d
\n
"
,
GetLastError
());
...
...
@@ -2039,6 +2081,8 @@ static void test_CoGetContextToken(void)
ok
(
!
WaitForSingleObject
(
info
.
wait
,
10000
),
"wait timed out
\n
"
);
test_apt_type
(
APTTYPE_MTA
,
APTTYPEQUALIFIER_IMPLICIT_MTA
,
TRUE
,
TRUE
);
token
=
0
;
hr
=
pCoGetContextToken
(
&
token
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got 0x%08x
\n
"
,
hr
);
...
...
@@ -2059,8 +2103,12 @@ static void test_CoGetContextToken(void)
CloseHandle
(
info
.
wait
);
CloseHandle
(
info
.
stop
);
test_apt_type
(
APTTYPE_CURRENT
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
CoInitialize
(
NULL
);
test_apt_type
(
APTTYPE_MAINSTA
,
APTTYPEQUALIFIER_NONE
,
FALSE
,
FALSE
);
hr
=
pCoGetContextToken
(
NULL
);
ok
(
hr
==
E_POINTER
,
"Expected E_POINTER, got 0x%08x
\n
"
,
hr
);
...
...
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