From 53bf611e09b27c9c5be4bca3afe3ebc34ad10ea9 Mon Sep 17 00:00:00 2001 From: Richard Campbell Date: Sun, 15 Jun 2003 04:25:34 +0000 Subject: [PATCH] Implemented FindWindowEx, it's untested, but the code should work, as it's fairly straightfoward...This is only a partial implementation however. It searches all windows regardless... svn path=/trunk/; revision=4894 --- reactos/include/win32k/ntuser.h | 4 ++-- reactos/lib/user32/windows/window.c | 26 ++++++++++++++++++++++++-- reactos/subsys/win32k/ntuser/window.c | 20 +++++++++----------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/reactos/include/win32k/ntuser.h b/reactos/include/win32k/ntuser.h index b493e471d2c..0706b6b0aac 100644 --- a/reactos/include/win32k/ntuser.h +++ b/reactos/include/win32k/ntuser.h @@ -504,8 +504,8 @@ STDCALL NtUserFindWindowEx( HWND hwndParent, HWND hwndChildAfter, - LPCWSTR ucClassName, - LPCWSTR ucWindowName + PUNICODE_STRING ucClassName, + PUNICODE_STRING ucWindowName ); DWORD diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index 114899c3613..337eef9db82 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.37 2003/06/14 10:00:58 gvg Exp $ +/* $Id: window.c,v 1.38 2003/06/15 04:25:34 rcampbell Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -714,7 +714,29 @@ FindWindowExW(HWND hwndParent, LPCWSTR lpszClass, LPCWSTR lpszWindow) { - return NtUserFindWindowEx(hwndParent, hwndChildAfter, lpszClass, lpszWindow); + PUNICODE_STRING ucClassName; + PUNICODE_STRING ucWindowName; + + if (IS_ATOM(lpszClass)) + { + RtlInitUnicodeString(ucClassName, NULL); + ucClassName->Buffer = (LPWSTR)lpszClass; + } + else + { + RtlInitUnicodeString(ucClassName, lpszClass); + } + if (IS_ATOM(lpszWindow)) + { + RtlInitUnicodeString(ucWindowName, NULL); + ucClassName->Buffer = (LPWSTR)lpszWindow; + } + else + { + RtlInitUnicodeString(ucWindowName, lpszWindow); + } + + return NtUserFindWindowEx(hwndParent, hwndChildAfter, ucClassName, ucWindowName); } WINBOOL STDCALL diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 36dc802f1f6..ed48ab004c4 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.54 2003/06/14 10:00:57 gvg Exp $ +/* $Id: window.c,v 1.55 2003/06/15 04:25:34 rcampbell Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1139,10 +1139,9 @@ NtUserFillWindow(DWORD Unknown0, HWND STDCALL NtUserFindWindowEx(HWND hwndParent, HWND hwndChildAfter, - LPCWSTR ucClassName, - LPCWSTR ucWindowName) + PUNICODE_STRING ucClassName, + PUNICODE_STRING ucWindowName) { -#if 0 NTSTATUS status; HWND windowHandle; PWINDOW_OBJECT windowObject; @@ -1157,9 +1156,9 @@ NtUserFindWindowEx(HWND hwndParent, return (HWND)0; } - ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock); - currentEntry = PsGetWin32Process()->WindowListHead.Flink; - while (currentEntry != &PsGetWin32Process()->WindowListHead) + //ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock); + currentEntry = W32kGetActiveDesktop()->WindowListHead.Flink; + while (currentEntry != &W32kGetActiveDesktop()->WindowListHead) { windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT, ListEntry); @@ -1168,20 +1167,19 @@ NtUserFindWindowEx(HWND hwndParent, RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName, TRUE) == 0) { - ObmCreateHandle(PsGetWin32Process()->HandleTable, + ObmCreateHandle(W32kGetActiveDesktop()->WindowStation->HandleTable, windowObject, &windowHandle); - ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock); + //ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock); ObmDereferenceObject (classObject); return windowHandle; } currentEntry = currentEntry->Flink; } - ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock); + //ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock); ObmDereferenceObject (classObject); -#endif return (HWND)0; }