PATCH: combo_gettext
Marcus Meissner
marcus at jet.franken.de
Fri Apr 27 15:31:52 CDT 2001
Hi,
WM_GETTEXT in the combo box was rather broken.
- Potentially heapfreeing memory passed as lParam
- LB_GETTEXT has _different_ return values as WM_GETTEXT.
Now the 16bit printdialog is much happier.
Ciao, Marcus
Changelog:
do not HeapFree() memory not allocated by us in COMBO_Gettext
convert return value from LB_GETTEXT into COMBO_GetText.
Index: combo.c
===================================================================
RCS file: /home/wine/wine/controls/combo.c,v
retrieving revision 1.68
diff -u -r1.68 combo.c
--- combo.c 2001/04/17 17:29:31 1.68
+++ combo.c 2001/04/27 21:33:02
@@ -1485,6 +1485,9 @@
/***********************************************************************
* COMBO_GetText
+ *
+ * NOTE! LB_GETTEXT does not count terminating \0, WM_GETTEXT does.
+ * also LB_GETTEXT might return values < 0, WM_GETTEXT doesn't.
*/
static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unicode)
{
@@ -1526,8 +1529,8 @@
strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1);
lpText[N - 1] = '\0';
}
+ HeapFree( GetProcessHeap(), 0, lpBuffer );
}
- HeapFree( GetProcessHeap(), 0, lpBuffer );
}
}
else
@@ -1553,10 +1556,14 @@
strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1);
lpText[N - 1] = '\0';
}
+ HeapFree( GetProcessHeap(), 0, lpBuffer );
}
- HeapFree( GetProcessHeap(), 0, lpBuffer );
}
}
+ if (n<0)
+ n=0;
+ else
+ n++;
return (LRESULT)n;
}
}
More information about the wine-patches
mailing list