Re: [PATCH 1/4] comctl32/tooltips: Fix an obviously wrong structure size check
On 10/15/2009 01:36 AM, Nikolay Sivov wrote:
Changelog: - fix an obviously wrong structure size check
Hi Nikolay, +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 = SendMessageW(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti); The W-call won't work on Win9x/WinMe. diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 54600e8..6b483df 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -1076,7 +1076,7 @@ TOOLTIPS_AddToolA (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOA *lpToolInfo) } } - if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA)) + if (lpToolInfo->cbSize >= TTTOOLINFOW_V2_SIZE) Shouldn't that be "TTTOOLINFOA_V2_SIZE" ? @@ -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 >= TTTOOLINFOA_V2_SIZE) lpToolInfo->lParam = toolPtr->lParam; And shouldn't this be "TTTOOLINFOW_V2_SIZE" ? -- Cheers, Paul.
On 10/15/2009 07:54 AM, Paul Vriens wrote:
On 10/15/2009 01:36 AM, Nikolay Sivov wrote:
Changelog: - fix an obviously wrong structure size check
Hi Nikolay,
+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 = SendMessageW(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
The W-call won't work on Win9x/WinMe.
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 54600e8..6b483df 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -1076,7 +1076,7 @@ TOOLTIPS_AddToolA (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOA *lpToolInfo) } }
- if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA)) + if (lpToolInfo->cbSize >= TTTOOLINFOW_V2_SIZE)
Shouldn't that be "TTTOOLINFOA_V2_SIZE" ?
@@ -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 >= TTTOOLINFOA_V2_SIZE) lpToolInfo->lParam = toolPtr->lParam;
And shouldn't this be "TTTOOLINFOW_V2_SIZE" ?
And here the ok-text doesn't match the test: + ok(0xaaaaaaaa == ti.lParam, "Expected 0xdeadbeef, got %lx\n", ti.lParam); -- Cheers, Paul.
Paul Vriens wrote:
On 10/15/2009 07:54 AM, Paul Vriens wrote:
And here the ok-text doesn't match the test:
+ ok(0xaaaaaaaa == ti.lParam, "Expected 0xdeadbeef, got %lx\n", ti.lParam);
It was to quick, sorry about that.
Paul Vriens wrote:
On 10/15/2009 01:36 AM, Nikolay Sivov wrote:
Changelog: - fix an obviously wrong structure size check
Hi Nikolay,
+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 = SendMessageW(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
The W-call won't work on Win9x/WinMe. Ah, ok.
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 54600e8..6b483df 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -1076,7 +1076,7 @@ TOOLTIPS_AddToolA (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOA *lpToolInfo) } }
- if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA)) + if (lpToolInfo->cbSize >= TTTOOLINFOW_V2_SIZE)
Shouldn't that be "TTTOOLINFOA_V2_SIZE" ? It doesn't matter actually. Sizes are the same. I'll resend. @@ -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 >= TTTOOLINFOA_V2_SIZE) lpToolInfo->lParam = toolPtr->lParam;
And shouldn't this be "TTTOOLINFOW_V2_SIZE" ?
participants (2)
-
Nikolay Sivov -
Paul Vriens