Author: tkreuzer Date: Wed Nov 3 00:51:19 2010 New Revision: 49455
URL: http://svn.reactos.org/svn/reactos?rev=49455&view=rev Log: [WIN32K] Change all Init functions to be NTAPI instead of FASTCALL, return NTSTATUS, and be an INIT_FUNCTION (saving incredible 2k). Simplify the initialization sequence by using a simple macro. Delete a comment that is not true anymore. Move some globals to appropriate file.
Modified: trunk/reactos/subsystems/win32/win32k/eng/device.c trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c trunk/reactos/subsystems/win32/win32k/eng/pdevobj.c trunk/reactos/subsystems/win32/win32k/eng/xlate.c trunk/reactos/subsystems/win32/win32k/include/accelerator.h trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/include/desktop.h trunk/reactos/subsystems/win32/win32k/include/device.h trunk/reactos/subsystems/win32/win32k/include/gdiobj.h trunk/reactos/subsystems/win32/win32k/include/guicheck.h trunk/reactos/subsystems/win32/win32k/include/hotkey.h trunk/reactos/subsystems/win32/win32k/include/input.h trunk/reactos/subsystems/win32/win32k/include/inteng.h trunk/reactos/subsystems/win32/win32k/include/ldevobj.h trunk/reactos/subsystems/win32/win32k/include/menu.h trunk/reactos/subsystems/win32/win32k/include/monitor.h trunk/reactos/subsystems/win32/win32k/include/msgqueue.h trunk/reactos/subsystems/win32/win32k/include/ntuser.h trunk/reactos/subsystems/win32/win32k/include/palette.h trunk/reactos/subsystems/win32/win32k/include/pdevobj.h trunk/reactos/subsystems/win32/win32k/include/timer.h trunk/reactos/subsystems/win32/win32k/include/win32kp.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/include/winsta.h trunk/reactos/subsystems/win32/win32k/include/xlateobj.h trunk/reactos/subsystems/win32/win32k/main/dllmain.c trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c trunk/reactos/subsystems/win32/win32k/ntuser/input.c trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c trunk/reactos/subsystems/win32/win32k/ntuser/menu.c trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c trunk/reactos/subsystems/win32/win32k/ntuser/timer.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c trunk/reactos/subsystems/win32/win32k/objects/dclife.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c trunk/reactos/subsystems/win32/win32k/objects/palette.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/device.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -20,15 +20,16 @@ static HSEMAPHORE ghsemGraphicsDeviceList; static ULONG giDevNum = 1;
-BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitDeviceImpl() { ghsemGraphicsDeviceList = EngCreateSemaphore(); if (!ghsemGraphicsDeviceList) - return FALSE; - - return TRUE; + return STATUS_INSUFFICIENT_RESOURCES; + + return STATUS_SUCCESS; }
Modified: trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -26,7 +26,8 @@
/** Private functions *********************************************************/
-BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitLDEVImpl() { @@ -34,7 +35,7 @@ ghsemLDEVList = EngCreateSemaphore(); if (!ghsemLDEVList) { - return FALSE; + return STATUS_INSUFFICIENT_RESOURCES; }
/* Allocate a LDEVOBJ for win32k */ @@ -44,7 +45,7 @@ GDITAG_LDEV); if (!gpldevWin32k) { - return FALSE; + return STATUS_NO_MEMORY; }
/* Initialize the LDEVOBJ for win32k */ @@ -62,7 +63,7 @@ gpldevWin32k->pGdiDriverInfo->ExportSectionPointer = NULL; gpldevWin32k->pGdiDriverInfo->ImageLength = 0; // FIXME;
- return TRUE; + return STATUS_SUCCESS; }
PLDEVOBJ
Modified: trunk/reactos/subsystems/win32/win32k/eng/pdevobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -18,12 +18,14 @@ static PPDEVOBJ gppdevList = NULL; static HSEMAPHORE ghsemPDEV;
-BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitPDEVImpl() { ghsemPDEV = EngCreateSemaphore(); - return TRUE; + if (!ghsemPDEV) return STATUS_INSUFFICIENT_RESOURCES; + return STATUS_SUCCESS; }
Modified: trunk/reactos/subsystems/win32/win32k/eng/xlate.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/xlate.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/xlate.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -634,11 +634,13 @@ pexlo->xlo.pulXlate = pexlo->aulXlate; }
-VOID +INIT_FUNCTION +NTSTATUS +NTAPI InitXlateImpl(VOID) { - EXLATEOBJ_vInitTrivial(&gexloTrivial); + return STATUS_SUCCESS; }
Modified: trunk/reactos/subsystems/win32/win32k/include/accelerator.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/accelerator.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/accelerator.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -11,7 +11,9 @@ LPACCEL Table; } ACCELERATOR_TABLE, *PACCELERATOR_TABLE;
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitAcceleratorImpl(VOID);
NTSTATUS FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -159,7 +159,7 @@
extern PDC defaultDCstate;
-NTSTATUS FASTCALL InitDcImpl(VOID); +INIT_FUNCTION NTSTATUS NTAPI InitDcImpl(); PPDEVOBJ FASTCALL IntEnumHDev(VOID); PDC NTAPI DC_AllocDcWithHandle(); VOID FASTCALL DC_InitDC(HDC DCToInit);
Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -45,7 +45,9 @@ HWND hWnd; } SHELL_HOOK_WINDOW, *PSHELL_HOOK_WINDOW;
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitDesktopImpl(VOID);
NTSTATUS FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/device.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/device.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/device.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -30,7 +30,8 @@ PUNICODE_STRING pustrDescription, PDEVMODEW pdmDefault);
-BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitDeviceImpl();
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -59,6 +59,8 @@ BASEFLAG_READY_TO_DIE = 0x1000 };
+extern PSECTION_OBJECT GdiTableSection; + BOOL INTERNAL_CALL GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle); BOOL INTERNAL_CALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner); BOOL INTERNAL_CALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo); @@ -74,6 +76,11 @@ VOID INTERNAL_CALL GDIOBJ_LockMultipleObjs(ULONG ulCount, IN HGDIOBJ* ahObj, OUT PGDIOBJ* apObj);
PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process); + +INIT_FUNCTION +NTSTATUS +NTAPI +InitGdiHandleTable();
#define GDIOBJ_GetObjectType(Handle) \ GDI_HANDLE_GET_TYPE(Handle)
Modified: trunk/reactos/subsystems/win32/win32k/include/guicheck.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/guicheck.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/guicheck.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -4,6 +4,9 @@ BOOL FASTCALL IntCreatePrimarySurface(VOID); VOID FASTCALL IntDestroyPrimarySurface(VOID);
-NTSTATUS FASTCALL InitGuiCheckImpl (VOID); +INIT_FUNCTION +NTSTATUS +NTAPI +InitGuiCheckImpl (VOID);
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/include/hotkey.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/hotkey.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/hotkey.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -13,7 +13,9 @@ UINT vk; } HOT_KEY_ITEM, *PHOT_KEY_ITEM;
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitHotkeyImpl(VOID);
//NTSTATUS FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/input.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -27,10 +27,16 @@ #define KBL_PRELOAD 2 #define KBL_RESET 4
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitInputImpl(VOID); -NTSTATUS FASTCALL + +INIT_FUNCTION +NTSTATUS +NTAPI InitKeyboardImpl(VOID); + PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID); VOID W32kUnregisterPrimitiveMessageQueue(VOID); PKBL W32kGetDefaultKeyLayout(VOID);
Modified: trunk/reactos/subsystems/win32/win32k/include/inteng.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/inteng.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/inteng.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -82,32 +82,6 @@ POINTL *pptlDitherOrg, ULONG ulMode);
-VOID InitXlateImpl(VOID); - -XLATEOBJ* FASTCALL -IntEngCreateXlate(USHORT DestPalType, - USHORT SourcePalType, - HPALETTE PaletteDest, - HPALETTE PaletteSource); - -XLATEOBJ* FASTCALL -IntEngCreateMonoXlate(USHORT SourcePalType, - HPALETTE PaletteDest, - HPALETTE PaletteSource, - ULONG BackgroundColor); - -XLATEOBJ* FASTCALL -IntEngCreateSrcMonoXlate(HPALETTE PaletteDest, - ULONG Color0, - ULONG Color1); - -XLATEOBJ* -IntCreateBrushXlate(BRUSH *pbrush, SURFACE * psurf, COLORREF crBackgroundClr); - -HPALETTE FASTCALL -IntEngGetXlatePalette(XLATEOBJ *XlateObj, - ULONG Palette); - BOOL APIENTRY IntEngPolyline(SURFOBJ *DestSurf, CLIPOBJ *Clip,
Modified: trunk/reactos/subsystems/win32/win32k/include/ldevobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/ldevobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/ldevobj.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -63,7 +63,8 @@ PLDEVOBJ pldev, HANDLE hDriver);
-BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitLDEVImpl();
Modified: trunk/reactos/subsystems/win32/win32k/include/menu.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/menu.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/menu.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -104,7 +104,9 @@ PROSMENUITEMINFO ItemInfo);
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitMenuImpl(VOID);
NTSTATUS FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/monitor.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/monitor.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/monitor.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -32,7 +32,10 @@ } MONITOR, *PMONITOR;
/* functions */ -NTSTATUS InitMonitorImpl(); +INIT_FUNCTION +NTSTATUS +NTAPI +InitMonitorImpl(); NTSTATUS CleanupMonitorImpl();
NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber);
Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -138,7 +138,9 @@ MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue); PUSER_MESSAGE_QUEUE FASTCALL MsqGetHardwareMessageQueue(VOID); -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI MsqInitializeImpl(VOID); BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
Modified: trunk/reactos/subsystems/win32/win32k/include/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/ntuser.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -11,7 +11,7 @@
extern PSERVERINFO gpsi;
-NTSTATUS FASTCALL InitUserImpl(VOID); +INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID); VOID FASTCALL CleanupUserImpl(VOID); VOID FASTCALL UserEnterShared(VOID); VOID FASTCALL UserEnterExclusive(VOID);
Modified: trunk/reactos/subsystems/win32/win32k/include/palette.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/palette.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/palette.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -74,8 +74,7 @@ GDIOBJ_ShareUnlockObjByPtr(&ppal->BaseObject)
BOOL INTERNAL_CALL PALETTE_Cleanup(PVOID ObjectBody); - -HPALETTE FASTCALL PALETTE_Init (VOID); +INIT_FUNCTION NTSTATUS NTAPI InitPaletteImpl(); VOID FASTCALL PALETTE_ValidateFlags (PALETTEENTRY* lpPalE, INT size); INT FASTCALL PALETTE_ToPhysical (PDC dc, COLORREF color);
Modified: trunk/reactos/subsystems/win32/win32k/include/pdevobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -174,17 +174,10 @@ PPDEVOBJ ppdev, PDEVCAPS pDevCaps);
-BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitPDEVImpl(); - -BOOL -NTAPI -InitLDEVImpl(); - -BOOL -NTAPI -InitDeviceImpl();
PSIZEL FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/timer.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/timer.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/timer.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -26,7 +26,10 @@
extern PKTIMER MasterTimer;
-NTSTATUS FASTCALL InitTimerImpl(VOID); +INIT_FUNCTION +NTSTATUS +NTAPI +InitTimerImpl(VOID); BOOL FASTCALL DestroyTimersForThread(PTHREADINFO pti); BOOL FASTCALL DestroyTimersForWindow(PTHREADINFO pti, PWND Window); BOOL FASTCALL IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer);
Modified: trunk/reactos/subsystems/win32/win32k/include/win32kp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32kp.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32kp.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -10,6 +10,9 @@
#pragma once #define INTERNAL_CALL APIENTRY + +#define PLACE_IN_SECTION(s) __attribute__((section(s))) +#define INIT_FUNCTION PLACE_IN_SECTION("INIT")
/* Internal Win32k Headers */ #include <include/accelerator.h>
Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -50,7 +50,9 @@ HWND* FASTCALL IntWinListChildren(PWND Window);
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowImpl (VOID);
NTSTATUS FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/winsta.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -62,7 +62,9 @@ extern WINSTATION_OBJECT *InputWindowStation; extern PPROCESSINFO LogonProcess;
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowStationImpl(VOID);
NTSTATUS FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/xlateobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/xlateobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/xlateobj.h [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -47,5 +47,9 @@ VOID NTAPI EXLATEOBJ_vInitXlateFromDCs(PEXLATEOBJ pexlo, PDC pdcSrc, PDC pdcDst); VOID NTAPI EXLATEOBJ_vInitSrcMonoXlate(PEXLATEOBJ pexlo, PPALETTE ppalDst, ULONG Color0, ULONG Color1); VOID NTAPI EXLATEOBJ_vCleanup(PEXLATEOBJ pexlo); +INIT_FUNCTION +NTSTATUS +NTAPI +InitXlateImpl(VOID);
//#define XLATEOBJ_iXlate(pxo, Color) ((EXLATEOBJ*)pxo)->pfnXlate(pxo, Color)
Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/mai... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -16,16 +16,11 @@
PGDI_HANDLE_TABLE INTERNAL_CALL GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject); BOOL INTERNAL_CALL GDI_CleanupForProcess (struct _EPROCESS *Process); -/* FIXME */ -PGDI_HANDLE_TABLE GdiHandleTable = NULL; -PSECTION_OBJECT GdiTableSection = NULL;
HANDLE GlobalUserHeap = NULL; PSECTION_OBJECT GlobalUserHeapSection = NULL;
PSERVERINFO gpsi = NULL; // Global User Server Information. - -HSEMAPHORE hsemDriverMgmt = NULL;
SHORT gusLanguageID;
@@ -315,8 +310,6 @@ END_CLEANUP; }
-/* Only used in ntuser/input.c KeyboardThreadMain(). If it's - not called there anymore, please delete */ NTSTATUS Win32kInitWin32Thread(PETHREAD Thread) { @@ -354,11 +347,22 @@
C_ASSERT(sizeof(SERVERINFO) <= PAGE_SIZE);
+// Return on failure +#define NT_ROF(x) \ + Status = (x); \ + if (!NT_SUCCESS(Status)) \ + { \ + DPRINT1("Failed '%s' (0x%lx)\n", #x, Status); \ + return Status; \ + } + /* * This definition doesn't work */ -NTSTATUS APIENTRY -DriverEntry ( +INIT_FUNCTION +NTSTATUS +APIENTRY +DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) { @@ -407,146 +411,48 @@ }
/* Allocate global server info structure */ + gpsi = UserHeapAlloc(sizeof(SERVERINFO)); if (!gpsi) { - gpsi = UserHeapAlloc(sizeof(SERVERINFO)); - if (gpsi) - { - RtlZeroMemory(gpsi, sizeof(SERVERINFO)); - DPRINT("Global Server Data -> %x\n", gpsi); - } - else - { - ASSERT(FALSE); - } - } - - if(!hsemDriverMgmt) hsemDriverMgmt = EngCreateSemaphore(); - - /* Create the GDI handle table */ - GdiHandleTable = GDIOBJ_iAllocHandleTable(&GdiTableSection); - if (GdiHandleTable == NULL) - { - DPRINT1("Failed to initialize the GDI handle table.\n"); + DPRINT1("Failed allocate server info structure!\n"); return STATUS_UNSUCCESSFUL; }
- /* Initialize default palettes */ - PALETTE_Init(); + RtlZeroMemory(gpsi, sizeof(SERVERINFO)); + DPRINT("Global Server Data -> %x\n", gpsi); + + NT_ROF(InitGdiHandleTable()); + NT_ROF(InitPaletteImpl());
/* Create stock objects, ie. precreated objects commonly used by win32 applications */ CreateStockObjects(); CreateSysColorObjects();
- InitXlateImpl(); - InitPDEVImpl(); - InitLDEVImpl(); - InitDeviceImpl(); - - Status = InitDcImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize Device context implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitUserImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize user implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitHotkeyImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize hotkey implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitWindowStationImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize window station implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitDesktopImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize desktop implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitWindowImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize window implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitMenuImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize menu implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = InitInputImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize input implementation.\n"); - return(Status); - } - - Status = InitKeyboardImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize keyboard implementation.\n"); - return(Status); - } - - Status = InitMonitorImpl(); - if (!NT_SUCCESS(Status)) - { - DbgPrint("Failed to initialize monitor implementation!\n"); - return STATUS_UNSUCCESSFUL; - } - - Status = MsqInitializeImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize message queue implementation.\n"); - return(Status); - } - - Status = InitTimerImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize timer implementation.\n"); - return(Status); - } - - Status = InitAcceleratorImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize accelerator implementation.\n"); - return(Status); - } - - Status = InitGuiCheckImpl(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize GUI check implementation.\n"); - return(Status); - } + NT_ROF(InitXlateImpl()); + NT_ROF(InitPDEVImpl()); + NT_ROF(InitLDEVImpl()); + NT_ROF(InitDeviceImpl()); + NT_ROF(InitDcImpl()); + NT_ROF(InitUserImpl()); + NT_ROF(InitHotkeyImpl()); + NT_ROF(InitWindowStationImpl()); + NT_ROF(InitDesktopImpl()); + NT_ROF(InitWindowImpl()); + NT_ROF(InitMenuImpl()); + NT_ROF(InitInputImpl()); + NT_ROF(InitKeyboardImpl()); + NT_ROF(InitMonitorImpl()); + NT_ROF(MsqInitializeImpl()); + NT_ROF(InitTimerImpl()); + NT_ROF(InitAcceleratorImpl()); + NT_ROF(InitGuiCheckImpl());
/* Initialize FreeType library */ if (!InitFontSupport()) { DPRINT1("Unable to initialize font support\n"); - return STATUS_UNSUCCESSFUL; + return Status; }
gusLanguageID = IntGdiGetLanguageID();
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -56,7 +56,9 @@
/* FUNCTIONS *****************************************************************/
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitAcceleratorImpl(VOID) { return(STATUS_SUCCESS);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -170,8 +170,9 @@
/* PRIVATE FUNCTIONS **********************************************************/
+INIT_FUNCTION NTSTATUS -FASTCALL +NTAPI InitDesktopImpl(VOID) { /* Set Desktop Object Attributes */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -130,7 +130,9 @@
}
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitGuiCheckImpl (VOID) { return STATUS_SUCCESS;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -51,7 +51,9 @@
/* FUNCTIONS *****************************************************************/
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitHotkeyImpl(VOID) { InitializeListHead(&gHotkeyList);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -922,7 +922,9 @@ DPRINT1("Raw Input Thread Exit!\n"); }
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitInputImpl(VOID) { NTSTATUS Status;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -58,7 +58,10 @@ /* FUNCTIONS *****************************************************************/
/* Initialization -- Right now, just zero the key state and init the lock */ -NTSTATUS FASTCALL InitKeyboardImpl(VOID) +INIT_FUNCTION +NTSTATUS +NTAPI +InitKeyboardImpl(VOID) { RtlZeroMemory(&gQueueKeyStateTable,0x100); return STATUS_SUCCESS;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -86,7 +86,9 @@ ( ((r).bottom >= y)) && \ ( ((r).top <= y)) )
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitMenuImpl(VOID) { return(STATUS_SUCCESS);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -28,7 +28,9 @@
/* INITALIZATION FUNCTIONS ****************************************************/
+INIT_FUNCTION NTSTATUS +NTAPI InitMonitorImpl() { DPRINT("Initializing monitor implementation...\n");
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -140,7 +140,9 @@ }
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI MsqInitializeImpl(VOID) { /*CurrentFocusMessageQueue = NULL;*/
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -53,8 +53,10 @@
/* FUNCTIONS *****************************************************************/
- -NTSTATUS FASTCALL InitUserImpl(VOID) +INIT_FUNCTION +NTSTATUS +NTAPI +InitUserImpl(VOID) { NTSTATUS Status;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -527,7 +527,9 @@ return pTmr ? TRUE : FALSE; }
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitTimerImpl(VOID) { ULONG BitmapBytes;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -29,7 +29,9 @@ * Initialize windowing implementation. */
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowImpl(VOID) { return STATUS_SUCCESS;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -56,7 +56,9 @@ };
-NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowStationImpl(VOID) { OBJECT_ATTRIBUTES ObjectAttributes;
Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -58,7 +58,9 @@
/** Internal functions ********************************************************/
+INIT_FUNCTION NTSTATUS +NTAPI InitDcImpl() { psurfDefaultBitmap = SURFACE_ShareLockSurface(StockObjects[DEFAULT_BITMAP]);
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -81,6 +81,8 @@ };
static LARGE_INTEGER ShortDelay; +PGDI_HANDLE_TABLE GdiHandleTable = NULL; +PSECTION_OBJECT GdiTableSection = NULL;
/** INTERNAL FUNCTIONS ********************************************************/
@@ -151,7 +153,9 @@ * Allocate GDI object table. * \param Size - number of entries in the object table. */ -PGDI_HANDLE_TABLE INTERNAL_CALL +INIT_FUNCTION +PGDI_HANDLE_TABLE +INTERNAL_CALL GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject) { PGDI_HANDLE_TABLE HandleTable = NULL; @@ -220,6 +224,23 @@
return HandleTable; } + +INIT_FUNCTION +NTSTATUS +NTAPI +InitGdiHandleTable() +{ + /* Create the GDI handle table */ + GdiHandleTable = GDIOBJ_iAllocHandleTable(&GdiTableSection); + if (GdiHandleTable == NULL) + { + DPRINT1("Failed to initialize the GDI handle table.\n"); + return STATUS_UNSUCCESSFUL; + } + + return STATUS_SUCCESS; +} +
static void FASTCALL LockErrorDebugOutput(HGDIOBJ hObj, PGDI_TABLE_ENTRY Entry, LPSTR Function)
Modified: trunk/reactos/subsystems/win32/win32k/objects/palette.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/palette.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/palette.c [iso-8859-1] Wed Nov 3 00:51:19 2010 @@ -57,7 +57,10 @@ }
// Create the system palette -HPALETTE FASTCALL PALETTE_Init(VOID) +INIT_FUNCTION +NTSTATUS +NTAPI +InitPaletteImpl() { int i; HPALETTE hpalette; @@ -68,7 +71,7 @@ sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE); - if (!palPtr) return FALSE; + if (!palPtr) return STATUS_NO_MEMORY;
palPtr->palVersion = 0x300; palPtr->palNumEntries = NB_RESERVED_COLORS; @@ -131,7 +134,7 @@ appalSurfaceDefault[BMF_JPEG] = &gpalRGB; appalSurfaceDefault[BMF_PNG] = &gpalRGB;
- return hpalette; + return STATUS_SUCCESS; }
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size)