[PATCH 1/4] comctl32/tooltips: Fix an obviously wrong structure size check

Paul Vriens paul.vriens.wine at gmail.com
Thu Oct 15 00:54:13 CDT 2009


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.



More information about the wine-devel mailing list