- Bug 1450: Patch by Thomas Weidenmueller "Some window class fixes"

This patch makes registering the "Abiword" window class succeed. However, Abiword now crashes with a stack overflow recursively delivering the WM_NOTIFYFORMAT message to a subclassed rebar control...

svn path=/trunk/; revision=21781
This commit is contained in:
Aleksey Bragin 2006-05-03 10:48:38 +00:00
parent fd9ff56f6d
commit 549d2f7cbd
3 changed files with 22 additions and 11 deletions

View file

@ -553,18 +553,22 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon);
}
if (lpwcx->lpszMenuName != NULL)
if (WndClass.lpszMenuName != NULL)
{
if (HIWORD(lpwcx->lpszMenuName))
if (!IS_INTRESOURCE(WndClass.lpszMenuName))
{
RtlCreateUnicodeStringFromAsciiz(&MenuName, WndClass.lpszMenuName);
if (WndClass.lpszMenuName[0])
{
RtlCreateUnicodeStringFromAsciiz(&MenuName, WndClass.lpszMenuName);
}
}
else
{
MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
}
hMenu = LoadMenuA(WndClass.hInstance, lpwcx->lpszMenuName);
if (MenuName.Buffer != NULL)
hMenu = LoadMenuA(WndClass.hInstance, WndClass.lpszMenuName);
}
if (IS_ATOM(WndClass.lpszClassName))
@ -585,7 +589,7 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
REGISTERCLASS_ANSI,
hMenu);
if (!IS_ATOM(WndClass.lpszMenuName))
if (!IS_INTRESOURCE(WndClass.lpszMenuName))
RtlFreeUnicodeString(&MenuName);
if (!IS_ATOM(WndClass.lpszClassName))
RtlFreeUnicodeString(&ClassName);
@ -637,17 +641,22 @@ RegisterClassExW(CONST WNDCLASSEXW *lpwcx)
WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon);
}
if (lpwcx->lpszMenuName != NULL)
if (WndClass.lpszMenuName != NULL)
{
if (HIWORD(lpwcx->lpszMenuName))
if (!IS_INTRESOURCE(WndClass.lpszMenuName))
{
RtlInitUnicodeString(&MenuName, WndClass.lpszMenuName);
if (WndClass.lpszMenuName[0])
{
RtlInitUnicodeString(&MenuName, WndClass.lpszMenuName);
}
}
else
{
MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
}
hMenu = LoadMenuW(WndClass.hInstance, lpwcx->lpszMenuName);
if (MenuName.Buffer != NULL)
hMenu = LoadMenuW(WndClass.hInstance, WndClass.lpszMenuName);
}
if (IS_ATOM(WndClass.lpszClassName))

View file

@ -1432,6 +1432,8 @@ UserUnregisterClass(IN PUNICODE_STRING ClassName,
/* unlink the class */
*Link = Class->Next;
IntDeregisterClassAtom(Class->Atom);
/* finally free the resources */
IntDestroyClass(Class);
return TRUE;

View file

@ -1491,7 +1491,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
}
else
{
DPRINT1("Class %wZ not found\n", ClassName);
DPRINT1("Class \"%wZ\" not found\n", ClassName);
}
SetLastWin32Error(ERROR_CANNOT_FIND_WND_CLASS);
@ -2073,7 +2073,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
RETURN( NULL);
}
}
else if (! IS_INTRESOURCE(ClassName.Buffer))
else if (! IS_ATOM(ClassName.Buffer))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return NULL;