Alex Villacís Lasso : user32: Fix returned value of LB_DIR.

Alexandre Julliard julliard at winehq.org
Wed Nov 14 07:31:04 CST 2007


Module: wine
Branch: master
Commit: 873799df246ea107a139ec898686490b20a1de7b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=873799df246ea107a139ec898686490b20a1de7b

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Sat Nov 10 18:08:06 2007 -0500

user32: Fix returned value of LB_DIR.

---

 dlls/user32/listbox.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 7ec97dd..5d99670 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1815,6 +1815,7 @@ static LRESULT LISTBOX_Directory( LB_DESCR *descr, UINT attrib,
     LRESULT ret = LB_OKAY;
     WIN32_FIND_DATAW entry;
     int pos;
+    LRESULT maxinsert = LB_ERR;
 
     /* don't scan directory if we just want drives exclusively */
     if (attrib != (DDL_DRIVES | DDL_EXCLUSIVE)) {
@@ -1860,22 +1861,27 @@ static LRESULT LISTBOX_Directory( LB_DESCR *descr, UINT attrib,
                 pos = LISTBOX_FindFileStrPos( descr, buffer );
                 if ((ret = LISTBOX_InsertString( descr, pos, buffer )) < 0)
                     break;
+                if (ret <= maxinsert) maxinsert++; else maxinsert = ret;
             } while (FindNextFileW( handle, &entry ));
             FindClose( handle );
         }
     }
-
-    /* scan drives */
-    if ((ret >= 0) && (attrib & DDL_DRIVES))
+    if (ret >= 0)
     {
-        WCHAR buffer[] = {'[','-','a','-',']',0};
-        WCHAR root[] = {'A',':','\\',0};
-        int drive;
-        for (drive = 0; drive < 26; drive++, buffer[2]++, root[0]++)
+        ret = maxinsert;
+
+        /* scan drives */
+        if (attrib & DDL_DRIVES)
         {
-            if (GetDriveTypeW(root) <= DRIVE_NO_ROOT_DIR) continue;
-            if ((ret = LISTBOX_InsertString( descr, -1, buffer )) < 0)
-                break;
+            WCHAR buffer[] = {'[','-','a','-',']',0};
+            WCHAR root[] = {'A',':','\\',0};
+            int drive;
+            for (drive = 0; drive < 26; drive++, buffer[2]++, root[0]++)
+            {
+                if (GetDriveTypeW(root) <= DRIVE_NO_ROOT_DIR) continue;
+                if ((ret = LISTBOX_InsertString( descr, -1, buffer )) < 0)
+                    break;
+            }
         }
     }
     return ret;




More information about the wine-cvs mailing list