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
375f60b0
Commit
375f60b0
authored
Mar 11, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Mar 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Add tests for TB_GETSTRING, fix NULL pointer access.
parent
7e63f953
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
toolbar.c
dlls/comctl32/tests/toolbar.c
+35
-0
toolbar.c
dlls/comctl32/toolbar.c
+5
-2
No files found.
dlls/comctl32/tests/toolbar.c
View file @
375f60b0
...
...
@@ -40,6 +40,8 @@ static BOOL g_fExpectedHotItemOld;
static
BOOL
g_fExpectedHotItemNew
;
static
DWORD
g_dwExpectedDispInfoMask
;
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
#define check_rect(name, val, exp) ok(val.top == exp.top && val.bottom == exp.bottom && \
val.left == exp.left && val.right == exp.right, "invalid rect (" name ") (%d,%d) (%d,%d) - expected (%d,%d) (%d,%d)\n", \
val.left, val.top, val.right, val.bottom, exp.left, exp.top, exp.right, exp.bottom);
...
...
@@ -1088,6 +1090,38 @@ static void test_setrows(void)
DestroyWindow
(
hToolbar
);
}
static
void
test_getstring
(
void
)
{
HWND
hToolbar
=
NULL
;
char
str
[
10
];
WCHAR
strW
[
10
];
static
const
char
answer
[]
=
"STR"
;
static
const
WCHAR
answerW
[]
=
{
'S'
,
'T'
,
'R'
,
0
};
INT
r
;
hToolbar
=
CreateWindowExA
(
0
,
TOOLBARCLASSNAME
,
NULL
,
WS_CHILD
|
WS_VISIBLE
,
0
,
0
,
0
,
0
,
hMainWnd
,
(
HMENU
)
5
,
GetModuleHandle
(
NULL
),
NULL
);
ok
(
hToolbar
!=
NULL
,
"Toolbar creation problem
\n
"
);
r
=
SendMessage
(
hToolbar
,
TB_GETSTRING
,
MAKEWPARAM
(
0
,
0
),
(
LPARAM
)
NULL
);
expect
(
-
1
,
r
);
r
=
SendMessage
(
hToolbar
,
TB_GETSTRINGW
,
MAKEWPARAM
(
0
,
0
),
(
LPARAM
)
NULL
);
expect
(
-
1
,
r
);
r
=
SendMessage
(
hToolbar
,
TB_ADDSTRING
,
0
,
(
LPARAM
)
answer
);
expect
(
0
,
r
);
r
=
SendMessage
(
hToolbar
,
TB_GETSTRING
,
MAKEWPARAM
(
0
,
0
),
(
LPARAM
)
NULL
);
todo_wine
expect
(
strlen
(
answer
),
r
);
r
=
SendMessage
(
hToolbar
,
TB_GETSTRINGW
,
MAKEWPARAM
(
0
,
0
),
(
LPARAM
)
NULL
);
todo_wine
expect
(
strlen
(
answer
),
r
);
r
=
SendMessage
(
hToolbar
,
TB_GETSTRING
,
MAKEWPARAM
(
sizeof
(
str
),
0
),
(
LPARAM
)
str
);
todo_wine
expect
(
strlen
(
answer
),
r
);
expect
(
0
,
lstrcmp
(
answer
,
str
));
r
=
SendMessage
(
hToolbar
,
TB_GETSTRINGW
,
MAKEWPARAM
(
sizeof
(
strW
),
0
),
(
LPARAM
)
strW
);
todo_wine
expect
(
strlen
(
answer
),
r
);
expect
(
0
,
lstrcmpW
(
answerW
,
strW
));
DestroyWindow
(
hToolbar
);
}
START_TEST
(
toolbar
)
{
WNDCLASSA
wc
;
...
...
@@ -1122,6 +1156,7 @@ START_TEST(toolbar)
test_createtoolbarex
();
test_dispinfo
();
test_setrows
();
test_getstring
();
PostQuitMessage
(
0
);
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
...
...
dlls/comctl32/toolbar.c
View file @
375f60b0
...
...
@@ -5211,8 +5211,11 @@ TOOLBAR_GetStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
len
=
min
(
len
,
strlenW
(
infoPtr
->
strings
[
iString
]));
ret
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
memcpy
(
str
,
infoPtr
->
strings
[
iString
],
ret
);
str
[
len
]
=
'\0'
;
if
(
str
)
{
memcpy
(
str
,
infoPtr
->
strings
[
iString
],
ret
);
str
[
len
]
=
'\0'
;
}
TRACE
(
"returning %s
\n
"
,
debugstr_w
(
str
));
}
...
...
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