-surround user part (most of it) with a single lock (currently a mutex,
but will be a resource). other now useless locks will be removed next.
-dont call NtUser fucnctions internally (they are syscalls only!)
-prepend co_ to functions leading to a "callout" (callback, wait, etc)
Modified: trunk/reactos/subsys/win32k/eng/window.c
Modified: trunk/reactos/subsys/win32k/include/callback.h
Modified: trunk/reactos/subsys/win32k/include/caret.h
Modified: trunk/reactos/subsys/win32k/include/csr.h
Modified: trunk/reactos/subsys/win32k/include/desktop.h
Modified: trunk/reactos/subsys/win32k/include/focus.h
Modified: trunk/reactos/subsys/win32k/include/guicheck.h
Modified: trunk/reactos/subsys/win32k/include/hook.h
Modified: trunk/reactos/subsys/win32k/include/msgqueue.h
Modified: trunk/reactos/subsys/win32k/include/painting.h
Modified: trunk/reactos/subsys/win32k/include/scroll.h
Added: trunk/reactos/subsys/win32k/include/userfuncs.h
Modified: trunk/reactos/subsys/win32k/include/vis.h
Modified: trunk/reactos/subsys/win32k/include/win32k.h
Modified: trunk/reactos/subsys/win32k/include/winpos.h
Modified: trunk/reactos/subsys/win32k/include/winsta.h
Modified: trunk/reactos/subsys/win32k/main/dllmain.c
Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c
Modified: trunk/reactos/subsys/win32k/ntuser/callback.c
Modified: trunk/reactos/subsys/win32k/ntuser/caret.c
Modified: trunk/reactos/subsys/win32k/ntuser/class.c
Modified: trunk/reactos/subsys/win32k/ntuser/csr.c
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
Modified: trunk/reactos/subsys/win32k/ntuser/desktop.c
Modified: trunk/reactos/subsys/win32k/ntuser/focus.c
Modified: trunk/reactos/subsys/win32k/ntuser/guicheck.c
Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c
Modified: trunk/reactos/subsys/win32k/ntuser/input.c
Modified: trunk/reactos/subsys/win32k/ntuser/keyboard.c
Modified: trunk/reactos/subsys/win32k/ntuser/menu.c
Modified: trunk/reactos/subsys/win32k/ntuser/message.c
Modified: trunk/reactos/subsys/win32k/ntuser/metric.c
Modified: trunk/reactos/subsys/win32k/ntuser/misc.c
Modified: trunk/reactos/subsys/win32k/ntuser/msgqueue.c
Added: trunk/reactos/subsys/win32k/ntuser/ntuser.c
Modified: trunk/reactos/subsys/win32k/ntuser/painting.c
Modified: trunk/reactos/subsys/win32k/ntuser/prop.c
Modified: trunk/reactos/subsys/win32k/ntuser/scrollbar.c
Modified: trunk/reactos/subsys/win32k/ntuser/timer.c
Modified: trunk/reactos/subsys/win32k/ntuser/vis.c
Modified: trunk/reactos/subsys/win32k/ntuser/windc.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c
Modified: trunk/reactos/subsys/win32k/objects/color.c
Modified: trunk/reactos/subsys/win32k/objects/dc.c
Modified: trunk/reactos/subsys/win32k/win32k.xml
_____
Modified: trunk/reactos/subsys/win32k/eng/window.c
--- trunk/reactos/subsys/win32k/eng/window.c 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/eng/window.c 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -207,15 +207,22 @@
WNDGDI *WndObjInt = NULL;
WNDOBJ *WndObjUser = NULL;
PWINDOW_OBJECT Window;
+ BOOL calledFromUser;
+ DECLARE_RETURN(WNDOBJ*);
DPRINT("EngCreateWnd: pso = 0x%x, hwnd = 0x%x, pfn = 0x%x, fl = 0x%x,
pixfmt = %d\n",
pso, hwnd, pfn, fl, iPixelFormat);
+ calledFromUser = UserIsEntered();
+ if (!calledFromUser){
+ UserEnterShared();
+ }
+
/* Get window object */
Window = IntGetWindowObject(hwnd);
if (Window == NULL)
{
- return NULL;
+ RETURN( NULL);
}
/* Create WNDOBJ */
@@ -224,7 +231,7 @@
{
IntReleaseWindowObject(Window);
DPRINT1("Failed to allocate memory for a WND structure!\n");
- return NULL;
+ RETURN( NULL);
}
/* Fill the clipobj */
@@ -233,7 +240,7 @@
{
IntReleaseWindowObject(Window);
EngFreeMem(WndObjInt);
- return NULL;
+ RETURN( NULL);
}
/* Fill user object */
@@ -257,7 +264,15 @@
DPRINT("EngCreateWnd: SUCCESS!\n");
- return WndObjUser;
+ RETURN( WndObjUser);
+
+CLEANUP:
+
+ if (!calledFromUser){
+ UserLeave();
+ }
+
+ END_CLEANUP;
}
@@ -271,9 +286,15 @@
{
WNDGDI *WndObjInt = ObjToGDI(pwo, WND);
PWINDOW_OBJECT Window;
+ BOOL calledFromUser;
DPRINT("EngDeleteWnd: pwo = 0x%x\n", pwo);
+ calledFromUser = UserIsEntered();
+ if (!calledFromUser){
+ UserEnterExclusive();
+ }
+
/* Get window object */
Window = IntGetWindowObject(WndObjInt->Hwnd);
if (Window == NULL)
@@ -290,6 +311,10 @@
IntReleaseWindowObject(Window);
}
+ if (!calledFromUser){
+ UserLeave();
+ }
+
/* Free resources */
IntEngDeleteClipRegion(WndObjInt->ClientClipObj);
EngFreeMem(WndObjInt);
_____
Modified: trunk/reactos/subsys/win32k/include/callback.h
--- trunk/reactos/subsys/win32k/include/callback.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/callback.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -2,7 +2,7 @@
#define _WIN32K_CALLBACK_H
LRESULT STDCALL
-IntCallWindowProc(WNDPROC Proc,
+co_IntCallWindowProc(WNDPROC Proc,
BOOLEAN IsAnsiProc,
HWND Wnd,
UINT Message,
@@ -11,7 +11,7 @@
INT lParamBufferSize);
VOID STDCALL
-IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
+co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
HWND hWnd,
UINT Msg,
ULONG_PTR CompletionCallbackContext,
@@ -19,13 +19,13 @@
HMENU STDCALL
-IntLoadSysMenuTemplate();
+co_IntLoadSysMenuTemplate();
BOOL STDCALL
-IntLoadDefaultCursors(VOID);
+co_IntLoadDefaultCursors(VOID);
LRESULT STDCALL
-IntCallHookProc(INT HookId,
+co_IntCallHookProc(INT HookId,
INT Code,
WPARAM wParam,
LPARAM lParam,
_____
Modified: trunk/reactos/subsys/win32k/include/caret.h
--- trunk/reactos/subsys/win32k/include/caret.h 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/include/caret.h 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -4,13 +4,13 @@
#define IDCARETTIMER (0xffff)
BOOL FASTCALL
-IntDestroyCaret(PW32THREAD Win32Thread);
+co_IntDestroyCaret(PW32THREAD Win32Thread);
BOOL FASTCALL
IntSetCaretBlinkTime(UINT uMSeconds);
BOOL FASTCALL
-IntSetCaretPos(int X, int Y);
+co_IntSetCaretPos(int X, int Y);
BOOL FASTCALL
IntSwitchCaretShowing(PVOID Info);
@@ -18,6 +18,11 @@
VOID FASTCALL
IntDrawCaret(HWND hWnd);
+BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT WindowObject);
+
+BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT WindowObject);
+
+
#endif /* _WIN32K_CARET_H */
/* EOF */
_____
Modified: trunk/reactos/subsys/win32k/include/csr.h
--- trunk/reactos/subsys/win32k/include/csr.h 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/include/csr.h 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -13,7 +13,7 @@
extern PEPROCESS CsrProcess;
extern NTSTATUS FASTCALL CsrInit(void);
-extern NTSTATUS FASTCALL CsrNotify(PCSR_API_MESSAGE Request);
+extern NTSTATUS FASTCALL co_CsrNotify(PCSR_API_MESSAGE Request);
extern NTSTATUS FASTCALL CsrCloseHandle(HANDLE Handle);
NTSTATUS
STDCALL
_____
Modified: trunk/reactos/subsys/win32k/include/desktop.h
--- trunk/reactos/subsys/win32k/include/desktop.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/desktop.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -67,6 +67,9 @@
HWND FASTCALL
IntGetDesktopWindow (VOID);
+PWINDOW_OBJECT FASTCALL
+UserGetDesktopWindow(VOID);
+
HWND FASTCALL
IntGetCurrentThreadDesktopWindow(VOID);
@@ -80,7 +83,7 @@
IntGetActiveDesktop(VOID);
NTSTATUS FASTCALL
-IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
+co_IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP_OBJECT Desktop);
@@ -107,7 +110,7 @@
BOOL IntRegisterShellHookWindow(HWND hWnd);
BOOL IntDeRegisterShellHookWindow(HWND hWnd);
-VOID IntShellHookNotify(WPARAM Message, LPARAM lParam);
+VOID co_IntShellHookNotify(WPARAM Message, LPARAM lParam);
#define IntIsActiveDesktop(Desktop) \
((Desktop)->WindowStation->ActiveDesktop == (Desktop))
_____
Modified: trunk/reactos/subsys/win32k/include/focus.h
--- trunk/reactos/subsys/win32k/include/focus.h 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/include/focus.h 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -16,10 +16,10 @@
IntGetThreadFocusWindow();
BOOL FASTCALL
-IntMouseActivateWindow(PWINDOW_OBJECT Window);
+co_IntMouseActivateWindow(PWINDOW_OBJECT Window);
BOOL FASTCALL
-IntSetForegroundWindow(PWINDOW_OBJECT Window);
+co_IntSetForegroundWindow(PWINDOW_OBJECT Window);
HWND FASTCALL
-IntSetActiveWindow(PWINDOW_OBJECT Window);
+co_IntSetActiveWindow(PWINDOW_OBJECT Window);
#endif /* _WIN32K_FOCUS_H */
_____
Modified: trunk/reactos/subsys/win32k/include/guicheck.h
--- trunk/reactos/subsys/win32k/include/guicheck.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/guicheck.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -1,7 +1,7 @@
#ifndef _WIN32K_GUICHECK_H
#define _WIN32K_GUICHECK_H
-BOOL FASTCALL IntGraphicsCheck(BOOL Create);
+BOOL FASTCALL co_IntGraphicsCheck(BOOL Create);
BOOL FASTCALL IntCreatePrimarySurface();
VOID FASTCALL IntDestroyPrimarySurface();
_____
Modified: trunk/reactos/subsys/win32k/include/hook.h
--- trunk/reactos/subsys/win32k/include/hook.h 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/include/hook.h 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -24,7 +24,7 @@
UINT Counts[NB_HOOKS]; /* use counts for each hook chain */
} HOOKTABLE, *PHOOKTABLE;
-LRESULT FASTCALL HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam,
LPARAM lParam);
+LRESULT FASTCALL co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam,
LPARAM lParam);
VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread);
#define IntLockHookTable(HookTable) \
_____
Modified: trunk/reactos/subsys/win32k/include/msgqueue.h
--- trunk/reactos/subsys/win32k/include/msgqueue.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/msgqueue.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -1,7 +1,6 @@
#ifndef _WIN32K_MSGQUEUE_H
#define _WIN32K_MSGQUEUE_H
-#include "caret.h"
#include "hook.h"
#define MSQ_HUNG 5000
@@ -124,7 +123,7 @@
BOOL FASTCALL
MsqIsHung(PUSER_MESSAGE_QUEUE MessageQueue);
NTSTATUS FASTCALL
-MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
+co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam,
UINT uTimeout, BOOL Block, BOOL HookMessage,
ULONG_PTR *uResult);
@@ -138,7 +137,7 @@
VOID FASTCALL
MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
BOOLEAN STDCALL
-MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
+co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOLEAN Hardware,
IN BOOLEAN Remove,
IN HWND Wnd,
@@ -158,9 +157,9 @@
NTSTATUS FASTCALL
MsqInitializeImpl(VOID);
BOOLEAN FASTCALL
-MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
+co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
NTSTATUS FASTCALL
-MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, HWND WndFilter,
+co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, HWND
WndFilter,
UINT MsgFilterMin, UINT MsgFilterMax);
VOID FASTCALL
MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
@@ -170,17 +169,17 @@
VOID FASTCALL
MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
LRESULT FASTCALL
-IntSendMessage(HWND hWnd,
+co_IntSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
LRESULT FASTCALL
-IntPostOrSendMessage(HWND hWnd,
+co_IntPostOrSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
LRESULT FASTCALL
-IntSendMessageTimeout(HWND hWnd,
+co_IntSendMessageTimeout(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
@@ -193,7 +192,7 @@
IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl);
VOID FASTCALL
-MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
VOID FASTCALL
MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM
lParam);
VOID FASTCALL
_____
Modified: trunk/reactos/subsys/win32k/include/painting.h
--- trunk/reactos/subsys/win32k/include/painting.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/painting.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -8,12 +8,12 @@
VOID FASTCALL
IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion);
BOOL FASTCALL
-IntRedrawWindow(PWINDOW_OBJECT Wnd, const RECT* UpdateRect, HRGN
UpdateRgn, ULONG Flags);
+co_UserRedrawWindow(PWINDOW_OBJECT Wnd, const RECT* UpdateRect, HRGN
UpdateRgn, ULONG Flags);
BOOL FASTCALL
IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
PW32THREAD Thread,
MSG *Message, BOOL Remove);
-BOOL STDCALL
-NtUserValidateRgn(HWND hWnd, HRGN hRgn);
+//BOOL STDCALL
+//NtUserValidateRgn(HWND hWnd, HRGN hRgn);
#define IntLockWindowUpdate(Window) \
ExAcquireFastMutex(&Window->UpdateLock)
_____
Modified: trunk/reactos/subsys/win32k/include/scroll.h
--- trunk/reactos/subsys/win32k/include/scroll.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/scroll.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -16,7 +16,7 @@
#define SBOBJ_TO_SBID(Obj) ((Obj) - OBJID_HSCROLL)
#define SBID_IS_VALID(id) (id == SB_HORZ || id == SB_VERT || id ==
SB_CTL)
-BOOL FASTCALL IntCreateScrollBars(PWINDOW_OBJECT Window);
+BOOL FASTCALL co_IntCreateScrollBars(PWINDOW_OBJECT Window);
BOOL FASTCALL IntDestroyScrollBars(PWINDOW_OBJECT Window);
#endif /* _WIN32K_SCROLL_H */
_____
Added: trunk/reactos/subsys/win32k/include/userfuncs.h
--- trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -0,0 +1,130 @@
+#ifndef _WIN32K_USERFUNCS_H
+#define _WIN32K_USERFUNCS_H
+
+/*************** WINSTA.C ***************/
+
+HWINSTA FASTCALL UserGetProcessWindowStation(VOID);
+
+/*************** INPUT.C ***************/
+
+NTSTATUS FASTCALL
+UserAcquireOrReleaseInputOwnership(BOOLEAN Release);
+
+/*************** WINPOS.C ***************/
+
+BOOL FASTCALL
+UserGetClientOrigin(HWND hWnd, LPPOINT Point);
+
+/*************** FOCUS.C ***************/
+
+HWND FASTCALL UserGetActiveWindow();
+
+HWND FASTCALL UserGetForegroundWindow(VOID);
+
+HWND FASTCALL UserSetFocus(HWND hWnd);
+
+/*************** WINDC.C ***************/
+
+INT FASTCALL
+UserReleaseDC(PWINDOW_OBJECT Window, HDC hDc);
+
+HDC FASTCALL
+UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG
Flags);
+
+DWORD FASTCALL
+UserGetWindowDC(PWINDOW_OBJECT Wnd);
+
+/*************** METRIC.C ***************/
+
+ULONG FASTCALL
+UserGetSystemMetrics(ULONG Index);
+
+/*************** KEYBOARD.C ***************/
+
+DWORD FASTCALL UserGetKeyState(DWORD key);
+
+DWORD FASTCALL UserGetKeyboardType(DWORD TypeFlag);
+
+HKL FASTCALL UserGetKeyboardLayout(DWORD dwThreadId);
+
+
+/*************** MISC.C ***************/
+
+BOOL FASTCALL
+UserSystemParametersInfo(
+ UINT uiAction,
+ UINT uiParam,
+ PVOID pvParam,
+ UINT fWinIni);
+
+/*************** MESSAGE.C ***************/
+
+BOOL FASTCALL
+UserPostMessage(HWND Wnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+
+
+/*************** PAINTING.C ***************/
+
+BOOL FASTCALL UserValidateRgn(HWND hWnd, HRGN hRgn);
+
+
+/*************** WINDOW.C ***************/
+
+VOID FASTCALL
+co_DestroyThreadWindows(struct _ETHREAD *Thread);
+
+HWND FASTCALL UserGetShellWindow();
+
+HWND FASTCALL UserSetParent(HWND hWndChild, HWND hWndNewParent);
+
+HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship);
+
+HDC FASTCALL
+UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG
Flags);
+
+BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Wnd);
+
+LONG FASTCALL UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi);
+
+HWND FASTCALL UserGetAncestor(HWND hWnd, UINT Type);
+
+/*************** MENU.C ***************/
+
+HMENU FASTCALL UserCreateMenu(BOOL PopupMenu);
+
+BOOL FASTCALL
+UserSetMenuDefaultItem(
+ HMENU hMenu,
+ UINT uItem,
+ UINT fByPos);
+
+BOOL FASTCALL UserDestroyMenu(HMENU hMenu);
+
+BOOL FASTCALL
+UserMenuItemInfo(
+ HMENU Menu,
+ UINT Item,
+ BOOL ByPosition,
+ PROSMENUITEMINFO UnsafeItemInfo,
+ BOOL SetOrGet);
+
+BOOL FASTCALL
+UserMenuInfo(
+ HMENU Menu,
+ PROSMENUINFO UnsafeMenuInfo,
+ BOOL SetOrGet);
+
+
+/*************** SCROLLBAR.C ***************/
+
+DWORD FASTCALL
+co_UserShowScrollBar(HWND hWnd, int wBar, DWORD bShow);
+
+
+#endif /* _WIN32K_USERFUNCS_H */
+
+/* EOF */
_____
Modified: trunk/reactos/subsys/win32k/include/vis.h
--- trunk/reactos/subsys/win32k/include/vis.h 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/include/vis.h 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -18,7 +18,7 @@
BOOLEAN ClipChildren, BOOLEAN ClipSiblings);
VOID FASTCALL
-VIS_WindowLayoutChanged(PWINDOW_OBJECT Window, HRGN UncoveredRgn);
+co_VIS_WindowLayoutChanged(PWINDOW_OBJECT Window, HRGN UncoveredRgn);
#endif /* ! defined(_WIN32K_VIS_H) */
_____
Modified: trunk/reactos/subsys/win32k/include/win32k.h
--- trunk/reactos/subsys/win32k/include/win32k.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/win32k.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -9,11 +9,11 @@
/* INCLUDES
******************************************************************/
/* Internal Win32k Headers */
+#include <include/ntuser.h>
#include <include/win32.h>
#include <include/ssec.h>
#include <include/accelerator.h>
#include <include/callback.h>
-#include <include/caret.h>
#include <include/class.h>
#include <include/cleanup.h>
#include <include/clipboard.h>
@@ -53,6 +53,8 @@
#include <include/useratom.h>
#include <include/vis.h>
#include <include/window.h>
+#include <include/caret.h>
+#include <include/userfuncs.h>
#include <include/winpos.h>
#include <include/winsta.h>
#include <include/mmcopy.h>
_____
Modified: trunk/reactos/subsys/win32k/include/winpos.h
--- trunk/reactos/subsys/win32k/include/winpos.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/winpos.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -15,25 +15,25 @@
(INT)((y) - (WndObject)->WindowRect.top))))
UINT
-FASTCALL WinPosArrangeIconicWindows(PWINDOW_OBJECT parent);
+FASTCALL co_WinPosArrangeIconicWindows(PWINDOW_OBJECT parent);
BOOL FASTCALL
IntGetClientOrigin(HWND hWnd, LPPOINT Point);
LRESULT FASTCALL
-WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect);
+co_WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT*
ClientRect);
UINT FASTCALL
-WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT*
MaxPos,
+co_WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT*
MaxPos,
POINT* MinTrack, POINT* MaxTrack);
UINT FASTCALL
-WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT*
NewPos);
+co_WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT*
NewPos);
BOOLEAN FASTCALL
-WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
+co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT
cx,
INT cy, UINT flags);
BOOLEAN FASTCALL
-WinPosShowWindow(HWND Wnd, INT Cmd);
+co_WinPosShowWindow(HWND Wnd, INT Cmd);
USHORT FASTCALL
-WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE
OnlyHitTests, POINT *WinPoint,
+co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE
OnlyHitTests, POINT *WinPoint,
PWINDOW_OBJECT* Window);
-VOID FASTCALL WinPosActivateOtherWindow(PWINDOW_OBJECT Window);
+VOID FASTCALL co_WinPosActivateOtherWindow(PWINDOW_OBJECT Window);
PINTERNALPOS FASTCALL WinPosInitInternalPos(PWINDOW_OBJECT
WindowObject,
POINT *pt, PRECT
RestoreRect);
_____
Modified: trunk/reactos/subsys/win32k/include/winsta.h
--- trunk/reactos/subsys/win32k/include/winsta.h 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/include/winsta.h 2005-09-05
21:19:23 UTC (rev 17671)
@@ -90,7 +90,7 @@
IntGetWindowStationObject(PWINSTATION_OBJECT Object);
BOOL FASTCALL
-IntInitializeDesktopGraphics(VOID);
+co_IntInitializeDesktopGraphics(VOID);
VOID FASTCALL
IntEndDesktopGraphics(VOID);
_____
Modified: trunk/reactos/subsys/win32k/main/dllmain.c
--- trunk/reactos/subsys/win32k/main/dllmain.c 2005-09-05 21:17:26 UTC
(rev 17670)
+++ trunk/reactos/subsys/win32k/main/dllmain.c 2005-09-05 21:19:23 UTC
(rev 17671)
@@ -42,7 +42,11 @@
BOOLEAN Create)
{
PW32PROCESS Win32Process;
+ DECLARE_RETURN(NTSTATUS);
+ DPRINT("Enter Win32kProcessCallback\n");
+ UserEnterExclusive();
+
/* Get the Win32 Process */
Win32Process = PsGetProcessWin32Process(Process);
@@ -54,7 +58,7 @@
sizeof(W32PROCESS),
TAG('W', '3', '2',
'p'));
- if (Win32Process == NULL) return STATUS_NO_MEMORY;
+ if (Win32Process == NULL) RETURN( STATUS_NO_MEMORY);
RtlZeroMemory(Win32Process, sizeof(W32PROCESS));
@@ -101,7 +105,7 @@
GDI_CleanupForProcess(Process);
- IntGraphicsCheck(FALSE);
+ co_IntGraphicsCheck(FALSE);
/*
* Deregister logon application automatically
@@ -112,7 +116,12 @@
}
}
- return STATUS_SUCCESS;
+ RETURN( STATUS_SUCCESS);
+
+CLEANUP:
+ UserLeave();
+ DPRINT("Leave Win32kProcessCallback, ret=%i\n",_ret_);
+ END_CLEANUP;
}
@@ -123,6 +132,10 @@
{
struct _EPROCESS *Process;
PW32THREAD Win32Thread;
+ DECLARE_RETURN(NTSTATUS);
+
+ DPRINT("Enter Win32kThreadCallback\n");
+ UserEnterExclusive();
Process = Thread->ThreadsProcess;
@@ -137,7 +150,7 @@
sizeof(W32THREAD),
TAG('W', '3', '2',
't'));
- if (Win32Thread == NULL) return STATUS_NO_MEMORY;
+ if (Win32Thread == NULL) RETURN( STATUS_NO_MEMORY);
RtlZeroMemory(Win32Thread, sizeof(W32THREAD));
@@ -199,7 +212,7 @@
}
}
Win32Thread->IsExiting = FALSE;
- IntDestroyCaret(Win32Thread);
+ co_IntDestroyCaret(Win32Thread);
Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread);
Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout();
Win32Thread->MessagePumpHookValue = 0;
@@ -214,7 +227,7 @@
Win32Thread->IsExiting = TRUE;
HOOK_DestroyThreadHooks(Thread);
UnregisterThreadHotKeys(Thread);
- DestroyThreadWindows(Thread);
+ co_DestroyThreadWindows(Thread);
IntBlockInput(Win32Thread, FALSE);
MsqDestroyMessageQueue(Win32Thread->MessageQueue);
IntCleanupThreadCallbacks(Win32Thread);
@@ -224,7 +237,12 @@
}
}
- return STATUS_SUCCESS;
+ RETURN( STATUS_SUCCESS);
+
+CLEANUP:
+ UserLeave();
+ DPRINT("Leave Win32kThreadCallback, ret=%i\n",_ret_);
+ END_CLEANUP;
}
/* Only used in ntuser/input.c KeyboardThreadMain(). If it's
@@ -316,6 +334,13 @@
DPRINT1("Failed to initialize the shared section pool: Status
0x%x\n", Status);
}
+ Status = InitUserImpl();
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to initialize user implementation!\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
Status = InitWindowStationImpl();
if (!NT_SUCCESS(Status))
{
_____
Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c
--- trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-05
21:17:26 UTC (rev 17670)
+++ trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-05
21:19:23 UTC (rev 17671)
@@ -79,15 +79,19 @@
PACCELERATOR_TABLE AcceleratorTable;
NTSTATUS Status;
int Ret;
+ DECLARE_RETURN(int);
- Status =
IntValidateWindowStationHandle(NtUserGetProcessWindowStation(),
+ DPRINT("Enter NtUserCopyAcceleratorTable\n");
+ UserEnterShared();
+
+ Status =
IntValidateWindowStationHandle(UserGetProcessWindowStation(),
UserMode,
0,
&WindowStation);
if (!NT_SUCCESS(Status))
{
SetLastNtError(STATUS_ACCESS_DENIED);
- return 0;
+ RETURN(0);
}
Status = ObmReferenceObjectByHandle(WindowStation->HandleTable,
@@ -98,7 +102,7 @@
{
SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
ObDereferenceObject(WindowStation);
- return 0;
+ RETURN(0);
}
if(Entries)
@@ -110,7 +114,7 @@
ObmDereferenceObject(AcceleratorTable);
ObDereferenceObject(WindowStation);
SetLastNtError(Status);
- return 0;
+ RETURN(0);
}
}
else
@@ -121,7 +125,12 @@
ObmDereferenceObject(AcceleratorTable);
ObDereferenceObject(WindowStation);
- return Ret;
+ RETURN(Ret);
+
+CLEANUP:
+ DPRINT("Leave NtUserCopyAcceleratorTable, ret=%i\n",_ret_);
+ UserLeave();
+ END_CLEANUP;
}
HACCEL
@@ -134,11 +143,13 @@
PACCELERATOR_TABLE AcceleratorTable;
NTSTATUS Status;
HACCEL Handle;
+ DECLARE_RETURN(HACCEL);
- DPRINT("NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n",
- Entries, EntriesCount);
+ DPRINT("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount
%d)\n",
+ Entries, EntriesCount);
+ UserEnterExclusive();
- Status =
IntValidateWindowStationHandle(NtUserGetProcessWindowStation(),
+ Status =
IntValidateWindowStationHandle(UserGetProcessWindowStation(),
UserMode,
0,
&WindowStation);
@@ -146,7 +157,7 @@
{
SetLastNtError(STATUS_ACCESS_DENIED);
DPRINT1("E1\n");
- return FALSE;
+ RETURN( FALSE );
}
AcceleratorTable = ObmCreateObject(
@@ -159,7 +170,7 @@
ObDereferenceObject(WindowStation);
SetLastNtError(STATUS_NO_MEMORY);
DPRINT1("E2\n");
- return (HACCEL) 0;
+ RETURN( (HACCEL) 0 );
}
AcceleratorTable->Count = EntriesCount;
@@ -172,7 +183,7 @@
ObDereferenceObject(WindowStation);
SetLastNtError(Status);
DPRINT1("E3\n");
- return (HACCEL) 0;
+ RETURN( (HACCEL) 0);
}
Status = MmCopyFromCaller(AcceleratorTable->Table, Entries,
EntriesCount * sizeof(ACCEL));
@@ -183,7 +194,7 @@
ObDereferenceObject(WindowStation);
SetLastNtError(Status);
DPRINT1("E4\n");
- return (HACCEL) 0;
+ RETURN((HACCEL) 0);
}
}
@@ -191,10 +202,13 @@
/* FIXME: Save HandleTable in a list somewhere so we can clean it up
again */
- DPRINT("NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) =
%x end\n",
- Entries, EntriesCount, Handle);
-
- return (HACCEL) Handle;
+ RETURN((HACCEL) Handle);
+
+CLEANUP:
+ DPRINT("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount
%d) = %x\n",
+ Entries, EntriesCount,_ret_);
+ UserLeave();
+ END_CLEANUP;
}
BOOLEAN
@@ -205,16 +219,17 @@
PWINSTATION_OBJECT WindowStation;
PACCELERATOR_TABLE AcceleratorTable;
NTSTATUS Status;
+ DECLARE_RETURN(BOOLEAN);
/* FIXME: If the handle table is from a call to LoadAcceleratorTable,
decrement it's
usage count (and return TRUE).
FIXME: Destroy only tables created using
CreateAcceleratorTable.
*/
- DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n",
- Table);
+ DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n", Table);
+ UserEnterExclusive();
- Status =
IntValidateWindowStationHandle(NtUserGetProcessWindowStation(),
+ Status =
IntValidateWindowStationHandle(UserGetProcessWindowStation(),
UserMode,
0,
&WindowStation);
@@ -222,7 +237,7 @@
{
SetLastNtError(STATUS_ACCESS_DENIED);
DPRINT1("E1\n");
- return FALSE;
+ RETURN( FALSE);
}
Status = ObmReferenceObjectByHandle(WindowStation->HandleTable,
@@ -234,7 +249,7 @@
SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
ObDereferenceObject(WindowStation);
DPRINT1("E2\n");
- return FALSE;
+ RETURN( FALSE);
}
ObmCloseHandle(WindowStation->HandleTable, Table);
@@ -249,11 +264,16 @@
DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n",
Table);
- return TRUE;
+ RETURN( TRUE);
+
+CLEANUP:
+ DPRINT("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n",
Table,_ret_);
+ UserLeave();
+ END_CLEANUP;
}
static BOOLEAN
-IntTranslateAccelerator(HWND hWnd,
+co_IntTranslateAccelerator(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam,
@@ -289,15 +309,15 @@
wParam, 0xff & HIWORD(lParam));
DPRINT("NtUserGetKeyState(VK_SHIFT) = 0x%x\n",
- NtUserGetKeyState(VK_SHIFT));
+ UserGetKeyState(VK_SHIFT));
DPRINT("NtUserGetKeyState(VK_CONTROL) = 0x%x\n",
- NtUserGetKeyState(VK_CONTROL));
+ UserGetKeyState(VK_CONTROL));
DPRINT("NtUserGetKeyState(VK_MENU) = 0x%x\n",
- NtUserGetKeyState(VK_MENU));
+ UserGetKeyState(VK_MENU));
- if (NtUserGetKeyState(VK_SHIFT) & 0x8000) mask |=
FSHIFT;
- if (NtUserGetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
- if (NtUserGetKeyState(VK_MENU) & 0x8000) mask |= FALT;
+ if (UserGetKeyState(VK_SHIFT) & 0x8000) mask |=
FSHIFT;
+ if (UserGetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
+ if (UserGetKeyState(VK_MENU) & 0x8000) mask |= FALT;
if (mask == (fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
DPRINT("but incorrect SHIFT/CTRL/ALT-state\n");
}
@@ -332,7 +352,7 @@
HMENU hMenu, hSubMenu, hSysMenu;
UINT uSysStat = (UINT)-1, uStat = (UINT)-1, nPos;
- hMenu = (NtUserGetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) ? 0
: GetMenu(hWnd);
+ hMenu = (UserGetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) ? 0 :
GetMenu(hWnd);
hSysMenu = get_win_sys_menu(hWnd);
/* find menu item and ask application to initialize it */
@@ -341,12 +361,12 @@
nPos = cmd;
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
{
- IntSendMessage(hWnd, WM_INITMENU,
(WPARAM)hSysMenu, 0L);
+ co_IntSendMessage(hWnd, WM_INITMENU,
(WPARAM)hSysMenu, 0L);
if(hSubMenu != hSysMenu)
{
nPos = MENU_FindSubMenu(&hSysMenu, hSubMenu);
TRACE_(accel)("hSysMenu = %p, hSubMenu = %p, nPos =
%d\n", hSysMenu, hSubMenu, nPos);
- IntSendMessage(hWnd, WM_INITMENUPOPUP,
(WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
+ co_IntSendMessage(hWnd, WM_INITMENUPOPUP,
(WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
}
uSysStat = GetMenuState(GetSubMenu(hSysMenu, 0), cmd,
MF_BYCOMMAND);
}
@@ -356,12 +376,12 @@
nPos = cmd;
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
{
- IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
+ co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu,
0L);
if(hSubMenu != hMenu)
{
nPos = MENU_FindSubMenu(&hMenu, hSubMenu);
TRACE_(accel)("hMenu = %p, hSubMenu = %p, nPos =
%d\n", hMenu, hSubMenu, nPos);
- IntSendMessage(hWnd, WM_INITMENUPOPUP,
(WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE));
+ co_IntSendMessage(hWnd, WM_INITMENUPOPUP,
(WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE));
}
uStat = GetMenuState(hMenu, cmd, MF_BYCOMMAND);
}
@@ -402,12 +422,12 @@
if (mesg == WM_COMMAND)
{
DPRINT(", sending WM_COMMAND, wParam=%0x\n", 0x10000 | cmd);
- IntSendMessage(hWnd, mesg, 0x10000 | cmd, 0L);
+ co_IntSendMessage(hWnd, mesg, 0x10000 | cmd, 0L);
}
else if (mesg == WM_SYSCOMMAND)
{
DPRINT(", sending WM_SYSCOMMAND, wParam=%0x\n", cmd);
- IntSendMessage(hWnd, mesg, cmd, 0x00010000L);
+ co_IntSendMessage(hWnd, mesg, cmd, 0x00010000L);
}
else
{
@@ -444,23 +464,25 @@
PACCELERATOR_TABLE AcceleratorTable;
NTSTATUS Status;
ULONG i;
+ DECLARE_RETURN(int);
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n",
hWnd, Table, Message);
+ UserEnterShared();
if (hWnd == NULL)
- return 0;
+ RETURN( 0);
if (Message == NULL)
{
SetLastNtError(STATUS_INVALID_PARAMETER);
- return 0;
+ RETURN( 0);
}
if (Table == NULL)
{
SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
- return 0;
+ RETURN( 0);
}
if ((Message->message != WM_KEYDOWN) &&
@@ -468,17 +490,17 @@
(Message->message != WM_SYSCHAR) &&
(Message->message != WM_CHAR))
{
- return 0;
+ RETURN( 0);
}
- Status =
IntValidateWindowStationHandle(NtUserGetProcessWindowStation(),
+ Status =
IntValidateWindowStationHandle(UserGetProcessWindowStation(),
UserMode,
0,
&WindowStation);
if (!NT_SUCCESS(Status))
[truncated at 1000 lines; 10081 more skipped]