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
98a7d8cf
Commit
98a7d8cf
authored
Oct 15, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tooltips: Fix an obviously wrong structure size check.
parent
49012919
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
14 deletions
+71
-14
tooltips.c
dlls/comctl32/tests/tooltips.c
+51
-0
tooltips.c
dlls/comctl32/tooltips.c
+16
-14
commctrl.h
include/commctrl.h
+4
-0
No files found.
dlls/comctl32/tests/tooltips.c
View file @
98a7d8cf
...
...
@@ -416,6 +416,56 @@ static void test_gettext(void)
DestroyWindow
(
hwnd
);
}
static
void
test_ttm_gettoolinfo
(
void
)
{
TTTOOLINFOA
ti
;
TTTOOLINFOW
tiW
;
HWND
hwnd
;
DWORD
r
;
hwnd
=
CreateWindowExA
(
0
,
TOOLTIPS_CLASSA
,
NULL
,
0
,
10
,
10
,
300
,
100
,
NULL
,
NULL
,
NULL
,
0
);
ti
.
cbSize
=
TTTOOLINFOA_V2_SIZE
;
ti
.
hwnd
=
NULL
;
ti
.
hinst
=
GetModuleHandleA
(
NULL
);
ti
.
uFlags
=
0
;
ti
.
uId
=
0x1234ABCD
;
ti
.
lpszText
=
NULL
;
ti
.
lParam
=
0xdeadbeef
;
GetClientRect
(
hwnd
,
&
ti
.
rect
);
r
=
SendMessageA
(
hwnd
,
TTM_ADDTOOLA
,
0
,
(
LPARAM
)
&
ti
);
ok
(
r
,
"Adding the tool to the tooltip failed
\n
"
);
ti
.
cbSize
=
TTTOOLINFOA_V2_SIZE
;
ti
.
lParam
=
0xaaaaaaaa
;
r
=
SendMessageA
(
hwnd
,
TTM_GETTOOLINFOA
,
0
,
(
LPARAM
)
&
ti
);
ok
(
r
,
"Getting tooltip info failed
\n
"
);
ok
(
0xdeadbeef
==
ti
.
lParam
,
"Expected 0xdeadbeef, got %lx
\n
"
,
ti
.
lParam
);
tiW
.
cbSize
=
TTTOOLINFOW_V2_SIZE
;
tiW
.
hwnd
=
NULL
;
tiW
.
uId
=
0x1234ABCD
;
tiW
.
lParam
=
0xaaaaaaaa
;
r
=
SendMessageA
(
hwnd
,
TTM_GETTOOLINFOW
,
0
,
(
LPARAM
)
&
tiW
);
ok
(
r
,
"Getting tooltip info failed
\n
"
);
ok
(
0xdeadbeef
==
tiW
.
lParam
,
"Expected 0xdeadbeef, got %lx
\n
"
,
tiW
.
lParam
);
ti
.
cbSize
=
TTTOOLINFOA_V2_SIZE
;
ti
.
uId
=
0x1234ABCD
;
ti
.
lParam
=
0xaaaaaaaa
;
r
=
SendMessageA
(
hwnd
,
TTM_SETTOOLINFOA
,
0
,
(
LPARAM
)
&
ti
);
ti
.
cbSize
=
TTTOOLINFOA_V2_SIZE
;
ti
.
lParam
=
0xdeadbeef
;
r
=
SendMessageA
(
hwnd
,
TTM_GETTOOLINFOA
,
0
,
(
LPARAM
)
&
ti
);
ok
(
r
,
"Getting tooltip info failed
\n
"
);
ok
(
0xaaaaaaaa
==
ti
.
lParam
,
"Expected 0xaaaaaaaa, got %lx
\n
"
,
ti
.
lParam
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
tooltips
)
{
InitCommonControls
();
...
...
@@ -423,4 +473,5 @@ START_TEST(tooltips)
test_create_tooltip
();
test_customdraw
();
test_gettext
();
test_ttm_gettoolinfo
();
}
dlls/comctl32/tooltips.c
View file @
98a7d8cf
...
...
@@ -1076,7 +1076,7 @@ TOOLTIPS_AddToolA (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOA *lpToolInfo)
}
}
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOA
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOA_V2_SIZE
)
toolPtr
->
lParam
=
lpToolInfo
->
lParam
;
/* install subclassing hook */
...
...
@@ -1164,7 +1164,7 @@ TOOLTIPS_AddToolW (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
}
}
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOW
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOW_V2_SIZE
)
toolPtr
->
lParam
=
lpToolInfo
->
lParam
;
/* install subclassing hook */
...
...
@@ -1337,7 +1337,7 @@ TOOLTIPS_EnumToolsA (const TOOLTIPS_INFO *infoPtr, UINT uIndex, LPTTTOOLINFOA lp
/* lpToolInfo->lpszText = toolPtr->lpszText; */
lpToolInfo
->
lpszText
=
NULL
;
/* FIXME */
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOA
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOA_V2_SIZE
)
lpToolInfo
->
lParam
=
toolPtr
->
lParam
;
return
TRUE
;
...
...
@@ -1369,7 +1369,7 @@ TOOLTIPS_EnumToolsW (const TOOLTIPS_INFO *infoPtr, UINT uIndex, LPTTTOOLINFOW lp
/* lpToolInfo->lpszText = toolPtr->lpszText; */
lpToolInfo
->
lpszText
=
NULL
;
/* FIXME */
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOW
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOW_V2_SIZE
)
lpToolInfo
->
lParam
=
toolPtr
->
lParam
;
return
TRUE
;
...
...
@@ -1416,7 +1416,7 @@ TOOLTIPS_GetCurrentToolA (const TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOA lpToolInfo
/* lpToolInfo->lpszText = toolPtr->lpszText; */
lpToolInfo
->
lpszText
=
NULL
;
/* FIXME */
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOA
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOA_V2_SIZE
)
lpToolInfo
->
lParam
=
toolPtr
->
lParam
;
return
TRUE
;
...
...
@@ -1448,7 +1448,7 @@ TOOLTIPS_GetCurrentToolW (const TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOW lpToolInfo
/* lpToolInfo->lpszText = toolPtr->lpszText; */
lpToolInfo
->
lpszText
=
NULL
;
/* FIXME */
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOW
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOW_V2_SIZE
)
lpToolInfo
->
lParam
=
toolPtr
->
lParam
;
return
TRUE
;
...
...
@@ -1602,7 +1602,7 @@ TOOLTIPS_GetToolInfoA (const TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOA lpToolInfo)
/* lpToolInfo->lpszText = toolPtr->lpszText; */
lpToolInfo
->
lpszText
=
NULL
;
/* FIXME */
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOA
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOA_V2_SIZE
)
lpToolInfo
->
lParam
=
toolPtr
->
lParam
;
return
TRUE
;
...
...
@@ -1637,7 +1637,7 @@ TOOLTIPS_GetToolInfoW (const TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOW lpToolInfo)
/* lpToolInfo->lpszText = toolPtr->lpszText; */
lpToolInfo
->
lpszText
=
NULL
;
/* FIXME */
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOW
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOW_V2_SIZE
)
lpToolInfo
->
lParam
=
toolPtr
->
lParam
;
return
TRUE
;
...
...
@@ -1660,7 +1660,7 @@ TOOLTIPS_HitTestA (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOA lptthit)
TRACE
(
"tool %d!
\n
"
,
nTool
);
/* copy tool data */
if
(
lptthit
->
ti
.
cbSize
>=
sizeof
(
TTTOOLINFOA
)
)
{
if
(
lptthit
->
ti
.
cbSize
>=
TTTOOLINFOA_V1_SIZE
)
{
toolPtr
=
&
infoPtr
->
tools
[
nTool
];
lptthit
->
ti
.
uFlags
=
toolPtr
->
uFlags
;
...
...
@@ -1670,7 +1670,8 @@ TOOLTIPS_HitTestA (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOA lptthit)
lptthit
->
ti
.
hinst
=
toolPtr
->
hinst
;
/* lptthit->ti.lpszText = toolPtr->lpszText; */
lptthit
->
ti
.
lpszText
=
NULL
;
/* FIXME */
lptthit
->
ti
.
lParam
=
toolPtr
->
lParam
;
if
(
lptthit
->
ti
.
cbSize
>=
TTTOOLINFOA_V2_SIZE
)
lptthit
->
ti
.
lParam
=
toolPtr
->
lParam
;
}
return
TRUE
;
...
...
@@ -1693,7 +1694,7 @@ TOOLTIPS_HitTestW (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit)
TRACE
(
"tool %d!
\n
"
,
nTool
);
/* copy tool data */
if
(
lptthit
->
ti
.
cbSize
>=
sizeof
(
TTTOOLINFOW
)
)
{
if
(
lptthit
->
ti
.
cbSize
>=
TTTOOLINFOW_V1_SIZE
)
{
toolPtr
=
&
infoPtr
->
tools
[
nTool
];
lptthit
->
ti
.
uFlags
=
toolPtr
->
uFlags
;
...
...
@@ -1703,7 +1704,8 @@ TOOLTIPS_HitTestW (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit)
lptthit
->
ti
.
hinst
=
toolPtr
->
hinst
;
/* lptthit->ti.lpszText = toolPtr->lpszText; */
lptthit
->
ti
.
lpszText
=
NULL
;
/* FIXME */
lptthit
->
ti
.
lParam
=
toolPtr
->
lParam
;
if
(
lptthit
->
ti
.
cbSize
>=
TTTOOLINFOW_V2_SIZE
)
lptthit
->
ti
.
lParam
=
toolPtr
->
lParam
;
}
return
TRUE
;
...
...
@@ -2018,7 +2020,7 @@ TOOLTIPS_SetToolInfoA (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOA *lpToolInfo)
}
}
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOA
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOA_V2_SIZE
)
toolPtr
->
lParam
=
lpToolInfo
->
lParam
;
return
0
;
...
...
@@ -2072,7 +2074,7 @@ TOOLTIPS_SetToolInfoW (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
}
}
if
(
lpToolInfo
->
cbSize
>=
sizeof
(
TTTOOLINFOW
)
)
if
(
lpToolInfo
->
cbSize
>=
TTTOOLINFOW_V2_SIZE
)
toolPtr
->
lParam
=
lpToolInfo
->
lParam
;
if
(
infoPtr
->
nCurrentTool
==
nTool
)
...
...
include/commctrl.h
View file @
98a7d8cf
...
...
@@ -1774,6 +1774,10 @@ typedef struct tagTOOLINFOW {
#define TTTOOLINFOA_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpszText)
#define TTTOOLINFOW_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpszText)
#define TTTOOLINFO_V1_SIZE CCSIZEOF_STRUCT(WINELIB_NAME_AW(TTTOOLINFO), lpszText)
#define TTTOOLINFOA_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lParam)
#define TTTOOLINFOW_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lParam)
#define TTTOOLINFOA_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpReserved)
#define TTTOOLINFOW_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpReserved)
typedef
struct
_TT_HITTESTINFOA
{
...
...
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