fixed some bugs in GetClassInfoExA/W()

svn path=/trunk/; revision=5660
This commit is contained in:
Thomas Bluemel 2003-08-19 00:36:40 +00:00
parent 1717987643
commit 37da5cd4d8
3 changed files with 23 additions and 14 deletions

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.30 2003/08/18 23:52:03 weiden Exp $
/* $Id: class.c,v 1.31 2003/08/19 00:36:40 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -31,7 +31,10 @@ GetClassInfoExA(
WNDCLASSEXW w;
BOOL retval;
NTSTATUS Status;
Status = HEAP_strdupAtoW (&str, lpszClass, NULL);
if(IS_ATOM(lpszClass))
str = (LPWSTR)lpszClass;
else
Status = HEAP_strdupAtoW (&str, lpszClass, NULL);
if ( !NT_SUCCESS (Status) )
{
SetLastError (RtlNtStatusToDosError(Status));
@ -47,10 +50,11 @@ GetClassInfoExA(
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
return 0;
}
w.lpszMenuName = (LPCWSTR)&str2;
retval = (BOOL)NtUserGetClassInfo(hinst, str, &w, TRUE, 0);
HEAP_free(str);
if(!IS_ATOM(str))
HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if (!IS_INTRESOURCE(w.lpszMenuName))
@ -76,8 +80,11 @@ GetClassInfoExW(
UNICODE_STRING str2;
WNDCLASSEXW w;
WINBOOL retval;
str = HEAP_strdupW (lpszClass, wcslen(lpszClass) );
if(IS_ATOM(lpszClass))
str = (LPWSTR)lpszClass;
else
str = HEAP_strdupW (lpszClass, wcslen(lpszClass) );
str2.Length = 0;
str2.MaximumLength = 255;
str2.Buffer = (PWSTR)RtlAllocateHeap(RtlGetProcessHeap(), 0,
@ -90,13 +97,15 @@ GetClassInfoExW(
w.lpszMenuName = (LPCWSTR)&str2;
retval = (BOOL)NtUserGetClassInfo(hinst, str, &w, TRUE, 0);
HEAP_free(str);
if(!IS_ATOM(str))
HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if (!IS_INTRESOURCE(w.lpszMenuName) )
{
lpwcx->lpszMenuName = heap_string_poolW (str2.Buffer, str2.Length);
}
RtlFreeHeap(RtlGetProcessHeap(), 0, str2.Buffer);
return retval;
}

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.66 2003/08/18 23:52:03 weiden Exp $
/* $Id: window.c,v 1.67 2003/08/19 00:36:40 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -722,7 +722,7 @@ CreateWindowExW(DWORD dwExStyle,
}
}
}
if(!hMenu)
{
wce.cbSize = sizeof(WNDCLASSEXW);

View file

@ -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.31 2003/08/18 23:52:03 weiden Exp $
/* $Id: class.c,v 1.32 2003/08/19 00:36:40 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -181,12 +181,12 @@ NtUserGetClassInfo(HINSTANCE hInst,
wcex->hIcon = Class->hIcon;
wcex->hCursor = Class->hCursor;
wcex->hbrBackground = Class->hbrBackground;
//wcex->lpszMenuName = (LPCWSTR)Class->lpszMenuName;
if(Class->lpszMenuName)
RtlCopyUnicodeString((PUNICODE_STRING)wcex->lpszMenuName, Class->lpszMenuName);
else
wcex->lpszMenuName = (LPCWSTR)NULL;
wcex->lpszClassName = (LPCWSTR)Class->lpszClassName;
wcex->hIconSm = Class->hIconSm;
DbgPrint("Copying string...\n");
RtlCopyUnicodeString((PUNICODE_STRING)wcex->lpszMenuName, Class->lpszMenuName);
DbgPrint("Copied string...\n");
return 1;
}