Author: gbrunmar Date: Sun May 11 08:46:47 2008 New Revision: 33442
URL: http://svn.reactos.org/svn/reactos?rev=33442&view=rev Log: Made 17 listbox winetests pass in user32.dll (some of the changes were taken from wine)
Modified: trunk/reactos/dll/win32/user32/controls/listbox.c
Modified: trunk/reactos/dll/win32/user32/controls/listbox.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/l... ============================================================================== --- trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] Sun May 11 08:46:47 2008 @@ -1879,13 +1879,14 @@ 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)) { /* scan directory */ if ((handle = FindFirstFileW(filespec, &entry)) == INVALID_HANDLE_VALUE) { - int le = GetLastError(); + int le = GetLastError(); if ((le != ERROR_NO_MORE_FILES) && (le != ERROR_FILE_NOT_FOUND)) return LB_ERR; } else @@ -1909,7 +1910,8 @@ else /* not a directory */ { #define ATTRIBS (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \ - FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE) + FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE | \ + FILE_ATTRIBUTE_DIRECTORY)
if ((attrib & DDL_EXCLUSIVE) && ((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS))) @@ -1924,22 +1926,33 @@ 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)) - { - 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; + if (ret >= 0) + { + ret = maxinsert; + + /* scan drives */ + if (attrib & DDL_DRIVES) + { + 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;