From a306e56c555e2e8d0b61069ad85cf64eebaf76ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 27 Dec 2014 19:16:05 +0000 Subject: [PATCH] [WIN32K] - Put GDI initialization function(s) in a dedicated file. - Whitespace fixes... svn path=/trunk/; revision=65852 --- reactos/win32ss/CMakeLists.txt | 1 + reactos/win32ss/gdi/eng/stubs.c | 10 -- reactos/win32ss/gdi/ntgdi/init.c | 25 +++++ reactos/win32ss/include/ntuser.h | 4 + reactos/win32ss/user/ntuser/main.c | 4 - reactos/win32ss/user/ntuser/ntuser.c | 135 ++++++++++++++------------- 6 files changed, 98 insertions(+), 81 deletions(-) create mode 100644 reactos/win32ss/gdi/ntgdi/init.c diff --git a/reactos/win32ss/CMakeLists.txt b/reactos/win32ss/CMakeLists.txt index cbed7b85905..9cb2fcbf676 100644 --- a/reactos/win32ss/CMakeLists.txt +++ b/reactos/win32ss/CMakeLists.txt @@ -167,6 +167,7 @@ list(APPEND SOURCE gdi/ntgdi/gdiobj.c gdi/ntgdi/gdipool.c gdi/ntgdi/icm.c + gdi/ntgdi/init.c gdi/ntgdi/line.c gdi/ntgdi/metafile.c gdi/ntgdi/palette.c diff --git a/reactos/win32ss/gdi/eng/stubs.c b/reactos/win32ss/gdi/eng/stubs.c index 1157e792419..d54fd6f6df5 100644 --- a/reactos/win32ss/gdi/eng/stubs.c +++ b/reactos/win32ss/gdi/eng/stubs.c @@ -1537,16 +1537,6 @@ NtGdiIcmBrushInfo( return FALSE; } -/* - * @implemented - */ -BOOL -APIENTRY -NtGdiInit(VOID) -{ - return TRUE; -} - /* * @unimplemented */ diff --git a/reactos/win32ss/gdi/ntgdi/init.c b/reactos/win32ss/gdi/ntgdi/init.c new file mode 100644 index 00000000000..fe1faf22c69 --- /dev/null +++ b/reactos/win32ss/gdi/ntgdi/init.c @@ -0,0 +1,25 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Win32k subsystem + * PURPOSE: Initialization of GDI + * FILE: win32ss/gdi/ntgdi/init.c + * PROGRAMER: + */ + +#include + +#define NDEBUG +#include +#include + +/* + * @implemented + */ +BOOL +APIENTRY +NtGdiInit(VOID) +{ + return TRUE; +} + +/* EOF */ diff --git a/reactos/win32ss/include/ntuser.h b/reactos/win32ss/include/ntuser.h index 74220520223..567e1ac7cfd 100644 --- a/reactos/win32ss/include/ntuser.h +++ b/reactos/win32ss/include/ntuser.h @@ -974,6 +974,10 @@ typedef struct tagSERVERINFO PERUSERSERVERINFO; } SERVERINFO, *PSERVERINFO; +#ifdef _M_IX86 +C_ASSERT(sizeof(SERVERINFO) <= PAGE_SIZE); +#endif + // Server event activity bits. #define SRV_EVENT_MENU 0x0001 diff --git a/reactos/win32ss/user/ntuser/main.c b/reactos/win32ss/user/ntuser/main.c index 29f48c87969..3f5ad8e386f 100644 --- a/reactos/win32ss/user/ntuser/main.c +++ b/reactos/win32ss/user/ntuser/main.c @@ -733,10 +733,6 @@ DriverUnload(IN PDRIVER_OBJECT DriverObject) ResetCsrProcess(); } -#ifdef _M_IX86 -C_ASSERT(sizeof(SERVERINFO) <= PAGE_SIZE); -#endif - // Return on failure #define NT_ROF(x) \ { \ diff --git a/reactos/win32ss/user/ntuser/ntuser.c b/reactos/win32ss/user/ntuser/ntuser.c index efa2c493df1..3fe324291eb 100644 --- a/reactos/win32ss/user/ntuser/ntuser.c +++ b/reactos/win32ss/user/ntuser/ntuser.c @@ -2,13 +2,13 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: ntuser init. and main funcs. - * FILE: subsystems/win32/win32k/ntuser/ntuser.c + * FILE: win32ss/user/ntuser/ntuser.c */ #include DBG_DEFAULT_CHANNEL(UserMisc); -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ PTHREADINFO gptiCurrent = NULL; PPROCESSINFO gppiInputProvider = NULL; @@ -21,73 +21,72 @@ HINSTANCE hModClient = NULL; BOOL ClientPfnInit = FALSE; ATOM gaGuiConsoleWndClass; -/* PRIVATE FUNCTIONS *********************************************************/ +/* PRIVATE FUNCTIONS **********************************************************/ static NTSTATUS FASTCALL InitUserAtoms(VOID) { + gpsi->atomSysClass[ICLS_MENU] = 32768; + gpsi->atomSysClass[ICLS_DESKTOP] = 32769; + gpsi->atomSysClass[ICLS_DIALOG] = 32770; + gpsi->atomSysClass[ICLS_SWITCH] = 32771; + gpsi->atomSysClass[ICLS_ICONTITLE] = 32772; + gpsi->atomSysClass[ICLS_TOOLTIPS] = 32774; - gpsi->atomSysClass[ICLS_MENU] = 32768; - gpsi->atomSysClass[ICLS_DESKTOP] = 32769; - gpsi->atomSysClass[ICLS_DIALOG] = 32770; - gpsi->atomSysClass[ICLS_SWITCH] = 32771; - gpsi->atomSysClass[ICLS_ICONTITLE] = 32772; - gpsi->atomSysClass[ICLS_TOOLTIPS] = 32774; + /* System Message Atom */ + AtomMessage = IntAddGlobalAtom(L"Message", TRUE); + gpsi->atomSysClass[ICLS_HWNDMESSAGE] = AtomMessage; - /* System Message Atom */ - AtomMessage = IntAddGlobalAtom(L"Message", TRUE); - gpsi->atomSysClass[ICLS_HWNDMESSAGE] = AtomMessage; + /* System Context Help Id Atom */ + gpsi->atomContextHelpIdProp = IntAddGlobalAtom(L"SysCH", TRUE); - /* System Context Help Id Atom */ - gpsi->atomContextHelpIdProp = IntAddGlobalAtom(L"SysCH", TRUE); + gpsi->atomIconSmProp = IntAddGlobalAtom(L"SysICS", TRUE); + gpsi->atomIconProp = IntAddGlobalAtom(L"SysIC", TRUE); - gpsi->atomIconSmProp = IntAddGlobalAtom(L"SysICS", TRUE); - gpsi->atomIconProp = IntAddGlobalAtom(L"SysIC", TRUE); + gpsi->atomFrostedWindowProp = IntAddGlobalAtom(L"SysFrostedWindow", TRUE); - gpsi->atomFrostedWindowProp = IntAddGlobalAtom(L"SysFrostedWindow", TRUE); + /* + * FIXME: AddPropW uses the global kernel atom table, thus leading to conflicts if we use + * the win32k atom table for this ones. What is the right thing to do ? + */ + // AtomWndObj = IntAddGlobalAtom(L"SysWNDO", TRUE); + NtAddAtom(L"SysWNDO", 14, &AtomWndObj); + AtomLayer = IntAddGlobalAtom(L"SysLayer", TRUE); + AtomFlashWndState = IntAddGlobalAtom(L"FlashWState", TRUE); - /* - * FIXME: AddPropW uses the global kernel atom table, thus leading to conflicts if we use - * the win32k atom table for this ones. What is the right thing to do ? - */ - // AtomWndObj = IntAddGlobalAtom(L"SysWNDO", TRUE); - NtAddAtom(L"SysWNDO", 14, &AtomWndObj); - AtomLayer = IntAddGlobalAtom(L"SysLayer", TRUE); - AtomFlashWndState = IntAddGlobalAtom(L"FlashWState", TRUE); - - return STATUS_SUCCESS; + return STATUS_SUCCESS; } -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID) { - NTSTATUS Status; + NTSTATUS Status; - ExInitializeResourceLite(&UserLock); + ExInitializeResourceLite(&UserLock); - if (!UserCreateHandleTable()) - { - ERR("Failed creating handle table\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } + if (!UserCreateHandleTable()) + { + ERR("Failed creating handle table\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } - Status = InitSessionImpl(); - if (!NT_SUCCESS(Status)) - { - ERR("Error init session impl.\n"); - return Status; - } + Status = InitSessionImpl(); + if (!NT_SUCCESS(Status)) + { + ERR("Error init session impl.\n"); + return Status; + } - InitUserAtoms(); + InitUserAtoms(); - InitSysParams(); + InitSysParams(); - return STATUS_SUCCESS; + return STATUS_SUCCESS; } NTSTATUS @@ -110,7 +109,7 @@ UserInitialize(VOID) Status = UserCreateWinstaDirectory(); if (!NT_SUCCESS(Status)) return Status; - /* Initialize Video. */ + /* Initialize Video */ Status = InitVideo(); if (!NT_SUCCESS(Status)) return Status; @@ -123,7 +122,7 @@ UserInitialize(VOID) // Create ThreadInfo for this Thread! // { - /* Initialize the current thread. */ + /* Initialize the current thread */ Status = UserCreateThreadInfo(PsGetCurrentThread()); if (!NT_SUCCESS(Status)) return Status; @@ -135,10 +134,10 @@ UserInitialize(VOID) if (gpsi->hbrGray == NULL) { - hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA); - gpsi->hbrGray = IntGdiCreatePatternBrush(hPattern55AABitmap); - GreDeleteObject(hPattern55AABitmap); - GreSetBrushOwner(gpsi->hbrGray, GDI_OBJ_HMGR_PUBLIC); + hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA); + gpsi->hbrGray = IntGdiCreatePatternBrush(hPattern55AABitmap); + GreDeleteObject(hPattern55AABitmap); + GreSetBrushOwner(gpsi->hbrGray, GDI_OBJ_HMGR_PUBLIC); } return STATUS_SUCCESS; @@ -150,9 +149,9 @@ UserInitialize(VOID) NTSTATUS APIENTRY NtUserInitialize( - DWORD dwWinVersion, - HANDLE hPowerRequestEvent, - HANDLE hMediaRequestEvent) + DWORD dwWinVersion, + HANDLE hPowerRequestEvent, + HANDLE hMediaRequestEvent) { NTSTATUS Status; @@ -201,38 +200,40 @@ RETURN */ BOOL FASTCALL UserIsEntered(VOID) { - return ExIsResourceAcquiredExclusiveLite(&UserLock) - || ExIsResourceAcquiredSharedLite(&UserLock); + return ExIsResourceAcquiredExclusiveLite(&UserLock) || + ExIsResourceAcquiredSharedLite(&UserLock); } BOOL FASTCALL UserIsEnteredExclusive(VOID) { - return ExIsResourceAcquiredExclusiveLite(&UserLock); + return ExIsResourceAcquiredExclusiveLite(&UserLock); } VOID FASTCALL CleanupUserImpl(VOID) { - ExDeleteResourceLite(&UserLock); + ExDeleteResourceLite(&UserLock); } VOID FASTCALL UserEnterShared(VOID) { - KeEnterCriticalRegion(); - ExAcquireResourceSharedLite(&UserLock, TRUE); + KeEnterCriticalRegion(); + ExAcquireResourceSharedLite(&UserLock, TRUE); } VOID FASTCALL UserEnterExclusive(VOID) { - ASSERT_NOGDILOCKS(); - KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&UserLock, TRUE); - gptiCurrent = PsGetCurrentThreadWin32Thread(); + ASSERT_NOGDILOCKS(); + KeEnterCriticalRegion(); + ExAcquireResourceExclusiveLite(&UserLock, TRUE); + gptiCurrent = PsGetCurrentThreadWin32Thread(); } VOID FASTCALL UserLeave(VOID) { - ASSERT_NOGDILOCKS(); - ASSERT(UserIsEntered()); - ExReleaseResourceLite(&UserLock); - KeLeaveCriticalRegion(); + ASSERT_NOGDILOCKS(); + ASSERT(UserIsEntered()); + ExReleaseResourceLite(&UserLock); + KeLeaveCriticalRegion(); } + +/* EOF */