Author: gbrunmar Date: Mon May 12 14:36:39 2008 New Revision: 33483
URL: http://svn.reactos.org/svn/reactos?rev=33483&view=rev Log: * Synced DIALOG_DlgDirListW() and DIALOG_DlgDirSelect() from Wine to get more user32.dll winetests to pass * Fixed indentation in User32EnumWindows() * Removed internal use of Set/GetLastError() from User32EnumWindows() - makes even more winetests pass
Modified: trunk/reactos/dll/win32/user32/windows/dialog.c trunk/reactos/dll/win32/user32/windows/window.c
Modified: trunk/reactos/dll/win32/user32/windows/dialog.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/di... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Mon May 12 14:36:39 2008 @@ -1196,6 +1196,7 @@ { WCHAR *p, *p2; p = spec; + if ((p2 = strchrW( p, ':' ))) p = p2 + 1; if ((p2 = strrchrW( p, '\' ))) p = p2; if ((p2 = strrchrW( p, '/' ))) p = p2; if (p != spec) @@ -1215,28 +1216,29 @@
if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0)) { + if (attrib == DDL_DRIVES) attrib |= DDL_EXCLUSIVE; + SENDMSG( combo ? CB_RESETCONTENT : LB_RESETCONTENT, 0, 0 ); if (attrib & DDL_DIRECTORY) { if (!(attrib & DDL_EXCLUSIVE)) { - if (SENDMSG( combo ? CB_DIR : LB_DIR, - attrib & ~(DDL_DIRECTORY | DDL_DRIVES), - (LPARAM)spec ) == LB_ERR) - return FALSE; + SENDMSG( combo ? CB_DIR : LB_DIR, + attrib & ~(DDL_DIRECTORY | DDL_DRIVES), + (LPARAM)spec ); } - if (SENDMSG( combo ? CB_DIR : LB_DIR, - (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE, - (LPARAM)any ) == LB_ERR) - return FALSE; + SENDMSG( combo ? CB_DIR : LB_DIR, + (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE, + (LPARAM)any ); } else { - if (SENDMSG( combo ? CB_DIR : LB_DIR, attrib, - (LPARAM)spec ) == LB_ERR) - return FALSE; - } - } + SENDMSG( combo ? CB_DIR : LB_DIR, attrib, (LPARAM)spec ); + } + } + + /* Convert path specification to uppercase */ + if (spec) CharUpperW(spec);
if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0)) { @@ -1300,7 +1302,7 @@ size = SendMessageW(listbox, combo ? CB_GETLBTEXTLEN : LB_GETTEXTLEN, 0, 0 ); if (size == LB_ERR) return FALSE;
- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size+1 ))) return FALSE; + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+2) * sizeof(WCHAR) ))) return FALSE;
SendMessageW( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT, item, (LPARAM)buffer );
@@ -1318,14 +1320,25 @@ ptr = buffer + 1; } } - else ptr = buffer; - - if (unicode) + else + { + /* Filenames without a dot extension must have one tacked at the end */ + if (strchrW(buffer, '.') == NULL) + { + buffer[strlenW(buffer)+1] = '\0'; + buffer[strlenW(buffer)] = '.'; + } + ptr = buffer; + } + + if (!unicode) { if (len > 0 && !WideCharToMultiByte( CP_ACP, 0, ptr, -1, (LPSTR)str, len, 0, 0 )) ((LPSTR)str)[len-1] = 0; } - else lstrcpynW( str, ptr, len ); + else + lstrcpynW( str, ptr, len ); + HeapFree( GetProcessHeap(), 0, buffer ); TRACE("Returning %d '%s'\n", ret, str ); return ret;
Modified: trunk/reactos/dll/win32/user32/windows/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Mon May 12 14:36:39 2008 @@ -548,12 +548,12 @@ static BOOL User32EnumWindows ( - HDESK hDesktop, - HWND hWndparent, - WNDENUMPROC lpfn, - LPARAM lParam, - DWORD dwThreadId, - BOOL bChildren ) + HDESK hDesktop, + HWND hWndparent, + WNDENUMPROC lpfn, + LPARAM lParam, + DWORD dwThreadId, + BOOL bChildren ) { DWORD i, dwCount = 0; HWND* pHwnd = NULL; @@ -569,10 +569,9 @@ sort of persistent buffer and only grow it ( requiring a 2nd call ) when the buffer wasn't already big enough? */ /* first get how many window entries there are */ - SetLastError(0); dwCount = NtUserBuildHwndList ( hDesktop, hWndparent, bChildren, dwThreadId, lParam, NULL, 0 ); - if ( !dwCount || GetLastError() ) + if ( !dwCount ) return FALSE;
/* allocate buffer to receive HWND handles */ @@ -587,10 +586,10 @@ /* now call kernel again to fill the buffer this time */ dwCount = NtUserBuildHwndList ( hDesktop, hWndparent, bChildren, dwThreadId, lParam, pHwnd, dwCount ); - if ( !dwCount || GetLastError() ) + if ( !dwCount ) { if ( pHwnd ) - HeapFree ( hHeap, 0, pHwnd ); + HeapFree ( hHeap, 0, pHwnd ); return FALSE; }