--- trunk/reactos/lib/user32/windows/class.c 2005-11-23 04:31:58 UTC (rev 19479)
+++ trunk/reactos/lib/user32/windows/class.c 2005-11-23 06:00:41 UTC (rev 19480)
@@ -574,8 +574,9 @@
WNDCLASSEXA WndClass;
UNICODE_STRING ClassName;
UNICODE_STRING MenuName;
+ HMENU hMenu;
- if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXW) ||
+ if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXA) ||
lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 ||
lpwcx->lpszClassName == NULL)
{
@@ -601,31 +602,34 @@
if (lpwcx->hInstance == NULL)
((WNDCLASSEXA*)lpwcx)->hInstance = GetModuleHandleW(NULL);
- RtlCopyMemory(&WndClass, lpwcx, sizeof(WNDCLASSEXW));
+ RtlCopyMemory(&WndClass, lpwcx, sizeof(WNDCLASSEXA));
if (NULL == WndClass.hIconSm)
{
WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon);
}
- if (IS_ATOM(lpwcx->lpszMenuName) || lpwcx->lpszMenuName == 0)
+ if HIWORD(lpwcx->lpszMenuName)
{
+ hMenu = 0;
+ RtlCreateUnicodeStringFromAsciiz(&MenuName, WndClass.lpszMenuName);
+ }
+ else
+ {
MenuName.Length =
MenuName.MaximumLength = 0;
- MenuName.Buffer = (LPWSTR)lpwcx->lpszMenuName;
- } else
- {
- RtlCreateUnicodeStringFromAsciiz(&MenuName, lpwcx->lpszMenuName);
+ MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
+ hMenu = LoadMenuA(WndClass.hInstance, lpwcx->lpszMenuName);
}
-
- if (IS_ATOM(lpwcx->lpszClassName))
+
+ if (IS_ATOM(WndClass.lpszClassName))
{
ClassName.Length =
ClassName.MaximumLength = 0;
- ClassName.Buffer = (LPWSTR)lpwcx->lpszClassName;
+ ClassName.Buffer = (LPWSTR)WndClass.lpszClassName;
} else
{
- RtlCreateUnicodeStringFromAsciiz(&ClassName, lpwcx->lpszClassName);
+ RtlCreateUnicodeStringFromAsciiz(&ClassName, WndClass.lpszClassName);
}
Atom = NtUserRegisterClassExWOW(
@@ -635,11 +639,12 @@
&MenuName,
NULL,
REGISTERCLASS_ANSI,
- 0);
+ 0,
+ hMenu);
- if (!IS_ATOM(lpwcx->lpszMenuName))
+ if (!IS_ATOM(WndClass.lpszMenuName))
RtlFreeUnicodeString(&MenuName);
- if (!IS_ATOM(lpwcx->lpszClassName))
+ if (!IS_ATOM(WndClass.lpszClassName))
RtlFreeUnicodeString(&ClassName);
return (ATOM)Atom;
@@ -654,6 +659,7 @@
WNDCLASSEXW WndClass;
UNICODE_STRING ClassName;
UNICODE_STRING MenuName;
+ HMENU hMenu;
if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXW) ||
lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 ||
@@ -688,24 +694,27 @@
WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon);
}
- if (IS_ATOM(lpwcx->lpszMenuName))
+ if HIWORD(lpwcx->lpszMenuName)
{
+ hMenu = 0;
+ RtlInitUnicodeString(&MenuName, WndClass.lpszMenuName);
+ }
+ else
+ {
MenuName.Length =
MenuName.MaximumLength = 0;
- MenuName.Buffer = (LPWSTR)lpwcx->lpszMenuName;
- } else
- {
- RtlInitUnicodeString(&MenuName, lpwcx->lpszMenuName);
+ MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
+ hMenu = LoadMenuW(WndClass.hInstance, lpwcx->lpszMenuName);
}
- if (IS_ATOM(lpwcx->lpszClassName))
+ if (IS_ATOM(WndClass.lpszClassName))
{
ClassName.Length =
ClassName.MaximumLength = 0;
- ClassName.Buffer = (LPWSTR)lpwcx->lpszClassName;
+ ClassName.Buffer = (LPWSTR)WndClass.lpszClassName;
} else
{
- RtlInitUnicodeString(&ClassName, lpwcx->lpszClassName);
+ RtlInitUnicodeString(&ClassName, WndClass.lpszClassName);
}
return (ATOM)NtUserRegisterClassExWOW(
@@ -715,7 +724,8 @@
&MenuName,
NULL,
0,
- 0);
+ 0,
+ hMenu);
}
/*
--- trunk/reactos/subsys/win32k/ntuser/class.c 2005-11-23 04:31:58 UTC (rev 19479)
+++ trunk/reactos/subsys/win32k/ntuser/class.c 2005-11-23 06:00:41 UTC (rev 19480)
@@ -69,6 +69,8 @@
ASSERT(Class->refs == 0);
RemoveEntryList(&Class->ListEntry);
+ if (Class->hMenu)
+ UserDestroyMenu(Class->hMenu);
RtlDeleteAtomFromAtomTable(gAtomTable, Class->Atom);
ExFreePool(Class);
}
@@ -149,7 +151,8 @@
DWORD Flags,
WNDPROC wpExtra,
PUNICODE_STRING MenuName,
- RTL_ATOM Atom)
+ RTL_ATOM Atom,
+ HMENU hMenu)
{
PWNDCLASS_OBJECT Class;
ULONG objectSize;
@@ -188,6 +191,7 @@
Class->hInstance = lpwcx->hInstance;
Class->hIcon = lpwcx->hIcon;
Class->hCursor = lpwcx->hCursor;
+ Class->hMenu = hMenu;
Class->hbrBackground = lpwcx->hbrBackground;
Class->Unicode = !(Flags & REGISTERCLASS_ANSI);
Class->Global = Global;
@@ -414,7 +418,8 @@
PUNICODE_STRING MenuName,
WNDPROC wpExtra,
DWORD Flags,
- DWORD Unknown7)
+ DWORD Unknown7,
+ HMENU hMenu)
/*
* FUNCTION:
@@ -495,7 +500,7 @@
RETURN(0);
}
- if (!IntRegisterClass(&SafeClass, Flags, wpExtra, MenuName, Atom))
+ if (!IntRegisterClass(&SafeClass, Flags, wpExtra, MenuName, Atom, hMenu))
{
if (ClassName->Length)
{