Audit the combo control code
Dimitrie O. Paun
dpaun at rogers.com
Mon Oct 4 22:52:37 CDT 2004
ChangeLog
Audit combo control code.
Change [GS]etWindowLong{,Ptr}A to [GS]etWindowLong{,Ptr}W.
Index: dlls/user/combo.c
===================================================================
RCS file: /var/cvs/wine/dlls/user/combo.c,v
retrieving revision 1.1
diff -u -r1.1 combo.c
--- dlls/user/combo.c 31 Aug 2004 01:10:08 -0000 1.1
+++ dlls/user/combo.c 5 Oct 2004 03:50:34 -0000
@@ -17,7 +17,23 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * FIXME: roll up in Netscape 3.01.
+ * NOTES
+ *
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Oct. 4, 2004, by Dimitrie O. Paun.
+ *
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features, or bugs, please note them below.
+ *
+ * TODO:
+ * - GetComboBoxInfo()
+ * - ComboBox_[GS]etMinVisible()
+ * - CB_GETCOMBOBOXINFO
+ * - CB_GETMINVISIBLE, CB_SETMINVISIBLE
+ * - CB_LIMITTEXT
+ * - CB_SETTOPINDEX
+ * - Fix roll up in Netscape 3.01.
*/
#include <stdarg.h>
@@ -49,7 +65,7 @@
#define CB_NOTIFY( lphc, code ) \
(SendMessageW((lphc)->owner, WM_COMMAND, \
- MAKEWPARAM(GetWindowLongPtrA((lphc)->self,GWLP_ID), (code)), (LPARAM)(lphc)->self))
+ MAKEWPARAM(GetWindowLongPtrW((lphc)->self,GWLP_ID), (code)), (LPARAM)(lphc)->self))
#define CB_DISABLED( lphc ) (!IsWindowEnabled((lphc)->self))
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
@@ -139,23 +155,23 @@
if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
{
lphc->self = hwnd;
- SetWindowLongA( hwnd, 0, (LONG)lphc );
+ SetWindowLongW( hwnd, 0, (LONG)lphc );
/* some braindead apps do try to use scrollbar/border flags */
lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
- SetWindowLongA( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
+ SetWindowLongW( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
/*
* We also have to remove the client edge style to make sure
* we don't end-up with a non client area.
*/
- SetWindowLongA( hwnd, GWL_EXSTYLE,
- GetWindowLongA( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
+ SetWindowLongW( hwnd, GWL_EXSTYLE,
+ GetWindowLongW( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
lphc->dwStyle |= CBS_HASSTRINGS;
- if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
+ if( !(GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
lphc->wState |= CBF_NOTIFY;
TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
@@ -177,7 +193,7 @@
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
DestroyWindow( lphc->hWndLBox );
- SetWindowLongA( lphc->self, 0, 0 );
+ SetWindowLongW( lphc->self, 0, 0 );
HeapFree( GetProcessHeap(), 0, lphc );
}
return 0;
@@ -243,7 +259,7 @@
MEASUREITEMSTRUCT measureItem;
RECT clientRect;
INT originalItemHeight = iTextItemHeight;
- UINT id = (UINT)GetWindowLongPtrA( lphc->self, GWLP_ID );
+ UINT id = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
/*
* We use the client rect for the width of the item.
@@ -586,7 +602,7 @@
lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top,
hwnd, (HMENU)ID_CB_LISTBOX,
- (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), lphc );
+ (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), lphc );
else
lphc->hWndLBox = CreateWindowExA(lbeExStyle, "ComboLBox", NULL, lbeStyle,
lphc->droppedRect.left,
@@ -594,7 +610,7 @@
lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top,
hwnd, (HMENU)ID_CB_LISTBOX,
- (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), lphc );
+ (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), lphc );
if( lphc->hWndLBox )
{
@@ -620,14 +636,14 @@
lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top,
hwnd, (HMENU)ID_CB_EDIT,
- (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), NULL );
+ (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), NULL );
else
lphc->hWndEdit = CreateWindowExA(0, "Edit", NULL, lbeStyle,
lphc->textRect.left, lphc->textRect.top,
lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top,
hwnd, (HMENU)ID_CB_EDIT,
- (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), NULL );
+ (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), NULL );
if( !lphc->hWndEdit )
bEdit = FALSE;
@@ -739,7 +755,7 @@
{
DRAWITEMSTRUCT dis;
HRGN clipRegion;
- UINT ctlid = (UINT)GetWindowLongPtrA( lphc->self, GWLP_ID );
+ UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
/* setup state for DRAWITEM message. Owner will highlight */
if ( (lphc->wState & CBF_FOCUSED) &&
@@ -1314,7 +1330,7 @@
case (EN_CHANGE >> 8):
/*
* In some circumstances (when the selection of the combobox
- * is changed for example) we don't wans the EN_CHANGE notification
+ * is changed for example) we don't want the EN_CHANGE notification
* to be forwarded to the parent of the combobox. This code
* checks a flag that is set in these occasions and ignores the
* notification.
@@ -1402,7 +1418,7 @@
static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
{
HWND hWnd = lphc->self;
- UINT id = (UINT)GetWindowLongPtrA( hWnd, GWLP_ID );
+ UINT id = (UINT)GetWindowLongPtrW( hWnd, GWLP_ID );
TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
@@ -1509,7 +1525,7 @@
if (!count || !buf) return 0;
if( lphc->hWndLBox )
{
- INT idx = SendMessageA(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
+ INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
if (idx == LB_ERR) goto error;
length = SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, idx, 0 );
if (length == LB_ERR) goto error;
@@ -1821,7 +1837,7 @@
static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam, BOOL unicode )
{
- LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 );
+ LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongW( hwnd, 0 );
TRACE("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
More information about the wine-patches
mailing list