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
17987c58
Commit
17987c58
authored
Aug 16, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Handle invalid dialog handles in IsDialogMessage().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9fe77b4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
dialog.c
dlls/user32/dialog.c
+3
-0
dialog.c
dlls/user32/tests/dialog.c
+50
-0
No files found.
dlls/user32/dialog.c
View file @
17987c58
...
...
@@ -1152,6 +1152,9 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
{
INT
dlgCode
;
if
(
!
IsWindow
(
hwndDlg
))
return
FALSE
;
if
(
CallMsgFilterW
(
msg
,
MSGF_DIALOGBOX
))
return
TRUE
;
hwndDlg
=
WIN_GetFullHandle
(
hwndDlg
);
...
...
dlls/user32/tests/dialog.c
View file @
17987c58
...
...
@@ -710,8 +710,23 @@ static void test_WM_NEXTDLGCTL(void)
DestroyWindow
(
g_hwndTestDlg
);
}
static
LRESULT
CALLBACK
hook_proc
(
INT
code
,
WPARAM
wParam
,
LPARAM
lParam
)
{
ok
(
0
,
"unexpected hook called, code %d
\n
"
,
code
);
return
CallNextHookEx
(
NULL
,
code
,
wParam
,
lParam
);
}
static
BOOL
g_MSGF_DIALOGBOX
;
static
LRESULT
CALLBACK
hook_proc2
(
INT
code
,
WPARAM
wParam
,
LPARAM
lParam
)
{
ok
(
code
==
MSGF_DIALOGBOX
,
"unexpected hook called, code %d
\n
"
,
code
);
g_MSGF_DIALOGBOX
=
code
==
MSGF_DIALOGBOX
;
return
CallNextHookEx
(
NULL
,
code
,
wParam
,
lParam
);
}
static
void
test_IsDialogMessage
(
void
)
{
HHOOK
hook
;
MSG
msg
;
g_hwndMain
=
CreateWindowA
(
"IsDialogMessageWindowClass"
,
"IsDialogMessageWindowClass"
,
...
...
@@ -723,11 +738,34 @@ static void test_IsDialogMessage(void)
assert
(
g_hwndButton1
);
assert
(
g_hwndButtonCancel
);
if
(
0
)
{
/* crashes on Windows */
IsDialogMessageA
(
NULL
,
NULL
);
IsDialogMessageA
(
g_hwndMain
,
NULL
);
}
/* The focus should initially be nowhere. The first TAB should take it
* to the first button. The second TAB should take it to the Cancel
* button.
*/
/* valid window, invalid message window */
hook
=
SetWindowsHookExA
(
WH_MSGFILTER
,
hook_proc2
,
NULL
,
GetCurrentThreadId
());
FormTabMsg
(
&
msg
,
(
HWND
)
0xbeefbeef
);
ok
(
!
IsDialogMessageA
(
g_hwndMain
,
&
msg
),
"expected failure
\n
"
);
ok
(
g_MSGF_DIALOGBOX
,
"hook wasn't called
\n
"
);
g_MSGF_DIALOGBOX
=
FALSE
;
UnhookWindowsHookEx
(
hook
);
hook
=
SetWindowsHookExA
(
WH_MSGFILTER
,
hook_proc
,
NULL
,
GetCurrentThreadId
());
FormTabMsg
(
&
msg
,
g_hwndMain
);
ok
(
!
IsDialogMessageA
(
NULL
,
&
msg
),
"expected failure
\n
"
);
ok
(
!
IsDialogMessageA
((
HWND
)
0xbeefbeef
,
&
msg
),
"expected failure
\n
"
);
UnhookWindowsHookEx
(
hook
);
ok
(
IsDialogMessageA
(
g_hwndMain
,
&
msg
),
"Did not handle first TAB
\n
"
);
ok
((
GetFocus
()
==
g_hwndButton1
),
"Focus did not move to first button
\n
"
);
FormTabMsg
(
&
msg
,
g_hwndButton1
);
...
...
@@ -737,6 +775,18 @@ static void test_IsDialogMessage(void)
FormEnterMsg
(
&
msg
,
g_hwndButtonCancel
);
ok
(
IsDialogMessageA
(
g_hwndMain
,
&
msg
),
"Did not handle the ENTER
\n
"
);
ok
(
g_terminated
,
"ENTER did not terminate
\n
"
);
/* matching but invalid window handles, NULL */
hook
=
SetWindowsHookExA
(
WH_MSGFILTER
,
hook_proc
,
NULL
,
GetCurrentThreadId
());
FormTabMsg
(
&
msg
,
NULL
);
ok
(
!
IsDialogMessageA
(
msg
.
hwnd
,
&
msg
),
"expected failure
\n
"
);
/* matching but invalid window handles, not NULL */
FormTabMsg
(
&
msg
,
(
HWND
)
0xbeefbeef
);
ok
(
!
IsDialogMessageA
(
msg
.
hwnd
,
&
msg
),
"expected failure
\n
"
);
UnhookWindowsHookEx
(
hook
);
}
...
...
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