comctl32/tooltips: Fix an obviously wrong structure size check.
This commit is contained in:
parent
4901291990
commit
98a7d8cf9d
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue