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
04847e68
Commit
04847e68
authored
Sep 19, 2018
by
Sven Baars
Committed by
Alexandre Julliard
Sep 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Add NULL checks to SetWindowSubclass (Valgrind).
Signed-off-by:
Sven Baars
<
sven.wine@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
43f44ffb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
commctrl.c
dlls/comctl32/commctrl.c
+3
-0
subclass.c
dlls/comctl32/tests/subclass.c
+23
-8
No files found.
dlls/comctl32/commctrl.c
View file @
04847e68
...
...
@@ -1082,6 +1082,9 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
TRACE
(
"(%p, %p, %lx, %lx)
\n
"
,
hWnd
,
pfnSubclass
,
uIDSubclass
,
dwRef
);
if
(
!
hWnd
||
!
pfnSubclass
)
return
FALSE
;
/* Since the window procedure that we set here has two additional arguments,
* we can't simply set it as the new window procedure of the window. So we
* set our own window procedure and then calculate the other two arguments
...
...
dlls/comctl32/tests/subclass.c
View file @
04847e68
...
...
@@ -218,46 +218,61 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA
static
void
test_subclass
(
void
)
{
BOOL
ret
;
HWND
hwnd
=
CreateWindowExA
(
0
,
"TestSubclass"
,
"Test subclass"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
NULL
,
"failed to create test subclass wnd
\n
"
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
2
,
0
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
2
,
0
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
0
);
SendMessageA
(
hwnd
,
WM_USER
,
2
,
0
);
ok_sequence
(
Sub_BasicTest
,
"Basic"
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
2
,
DELETE_SELF
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
2
,
DELETE_SELF
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
1
);
ok_sequence
(
Sub_DeletedTest
,
"Deleted"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
0
);
ok_sequence
(
Sub_AfterDeletedTest
,
"After Deleted"
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
2
,
0
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
2
,
0
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
orig_proc_3
=
(
WNDPROC
)
SetWindowLongPtrA
(
hwnd
,
GWLP_WNDPROC
,
(
LONG_PTR
)
wnd_proc_3
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
0
);
SendMessageA
(
hwnd
,
WM_USER
,
2
,
0
);
ok_sequence
(
Sub_OldAfterNewTest
,
"Old after New"
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
0
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
0
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
0
);
ok_sequence
(
Sub_MixTest
,
"Mix"
);
/* Now the fun starts */
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
SEND_NEST
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
SEND_NEST
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
1
);
ok_sequence
(
Sub_MixAndNestTest
,
"Mix and nest"
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
SEND_NEST
|
DELETE_SELF
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
SEND_NEST
|
DELETE_SELF
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
1
);
ok_sequence
(
Sub_MixNestDelTest
,
"Mix, nest, del"
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
0
);
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
5
,
DELETE_PREV
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
4
,
0
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
ret
=
pSetWindowSubclass
(
hwnd
,
wnd_proc_sub
,
5
,
DELETE_PREV
);
ok
(
ret
==
TRUE
,
"Expected TRUE
\n
"
);
SendMessageA
(
hwnd
,
WM_USER
,
1
,
1
);
ok_sequence
(
Sub_MixDelPrevTest
,
"Mix and del prev"
);
ret
=
pSetWindowSubclass
(
NULL
,
wnd_proc_sub
,
1
,
0
);
ok
(
ret
==
FALSE
,
"Expected FALSE
\n
"
);
ret
=
pSetWindowSubclass
(
hwnd
,
NULL
,
1
,
0
);
ok
(
ret
==
FALSE
,
"Expected FALSE
\n
"
);
DestroyWindow
(
hwnd
);
}
...
...
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