From 77956b2f51106fcf9630202b6ced72aafdd5b65a Mon Sep 17 00:00:00 2001 From: Peter Oberndorfer Date: Thu, 3 Jan 2008 22:24:55 +0100 Subject: [PATCH] user32: implement part of EnumDesktopWindows using EnumWindows code --- dlls/user32/win.c | 23 +---------------------- dlls/user32/winstation.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 72f3cfcf15b..1fa9cdc48ac 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -2759,28 +2759,7 @@ HWND *WIN_ListChildren( HWND hwnd ) */ BOOL WINAPI EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam ) { - HWND *list; - BOOL ret = TRUE; - int i; - - USER_CheckNotLock(); - - /* We have to build a list of all windows first, to avoid */ - /* unpleasant side-effects, for instance if the callback */ - /* function changes the Z-order of the windows. */ - - if (!(list = WIN_ListChildren( GetDesktopWindow() ))) return TRUE; - - /* Now call the callback function for every window */ - - for (i = 0; list[i]; i++) - { - /* Make sure that the window still exists */ - if (!IsWindow( list[i] )) continue; - if (!(ret = lpEnumFunc( list[i], lParam ))) break; - } - HeapFree( GetProcessHeap(), 0, list ); - return ret; + return EnumDesktopWindows(NULL, lpEnumFunc, lParam ); } diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c index 75cb286c9f0..8e3883f6acb 100644 --- a/dlls/user32/winstation.c +++ b/dlls/user32/winstation.c @@ -435,8 +435,34 @@ HDESK WINAPI OpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access ) */ BOOL WINAPI EnumDesktopWindows( HDESK desktop, WNDENUMPROC func, LPARAM lparam ) { - FIXME( "(%p,%p,0x%lx): stub!\n", desktop, func, lparam ); - return TRUE; + HWND *list; + BOOL ret = TRUE; + int i; + + USER_CheckNotLock(); + + if (desktop) + { + FIXME( "(%p,%p,0x%lx): not supported with other desktops!\n", desktop, func, lparam ); + return TRUE; + } + + /* We have to build a list of all windows first, to avoid */ + /* unpleasant side-effects, for instance if the callback */ + /* function changes the Z-order of the windows. */ + + if (!(list = WIN_ListChildren( GetDesktopWindow() ))) return TRUE; + + /* Now call the callback function for every window */ + + for (i = 0; list[i]; i++) + { + /* Make sure that the window still exists */ + if (!IsWindow( list[i] )) continue; + if (!(ret = func( list[i], lparam ))) break; + } + HeapFree( GetProcessHeap(), 0, list ); + return ret; } -- 2.11.4.GIT