<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>reactos/lib/user32/controls</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">listbox.c</a></tt></td><td align="right" id="added">+333</td><td align="right" id="removed">-104</td><td nowrap="nowrap" align="center"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls/listbox.c?rev=1.17&amp;content-type=text/x-cvsweb-markup">1.17</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls/listbox.c.diff?r1=text&amp;tr1=1.17&amp;r2=text&amp;tr2=1.18&amp;f=h">-&gt;</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls/listbox.c?rev=1.18&amp;content-type=text/x-cvsweb-markup">1.18</a></td></tr>
</table>
<div class="tasklist"><ul>
<li><a href="#task1">FIXME("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr-&gt;nb_items);</a></li>
</ul></div>
<pre class="comment">
Sync with wine-20040724
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos">reactos</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib">lib</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32">user32</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls">controls</a><br /></span>
<div class="fileheader"><big><b>listbox.c</b></big> <small id="info"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls/listbox.c?rev=1.17&amp;content-type=text/x-cvsweb-markup">1.17</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls/listbox.c.diff?r1=text&amp;tr1=1.17&amp;r2=text&amp;tr2=1.18&amp;f=h">-&gt;</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/lib/user32/controls/listbox.c?rev=1.18&amp;content-type=text/x-cvsweb-markup">1.18</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.17 -r1.18
--- listbox.c        16 May 2004 19:31:06 -0000        1.17
+++ listbox.c        24 Jul 2004 00:40:01 -0000        1.18
@@ -1,14 +1,22 @@
</small></pre><pre class="diff" id="removed">-/* $Id: listbox.c,v 1.17 2004/05/16 19:31:06 navaraf Exp $
</pre><pre class="diff" id="added">+/*
+ * Listbox controls
</pre><pre class="diff" id="context">  *
</pre><pre class="diff" id="removed">- * COPYRIGHT:        See COPYING in the top level directory
- * PROJECT:          ReactOS User32
- * PURPOSE:          ListBox controls
- * FILE:             lib/user32/controls/listbox.c
- * PROGRAMER:        Andrew Greenwood
- * REVISION HISTORY: 2003/08/17 Created
- * NOTES:            Adapted from Wine
</pre><pre class="diff" id="added">+ * Copyright 1996 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
</pre><pre class="diff" id="context">  */
</pre><pre class="diff" id="removed">-
</pre><pre class="diff" id="context"> #define NDEBUG
 #include &lt;string.h&gt;
 #include &lt;stdlib.h&gt;
</pre><pre class="diff"><small id="info">@@ -18,14 +26,8 @@
</small></pre><pre class="diff" id="context"> #include "user32/regcontrol.h"
 #include "wine/debug.h"
 
</pre><pre class="diff" id="removed">-/* Unimplemented yet:
- * - LBS_USETABSTOPS
- * - Locale handling
- *
- * Probably needs improvement:
- * - LBS_NOSEL
- */
-
</pre><pre class="diff" id="added">+#ifdef __REACTOS__
+#include "wine/unicode.h"
</pre><pre class="diff" id="context"> /* Start of hack section -------------------------------- */
 
 typedef short *LPINT16;
</pre><pre class="diff"><small id="info">@@ -44,6 +46,15 @@
</small></pre><pre class="diff" id="context"> WINBOOL STDCALL KillSystemTimer(HWND,UINT_PTR);
 
 /* End of hack section -------------------------------- */
</pre><pre class="diff" id="added">+#endif
+
+/* Unimplemented yet:
+ * - LBS_USETABSTOPS
+ * - Locale handling
+ *
+ * Probably needs improvement:
+ * - LBS_NOSEL
+ */
</pre><pre class="diff" id="context"> 
 /* Items array granularity */
 #define LB_ARRAY_GRANULARITY 16
</pre><pre class="diff"><small id="info">@@ -135,6 +146,7 @@
</small></pre><pre class="diff" id="context">  */
 const struct builtin_class_descr LISTBOX_builtin_class =
 {
</pre><pre class="diff" id="added">+#ifdef __REACTOS__
</pre><pre class="diff" id="context">     L"ListBox",            /* name */
     CS_DBLCLKS /*| CS_PARENTDC*/,  /* style */
     (WNDPROC)ListBoxWndProcW,      /* procW */
</pre><pre class="diff"><small id="info">@@ -142,6 +154,15 @@
</small></pre><pre class="diff" id="context">     sizeof(LB_DESCR *),   /* extra */
     (LPCWSTR) IDC_ARROW,           /* cursor */
     0                     /* brush */
</pre><pre class="diff" id="added">+#else
+    "ListBox",            /* name */
+    CS_DBLCLKS /*| CS_PARENTDC*/,  /* style */
+    ListBoxWndProcA,      /* procA */
+    ListBoxWndProcW,      /* procW */
+    sizeof(LB_DESCR *),   /* extra */
+    IDC_ARROW,            /* cursor */
+    0                     /* brush */
+#endif
</pre><pre class="diff" id="context"> };
 
 
</pre><pre class="diff"><small id="info">@@ -150,6 +171,7 @@
</small></pre><pre class="diff" id="context">  */
 const struct builtin_class_descr COMBOLBOX_builtin_class =
 {
</pre><pre class="diff" id="added">+#ifdef __REACTOS__
</pre><pre class="diff" id="context">     L"ComboLBox",          /* name */
     CS_DBLCLKS | CS_SAVEBITS,  /* style */
     (WNDPROC)ComboLBWndProcW,      /* procW */
</pre><pre class="diff"><small id="info">@@ -157,9 +179,26 @@
</small></pre><pre class="diff" id="context">     sizeof(LB_DESCR *),   /* extra */
     (LPCWSTR) IDC_ARROW,           /* cursor */
     0                     /* brush */
</pre><pre class="diff" id="added">+#else
+    "ComboLBox",          /* name */
+    CS_DBLCLKS | CS_SAVEBITS,  /* style */
+    ComboLBWndProcA,      /* procA */
+    ComboLBWndProcW,      /* procW */
+    sizeof(LB_DESCR *),   /* extra */
+    IDC_ARROW,            /* cursor */
+    0                     /* brush */
+#endif
</pre><pre class="diff" id="context"> };
 
</pre><pre class="diff" id="removed">-#if 0
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+/* check whether app is a Win 3.1 app */
+inline static BOOL is_old_app( HWND hwnd )
+{
+    return (GetExpWinVer16( GetWindowLongA(hwnd,GWL_HINSTANCE) ) &amp; 0xFF00 ) == 0x0300;
+}
+#endif
+
+
</pre><pre class="diff" id="context"> /***********************************************************************
  *           LISTBOX_Dump
  */
</pre><pre class="diff"><small id="info">@@ -175,14 +214,10 @@
</small></pre><pre class="diff" id="context">     for (i = 0, item = descr-&gt;items; i &lt; descr-&gt;nb_items; i++, item++)
     {
         TRACE( "%4d: %-40s %d %08lx %3d\n",
</pre><pre class="diff" id="removed">-               i, 
-                           debugstr_w(item-&gt;str), 
-                           item-&gt;selected, 
-                           item-&gt;data, 
-                           item-&gt;height );
</pre><pre class="diff" id="added">+               i, debugstr_w(item-&gt;str), item-&gt;selected, item-&gt;data, item-&gt;height );
</pre><pre class="diff" id="context">     }
 }
</pre><pre class="diff" id="removed">-#endif
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> 
 /***********************************************************************
  *           LISTBOX_GetCurrentPageSize
</pre><pre class="diff"><small id="info">@@ -408,6 +443,7 @@
</small></pre><pre class="diff" id="context">             remaining = 0;
         if ((descr-&gt;height &gt; descr-&gt;item_height) &amp;&amp; remaining)
         {
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
</pre><pre class="diff" id="context">             if (is_old_app(hwnd))
             { /* give a margin for error to 16 bits programs - if we need
                  less than the height of the nonclient area, round to the
</pre><pre class="diff"><small id="info">@@ -416,6 +452,7 @@
</small></pre><pre class="diff" id="context">                 if ((descr-&gt;item_height - remaining) &lt;= ncheight)
                     remaining = remaining - descr-&gt;item_height;
             }
</pre><pre class="diff" id="added">+#endif
</pre><pre class="diff" id="context">             TRACE("[%p]: changing height %d -&gt; %d\n",
                   hwnd, descr-&gt;height, descr-&gt;height - remaining );
             SetWindowPos( hwnd, 0, 0, 0, rect.right - rect.left,
</pre><pre class="diff"><small id="info">@@ -558,7 +595,7 @@
</small></pre><pre class="diff" id="context">             if (action == ODA_FOCUS)
                 DrawFocusRect( hdc, rect );
             else
</pre><pre class="diff" id="removed">-<span id="removedchars">//</span>                FIXME("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr-&gt;nb_items);
</pre><pre class="diff" id="added"><a name="task1" />+                <span class="task">FIXME</span>("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr-&gt;nb_items);
</pre><pre class="diff" id="context">             return;
         }
 
</pre><pre class="diff"><small id="info">@@ -614,14 +651,14 @@
</small></pre><pre class="diff" id="context">         else if (!(descr-&gt;style &amp; LBS_USETABSTOPS))
             ExtTextOutW( hdc, rect-&gt;left + 1, rect-&gt;top,
                          ETO_OPAQUE | ETO_CLIPPED, rect, item-&gt;str,
</pre><pre class="diff" id="removed">-                         <span id="removedchars">wcslen</span>(item-&gt;str), NULL );
</pre><pre class="diff" id="added">+                         <span id="addedchars">strlenW</span>(item-&gt;str), NULL );
</pre><pre class="diff" id="context">         else
         {
             /* Output empty string to paint background in the full width. */
             ExtTextOutW( hdc, rect-&gt;left + 1, rect-&gt;top,
                          ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL );
             TabbedTextOutW( hdc, rect-&gt;left + 1 , rect-&gt;top,
</pre><pre class="diff" id="removed">-                            item-&gt;str, <span id="removedchars">wcslen</span>(item-&gt;str),
</pre><pre class="diff" id="added">+                            item-&gt;str, <span id="addedchars">strlenW</span>(item-&gt;str),
</pre><pre class="diff" id="context">                             descr-&gt;nb_tabs, descr-&gt;tabs, 0);
         }
         if (item &amp;&amp; item-&gt;selected)
</pre><pre class="diff"><small id="info">@@ -708,10 +745,17 @@
</small></pre><pre class="diff" id="context"> 
     nb_items += LB_ARRAY_GRANULARITY - 1;
     nb_items -= (nb_items % LB_ARRAY_GRANULARITY);
</pre><pre class="diff" id="removed">-    if (descr-&gt;items)
</pre><pre class="diff" id="added">+    if (descr-&gt;items)<span id="addedchars">&nbsp;{</span>
</pre><pre class="diff" id="context">         nb_items += HeapSize( GetProcessHeap(), 0, descr-&gt;items ) / sizeof(*item);
</pre><pre class="diff" id="removed">-    if (!(item = HeapReAlloc( GetProcessHeap(), 0, descr-&gt;items,
-                              nb_items * sizeof(LB_ITEMDATA) )))
</pre><pre class="diff" id="added">+        item = HeapReAlloc( GetProcessHeap(), 0, descr-&gt;items,
+                              nb_items * sizeof(LB_ITEMDATA));
+    }
+    else {
+        item = HeapAlloc( GetProcessHeap(), 0,
+                              nb_items * sizeof(LB_ITEMDATA));
+    }
+
+    if (!item)
</pre><pre class="diff" id="context">     {
         SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
         return LB_ERRSPACE;
</pre><pre class="diff"><small id="info">@@ -738,10 +782,11 @@
</small></pre><pre class="diff" id="context">     if (!(descr-&gt;tabs = (INT *)HeapAlloc( GetProcessHeap(), 0,
                                             descr-&gt;nb_tabs * sizeof(INT) )))
         return FALSE;
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
</pre><pre class="diff" id="context">     if (short_ints)
     {
         INT i;
</pre><pre class="diff" id="removed">-        PUSHORT p = (PUSHORT)tabs;
</pre><pre class="diff" id="added">+        LPINT16 p = (LPINT16)tabs;
</pre><pre class="diff" id="context"> 
         TRACE("[%p]: settabstops ", hwnd );
         for (i = 0; i &lt; descr-&gt;nb_tabs; i++) {
</pre><pre class="diff"><small id="info">@@ -751,6 +796,9 @@
</small></pre><pre class="diff" id="context">         if (TRACE_ON(listbox)) TRACE("\n");
     }
     else memcpy( descr-&gt;tabs, tabs, descr-&gt;nb_tabs * sizeof(INT) );
</pre><pre class="diff" id="added">+#else
+    memcpy( descr-&gt;tabs, tabs, descr-&gt;nb_tabs * sizeof(INT) );
+#endif
</pre><pre class="diff" id="context">     /* FIXME: repaint the window? */
     return TRUE;
 }
</pre><pre class="diff"><small id="info">@@ -765,15 +813,15 @@
</small></pre><pre class="diff" id="context">     if (HAS_STRINGS(descr))
     {
         if (!lParam)
</pre><pre class="diff" id="removed">-            return <span id="removedchars">wcslen</span>(descr-&gt;items[index].str);
</pre><pre class="diff" id="added">+            return <span id="addedchars">strlenW</span>(descr-&gt;items[index].str);
</pre><pre class="diff" id="context"> 
         TRACE("index %d (0x%04x) %s\n", index, index, debugstr_w(descr-&gt;items[index].str));
 
         if(unicode)
         {
             LPWSTR buffer = (LPWSTR)lParam;
</pre><pre class="diff" id="removed">-            wcscpy( buffer, descr-&gt;items[index].str );
-            return wcslen(buffer);
</pre><pre class="diff" id="added">+            strcpyW( buffer, descr-&gt;items[index].str );
+            return strlenW(buffer);
</pre><pre class="diff" id="context">         }
         else
         {
</pre><pre class="diff"><small id="info">@@ -906,20 +954,20 @@
</small></pre><pre class="diff" id="context"> #define CHECK_DRIVE(item) \
     if ((item)-&gt;str[0] == '[') \
     { \
</pre><pre class="diff" id="removed">-        if (!_wcsnicmp( str, (item)-&gt;str+1, len )) return i; \
-        if (((item)-&gt;str[1] == '-') &amp;&amp; !_wcsnicmp(str, (item)-&gt;str+2, len)) \
</pre><pre class="diff" id="added">+        if (!strncmpiW( str, (item)-&gt;str+1, len )) return i; \
+        if (((item)-&gt;str[1] == '-') &amp;&amp; !strncmpiW(str, (item)-&gt;str+2, len)) \
</pre><pre class="diff" id="context">         return i; \
     }
 
</pre><pre class="diff" id="removed">-            INT len = <span id="removedchars">wcslen</span>(str);
</pre><pre class="diff" id="added">+            INT len = <span id="addedchars">strlenW</span>(str);
</pre><pre class="diff" id="context">             for (i = start + 1; i &lt; descr-&gt;nb_items; i++, item++)
             {
</pre><pre class="diff" id="removed">-               if (!<span id="removedchars">_wcsnicmp</span>( str, item-&gt;str, len )) return i;
</pre><pre class="diff" id="added">+               if (!<span id="addedchars">strncmpiW</span>( str, item-&gt;str, len )) return i;
</pre><pre class="diff" id="context">                CHECK_DRIVE(item);
             }
             for (i = 0, item = descr-&gt;items; i &lt;= start; i++, item++)
             {
</pre><pre class="diff" id="removed">-               if (!<span id="removedchars">_wcsnicmp</span>( str, item-&gt;str, len )) return i;
</pre><pre class="diff" id="added">+               if (!<span id="addedchars">strncmpiW</span>( str, item-&gt;str, len )) return i;
</pre><pre class="diff" id="context">                CHECK_DRIVE(item);
             }
 #undef CHECK_DRIVE
</pre><pre class="diff"><small id="info">@@ -955,16 +1003,34 @@
</small></pre><pre class="diff" id="context">     return count;
 }
 
</pre><pre class="diff" id="added">+
+#ifndef __REACTOS__
+/***********************************************************************
+ *           LISTBOX_GetSelItems16
+ */
+static LRESULT LISTBOX_GetSelItems16( LB_DESCR *descr, INT16 max, LPINT16 array )
+{
+    INT i, count;
+    LB_ITEMDATA *item = descr-&gt;items;
+
+    if (!(descr-&gt;style &amp; LBS_MULTIPLESEL)) return LB_ERR;
+    for (i = count = 0; (i &lt; descr-&gt;nb_items) &amp;&amp; (count &lt; max); i++, item++)
+        if (item-&gt;selected) array[count++] = (INT16)i;
+    return count;
+}
+#endif
+
+
</pre><pre class="diff" id="context"> /***********************************************************************
  *           LISTBOX_GetSelItems
  */
</pre><pre class="diff" id="removed">-static LRESULT LISTBOX_GetSelItems( LB_DESCR *descr, INT max<span id="removedchars">count</span>, LPINT array )
</pre><pre class="diff" id="added">+static LRESULT LISTBOX_GetSelItems( LB_DESCR *descr, INT max, LPINT array )
</pre><pre class="diff" id="context"> {
     INT i, count;
     LB_ITEMDATA *item = descr-&gt;items;
 
     if (!(descr-&gt;style &amp; LBS_MULTIPLESEL)) return LB_ERR;
</pre><pre class="diff" id="removed">-    for (i = count = 0; (i &lt; descr-&gt;nb_items) &amp;&amp; (count &lt; max<span id="removedchars">count</span>); i++, item++)
</pre><pre class="diff" id="added">+    for (i = count = 0; (i &lt; descr-&gt;nb_items) &amp;&amp; (count &lt; max); i++, item++)
</pre><pre class="diff" id="context">         if (item-&gt;selected) array[count++] = i;
     return count;
 }
</pre><pre class="diff"><small id="info">@@ -1114,6 +1180,13 @@
</small></pre><pre class="diff" id="context">     }
 }
 
</pre><pre class="diff" id="added">+static void LISTBOX_InvalidateItemRect( HWND hwnd, LB_DESCR *descr, INT index )
+{
+    RECT rect;
+
+    if (LISTBOX_GetItemRect( descr, index, &amp;rect ) == 1)
+        InvalidateRect( hwnd, &amp;rect, TRUE );
+}
</pre><pre class="diff" id="context"> 
 /***********************************************************************
  *           LISTBOX_GetItemHeight
</pre><pre class="diff"><small id="info">@@ -1174,8 +1247,14 @@
</small></pre><pre class="diff" id="context">     descr-&gt;horz_pos = pos;
     LISTBOX_UpdateScroll( hwnd, descr );
     if (abs(diff) &lt; descr-&gt;width)
</pre><pre class="diff" id="added">+    {
+        RECT rect;
+        /* Invalidate the focused item so it will be repainted correctly */
+        if (LISTBOX_GetItemRect( descr, descr-&gt;focus_item, &amp;rect ) == 1)
+            InvalidateRect( hwnd, &amp;rect, TRUE );
</pre><pre class="diff" id="context">         ScrollWindowEx( hwnd, diff, 0, NULL, NULL, 0, NULL,
                           SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
</pre><pre class="diff" id="added">+    }
</pre><pre class="diff" id="context">     else
         InvalidateRect( hwnd, NULL, TRUE );
 }
</pre><pre class="diff"><small id="info">@@ -1332,7 +1411,7 @@
</small></pre><pre class="diff" id="context">         {
             if (descr-&gt;items[i].selected) continue;
             descr-&gt;items[i].selected = TRUE;
</pre><pre class="diff" id="removed">-            LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
</pre><pre class="diff" id="added">+            LISTBOX_InvalidateItemRect(hwnd, descr, i);
</pre><pre class="diff" id="context">         }
         LISTBOX_SetCaretIndex( hwnd, descr, last, TRUE );
     }
</pre><pre class="diff"><small id="info">@@ -1342,7 +1421,7 @@
</small></pre><pre class="diff" id="context">         {
             if (!descr-&gt;items[i].selected) continue;
             descr-&gt;items[i].selected = FALSE;
</pre><pre class="diff" id="removed">-            LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
</pre><pre class="diff" id="added">+            LISTBOX_InvalidateItemRect(hwnd, descr, i);
</pre><pre class="diff" id="context">         }
     }
     return LB_OKAY;
</pre><pre class="diff"><small id="info">@@ -1447,37 +1526,25 @@
</small></pre><pre class="diff" id="context">     INT max_items;
     INT oldfocus = descr-&gt;focus_item;
 
</pre><pre class="diff" id="removed">-    if (index == -1) 
-                index = descr-&gt;nb_items;
-    else if ((index &lt; 0) || (index &gt; descr-&gt;nb_items)) 
-                return LB_ERR;
-
-    if (!descr-&gt;items) 
-                max_items = 0;
-    else 
-                max_items = HeapSize( GetProcessHeap(), 0, descr-&gt;items ) / sizeof(*item);
-
</pre><pre class="diff" id="added">+    if (index == -1) index = descr-&gt;nb_items;
+    else if ((index &lt; 0) || (index &gt; descr-&gt;nb_items)) return LB_ERR;
+    if (!descr-&gt;items) max_items = 0;
+    else max_items = HeapSize( GetProcessHeap(), 0, descr-&gt;items ) / sizeof(*item);
</pre><pre class="diff" id="context">     if (descr-&gt;nb_items == max_items)
     {
         /* We need to grow the array */
         max_items += LB_ARRAY_GRANULARITY;
</pre><pre class="diff" id="removed">-       
-                /* In WINE it seems to be possible to use HeapReAlloc for allocating new blocks
-                of memory. This doesn't work in Windows */
-
-                if (descr-&gt;items&amp;&amp;!(item = HeapReAlloc( GetProcessHeap(), 0, descr-&gt;items,
-                                  max_items * sizeof(LB_ITEMDATA) )))
-        {
-            SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
-            return LB_ERRSPACE;
-        }
-                else if((!descr-&gt;items)&amp;&amp;!(item = HeapAlloc( GetProcessHeap(), 0,
-                                  max_items * sizeof(LB_ITEMDATA) )))
</pre><pre class="diff" id="added">+        if (descr-&gt;items)
+                item = HeapReAlloc( GetProcessHeap(), 0, descr-&gt;items,
+                                  max_items * sizeof(LB_ITEMDATA) );
+        else
+            item = HeapAlloc( GetProcessHeap(), 0,
+                                  max_items * sizeof(LB_ITEMDATA) );
+        if (!item)
</pre><pre class="diff" id="context">         {
             SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
             return LB_ERRSPACE;
         }
</pre><pre class="diff" id="removed">-
</pre><pre class="diff" id="context">         descr-&gt;items = item;
     }
 
</pre><pre class="diff"><small id="info">@@ -1552,12 +1619,12 @@
</small></pre><pre class="diff" id="context">     {
         static const WCHAR empty_stringW[] = { 0 };
         if (!str) str = empty_stringW;
</pre><pre class="diff" id="removed">-        if (!(new_str = HeapAlloc( GetProcessHeap(), 0, (<span id="removedchars">wcslen</span>(str) + 1) * sizeof(WCHAR) )))
</pre><pre class="diff" id="added">+        if (!(new_str = HeapAlloc( GetProcessHeap(), 0, (<span id="addedchars">strlenW</span>(str) + 1) * sizeof(WCHAR) )))
</pre><pre class="diff" id="context">         {
             SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
             return LB_ERRSPACE;
         }
</pre><pre class="diff" id="removed">-        <span id="removedchars">wcscpy</span>(new_str, str);
</pre><pre class="diff" id="added">+        <span id="addedchars">strcpyW</span>(new_str, str);
</pre><pre class="diff" id="context">     }
     else data = (DWORD)str;
 
</pre><pre class="diff"><small id="info">@@ -1742,11 +1809,13 @@
</small></pre><pre class="diff" id="context">                     static const WCHAR bracketW[]  = { ']',0 };
                     static const WCHAR dotW[] = { '.',0 };
                     if (!(attrib &amp; DDL_DIRECTORY) ||
</pre><pre class="diff" id="removed">-                        !<span id="removedchars">wcscmp(&nbsp;entry.cAlternate</span>FileName, dotW )) continue;
</pre><pre class="diff" id="added">+                        !<span id="addedchars">strcmpW(&nbsp;entry.c</span>FileName, dotW )) continue;
</pre><pre class="diff" id="context">                     buffer[0] = '[';
</pre><pre class="diff" id="removed">-                    if (long_names) wcscpy( buffer + 1, entry.cFileName );
-                    else wcscpy( buffer + 1, entry.cAlternateFileName );
-                    wcscat(buffer, bracketW);
</pre><pre class="diff" id="added">+                    if (!long_names &amp;&amp; entry.cAlternateFileName[0])
+                        strcpyW( buffer + 1, entry.cAlternateFileName );
+                    else
+                        strcpyW( buffer + 1, entry.cFileName );
+                    strcatW(buffer, bracketW);
</pre><pre class="diff" id="context">                 }
                 else  /* not a directory */
                 {
</pre><pre class="diff"><small id="info">@@ -1757,8 +1826,10 @@
</small></pre><pre class="diff" id="context">                         ((attrib &amp; ATTRIBS) != (entry.dwFileAttributes &amp; ATTRIBS)))
                         continue;
 #undef ATTRIBS
</pre><pre class="diff" id="removed">-                    if (long_names) wcscpy( buffer, entry.cFileName );
-                    else wcscpy( buffer, entry.cAlternateFileName );
</pre><pre class="diff" id="added">+                    if (!long_names &amp;&amp; entry.cAlternateFileName[0])
+                        strcpyW( buffer, entry.cAlternateFileName );
+                    else
+                        strcpyW( buffer, entry.cFileName );
</pre><pre class="diff" id="context">                 }
                 if (!long_names) CharLowerW( buffer );
                 pos = LISTBOX_FindFileStrPos( hwnd, descr, buffer );
</pre><pre class="diff"><small id="info">@@ -1924,10 +1995,8 @@
</small></pre><pre class="diff" id="context"> {
     short gcWheelDelta = 0;
     UINT pulScrollLines = 3;
</pre><pre class="diff" id="removed">-    
-#if 0
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context">     SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &amp;pulScrollLines, 0);
</pre><pre class="diff" id="removed">-#endif 
</pre><pre class="diff" id="context"> 
     gcWheelDelta -= (short) HIWORD(wParam);
 
</pre><pre class="diff"><small id="info">@@ -2066,9 +2135,7 @@
</small></pre><pre class="diff" id="context">         {
             LISTBOX_SetCaretIndex( hwnd, pDescr, pDescr-&gt;lphc-&gt;droppedIndex, FALSE );
             LISTBOX_SetSelection( hwnd, pDescr, pDescr-&gt;lphc-&gt;droppedIndex, FALSE, FALSE );
</pre><pre class="diff" id="removed">-#if 0
</pre><pre class="diff" id="context">             COMBO_FlipListbox( pDescr-&gt;lphc, FALSE, FALSE );
</pre><pre class="diff" id="removed">-#endif
</pre><pre class="diff" id="context">             return 0;
         }
         else
</pre><pre class="diff"><small id="info">@@ -2411,6 +2478,7 @@
</small></pre><pre class="diff" id="context">     descr-&gt;locale        = 0;  /* FIXME */
     descr-&gt;lphc                 = lphc;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
</pre><pre class="diff" id="context">     if (is_old_app(hwnd) &amp;&amp; ( descr-&gt;style &amp; ( WS_VSCROLL | WS_HSCROLL ) ) )
     {
         /* Win95 document "List Box Differences" from MSDN:
</pre><pre class="diff"><small id="info">@@ -2420,6 +2488,7 @@
</small></pre><pre class="diff" id="context">         */
         descr-&gt;style |= WS_VSCROLL | WS_HSCROLL;
     }
</pre><pre class="diff" id="added">+#endif
</pre><pre class="diff" id="context"> 
     if( lphc )
     {
</pre><pre class="diff"><small id="info">@@ -2497,19 +2566,24 @@
</small></pre><pre class="diff" id="context">                          DefWindowProcA( hwnd, msg, wParam, lParam );
     }
 
</pre><pre class="diff" id="removed">-#if 0  
-  TRACE("[%p]: msg %s wp %08x lp %08lx\n",
</pre><pre class="diff" id="added">+    TRACE("[%p]: msg %s wp %08x lp %08lx\n",
</pre><pre class="diff" id="context">           hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
</pre><pre class="diff" id="removed">-#endif
-          
</pre><pre class="diff" id="context">     switch(msg)
     {
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_RESETCONTENT16:
+#endif
</pre><pre class="diff" id="context">     case LB_RESETCONTENT:
         LISTBOX_ResetContent( hwnd, descr );
         LISTBOX_UpdateScroll( hwnd, descr );
         InvalidateRect( hwnd, NULL, TRUE );
         return 0;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_ADDSTRING16:
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_ADDSTRING:
     {
         INT ret;
</pre><pre class="diff"><small id="info">@@ -2530,6 +2604,12 @@
</small></pre><pre class="diff" id="context">         return ret;
     }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_INSERTSTRING16:
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+        wParam = (INT)(INT16)wParam;
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_INSERTSTRING:
     {
         INT ret;
</pre><pre class="diff"><small id="info">@@ -2549,6 +2629,11 @@
</small></pre><pre class="diff" id="context">         return ret;
     }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_ADDFILE16:
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_ADDFILE:
     {
         INT ret;
</pre><pre class="diff"><small id="info">@@ -2569,37 +2654,61 @@
</small></pre><pre class="diff" id="context">         return ret;
     }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_DELETESTRING16:
+#endif
</pre><pre class="diff" id="context">     case LB_DELETESTRING:
         if (LISTBOX_RemoveItem( hwnd, descr, wParam) != LB_ERR)
            return descr-&gt;nb_items;
         else
            return LB_ERR;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETITEMDATA16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETITEMDATA:
         if (((INT)wParam &lt; 0) || ((INT)wParam &gt;= descr-&gt;nb_items))
             return LB_ERR;
         return descr-&gt;items[wParam].data;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETITEMDATA16:
+#endif
</pre><pre class="diff" id="context">     case LB_SETITEMDATA:
         if (((INT)wParam &lt; 0) || ((INT)wParam &gt;= descr-&gt;nb_items))
             return LB_ERR;
         descr-&gt;items[wParam].data = (DWORD)lParam;
         return LB_OKAY;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETCOUNT16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETCOUNT:
         return descr-&gt;nb_items;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETTEXT16:
+        lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_GETTEXT:
         return LISTBOX_GetText( descr, wParam, lParam, unicode );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETTEXTLEN16:
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_GETTEXTLEN:
         if ((INT)wParam &gt;= descr-&gt;nb_items || (INT)wParam &lt; 0)
             return LB_ERR;
         if (!HAS_STRINGS(descr)) return sizeof(DWORD);
</pre><pre class="diff" id="removed">-        if (unicode) return <span id="removedchars">wcslen</span>( descr-&gt;items[wParam].str );
</pre><pre class="diff" id="added">+        if (unicode) return <span id="addedchars">strlenW</span>( descr-&gt;items[wParam].str );
</pre><pre class="diff" id="context">         return WideCharToMultiByte( CP_ACP, 0, descr-&gt;items[wParam].str,
</pre><pre class="diff" id="removed">-                                    <span id="removedchars">wcslen</span>(descr-&gt;items[wParam].str), NULL, 0, NULL, NULL );
</pre><pre class="diff" id="added">+                                    <span id="addedchars">strlenW</span>(descr-&gt;items[wParam].str), NULL, 0, NULL, NULL );
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETCURSEL16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETCURSEL:
         if (descr-&gt;nb_items==0)
           return LB_ERR;
</pre><pre class="diff"><small id="info">@@ -2612,12 +2721,23 @@
</small></pre><pre class="diff" id="context">         return descr-&gt;focus_item;
         /* otherwise, if the user tries to move the selection with the    */
         /* arrow keys, we will give the application something to choke on */
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETTOPINDEX16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETTOPINDEX:
         return descr-&gt;top_item;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETITEMHEIGHT16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETITEMHEIGHT:
         return LISTBOX_GetItemHeight( descr, wParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETITEMHEIGHT16:
+        lParam = LOWORD(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_SETITEMHEIGHT:
         return LISTBOX_SetItemHeight( hwnd, descr, wParam, lParam, TRUE );
 
</pre><pre class="diff"><small id="info">@@ -2637,6 +2757,9 @@
</small></pre><pre class="diff" id="context">                              !PtInRect( &amp;rect, pt ) );
         }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETCARETINDEX16:
+#endif
</pre><pre class="diff" id="context">     case LB_SETCARETINDEX:
         if ((!IS_MULTISELECT(descr)) &amp;&amp; (descr-&gt;selected_item != -1)) return LB_ERR;
         if (LISTBOX_SetCaretIndex( hwnd, descr, wParam, !lParam ) == LB_ERR)
</pre><pre class="diff"><small id="info">@@ -2646,18 +2769,43 @@
</small></pre><pre class="diff" id="context">         else
              return LB_OKAY;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETCARETINDEX16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETCARETINDEX:
         return descr-&gt;focus_item;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETTOPINDEX16:
+#endif
</pre><pre class="diff" id="context">     case LB_SETTOPINDEX:
         return LISTBOX_SetTopItem( hwnd, descr, wParam, TRUE );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETCOLUMNWIDTH16:
+#endif
</pre><pre class="diff" id="context">     case LB_SETCOLUMNWIDTH:
         return LISTBOX_SetColumnWidth( hwnd, descr, wParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETITEMRECT16:
+        {
+            RECT rect;
+            ret = LISTBOX_GetItemRect( descr, (INT16)wParam, &amp;rect );
+            CONV_RECT32TO16( &amp;rect, MapSL(lParam) );
+        }
+        return ret;
+#endif
+
</pre><pre class="diff" id="context">     case LB_GETITEMRECT:
         return LISTBOX_GetItemRect( descr, wParam, (RECT *)lParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_FINDSTRING16:
+        wParam = (INT)(INT16)wParam;
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_FINDSTRING:
     {
         INT ret;
</pre><pre class="diff"><small id="info">@@ -2677,6 +2825,12 @@
</small></pre><pre class="diff" id="context">         return ret;
     }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_FINDSTRINGEXACT16:
+        wParam = (INT)(INT16)wParam;
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_FINDSTRINGEXACT:
     {
         INT ret;
</pre><pre class="diff"><small id="info">@@ -2696,6 +2850,12 @@
</small></pre><pre class="diff" id="context">         return ret;
     }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SELECTSTRING16:
+        wParam = (INT)(INT16)wParam;
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_SELECTSTRING:
     {
         INT index;
</pre><pre class="diff"><small id="info">@@ -2724,25 +2884,51 @@
</small></pre><pre class="diff" id="context">         return index;
     }
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETSEL16:
+        wParam = (INT)(INT16)wParam;
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_GETSEL:
         if (((INT)wParam &lt; 0) || ((INT)wParam &gt;= descr-&gt;nb_items))
             return LB_ERR;
         return descr-&gt;items[wParam].selected;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETSEL16:
+        lParam = (INT)(INT16)lParam;
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_SETSEL:
         return LISTBOX_SetSelection( hwnd, descr, lParam, wParam, FALSE );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETCURSEL16:
+        wParam = (INT)(INT16)wParam;
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_SETCURSEL:
         if (IS_MULTISELECT(descr)) return LB_ERR;
         LISTBOX_SetCaretIndex( hwnd, descr, wParam, TRUE );
         return LISTBOX_SetSelection( hwnd, descr, wParam, TRUE, FALSE );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETSELCOUNT16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETSELCOUNT:
         return LISTBOX_GetSelCount( descr );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETSELITEMS16:
+        return LISTBOX_GetSelItems16( descr, wParam, (LPINT16)MapSL(lParam) );
+#endif
+
</pre><pre class="diff" id="context">     case LB_GETSELITEMS:
         return LISTBOX_GetSelItems( descr, wParam, (LPINT)lParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SELITEMRANGE16:
+#endif
</pre><pre class="diff" id="context">     case LB_SELITEMRANGE:
         if (LOWORD(lParam) &lt;= HIWORD(lParam))
             return LISTBOX_SelectItemRange( hwnd, descr, LOWORD(lParam),
</pre><pre class="diff"><small id="info">@@ -2751,27 +2937,52 @@
</small></pre><pre class="diff" id="context">             return LISTBOX_SelectItemRange( hwnd, descr, HIWORD(lParam),
                                             LOWORD(lParam), wParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SELITEMRANGEEX16:
+#endif
</pre><pre class="diff" id="context">     case LB_SELITEMRANGEEX:
         if ((INT)lParam &gt;= (INT)wParam)
             return LISTBOX_SelectItemRange( hwnd, descr, wParam, lParam, TRUE );
         else
             return LISTBOX_SelectItemRange( hwnd, descr, lParam, wParam, FALSE);
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETHORIZONTALEXTENT16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETHORIZONTALEXTENT:
         return descr-&gt;horz_extent;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETHORIZONTALEXTENT16:
+#endif
</pre><pre class="diff" id="context">     case LB_SETHORIZONTALEXTENT:
         return LISTBOX_SetHorizontalExtent( hwnd, descr, wParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_GETANCHORINDEX16:
+#endif
</pre><pre class="diff" id="context">     case LB_GETANCHORINDEX:
         return descr-&gt;anchor_item;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETANCHORINDEX16:
+        wParam = (INT)(INT16)wParam;
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_SETANCHORINDEX:
         if (((INT)wParam &lt; -1) || ((INT)wParam &gt;= descr-&gt;nb_items))
             return LB_ERR;
         descr-&gt;anchor_item = (INT)wParam;
         return LB_OKAY;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_DIR16:
+        /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
+         * be set automatically (this is different in Win32) */
+        if (wParam &amp; DDL_DRIVES) wParam |= DDL_EXCLUSIVE;
+        lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
+#endif
</pre><pre class="diff" id="context">     case LB_DIR:
     {
         INT ret;
</pre><pre class="diff"><small id="info">@@ -2804,9 +3015,17 @@
</small></pre><pre class="diff" id="context">     case LB_SETCOUNT:
         return LISTBOX_SetCount( hwnd, descr, (INT)wParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_SETTABSTOPS16:
+        return LISTBOX_SetTabStops( hwnd, descr, (INT)(INT16)wParam, MapSL(lParam), TRUE );
+#endif
+
</pre><pre class="diff" id="context">     case LB_SETTABSTOPS:
         return LISTBOX_SetTabStops( hwnd, descr, wParam, (LPINT)lParam, FALSE );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_CARETON16:
+#endif
</pre><pre class="diff" id="context">     case LB_CARETON:
         if (descr-&gt;caret_on)
             return LB_OKAY;
</pre><pre class="diff"><small id="info">@@ -2815,6 +3034,9 @@
</small></pre><pre class="diff" id="context">             LISTBOX_RepaintItem( hwnd, descr, descr-&gt;focus_item, ODA_FOCUS );
         return LB_OKAY;
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+    case LB_CARETOFF16:
+#endif
</pre><pre class="diff" id="context">     case LB_CARETOFF:
         if (!descr-&gt;caret_on)
             return LB_OKAY;
</pre><pre class="diff"><small id="info">@@ -2877,16 +3099,16 @@
</small></pre><pre class="diff" id="context">         return LISTBOX_HandleMouseWheel( hwnd, descr, wParam );
     case WM_LBUTTONDOWN:
         return LISTBOX_HandleLButtonDown( hwnd, descr, wParam,
</pre><pre class="diff" id="removed">-                                          (USHORT)LOWORD(lParam),
-                                          (USHORT)HIWORD(lParam) );
</pre><pre class="diff" id="added">+                                          (INT16)LOWORD(lParam),
+                                          (INT16)HIWORD(lParam) );
</pre><pre class="diff" id="context">     case WM_LBUTTONDBLCLK:
         if (descr-&gt;style &amp; LBS_NOTIFY)
             SEND_NOTIFICATION( hwnd, descr, LBN_DBLCLK );
         return 0;
     case WM_MOUSEMOVE:
         if (GetCapture() == hwnd)
</pre><pre class="diff" id="removed">-            LISTBOX_HandleMouseMove( hwnd, descr, (USHORT)LOWORD(lParam),
-                                     (USHORT)HIWORD(lParam) );
</pre><pre class="diff" id="added">+            LISTBOX_HandleMouseMove( hwnd, descr, (INT16)LOWORD(lParam),
+                                     (INT16)HIWORD(lParam) );
</pre><pre class="diff" id="context">         return 0;
     case WM_LBUTTONUP:
         return LISTBOX_HandleLButtonUp( hwnd, descr );
</pre><pre class="diff"><small id="info">@@ -2929,6 +3151,9 @@
</small></pre><pre class="diff" id="context">         break;
 
     default:
</pre><pre class="diff" id="added">+        if ((msg &gt;= WM_USER) &amp;&amp; (msg &lt; 0xc000))
+            WARN("[%p]: unknown msg %04x wp %08x lp %08lx\n",
+                 hwnd, msg, wParam, lParam );
</pre><pre class="diff" id="context">         return unicode ? DefWindowProcW( hwnd, msg, wParam, lParam ) :
                          DefWindowProcA( hwnd, msg, wParam, lParam );
     }
</pre><pre class="diff"><small id="info">@@ -2937,6 +3162,9 @@
</small></pre><pre class="diff" id="context"> 
 /***********************************************************************
  *           ListBoxWndProcA
</pre><pre class="diff" id="added">+ *
+ * This is just a wrapper for the real wndproc, it only does window locking
+ * and unlocking.
</pre><pre class="diff" id="context">  */
 static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
</pre><pre class="diff"><small id="info">@@ -2979,24 +3207,22 @@
</small></pre><pre class="diff" id="context">                          DefWindowProcA( hwnd, msg, wParam, lParam );
     }
 
</pre><pre class="diff" id="removed">-#if 0 
-  TRACE_(combo)("[%p]: msg %s wp %08x lp %08lx\n",
</pre><pre class="diff" id="added">+    TRACE_(combo)("[%p]: msg %s wp %08x lp %08lx\n",
</pre><pre class="diff" id="context">                   hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
</pre><pre class="diff" id="removed">-#endif
</pre><pre class="diff" id="context"> 
     if ((lphc = descr-&gt;lphc) != NULL)
     {
         switch( msg )
         {
         case WM_MOUSEMOVE:
</pre><pre class="diff" id="removed">-            if (CB_GETTYPE(lphc) != CBS_SIMPLE)
</pre><pre class="diff" id="added">+            if ( (CB_GETTYPE(lphc) != CBS_SIMPLE) )
</pre><pre class="diff" id="context">             {
                 POINT   mousePos;
                 BOOL    captured;
                 RECT    clientRect;
 
</pre><pre class="diff" id="removed">-                mousePos.x = (USHORT)LOWORD(lParam);
-                mousePos.y = (USHORT)HIWORD(lParam);
</pre><pre class="diff" id="added">+                mousePos.x = (INT16)LOWORD(lParam);
+                mousePos.y = (INT16)HIWORD(lParam);
</pre><pre class="diff" id="context"> 
                 /*
                  * If we are in a dropdown combobox, we simulate that
</pre><pre class="diff"><small id="info">@@ -3024,7 +3250,6 @@
</small></pre><pre class="diff" id="context">                 return 0;
 
             }
</pre><pre class="diff" id="removed">-            /* else we are in Win3.1 look, go with the default behavior. */
</pre><pre class="diff" id="context">             break;
 
         case WM_LBUTTONUP:
</pre><pre class="diff"><small id="info">@@ -3037,8 +3262,8 @@
</small></pre><pre class="diff" id="context">                  * we make sure there is no selection by re-selecting the
                  * item that was selected when the listbox was made visible.
                  */
</pre><pre class="diff" id="removed">-                mousePos.x = (USHORT)LOWORD(lParam);
-                mousePos.y = (USHORT)HIWORD(lParam);
</pre><pre class="diff" id="added">+                mousePos.x = (INT16)LOWORD(lParam);
+                mousePos.y = (INT16)HIWORD(lParam);
</pre><pre class="diff" id="context"> 
                 GetClientRect(hwnd, &amp;clientRect);
 
</pre><pre class="diff"><small id="info">@@ -3058,8 +3283,8 @@
</small></pre><pre class="diff" id="context">         case WM_LBUTTONDBLCLK:
         case WM_LBUTTONDOWN:
             return LISTBOX_HandleLButtonDownCombo(hwnd, descr, msg, wParam,
</pre><pre class="diff" id="removed">-                                                  (USHORT)LOWORD(lParam),
-                                                  (USHORT)HIWORD(lParam) );
</pre><pre class="diff" id="added">+                                                  (INT16)LOWORD(lParam),
+                                                  (INT16)HIWORD(lParam) );
</pre><pre class="diff" id="context">         case WM_NCACTIVATE:
             return FALSE;
         case WM_KEYDOWN:
</pre><pre class="diff"><small id="info">@@ -3072,14 +3297,15 @@
</small></pre><pre class="diff" id="context">                     ( (lphc-&gt;wState &amp; CBF_EUI) &amp;&amp; !(lphc-&gt;wState &amp; CBF_DROPPED)
                       &amp;&amp; (wParam == VK_DOWN || wParam == VK_UP)) )
                 {
</pre><pre class="diff" id="removed">-#if 0
</pre><pre class="diff" id="context">                     COMBO_FlipListbox( lphc, FALSE, FALSE );
</pre><pre class="diff" id="removed">-#endif
</pre><pre class="diff" id="context">                     return 0;
                 }
             }
             return LISTBOX_HandleKeyDown( hwnd, descr, wParam );
 
</pre><pre class="diff" id="added">+#ifndef __REACTOS__
+        case LB_SETCURSEL16:
+#endif
</pre><pre class="diff" id="context">         case LB_SETCURSEL:
             lRet = unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
                 ListBoxWndProcA( hwnd, msg, wParam, lParam );
</pre><pre class="diff"><small id="info">@@ -3096,7 +3322,7 @@
</small></pre><pre class="diff" id="context">     lRet = unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
                      ListBoxWndProcA( hwnd, msg, wParam, lParam );
 
</pre><pre class="diff" id="removed">-    TRACE_(combo)("\t default on msg [%04x]\n", (U<span id="removedchars">SHORT</span>)msg );
</pre><pre class="diff" id="added">+    TRACE_(combo)("\t default on msg [%04x]\n", (U<span id="addedchars">INT16</span>)msg );
</pre><pre class="diff" id="context"> 
     return lRet;
 }
</pre><pre class="diff"><small id="info">@@ -3122,10 +3348,13 @@
</small></pre><pre class="diff" id="context">     return ComboLBWndProc_common( hwnd, msg, wParam, lParam, TRUE );
 }
 
</pre><pre class="diff" id="removed">-
</pre><pre class="diff" id="added">+/***********************************************************************
+ *           GetListBoxInfo
+ */
</pre><pre class="diff" id="context"> DWORD STDCALL
 GetListBoxInfo(HWND hwnd)
 {
   UNIMPLEMENTED;
   return 0;
 }
</pre><pre class="diff" id="added">+
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.8</small></center>
</body></html>