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
f9736bcc
Commit
f9736bcc
authored
Oct 03, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/toolbar: Properly handle invalid arguments processing TB_ADDSTRING message.
parent
d0e0e69f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
toolbar.c
dlls/comctl32/tests/toolbar.c
+8
-0
toolbar.c
dlls/comctl32/toolbar.c
+22
-6
No files found.
dlls/comctl32/tests/toolbar.c
View file @
f9736bcc
...
...
@@ -505,6 +505,14 @@ static void test_add_string(void)
ok
(
ret
==
2
,
"TB_ADDSTRINGA - unexpected return %d
\n
"
,
ret
);
CHECK_STRING_TABLE
(
3
,
ret2
);
/* null instance handle */
ret
=
SendMessageA
(
hToolbar
,
TB_ADDSTRINGA
,
0
,
IDS_TBADD1
);
ok
(
ret
==
-
1
,
"TB_ADDSTRINGA - unexpected return %d
\n
"
,
ret
);
/* invalid instance handle */
ret
=
SendMessageA
(
hToolbar
,
TB_ADDSTRINGA
,
0xdeadbeef
,
IDS_TBADD1
);
ok
(
ret
==
-
1
,
"TB_ADDSTRINGA - unexpected return %d
\n
"
,
ret
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDSTRINGA
,
(
WPARAM
)
GetModuleHandle
(
NULL
),
IDS_TBADD1
);
ok
(
ret
==
3
,
"TB_ADDSTRINGA - unexpected return %d
\n
"
,
ret
);
CHECK_STRING_TABLE
(
3
,
ret2
);
...
...
dlls/comctl32/toolbar.c
View file @
f9736bcc
...
...
@@ -2900,13 +2900,27 @@ TOOLBAR_AddStringW (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
BOOL
fFirstString
=
(
infoPtr
->
nNumStrings
==
0
);
INT
nIndex
=
infoPtr
->
nNumStrings
;
if
(
hInstance
&&
IS_INTRESOURCE
(
lParam
))
{
TRACE
(
"%p, %lx
\n
"
,
hInstance
,
lParam
);
if
(
IS_INTRESOURCE
(
lParam
))
{
WCHAR
szString
[
MAX_RESOURCE_STRING_LENGTH
];
WCHAR
delimiter
;
WCHAR
*
next_delim
;
HRSRC
hrsrc
;
WCHAR
*
p
;
INT
len
;
TRACE
(
"adding string from resource!
\n
"
);
TRACE
(
"adding string from resource
\n
"
);
if
(
!
hInstance
)
return
-
1
;
hrsrc
=
FindResourceW
(
hInstance
,
MAKEINTRESOURCEW
((
LOWORD
(
lParam
)
>>
4
)
+
1
),
(
LPWSTR
)
RT_STRING
);
if
(
!
hrsrc
)
{
TRACE
(
"string not found in resources
\n
"
);
return
-
1
;
}
len
=
LoadStringW
(
hInstance
,
(
UINT
)
lParam
,
szString
,
MAX_RESOURCE_STRING_LENGTH
);
...
...
@@ -2915,7 +2929,7 @@ TOOLBAR_AddStringW (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
if
(
len
==
0
||
len
==
1
)
return
nIndex
;
TRACE
(
"
D
elimiter: 0x%x
\n
"
,
*
szString
);
TRACE
(
"
d
elimiter: 0x%x
\n
"
,
*
szString
);
delimiter
=
*
szString
;
p
=
szString
+
1
;
...
...
@@ -2941,7 +2955,7 @@ TOOLBAR_AddStringW (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
if
(
p
==
NULL
)
return
-
1
;
TRACE
(
"adding string(s) from array
!
\n
"
);
TRACE
(
"adding string(s) from array
\n
"
);
while
(
*
p
)
{
len
=
strlenW
(
p
);
...
...
@@ -2968,14 +2982,16 @@ TOOLBAR_AddStringA (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
INT
nIndex
;
INT
len
;
if
(
hInstance
&&
IS_INTRESOURCE
(
lParam
))
/* load from resources */
TRACE
(
"%p, %lx
\n
"
,
hInstance
,
lParam
);
if
(
IS_INTRESOURCE
(
lParam
))
/* load from resources */
return
TOOLBAR_AddStringW
(
infoPtr
,
hInstance
,
lParam
);
p
=
(
LPSTR
)
lParam
;
if
(
p
==
NULL
)
return
-
1
;
TRACE
(
"adding string(s) from array
!
\n
"
);
TRACE
(
"adding string(s) from array
\n
"
);
nIndex
=
infoPtr
->
nNumStrings
;
while
(
*
p
)
{
len
=
strlen
(
p
);
...
...
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