Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4439cd43
Commit
4439cd43
authored
May 12, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
May 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: attach_thread_input shouldn't create queues for foreign threads.
parent
6be21eeb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
1 deletion
+117
-1
input.c
dlls/user32/tests/input.c
+109
-0
queue.c
server/queue.c
+8
-1
No files found.
dlls/user32/tests/input.c
View file @
4439cd43
...
...
@@ -2040,7 +2040,10 @@ static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPAR
struct
wnd_event
{
HWND
hwnd
;
HANDLE
wait_event
;
HANDLE
start_event
;
DWORD
attach_from
;
DWORD
attach_to
;
BOOL
setWindows
;
};
...
...
@@ -2048,6 +2051,26 @@ static DWORD WINAPI thread_proc(void *param)
{
MSG
msg
;
struct
wnd_event
*
wnd_event
=
param
;
BOOL
ret
;
if
(
wnd_event
->
wait_event
)
{
ok
(
WaitForSingleObject
(
wnd_event
->
wait_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
->
wait_event
);
}
if
(
wnd_event
->
attach_from
)
{
ret
=
AttachThreadInput
(
wnd_event
->
attach_from
,
GetCurrentThreadId
(),
TRUE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
}
if
(
wnd_event
->
attach_to
)
{
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
wnd_event
->
attach_to
,
TRUE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
}
wnd_event
->
hwnd
=
CreateWindowExA
(
0
,
"TestWindowClass"
,
"window caption text"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
...
...
@@ -2090,7 +2113,10 @@ static void test_attach_input(void)
cls
.
lpszClassName
=
"TestWindowClass"
;
if
(
!
RegisterClassA
(
&
cls
))
return
;
wnd_event
.
wait_event
=
NULL
;
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
attach_from
=
0
;
wnd_event
.
attach_to
=
0
;
wnd_event
.
setWindows
=
FALSE
;
if
(
!
wnd_event
.
start_event
)
{
...
...
@@ -2157,7 +2183,10 @@ static void test_attach_input(void)
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
wnd_event
.
wait_event
=
NULL
;
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
attach_from
=
0
;
wnd_event
.
attach_to
=
0
;
wnd_event
.
setWindows
=
TRUE
;
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
...
...
@@ -2213,6 +2242,86 @@ static void test_attach_input(void)
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
wnd_event
.
wait_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
attach_from
=
0
;
wnd_event
.
attach_to
=
0
;
wnd_event
.
setWindows
=
TRUE
;
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
ok
(
hThread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
tid
,
TRUE
);
ok
(
!
ret
,
"AttachThreadInput succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
)
/* <= Win XP */
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
AttachThreadInput
(
tid
,
GetCurrentThreadId
(),
TRUE
);
ok
(
!
ret
,
"AttachThreadInput succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
)
/* <= Win XP */
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetEvent
(
wnd_event
.
wait_event
);
ok
(
WaitForSingleObject
(
wnd_event
.
start_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
.
start_event
);
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
ret
,
"PostMessageA(WM_QUIT) error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
wnd_event
.
wait_event
=
NULL
;
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
attach_from
=
GetCurrentThreadId
();
wnd_event
.
attach_to
=
0
;
wnd_event
.
setWindows
=
FALSE
;
SetFocus
(
ourWnd
);
SetActiveWindow
(
ourWnd
);
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
ok
(
hThread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
wnd_event
.
start_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
.
start_event
);
ok
(
GetActiveWindow
()
==
ourWnd
,
"expected active %p, got %p
\n
"
,
ourWnd
,
GetActiveWindow
());
ok
(
GetFocus
()
==
ourWnd
,
"expected focus %p, got %p
\n
"
,
ourWnd
,
GetFocus
());
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
ret
,
"PostMessageA(WM_QUIT) error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
wnd_event
.
wait_event
=
NULL
;
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
attach_from
=
0
;
wnd_event
.
attach_to
=
GetCurrentThreadId
();
wnd_event
.
setWindows
=
FALSE
;
SetFocus
(
ourWnd
);
SetActiveWindow
(
ourWnd
);
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
ok
(
hThread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
wnd_event
.
start_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
.
start_event
);
ok
(
GetActiveWindow
()
==
ourWnd
,
"expected active %p, got %p
\n
"
,
ourWnd
,
GetActiveWindow
());
ok
(
GetFocus
()
==
ourWnd
,
"expected focus %p, got %p
\n
"
,
ourWnd
,
GetFocus
());
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
ret
,
"PostMessageA(WM_QUIT) error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
DestroyWindow
(
ourWnd
);
DestroyWindow
(
Wnd2
);
}
...
...
server/queue.c
View file @
4439cd43
...
...
@@ -2765,7 +2765,14 @@ DECL_HANDLER(attach_thread_input)
}
if
(
thread_from
!=
thread_to
)
{
if
(
req
->
attach
)
attach_thread_input
(
thread_from
,
thread_to
);
if
(
req
->
attach
)
{
if
((
thread_to
->
queue
||
thread_to
==
current
)
&&
(
thread_from
->
queue
||
thread_from
==
current
))
attach_thread_input
(
thread_from
,
thread_to
);
else
set_error
(
STATUS_INVALID_PARAMETER
);
}
else
{
if
(
thread_from
->
queue
&&
thread_to
->
queue
&&
...
...
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