NtUserCreateDesktop 5
NtUserCreateLocalMemHandle 4
NtUserCreateMenu 0
-NtUserCreateWindowEx 13
+NtUserCreateWindowEx 14
NtUserCreateWindowStation 6
NtUserDdeGetQualityOfService 3
NtUserDdeInitialize 5
NtUserGetWindow 2
NtUserGetLastActivePopup 1
NtUserGetShellWindow 0
+NtUserDereferenceWndProcHandle 2
# DirectDraw system calls
NtGdiD3dContextCreate 4
NtGdiD3dContextDestroy 1
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam,
- DWORD Unknown12);
+ DWORD dwShowMode,
+ BOOL bUnicodeWindow);
HWINSTA
STDCALL
STDCALL
NtUserRegisterClassExWOW(CONST WNDCLASSEXW* lpwcx,
BOOL bUnicodeClass,
- DWORD Unknown3,
+ WNDPROC wpExtra,
DWORD Unknown4,
DWORD Unknown5);
HWND STDCALL
NtUserGetLastActivePopup(HWND hWnd);
+typedef struct _WndProcHandle
+{
+ WNDPROC WindowProc;
+ BOOL IsUnicode;
+ HANDLE ProcessID;
+} WndProcHandle;
+DWORD STDCALL
+NtUserDereferenceWndProcHandle(WNDPROC wpHandle, WndProcHandle *Data);
#endif /* __WIN32K_NTUSER_H */
/* EOF */
-/* $Id: regcontrol.c,v 1.14 2003/11/02 06:58:57 navaraf Exp $
+/* $Id: regcontrol.c,v 1.15 2003/11/11 20:28:20 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32
#include "windows.h"
#include "user32/regcontrol.h"
+#include "win32k/ntuser.h"
static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
{
- WNDCLASSW wc;
+ WNDCLASSEXW wc;
ATOM Class;
+ wc.cbSize = sizeof(WNDCLASSEXW);
wc.lpszClassName = Descr->name;
wc.lpfnWndProc = Descr->procW;
wc.style = Descr->style;
wc.hInstance = NULL;
wc.hIcon = NULL;
+ wc.hIconSm = NULL;
wc.hCursor = LoadCursorW(NULL, Descr->cursor);
wc.hbrBackground = Descr->brush;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = Descr->extra;
+
#if 0
if(IS_ATOM(wc.lpszClassName))
DbgPrint("Registering built-in class atom=0x%x\n", wc.lpszClassName);
else
DbgPrint("Registering built-in class %wS\n", wc.lpszClassName);
#endif
- Class = RegisterClassW(&wc);
+ Class = NtUserRegisterClassExWOW(&wc,TRUE,Descr->procA,0,0);
#if 0
DbgPrint("RegisterClassW = %d\n", Class);
#endif
-/* $Id: class.c,v 1.38 2003/08/20 03:07:33 silverblade Exp $
+/* $Id: class.c,v 1.39 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
wndclass.lpszMenuName = MenuName;
}
- Atom = NtUserRegisterClassExWOW ( &wndclass, FALSE, 0, 0, 0 );
+ Atom = NtUserRegisterClassExWOW ( &wndclass, FALSE, (WNDPROC)0, 0, 0 );
/* free strings if neccessary */
if ( MenuName ) HEAP_free ( MenuName );
wndclass.lpszMenuName = MenuName;
}
- Atom = NtUserRegisterClassExWOW ( &wndclass, TRUE, 0, 0, 0 );
+ Atom = NtUserRegisterClassExWOW ( &wndclass, TRUE, (WNDPROC)0, 0, 0 );
/* free strings if neccessary */
if ( MenuName ) HEAP_free ( MenuName );
-/* $Id: message.c,v 1.26 2003/11/08 09:33:14 navaraf Exp $
+/* $Id: message.c,v 1.27 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
MSG UnicodeMsg;
LRESULT Result;
BOOL IsHandle;
+ WndProcHandle wphData;
- if ((DWORD)lpPrevWndFunc > 0x80000000)
- {
- lpPrevWndFunc -= 0x80000000;
- IsHandle = TRUE;
- }
- else
- {
- IsHandle = FALSE;
- }
-
+ IsHandle = NtUserDereferenceWndProcHandle(lpPrevWndFunc,&wphData);
AnsiMsg.hwnd = hWnd;
AnsiMsg.message = Msg;
AnsiMsg.wParam = wParam;
AnsiMsg.lParam = lParam;
-
- if (IsWindowUnicode(hWnd))
+ if (!IsHandle)
+ {
+ return(lpPrevWndFunc(hWnd, Msg, wParam, lParam));
+ } else {
+ if (wphData.IsUnicode)
{
if (!MsgiAnsiToUnicodeMessage(&UnicodeMsg, &AnsiMsg))
{
return(FALSE);
}
- Result = lpPrevWndFunc(hWnd, Msg, wParam, lParam);
+ Result = wphData.WindowProc(UnicodeMsg.hwnd, UnicodeMsg.message,
+ UnicodeMsg.wParam, UnicodeMsg.lParam);
if (!MsgiAnsiToUnicodeReply(&UnicodeMsg, &AnsiMsg, &Result))
{
return(FALSE);
}
else
{
- return(lpPrevWndFunc(hWnd, Msg, wParam, lParam));
+ return(wphData.WindowProc(hWnd, Msg, wParam, lParam));
+ }
}
}
LPARAM lParam)
{
BOOL IsHandle;
- if ((DWORD)lpPrevWndFunc > 0x80000000)
- {
- lpPrevWndFunc-= 0x80000000;
- IsHandle = TRUE;
- }
- else
+ WndProcHandle wphData;
+
+ IsHandle = NtUserDereferenceWndProcHandle(lpPrevWndFunc,&wphData);
+ if (!IsHandle)
{
- IsHandle = FALSE;
- }
- if (!IsWindowUnicode(hWnd))
+ return(lpPrevWndFunc(hWnd, Msg, wParam, lParam));
+ } else {
+ if (!wphData.IsUnicode)
{
LRESULT Result;
User32ConvertToAsciiMessage(&Msg, &wParam, &lParam);
- Result = lpPrevWndFunc(hWnd, Msg, wParam, lParam);
+ Result = wphData.WindowProc(hWnd, Msg, wParam, lParam);
User32FreeAsciiConvertedMessage(Msg, wParam, lParam);
return(Result);
}
else
{
- return(lpPrevWndFunc(hWnd, Msg, wParam, lParam));
+ return(wphData.WindowProc(hWnd, Msg, wParam, lParam));
+ }
}
}
-/* $Id: window.c,v 1.80 2003/11/09 13:50:04 navaraf Exp $
+/* $Id: window.c,v 1.81 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
hMenu,
hInstance,
lpParam,
- sw);
+ sw,
+ FALSE);
#if 0
DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle);
hMenu,
hInstance,
lpParam,
- sw);
+ sw,
+ TRUE);
return (HWND)Handle;
}
PWNDCLASS_OBJECT FASTCALL
IntCreateClass(CONST WNDCLASSEXW *lpwcx,
BOOL bUnicodeClass,
+ WNDPROC wpExtra,
RTL_ATOM Atom);
struct _WINDOW_OBJECT;
ULONG FASTCALL
VOID FASTCALL IntRestoreWinLock(WINLOCK_TYPE Type);
inline BOOL IntInitializeWinLock();
inline VOID IntDeleteWinLock();
+DWORD IntRemoveWndProcHandle(WNDPROC Handle);
+DWORD IntRemoveProcessWndProcHandles(HANDLE ProcessID);
+DWORD IntAddWndProcHandle(WNDPROC WindowProc, BOOL IsUnicode);
#endif /* __WIN32K_WINDOW_H */
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: dllmain.c,v 1.48 2003/11/07 17:40:02 gvg Exp $
+/* $Id: dllmain.c,v 1.49 2003/11/11 20:28:21 gvg Exp $
*
* Entry Point for win32k.sys
*/
DbgPrint (" Destroy process\n");
DbgPrint (" IRQ level: %lu\n", KeGetCurrentIrql ());
#endif
-
+ IntRemoveProcessWndProcHandles((HANDLE)Process->UniqueProcessId);
IntCleanupMenus(Process, Win32Process);
CleanupForProcess(Process, Process->UniqueProcessId);
* 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.38 2003/10/28 20:19:45 gvg Exp $
+/* $Id: class.c,v 1.39 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
PWNDCLASS_OBJECT FASTCALL
IntCreateClass(CONST WNDCLASSEXW *lpwcx,
BOOL bUnicodeClass,
+ WNDPROC wpExtra,
RTL_ATOM Atom)
{
PWNDCLASS_OBJECT ClassObject;
ClassObject->Unicode = bUnicodeClass;
ClassObject->hIconSm = lpwcx->hIconSm;
ClassObject->lpszClassName = (PUNICODE_STRING)(ULONG)Atom;
+ if (wpExtra == 0) {
if (bUnicodeClass)
{
ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
- ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc+0x80000000;
+ ClassObject->lpfnWndProcA = (WNDPROC)IntAddWndProcHandle(lpwcx->lpfnWndProc,TRUE);
}
else
{
ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
- ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc+0x80000000;
+ ClassObject->lpfnWndProcW = (WNDPROC)IntAddWndProcHandle(lpwcx->lpfnWndProc,FALSE);
+ }
+ } else {
+ if (bUnicodeClass)
+ {
+ ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
+ ClassObject->lpfnWndProcA = wpExtra;
+ }
+ else
+ {
+ ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
+ ClassObject->lpfnWndProcW = wpExtra;
+ }
}
if (IS_INTRESOURCE(lpwcx->lpszMenuName))
{
NtUserRegisterClassExWOW(
CONST WNDCLASSEXW *lpwcx,
BOOL bUnicodeClass,
- DWORD Unknown3,
+ WNDPROC wpExtra,
DWORD Unknown4,
DWORD Unknown5)
* lpwcx = Win32 extended window class structure
* bUnicodeClass = Whether to send ANSI or unicode strings
* to window procedures
+ * wpExtra = Extra window procedure, if this is not null, its used for the second window procedure for standard controls.
* RETURNS:
* Atom identifying the new class
*/
{
Atom = (RTL_ATOM)(ULONG)lpwcx->lpszClassName;
}
- ClassObject = IntCreateClass(lpwcx, bUnicodeClass, Atom);
+ ClassObject = IntCreateClass(lpwcx, bUnicodeClass, wpExtra, Atom);
if (ClassObject == NULL)
{
if (!IS_ATOM(lpwcx->lpszClassName))
if (Ansi)
{
WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong;
- WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong+0x80000000;
+ WindowObject->Class->lpfnWndProcW = (WNDPROC) IntAddWndProcHandle((WNDPROC)dwNewLong,FALSE);
WindowObject->Class->Unicode = FALSE;
}
else
{
WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong;
- WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong+0x80000000;
+ WindowObject->Class->lpfnWndProcA = (WNDPROC) IntAddWndProcHandle((WNDPROC)dwNewLong,TRUE);
WindowObject->Class->Unicode = TRUE;
}
break;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: message.c,v 1.30 2003/10/09 06:13:04 gvg Exp $
+/* $Id: message.c,v 1.31 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
/* FIXME: Call hook procedures. */
/* Call the window procedure. */
- if (WindowObject->Unicode == TRUE)
- {
Result = IntCallWindowProc(WindowObject->WndProcW,
Msg.hwnd,
Msg.message,
Msg.wParam,
Msg.lParam);
- }
- else
- {
- Result = IntCallWindowProc(WindowObject->WndProcA,
- Msg.hwnd,
- Msg.message,
- Msg.wParam,
- Msg.lParam);
- }
return Result;
}
return Result;
}
else
- {
- if (Window->Unicode == TRUE)
{
Result = IntCallWindowProc(Window->WndProcW, hWnd, Msg, wParam, lParam);
- }
- else
- {
- Result = IntCallWindowProc(Window->WndProcA, hWnd, Msg, wParam, lParam);
- }
return Result;
}
}
-/* $Id: misc.c,v 1.22 2003/11/10 17:44:49 weiden Exp $
+/* $Id: misc.c,v 1.23 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
case TWOPARAM_ROUTINE_SETCARETPOS:
return (DWORD)IntSetCaretPos((int)Param1, (int)Param2);
}
- DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam()\n Param1=0x%x Parm2=0x%x\n",
+ DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam()\n Param1=0x%x Parm2=0x%x\n",
Routine, Param1, Param2);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: window.c,v 1.131 2003/11/09 11:42:08 navaraf Exp $
+/* $Id: window.c,v 1.132 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
} REGISTERED_MESSAGE, *PREGISTERED_MESSAGE;
static LIST_ENTRY RegisteredMessageListHead;
+static WndProcHandle *WndProcHandlesArray = 0;
+static WORD WndProcHandlesArraySize = 0;
#define REGISTERED_MESSAGE_MIN 0xc000
#define REGISTERED_MESSAGE_MAX 0xffff
+#define WPH_SIZE 0x40 /* the size to add to the WndProcHandle array each time */
/* globally stored handles to the shell windows */
HWND hwndShellWindow = 0;
InitWindowImpl(VOID)
{
InitializeListHead(&RegisteredMessageListHead);
+ WndProcHandlesArray = ExAllocatePool(PagedPool,WPH_SIZE * sizeof(WndProcHandle));
+ WndProcHandlesArraySize = WPH_SIZE;
return STATUS_SUCCESS;
}
NTSTATUS FASTCALL
CleanupWindowImpl(VOID)
{
+ ExFreePool(WndProcHandlesArray);
+ WndProcHandlesArray = 0;
+ WndProcHandlesArraySize = 0;
return STATUS_SUCCESS;
}
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam,
- DWORD dwShowMode)
+ DWORD dwShowMode,
+ BOOL bUnicodeWindow)
{
PWINSTATION_OBJECT WinStaObject;
PWNDCLASS_OBJECT ClassObject;
WindowObject->Parent = ParentWindow;
WindowObject->Owner = IntGetWindowObject(OwnerWindowHandle);
WindowObject->UserData = 0;
+ if ((((DWORD)ClassObject->lpfnWndProcA & 0xFFFF0000) != 0xFFFF0000) || (((DWORD)ClassObject->lpfnWndProcW & 0xFFFF0000) != 0xFFFF0000))
+ {
WindowObject->Unicode = ClassObject->Unicode;
+ } else {
+ WindowObject->Unicode = bUnicodeWindow;
+ }
WindowObject->WndProcA = ClassObject->lpfnWndProcA;
WindowObject->WndProcW = ClassObject->lpfnWndProcW;
WindowObject->OwnerThread = PsGetCurrentThread();
{
OldValue = (LONG) WindowObject->WndProcA;
WindowObject->WndProcA = (WNDPROC) NewValue;
- WindowObject->WndProcW = (WNDPROC) NewValue + 0x80000000;
+ WindowObject->WndProcW = (WNDPROC) IntAddWndProcHandle((WNDPROC)NewValue,FALSE);
WindowObject->Unicode = FALSE;
}
else
{
OldValue = (LONG) WindowObject->WndProcW;
WindowObject->WndProcW = (WNDPROC) NewValue;
- WindowObject->WndProcA = (WNDPROC) NewValue + 0x80000000;
+ WindowObject->WndProcA = (WNDPROC) IntAddWndProcHandle((WNDPROC)NewValue,TRUE);
WindowObject->Unicode = TRUE;
}
break;
return Result;
}
+DWORD STDCALL
+NtUserDereferenceWndProcHandle(WNDPROC wpHandle, WndProcHandle *Data)
+{
+ WndProcHandle Entry;
+ if (((DWORD)wpHandle & 0xFFFF0000) == 0xFFFF0000)
+ {
+ Entry = WndProcHandlesArray[(DWORD)wpHandle & 0x0000FFFF];
+ Data->WindowProc = Entry.WindowProc;
+ Data->IsUnicode = Entry.IsUnicode;
+ Data->ProcessID = Entry.ProcessID;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ return FALSE;
+}
+
+DWORD
+IntAddWndProcHandle(WNDPROC WindowProc, BOOL IsUnicode)
+{
+ WORD i;
+ WORD FreeSpot;
+ BOOL found;
+ WndProcHandle *OldArray;
+ WORD OldArraySize;
+ found = FALSE;
+ for (i = 0;i < WndProcHandlesArraySize;i++)
+ {
+ if (WndProcHandlesArray[i].WindowProc == NULL)
+ {
+ FreeSpot = i;
+ found = TRUE;
+ }
+ }
+ if (!found)
+ {
+ OldArray = WndProcHandlesArray;
+ OldArraySize = WndProcHandlesArraySize;
+ WndProcHandlesArray = ExAllocatePool(PagedPool,(OldArraySize + WPH_SIZE) * sizeof(WndProcHandle));
+ WndProcHandlesArraySize = OldArraySize + WPH_SIZE;
+ RtlCopyMemory(WndProcHandlesArray,OldArray,OldArraySize * sizeof(WndProcHandle));
+ ExFreePool(OldArray);
+ FreeSpot = OldArraySize + 1;
+ }
+ WndProcHandlesArray[FreeSpot].WindowProc = WindowProc;
+ WndProcHandlesArray[FreeSpot].IsUnicode = IsUnicode;
+ WndProcHandlesArray[FreeSpot].ProcessID = PsGetCurrentProcessId();
+ return FreeSpot + 0xFFFF0000;
+}
+
+DWORD
+IntRemoveWndProcHandle(WNDPROC Handle)
+{
+ WORD position;
+ position = (DWORD)Handle & 0x0000FFFF;
+ if (position > WndProcHandlesArraySize)
+ {
+ return FALSE;
+ }
+ WndProcHandlesArray[position].WindowProc = NULL;
+ WndProcHandlesArray[position].IsUnicode = FALSE;
+ WndProcHandlesArray[position].ProcessID = NULL;
+ return TRUE;
+}
+
+DWORD
+IntRemoveProcessWndProcHandles(HANDLE ProcessID)
+{
+ WORD i;
+ for (i = 0;i < WndProcHandlesArraySize;i++)
+ {
+ if (WndProcHandlesArray[i].ProcessID == ProcessID)
+ {
+ WndProcHandlesArray[i].WindowProc = NULL;
+ WndProcHandlesArray[i].IsUnicode = FALSE;
+ WndProcHandlesArray[i].ProcessID = NULL;
+ }
+ }
+ return TRUE;
+}
+
/* EOF */
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: winsta.c,v 1.40 2003/11/10 17:44:49 weiden Exp $
+/* $Id: winsta.c,v 1.41 2003/11/11 20:28:21 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
wcx.hbrBackground = NULL;
wcx.lpszMenuName = NULL;
wcx.lpszClassName = L"DesktopWindowClass";
- DesktopWindowClass = IntCreateClass(&wcx, TRUE, (RTL_ATOM)32880);
+ DesktopWindowClass = IntCreateClass(&wcx, TRUE, IntDesktopWindowProc, (RTL_ATOM)32880);
return(STATUS_SUCCESS);
}