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
f08747cb
Commit
f08747cb
authored
Aug 15, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tab: Init TCITEM fields in TCM_GETITEM when invalid index passed.
parent
031c497a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
tab.c
dlls/comctl32/tab.c
+6
-0
tab.c
dlls/comctl32/tests/tab.c
+54
-0
No files found.
dlls/comctl32/tab.c
View file @
f08747cb
...
...
@@ -2813,7 +2813,13 @@ TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode)
if
(
!
tabItem
)
return
FALSE
;
if
(
iItem
<
0
||
iItem
>=
infoPtr
->
uNumItem
)
{
/* init requested fields */
if
(
tabItem
->
mask
&
TCIF_IMAGE
)
tabItem
->
iImage
=
0
;
if
(
tabItem
->
mask
&
TCIF_PARAM
)
tabItem
->
lParam
=
0
;
if
(
tabItem
->
mask
&
TCIF_STATE
)
tabItem
->
dwState
=
0
;
return
FALSE
;
}
wineItem
=
TAB_GetItem
(
infoPtr
,
iItem
);
...
...
dlls/comctl32/tests/tab.c
View file @
f08747cb
...
...
@@ -842,12 +842,66 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
0
,
(
LPARAM
)
NULL
);
expect
(
FALSE
,
ret
);
/* passing invalid index should result in initialization to zero
for members mentioned in mask requested */
/* valid range here is [0,4] */
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_PARAM
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
5
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
ok
(
tcItem
.
lParam
==
0
,
"Expected zero lParam, got %lu
\n
"
,
tcItem
.
lParam
);
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_IMAGE
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
5
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
expect
(
0
,
tcItem
.
iImage
);
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_TEXT
;
tcItem
.
pszText
=
szText
;
szText
[
0
]
=
'a'
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
5
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
expect
(
'a'
,
szText
[
0
]);
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_STATE
;
tcItem
.
dwStateMask
=
0
;
tcItem
.
dwState
=
TCIS_BUTTONPRESSED
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
5
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
ok
(
tcItem
.
dwState
==
0
,
"Expected zero dwState, got %u
\n
"
,
tcItem
.
dwState
);
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_STATE
;
tcItem
.
dwStateMask
=
TCIS_BUTTONPRESSED
;
tcItem
.
dwState
=
TCIS_BUTTONPRESSED
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
5
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
ok
(
tcItem
.
dwState
==
0
,
"Expected zero dwState
\n
"
);
/* check with negative index to be sure */
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_PARAM
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
-
1
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
ok
(
tcItem
.
lParam
==
0
,
"Expected zero lParam, got %lu
\n
"
,
tcItem
.
lParam
);
memset
(
&
tcItem
,
0xcc
,
sizeof
(
tcItem
));
tcItem
.
mask
=
TCIF_PARAM
;
ret
=
SendMessage
(
hTab
,
TCM_GETITEM
,
-
2
,
(
LPARAM
)
&
tcItem
);
expect
(
FALSE
,
ret
);
ok
(
tcItem
.
lParam
==
0
,
"Expected zero lParam, got %lu
\n
"
,
tcItem
.
lParam
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
tcItem
.
mask
=
TCIF_TEXT
;
tcItem
.
pszText
=
&
szText
[
0
];
tcItem
.
cchTextMax
=
sizeof
(
szText
);
strcpy
(
szText
,
"New Label"
);
ok
(
SendMessage
(
hTab
,
TCM_SETITEM
,
0
,
(
LPARAM
)
&
tcItem
),
"Setting new item failed.
\n
"
);
ok
(
SendMessage
(
hTab
,
TCM_GETITEM
,
0
,
(
LPARAM
)
&
tcItem
),
"Getting item failed.
\n
"
);
expect_str
(
"New Label"
,
tcItem
.
pszText
);
...
...
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