From aab0f8f99975e37c80671ed3735a6c93e62ba906 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Tue, 19 Aug 2003 23:41:20 +0000 Subject: [PATCH] fixed NtUserGetClassInfo() and GetClassInfoExA/W() svn path=/trunk/; revision=5682 --- reactos/lib/user32/windows/class.c | 46 +++++++++++++++++++++++----- reactos/subsys/win32k/ntuser/class.c | 19 ++++++++++-- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/reactos/lib/user32/windows/class.c b/reactos/lib/user32/windows/class.c index 92afe4752f1..51266c2e86e 100644 --- a/reactos/lib/user32/windows/class.c +++ b/reactos/lib/user32/windows/class.c @@ -1,4 +1,4 @@ -/* $Id: class.c,v 1.34 2003/08/19 02:55:53 royce Exp $ +/* $Id: class.c,v 1.35 2003/08/19 23:41:20 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -27,7 +27,7 @@ GetClassInfoExA( LPWNDCLASSEXA lpwcx) { LPWSTR str; - UNICODE_STRING str2; + UNICODE_STRING str2, str3; WNDCLASSEXW w; BOOL retval; NTSTATUS Status; @@ -50,8 +50,8 @@ GetClassInfoExA( } } - str2.Length = 0; - str2.MaximumLength = 255; + str2.Length = str3.Length = 0; + str2.MaximumLength = str3.MaximumLength = 255; str2.Buffer = (PWSTR)HEAP_alloc ( str2.MaximumLength * sizeof(WCHAR) ); if ( !str2.Buffer ) { @@ -60,8 +60,19 @@ GetClassInfoExA( HEAP_free ( str ); return FALSE; } + + str3.Buffer = (PWSTR)HEAP_alloc ( str3.MaximumLength * sizeof(WCHAR) ); + if ( !str3.Buffer ) + { + SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY)); + if ( !IS_ATOM(str) ) + HEAP_free ( str ); + HEAP_free ( str2.Buffer ); + return FALSE; + } w.lpszMenuName = (LPCWSTR)&str2; + w.lpszClassName = (LPCWSTR)&str3; retval = (BOOL)NtUserGetClassInfo(hinst, str, &w, TRUE, 0); if(!IS_ATOM(str)) HEAP_free(str); @@ -71,7 +82,12 @@ GetClassInfoExA( { lpwcx->lpszMenuName = heap_string_poolA ( str2.Buffer, str2.Length ); } + if ( !IS_INTRESOURCE(w.lpszClassName) && w.lpszClassName ) + { + lpwcx->lpszClassName = heap_string_poolA ( str3.Buffer, str3.Length ); + } HEAP_free ( str2.Buffer ); + HEAP_free ( str3.Buffer ); return retval; } @@ -88,7 +104,7 @@ GetClassInfoExW( LPWNDCLASSEXW lpwcx) { LPWSTR str; - UNICODE_STRING str2; + UNICODE_STRING str2, str3; WNDCLASSEXW w; WINBOOL retval; @@ -110,8 +126,8 @@ GetClassInfoExW( } } - str2.Length = 0; - str2.MaximumLength = 255; + str2.Length = str3.Length = 0; + str2.MaximumLength = str3.MaximumLength = 255; str2.Buffer = (PWSTR)HEAP_alloc ( str2.MaximumLength * sizeof(WCHAR) ); if ( !str2.Buffer ) { @@ -120,8 +136,19 @@ GetClassInfoExW( HEAP_free ( str ); return FALSE; } + + str3.Buffer = (PWSTR)HEAP_alloc ( str3.MaximumLength * sizeof(WCHAR) ); + if ( !str3.Buffer ) + { + SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY)); + if ( !IS_ATOM(str) ) + HEAP_free ( str ); + HEAP_free ( str2.Buffer ); + return FALSE; + } w.lpszMenuName = (LPCWSTR)&str2; + w.lpszClassName = (LPCWSTR)&str3; retval = (BOOL)NtUserGetClassInfo(hinst, str, &w, TRUE, 0); if ( !IS_ATOM(str) ) HEAP_free(str); @@ -131,8 +158,13 @@ GetClassInfoExW( { lpwcx->lpszMenuName = heap_string_poolW ( str2.Buffer, str2.Length ); } + if ( !IS_INTRESOURCE(w.lpszClassName) && w.lpszClassName ) + { + lpwcx->lpszClassName = heap_string_poolW ( str3.Buffer, str3.Length ); + } HEAP_free ( str2.Buffer ); + HEAP_free ( str3.Buffer ); return retval; } diff --git a/reactos/subsys/win32k/ntuser/class.c b/reactos/subsys/win32k/ntuser/class.c index c6e03780beb..81f3897eb16 100644 --- a/reactos/subsys/win32k/ntuser/class.c +++ b/reactos/subsys/win32k/ntuser/class.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: class.c,v 1.34 2003/08/19 11:48:49 weiden Exp $ +/* $Id: class.c,v 1.35 2003/08/19 23:41:20 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -182,10 +182,23 @@ NtUserGetClassInfo(HINSTANCE hInst, wcex->hCursor = Class->hCursor; wcex->hbrBackground = Class->hbrBackground; if(Class->lpszMenuName) - RtlCopyUnicodeString((PUNICODE_STRING)wcex->lpszMenuName, Class->lpszMenuName); + { + if(!IS_INTRESOURCE((LPCWSTR)Class->lpszMenuName)) + RtlCopyUnicodeString((PUNICODE_STRING)wcex->lpszMenuName, Class->lpszMenuName); + else + wcex->lpszMenuName = (LPCWSTR)Class->lpszMenuName; + } else wcex->lpszMenuName = (LPCWSTR)NULL; - wcex->lpszClassName = (LPCWSTR)Class->lpszClassName; + if(Class->lpszClassName) + { + if(!IS_ATOM((LPCWSTR)Class->lpszClassName)) + RtlCopyUnicodeString((PUNICODE_STRING)wcex->lpszClassName, Class->lpszClassName); + else + wcex->lpszClassName = (LPCWSTR)Class->lpszClassName; + } + else + wcex->lpszClassName = (LPCWSTR)NULL; wcex->hIconSm = Class->hIconSm; return 1; }