mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 20:31:25 +00:00
- Fixed Window Class menu handling that I broke with my last patch.
svn path=/trunk/; revision=9423
This commit is contained in:
parent
06ed586fb1
commit
aaa859c4a6
3 changed files with 31 additions and 29 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: class.c,v 1.48 2004/05/16 19:31:07 navaraf Exp $
|
/* $Id: class.c,v 1.49 2004/05/17 16:38:57 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -442,7 +442,7 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
|
||||||
{
|
{
|
||||||
MenuName.Length =
|
MenuName.Length =
|
||||||
MenuName.MaximumLength = 0;
|
MenuName.MaximumLength = 0;
|
||||||
MenuName.Buffer = (LPWSTR)lpwcx->lpszClassName;
|
MenuName.Buffer = (LPWSTR)lpwcx->lpszMenuName;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
RtlCreateUnicodeStringFromAsciiz(&MenuName, lpwcx->lpszMenuName);
|
RtlCreateUnicodeStringFromAsciiz(&MenuName, lpwcx->lpszMenuName);
|
||||||
|
@ -515,7 +515,7 @@ RegisterClassExW(CONST WNDCLASSEXW *lpwcx)
|
||||||
{
|
{
|
||||||
MenuName.Length =
|
MenuName.Length =
|
||||||
MenuName.MaximumLength = 0;
|
MenuName.MaximumLength = 0;
|
||||||
MenuName.Buffer = (LPWSTR)lpwcx->lpszClassName;
|
MenuName.Buffer = (LPWSTR)lpwcx->lpszMenuName;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&MenuName, lpwcx->lpszMenuName);
|
RtlInitUnicodeString(&MenuName, lpwcx->lpszMenuName);
|
||||||
|
|
|
@ -21,7 +21,7 @@ typedef struct _WNDCLASS_OBJECT
|
||||||
HICON hIcon;
|
HICON hIcon;
|
||||||
HCURSOR hCursor;
|
HCURSOR hCursor;
|
||||||
HBRUSH hbrBackground;
|
HBRUSH hbrBackground;
|
||||||
PUNICODE_STRING lpszMenuName;
|
UNICODE_STRING lpszMenuName;
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
HICON hIconSm;
|
HICON hIconSm;
|
||||||
BOOL Unicode;
|
BOOL Unicode;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: class.c,v 1.54 2004/05/16 19:31:09 navaraf Exp $
|
/* $Id: class.c,v 1.55 2004/05/17 16:38:58 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -183,15 +183,10 @@ NtUserGetClassInfo(
|
||||||
lpWndClassEx->hIcon = Class->hIcon;
|
lpWndClassEx->hIcon = Class->hIcon;
|
||||||
lpWndClassEx->hCursor = Class->hCursor;
|
lpWndClassEx->hCursor = Class->hCursor;
|
||||||
lpWndClassEx->hbrBackground = Class->hbrBackground;
|
lpWndClassEx->hbrBackground = Class->hbrBackground;
|
||||||
if (Class->lpszMenuName)
|
if (Class->lpszMenuName.MaximumLength)
|
||||||
{
|
RtlCopyUnicodeString((PUNICODE_STRING)lpWndClassEx->lpszMenuName, &Class->lpszMenuName);
|
||||||
if (!IS_INTRESOURCE((LPCWSTR)Class->lpszMenuName))
|
|
||||||
RtlCopyUnicodeString((PUNICODE_STRING)lpWndClassEx->lpszMenuName, Class->lpszMenuName);
|
|
||||||
else
|
else
|
||||||
lpWndClassEx->lpszMenuName = (LPCWSTR)Class->lpszMenuName;
|
lpWndClassEx->lpszMenuName = Class->lpszMenuName.Buffer;
|
||||||
}
|
|
||||||
else
|
|
||||||
lpWndClassEx->lpszMenuName = (LPCWSTR)NULL;
|
|
||||||
lpWndClassEx->lpszClassName = lpClassName;
|
lpWndClassEx->lpszClassName = lpClassName;
|
||||||
lpWndClassEx->hIconSm = Class->hIconSm;
|
lpWndClassEx->hIconSm = Class->hIconSm;
|
||||||
Atom = Class->Atom;
|
Atom = Class->Atom;
|
||||||
|
@ -349,12 +344,16 @@ IntCreateClass(
|
||||||
}
|
}
|
||||||
if (MenuName->Length == 0)
|
if (MenuName->Length == 0)
|
||||||
{
|
{
|
||||||
ClassObject->lpszMenuName = (PUNICODE_STRING)MenuName->Buffer;
|
ClassObject->lpszMenuName.Length =
|
||||||
|
ClassObject->lpszMenuName.MaximumLength = 0;
|
||||||
|
ClassObject->lpszMenuName.Buffer = MenuName->Buffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClassObject->lpszMenuName = ExAllocatePoolWithTag(NonPagedPool, sizeof(UNICODE_STRING), TAG_STRING);
|
ClassObject->lpszMenuName.Length =
|
||||||
RtlCreateUnicodeString(ClassObject->lpszMenuName, MenuName->Buffer);
|
ClassObject->lpszMenuName.MaximumLength = MenuName->MaximumLength;
|
||||||
|
ClassObject->lpszMenuName.Buffer = ExAllocatePoolWithTag(PagedPool, ClassObject->lpszMenuName.MaximumLength, TAG_STRING);
|
||||||
|
RtlCopyUnicodeString(&ClassObject->lpszMenuName, MenuName);
|
||||||
}
|
}
|
||||||
/* Extra class data */
|
/* Extra class data */
|
||||||
if (ClassObject->cbClsExtra != 0)
|
if (ClassObject->cbClsExtra != 0)
|
||||||
|
@ -516,7 +515,7 @@ IntGetClassLong(struct _WINDOW_OBJECT *WindowObject, ULONG Offset, BOOL Ansi)
|
||||||
Ret = (ULONG)WindowObject->Class->hInstance;
|
Ret = (ULONG)WindowObject->Class->hInstance;
|
||||||
break;
|
break;
|
||||||
case GCL_MENUNAME:
|
case GCL_MENUNAME:
|
||||||
Ret = (ULONG)WindowObject->Class->lpszMenuName;
|
Ret = (ULONG)WindowObject->Class->lpszMenuName.Buffer;
|
||||||
break;
|
break;
|
||||||
case GCL_STYLE:
|
case GCL_STYLE:
|
||||||
Ret = WindowObject->Class->style;
|
Ret = WindowObject->Class->style;
|
||||||
|
@ -558,8 +557,6 @@ NtUserGetClassLong(HWND hWnd, DWORD Offset, BOOL Ansi)
|
||||||
void FASTCALL
|
void FASTCALL
|
||||||
IntSetClassLong(PWINDOW_OBJECT WindowObject, ULONG Offset, LONG dwNewLong, BOOL Ansi)
|
IntSetClassLong(PWINDOW_OBJECT WindowObject, ULONG Offset, LONG dwNewLong, BOOL Ansi)
|
||||||
{
|
{
|
||||||
PUNICODE_STRING str;
|
|
||||||
|
|
||||||
if ((int)Offset >= 0)
|
if ((int)Offset >= 0)
|
||||||
{
|
{
|
||||||
DPRINT("SetClassLong(%x, %d, %x)\n", WindowObject->Self, Offset, dwNewLong);
|
DPRINT("SetClassLong(%x, %d, %x)\n", WindowObject->Self, Offset, dwNewLong);
|
||||||
|
@ -596,15 +593,20 @@ IntSetClassLong(PWINDOW_OBJECT WindowObject, ULONG Offset, LONG dwNewLong, BOOL
|
||||||
WindowObject->Class->hInstance = (HINSTANCE)dwNewLong;
|
WindowObject->Class->hInstance = (HINSTANCE)dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_MENUNAME:
|
case GCL_MENUNAME:
|
||||||
|
if (WindowObject->Class->lpszMenuName.MaximumLength)
|
||||||
|
RtlFreeUnicodeString(&WindowObject->Class->lpszMenuName);
|
||||||
if (!IS_INTRESOURCE(dwNewLong))
|
if (!IS_INTRESOURCE(dwNewLong))
|
||||||
{
|
{
|
||||||
str = ExAllocatePoolWithTag(PagedPool,sizeof(UNICODE_STRING)+((PUNICODE_STRING)dwNewLong)->Length, TAG_STRING);
|
WindowObject->Class->lpszMenuName.Length =
|
||||||
memcpy(str,(PUNICODE_STRING)dwNewLong,sizeof(UNICODE_STRING)+((PUNICODE_STRING)dwNewLong)->Length);
|
WindowObject->Class->lpszMenuName.MaximumLength = ((PUNICODE_STRING)dwNewLong)->MaximumLength;
|
||||||
WindowObject->Class->lpszMenuName = str;
|
WindowObject->Class->lpszMenuName.Buffer = ExAllocatePoolWithTag(PagedPool, WindowObject->Class->lpszMenuName.MaximumLength, TAG_STRING);
|
||||||
|
RtlCopyUnicodeString(&WindowObject->Class->lpszMenuName, (PUNICODE_STRING)dwNewLong);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WindowObject->Class->lpszMenuName = (PUNICODE_STRING)dwNewLong;
|
WindowObject->Class->lpszMenuName.Length =
|
||||||
|
WindowObject->Class->lpszMenuName.MaximumLength = 0;
|
||||||
|
WindowObject->Class->lpszMenuName.Buffer = (LPWSTR)dwNewLong;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GCL_STYLE:
|
case GCL_STYLE:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue