From a6e48e9704f9ccf273c11a717b3c58bac40f2751 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Tue, 12 Aug 2003 22:27:55 +0000 Subject: [PATCH] Implemented InternalGetWindowText() partially svn path=/trunk/; revision=5550 --- reactos/include/win32k/ntuser.h | 6 ++--- reactos/lib/user32/windows/window.c | 35 +++++++++++++++++++++++- reactos/subsys/win32k/ntuser/window.c | 39 ++++++++++++++++++++++----- 3 files changed, 69 insertions(+), 11 deletions(-) diff --git a/reactos/include/win32k/ntuser.h b/reactos/include/win32k/ntuser.h index 07dfd7be6a4..3190e5342b8 100644 --- a/reactos/include/win32k/ntuser.h +++ b/reactos/include/win32k/ntuser.h @@ -914,9 +914,9 @@ NtUserInitTask( DWORD STDCALL NtUserInternalGetWindowText( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2); + HWND hWnd, + LPWSTR lpString, + int nMaxCount); DWORD STDCALL diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index 79caafbb230..0da6a052f50 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.56 2003/08/11 19:09:53 gdalsnes Exp $ +/* $Id: window.c,v 1.57 2003/08/12 22:27:55 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1584,4 +1585,36 @@ GetWindowContextHelpId(HWND hwnd) return(0); } +/* + * @implemented + */ +DWORD +STDCALL +InternalGetWindowText(HWND hWnd, LPWSTR lpString, int nMaxCount) +{ + DWORD res = 0; + LPWSTR lps = NULL; + if(lpString && (nMaxCount > 0)) + { + lps = RtlAllocateHeap(RtlGetProcessHeap(), 0, nMaxCount * sizeof(WCHAR)); + if(!lps) + { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } + } + + res = NtUserInternalGetWindowText(hWnd, lps, nMaxCount); + + if(lps) + { + RtlCopyMemory(lpString, lps, res * sizeof(WCHAR)); + lpString[res] = (WCHAR)"\0"; /* null-terminate the string */ + + RtlFreeHeap(RtlGetProcessHeap(), 0, lps); + } + + return res; +} + /* EOF */ diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 8523d274c0d..06b79daab66 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.87 2003/08/11 21:10:49 royce Exp $ +/* $Id: window.c,v 1.88 2003/08/12 22:27:55 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1483,13 +1483,38 @@ NtUserGetWindowPlacement(DWORD Unknown0, } DWORD STDCALL -NtUserInternalGetWindowText(DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2) +NtUserInternalGetWindowText(HWND hWnd, + LPWSTR lpString, + int nMaxCount) { - UNIMPLEMENTED - - return 0; + DWORD res = 0; + PWINDOW_OBJECT WindowObject; + HANDLE Atom; + + W32kAcquireWinLockShared(); /* ??? */ + WindowObject = W32kGetWindowObject(hWnd); + if(!WindowObject) + { + W32kReleaseWinLock(); /* ??? */ + SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); + return 0; + } + + if(lpString) + { + /* FIXME - Window text is currently stored + in the Atom 'USER32!WindowTextAtomA' */ + + } + else + { + /* FIXME - return length of window text */ + } + + W32kReleaseWindowObject(WindowObject); + + W32kReleaseWinLock(); /* ??? */ + return res; } DWORD STDCALL