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
61fb28de
Commit
61fb28de
authored
Oct 24, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Oct 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Make the two reference marshalling thread more generic.
parent
14a87908
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
26 deletions
+30
-26
marshal.c
dlls/ole32/tests/marshal.c
+30
-26
No files found.
dlls/ole32/tests/marshal.c
View file @
61fb28de
...
...
@@ -346,10 +346,10 @@ static DWORD start_host_object(IStream *stream, REFIID riid, IUnknown *object, M
/* asks thread to release the marshal data because it has to be done by the
* same thread that marshaled the interface in the first place. */
static
void
release_host_object
(
DWORD
tid
)
static
void
release_host_object
(
DWORD
tid
,
WPARAM
wp
)
{
HANDLE
event
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
PostThreadMessageA
(
tid
,
RELEASEMARSHALDATA
,
0
,
(
LPARAM
)
event
);
PostThreadMessageA
(
tid
,
RELEASEMARSHALDATA
,
wp
,
(
LPARAM
)
event
);
ok
(
!
WaitForSingleObject
(
event
,
10000
),
"wait timed out
\n
"
);
CloseHandle
(
event
);
}
...
...
@@ -1130,7 +1130,7 @@ static void test_tableweak_marshal_and_unmarshal_twice(void)
todo_wine
ok_more_than_one_lock
();
IStream_Seek
(
pStream
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
release_host_object
(
tid
);
release_host_object
(
tid
,
0
);
}
/* Without IExternalConnection this line is shows the difference between weak and strong table marshaling
...
...
@@ -1171,7 +1171,7 @@ static void test_tableweak_marshal_releasedata1(void)
/* release the remaining reference on the object by calling
* CoReleaseMarshalData in the hosting thread */
IStream_Seek
(
pStream
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
release_host_object
(
tid
);
release_host_object
(
tid
,
0
);
ok_more_than_one_lock
();
ok_non_zero_external_conn
();
...
...
@@ -1224,7 +1224,7 @@ static void test_tableweak_marshal_releasedata2(void)
/* release the remaining reference on the object by calling
* CoReleaseMarshalData in the hosting thread */
IStream_Seek
(
pStream
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
release_host_object
(
tid
);
release_host_object
(
tid
,
0
);
ok_no_locks
();
...
...
@@ -1244,27 +1244,27 @@ static void test_tableweak_marshal_releasedata2(void)
end_host_object
(
tid
,
thread
);
}
struct
weak_and_normal
_marshal_data
struct
duo
_marshal_data
{
IStream
*
pStreamWeak
;
IStream
*
pStream
Normal
;
MSHLFLAGS
marshal_flags1
,
marshal_flags2
;
IStream
*
pStream
1
,
*
pStream2
;
HANDLE
hReadyEvent
;
HANDLE
hQuitEvent
;
};
static
DWORD
CALLBACK
weak_and_normal
_marshal_thread_proc
(
void
*
p
)
static
DWORD
CALLBACK
duo
_marshal_thread_proc
(
void
*
p
)
{
HRESULT
hr
;
struct
weak_and_normal
_marshal_data
*
data
=
p
;
struct
duo
_marshal_data
*
data
=
p
;
HANDLE
hQuitEvent
=
data
->
hQuitEvent
;
MSG
msg
;
pCoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
hr
=
CoMarshalInterface
(
data
->
pStream
Weak
,
&
IID_IClassFactory
,
(
IUnknown
*
)
&
Test_ClassFactory
,
MSHCTX_INPROC
,
NULL
,
MSHLFLAGS_TABLEWEAK
);
hr
=
CoMarshalInterface
(
data
->
pStream
1
,
&
IID_IClassFactory
,
(
IUnknown
*
)
&
Test_ClassFactory
,
MSHCTX_INPROC
,
NULL
,
data
->
marshal_flags1
);
ok_ole_success
(
hr
,
"CoMarshalInterface"
);
hr
=
CoMarshalInterface
(
data
->
pStream
Normal
,
&
IID_IClassFactory
,
(
IUnknown
*
)
&
Test_ClassFactory
,
MSHCTX_INPROC
,
NULL
,
MSHLFLAGS_NORMAL
);
hr
=
CoMarshalInterface
(
data
->
pStream
2
,
&
IID_IClassFactory
,
(
IUnknown
*
)
&
Test_ClassFactory
,
MSHCTX_INPROC
,
NULL
,
data
->
marshal_flags2
);
ok_ole_success
(
hr
,
"CoMarshalInterface"
);
/* force the message queue to be created before signaling parent thread */
...
...
@@ -1278,7 +1278,7 @@ static DWORD CALLBACK weak_and_normal_marshal_thread_proc(void *p)
{
if
(
msg
.
hwnd
==
NULL
&&
msg
.
message
==
RELEASEMARSHALDATA
)
{
CoReleaseMarshalData
(
data
->
pStreamWeak
);
CoReleaseMarshalData
(
msg
.
wParam
==
1
?
data
->
pStream1
:
data
->
pStream2
);
SetEvent
((
HANDLE
)
msg
.
lParam
);
}
else
...
...
@@ -1300,33 +1300,37 @@ static void test_tableweak_and_normal_marshal_and_unmarshal(void)
IUnknown
*
pProxyNormal
=
NULL
;
DWORD
tid
;
HANDLE
thread
;
struct
weak_and_normal
_marshal_data
data
;
struct
duo
_marshal_data
data
;
cLocks
=
0
;
external_connections
=
0
;
data
.
hReadyEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
data
.
hQuitEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
data
.
pStreamWeak
);
data
.
marshal_flags1
=
MSHLFLAGS_TABLEWEAK
;
data
.
marshal_flags2
=
MSHLFLAGS_NORMAL
;
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
data
.
pStream1
);
ok_ole_success
(
hr
,
CreateStreamOnHGlobal
);
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
data
.
pStream
Normal
);
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
data
.
pStream
2
);
ok_ole_success
(
hr
,
CreateStreamOnHGlobal
);
thread
=
CreateThread
(
NULL
,
0
,
weak_and_normal
_marshal_thread_proc
,
&
data
,
0
,
&
tid
);
thread
=
CreateThread
(
NULL
,
0
,
duo
_marshal_thread_proc
,
&
data
,
0
,
&
tid
);
ok
(
!
WaitForSingleObject
(
data
.
hReadyEvent
,
10000
),
"wait timed out
\n
"
);
CloseHandle
(
data
.
hReadyEvent
);
ok_more_than_one_lock
();
ok_non_zero_external_conn
();
IStream_Seek
(
data
.
pStreamWeak
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
hr
=
CoUnmarshalInterface
(
data
.
pStreamWeak
,
&
IID_IClassFactory
,
(
void
**
)
&
pProxyWeak
);
/* weak */
IStream_Seek
(
data
.
pStream1
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
hr
=
CoUnmarshalInterface
(
data
.
pStream1
,
&
IID_IClassFactory
,
(
void
**
)
&
pProxyWeak
);
ok_ole_success
(
hr
,
CoUnmarshalInterface
);
ok_more_than_one_lock
();
IStream_Seek
(
data
.
pStreamNormal
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
hr
=
CoUnmarshalInterface
(
data
.
pStreamNormal
,
&
IID_IClassFactory
,
(
void
**
)
&
pProxyNormal
);
/* normal */
IStream_Seek
(
data
.
pStream2
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
hr
=
CoUnmarshalInterface
(
data
.
pStream2
,
&
IID_IClassFactory
,
(
void
**
)
&
pProxyNormal
);
ok_ole_success
(
hr
,
CoUnmarshalInterface
);
ok_more_than_one_lock
();
...
...
@@ -1347,13 +1351,13 @@ static void test_tableweak_and_normal_marshal_and_unmarshal(void)
{
todo_wine
ok_more_than_one_lock
();
IStream_Seek
(
data
.
pStream
Weak
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
release_host_object
(
tid
);
IStream_Seek
(
data
.
pStream
1
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
release_host_object
(
tid
,
1
);
}
ok_no_locks
();
IStream_Release
(
data
.
pStream
Weak
);
IStream_Release
(
data
.
pStream
Normal
);
IStream_Release
(
data
.
pStream
1
);
IStream_Release
(
data
.
pStream
2
);
SetEvent
(
data
.
hQuitEvent
);
ok
(
!
WaitForSingleObject
(
thread
,
10000
),
"wait timed out
\n
"
);
...
...
@@ -1403,7 +1407,7 @@ static void test_tablestrong_marshal_and_unmarshal_twice(void)
/* release the remaining reference on the object by calling
* CoReleaseMarshalData in the hosting thread */
IStream_Seek
(
pStream
,
ullZero
,
STREAM_SEEK_SET
,
NULL
);
release_host_object
(
tid
);
release_host_object
(
tid
,
0
);
IStream_Release
(
pStream
);
ok_no_locks
();
...
...
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