fixed GetClassInfoExA/W() and CreateWindowExA/W()

svn path=/trunk/; revision=5659
This commit is contained in:
Thomas Bluemel 2003-08-18 23:52:03 +00:00
parent 5f8d059303
commit 1717987643
3 changed files with 61 additions and 20 deletions

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.29 2003/08/14 20:25:52 royce Exp $
/* $Id: class.c,v 1.30 2003/08/18 23:52:03 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -27,7 +27,7 @@ GetClassInfoExA(
LPWNDCLASSEXA lpwcx)
{
LPWSTR str;
PUNICODE_STRING str2;
UNICODE_STRING str2;
WNDCLASSEXW w;
BOOL retval;
NTSTATUS Status;
@ -37,18 +37,27 @@ GetClassInfoExA(
SetLastError (RtlNtStatusToDosError(Status));
return 0;
}
retval = (BOOL)NtUserGetClassInfo(hinst,str,&w,TRUE,0);
if (str)
str2.Length = 0;
str2.MaximumLength = 255;
str2.Buffer = (PWSTR)RtlAllocateHeap(RtlGetProcessHeap(), 0,
str2.MaximumLength * sizeof(WCHAR));
if(!str2.Buffer)
{
HEAP_free(str);
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
return 0;
}
RtlCopyMemory (&w,lpwcx,sizeof(WNDCLASSEXW));
w.lpszMenuName = (LPCWSTR)&str2;
retval = (BOOL)NtUserGetClassInfo(hinst, str, &w, TRUE, 0);
HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if (!IS_INTRESOURCE(w.lpszMenuName))
{
str = (LPWSTR)w.lpszMenuName;
str2 = (PUNICODE_STRING)str;
lpwcx->lpszMenuName = heap_string_poolA (str2->Buffer, str2->Length);
lpwcx->lpszMenuName = heap_string_poolA (str2.Buffer, str2.Length);
}
RtlFreeHeap(RtlGetProcessHeap(), 0, str2.Buffer);
return retval;
}
@ -64,22 +73,31 @@ GetClassInfoExW(
LPWNDCLASSEXW lpwcx)
{
LPWSTR str;
PUNICODE_STRING str2;
UNICODE_STRING str2;
WNDCLASSEXW w;
WINBOOL retval;
str = HEAP_strdupW (lpszClass, wcslen(lpszClass) );
retval = (BOOL)NtUserGetClassInfo(hinst,lpszClass,&w,FALSE,0);
if (str)
str2.Length = 0;
str2.MaximumLength = 255;
str2.Buffer = (PWSTR)RtlAllocateHeap(RtlGetProcessHeap(), 0,
str2.MaximumLength * sizeof(WCHAR));
if(!str2.Buffer)
{
HEAP_free(str);
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
return 0;
}
RtlCopyMemory (&w,lpwcx,sizeof(WNDCLASSEXW));
w.lpszMenuName = (LPCWSTR)&str2;
retval = (BOOL)NtUserGetClassInfo(hinst, str, &w, TRUE, 0);
HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if (!IS_INTRESOURCE(w.lpszMenuName) )
{
str = (LPWSTR)w.lpszMenuName;
str2 = (PUNICODE_STRING)str;
lpwcx->lpszMenuName = heap_string_poolW (str2->Buffer, str2->Length);
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.65 2003/08/18 00:11:17 weiden Exp $
/* $Id: window.c,v 1.66 2003/08/18 23:52:03 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -508,6 +508,7 @@ CreateWindowExA(DWORD dwExStyle,
{
UNICODE_STRING WindowName;
UNICODE_STRING ClassName;
WNDCLASSEXA wce;
HWND Handle;
INT sw;
@ -593,6 +594,15 @@ CreateWindowExA(DWORD dwExStyle,
}
}
}
if(!hMenu)
{
wce.cbSize = sizeof(WNDCLASSEXA);
if(GetClassInfoExA(hInstance, lpClassName, &wce) && wce.lpszMenuName)
{
hMenu = LoadMenuA(hInstance, wce.lpszMenuName);
}
}
Handle = NtUserCreateWindowEx(dwExStyle,
&ClassName,
@ -640,6 +650,7 @@ CreateWindowExW(DWORD dwExStyle,
{
UNICODE_STRING WindowName;
UNICODE_STRING ClassName;
WNDCLASSEXW wce;
HANDLE Handle;
UINT sw;
@ -711,6 +722,15 @@ CreateWindowExW(DWORD dwExStyle,
}
}
}
if(!hMenu)
{
wce.cbSize = sizeof(WNDCLASSEXW);
if(GetClassInfoExW(hInstance, lpClassName, &wce) && wce.lpszMenuName)
{
hMenu = LoadMenuW(hInstance, wce.lpszMenuName);
}
}
Handle = NtUserCreateWindowEx(dwExStyle,
&ClassName,

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.30 2003/08/14 01:38:19 royce Exp $
/* $Id: class.c,v 1.31 2003/08/18 23:52:03 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -181,9 +181,12 @@ NtUserGetClassInfo(HINSTANCE hInst,
wcex->hIcon = Class->hIcon;
wcex->hCursor = Class->hCursor;
wcex->hbrBackground = Class->hbrBackground;
wcex->lpszMenuName = (LPCWSTR)Class->lpszMenuName;
//wcex->lpszMenuName = (LPCWSTR)Class->lpszMenuName;
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;
}