Repairs to WNDPROC and class handling by Jonathan Wilson

svn path=/trunk/; revision=5526
This commit is contained in:
Gé van Geldorp 2003-08-11 10:30:19 +00:00
parent aee5041a87
commit 4fa73ed4a8
4 changed files with 41 additions and 87 deletions

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.22 2003/08/02 16:55:59 gdalsnes Exp $ /* $Id: message.c,v 1.23 2003/08/11 10:30:19 gvg 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
@ -221,6 +221,16 @@ CallWindowProcA(WNDPROC lpPrevWndFunc,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
BOOL IsHandle;
if ((DWORD)lpPrevWndFunc > 0x80000000)
{
lpPrevWndFunc -= 0x80000000;
IsHandle = TRUE;
}
else
{
IsHandle = FALSE;
}
if (IsWindowUnicode(hWnd)) if (IsWindowUnicode(hWnd))
{ {
LRESULT Result; LRESULT Result;
@ -246,6 +256,16 @@ CallWindowProcW(WNDPROC lpPrevWndFunc,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
BOOL IsHandle;
if ((DWORD)lpPrevWndFunc > 0x80000000)
{
lpPrevWndFunc-= 0x80000000;
IsHandle = TRUE;
}
else
{
IsHandle = FALSE;
}
if (!IsWindowUnicode(hWnd)) if (!IsWindowUnicode(hWnd))
{ {
LRESULT Result; LRESULT Result;

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.54 2003/08/09 07:09:57 jimtabor Exp $ /* $Id: window.c,v 1.55 2003/08/11 10:30:19 gvg 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
@ -45,14 +45,7 @@ User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
if (CallbackArgs->Validate) if (CallbackArgs->Validate)
@ -87,14 +80,7 @@ User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO, Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO,
@ -119,14 +105,7 @@ User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0, Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0,
@ -150,14 +129,7 @@ User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0, Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
@ -181,14 +153,7 @@ User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLengt
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGING, 0, Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGING, 0,
@ -212,14 +177,7 @@ User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGED, 0, Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGED, 0,
@ -243,14 +201,7 @@ User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGING, CallbackArgs->WhichStyle, Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGING, CallbackArgs->WhichStyle,
@ -274,14 +225,7 @@ User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
DPRINT("Wrong length.\n"); DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH); return(STATUS_INFO_LENGTH_MISMATCH);
} }
if (IsWindowUnicode(CallbackArgs->Wnd)) Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
DPRINT("Proc %X\n", Proc); DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */ /* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGED, CallbackArgs->WhichStyle, Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGED, CallbackArgs->WhichStyle,
@ -321,14 +265,7 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
} }
if (CallbackArgs->Proc == NULL) if (CallbackArgs->Proc == NULL)
{ {
if (IsWindowUnicode(CallbackArgs->Wnd)) CallbackArgs->Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
{
CallbackArgs->Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
}
else
{
CallbackArgs->Proc = (WNDPROC)GetWindowLongA(CallbackArgs->Wnd, GWL_WNDPROC);
}
} }
Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd, Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd,
CallbackArgs->Msg, CallbackArgs->wParam, CallbackArgs->Msg, CallbackArgs->wParam,

View file

@ -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.26 2003/08/09 07:09:57 jimtabor Exp $ /* $Id: class.c,v 1.27 2003/08/11 10:30:19 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -165,10 +165,6 @@ NtUserGetClassInfo(HINSTANCE hInst,
SetLastNtError(Status); SetLastNtError(Status);
return 0; return 0;
} }
if (Class->hInstance != hInst)
{
return 0;
}
wcex->cbSize = sizeof(LPWNDCLASSEXW); wcex->cbSize = sizeof(LPWNDCLASSEXW);
wcex->style = Class->style; wcex->style = Class->style;
if (Ansi) if (Ansi)
@ -302,19 +298,20 @@ W32kCreateClass(CONST WNDCLASSEXW *lpwcx,
if (bUnicodeClass) if (bUnicodeClass)
{ {
ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc; ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
ClassObject->lpfnWndProcA = (WNDPROC)0xCCCCCCCC; ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc+0x80000000;
} }
else else
{ {
ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc; ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
ClassObject->lpfnWndProcW = (WNDPROC)0xCCCCCCCC; ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc+0x80000000;
} }
if (IS_INTRESOURCE(lpwcx->lpszMenuName)) if (IS_INTRESOURCE(lpwcx->lpszMenuName))
{ {
ClassObject->lpszMenuName = (PUNICODE_STRING)lpwcx->lpszMenuName; ClassObject->lpszMenuName = (PUNICODE_STRING)lpwcx->lpszMenuName;
} }
else else
{ {
ClassObject->lpszMenuName = ExAllocatePool(NonPagedPool,sizeof(UNICODE_STRING));
RtlCreateUnicodeString(ClassObject->lpszMenuName,(LPWSTR)lpwcx->lpszMenuName); RtlCreateUnicodeString(ClassObject->lpszMenuName,(LPWSTR)lpwcx->lpszMenuName);
} }
return(ClassObject); return(ClassObject);
@ -504,12 +501,12 @@ W32kSetClassLong(PWINDOW_OBJECT WindowObject, ULONG Offset, LONG dwNewLong, BOOL
if (Ansi) if (Ansi)
{ {
WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong; WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong;
WindowObject->Class->lpfnWndProcW = (WNDPROC)0xCCCCCCCC; WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong+0x80000000;
} }
else else
{ {
WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong; WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong;
WindowObject->Class->lpfnWndProcA = (WNDPROC)0xCCCCCCCC; WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong+0x80000000;
} }
break; break;
} }

View file

@ -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: window.c,v 1.84 2003/08/09 21:13:14 gvg Exp $ /* $Id: window.c,v 1.85 2003/08/11 10:30:19 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1856,13 +1856,13 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
{ {
OldValue = (LONG) WindowObject->WndProcA; OldValue = (LONG) WindowObject->WndProcA;
WindowObject->WndProcA = (WNDPROC) NewValue; WindowObject->WndProcA = (WNDPROC) NewValue;
WindowObject->WndProcW = (WNDPROC)0xCCCCCCCC; WindowObject->WndProcW = (WNDPROC) NewValue+0x80000000;
} }
else else
{ {
OldValue = (LONG) WindowObject->WndProcW; OldValue = (LONG) WindowObject->WndProcW;
WindowObject->WndProcW = (WNDPROC) NewValue; WindowObject->WndProcW = (WNDPROC) NewValue;
WindowObject->WndProcA = (WNDPROC)0xCCCCCCCC; WindowObject->WndProcA = (WNDPROC) NewValue+0x80000000;
} }
break; break;