diff --git a/reactos/subsystems/win32/win32k/eng/device.c b/reactos/subsystems/win32/win32k/eng/device.c index 0965a967fc8..a6c0e72a75c 100644 --- a/reactos/subsystems/win32/win32k/eng/device.c +++ b/reactos/subsystems/win32/win32k/eng/device.c @@ -20,15 +20,16 @@ static PGRAPHICS_DEVICE gpGraphicsDeviceLast = NULL; static HSEMAPHORE ghsemGraphicsDeviceList; static ULONG giDevNum = 1; -BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitDeviceImpl() { ghsemGraphicsDeviceList = EngCreateSemaphore(); if (!ghsemGraphicsDeviceList) - return FALSE; + return STATUS_INSUFFICIENT_RESOURCES; - return TRUE; + return STATUS_SUCCESS; } diff --git a/reactos/subsystems/win32/win32k/eng/ldevobj.c b/reactos/subsystems/win32/win32k/eng/ldevobj.c index 6296a01b385..0e6c0eea540 100644 --- a/reactos/subsystems/win32/win32k/eng/ldevobj.c +++ b/reactos/subsystems/win32/win32k/eng/ldevobj.c @@ -26,7 +26,8 @@ LDEVOBJ *gpldevWin32k = NULL; /** Private functions *********************************************************/ -BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitLDEVImpl() { @@ -34,7 +35,7 @@ InitLDEVImpl() ghsemLDEVList = EngCreateSemaphore(); if (!ghsemLDEVList) { - return FALSE; + return STATUS_INSUFFICIENT_RESOURCES; } /* Allocate a LDEVOBJ for win32k */ @@ -44,7 +45,7 @@ InitLDEVImpl() GDITAG_LDEV); if (!gpldevWin32k) { - return FALSE; + return STATUS_NO_MEMORY; } /* Initialize the LDEVOBJ for win32k */ @@ -62,7 +63,7 @@ InitLDEVImpl() gpldevWin32k->pGdiDriverInfo->ExportSectionPointer = NULL; gpldevWin32k->pGdiDriverInfo->ImageLength = 0; // FIXME; - return TRUE; + return STATUS_SUCCESS; } PLDEVOBJ diff --git a/reactos/subsystems/win32/win32k/eng/pdevobj.c b/reactos/subsystems/win32/win32k/eng/pdevobj.c index 26c0f4b8416..2da468ee3fb 100644 --- a/reactos/subsystems/win32/win32k/eng/pdevobj.c +++ b/reactos/subsystems/win32/win32k/eng/pdevobj.c @@ -18,12 +18,14 @@ PPDEVOBJ gppdevPrimary = NULL; 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; } diff --git a/reactos/subsystems/win32/win32k/eng/xlate.c b/reactos/subsystems/win32/win32k/eng/xlate.c index 8f9962341e3..f15d757cb3d 100644 --- a/reactos/subsystems/win32/win32k/eng/xlate.c +++ b/reactos/subsystems/win32/win32k/eng/xlate.c @@ -634,11 +634,13 @@ EXLATEOBJ_vCleanup(PEXLATEOBJ pexlo) pexlo->xlo.pulXlate = pexlo->aulXlate; } -VOID +INIT_FUNCTION +NTSTATUS +NTAPI InitXlateImpl(VOID) { - EXLATEOBJ_vInitTrivial(&gexloTrivial); + return STATUS_SUCCESS; } diff --git a/reactos/subsystems/win32/win32k/include/accelerator.h b/reactos/subsystems/win32/win32k/include/accelerator.h index f9aea474215..48de41329da 100644 --- a/reactos/subsystems/win32/win32k/include/accelerator.h +++ b/reactos/subsystems/win32/win32k/include/accelerator.h @@ -11,7 +11,9 @@ typedef struct _ACCELERATOR_TABLE LPACCEL Table; } ACCELERATOR_TABLE, *PACCELERATOR_TABLE; -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitAcceleratorImpl(VOID); NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index 8150b169900..b1f8cd1838a 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -159,7 +159,7 @@ typedef struct _DC 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); diff --git a/reactos/subsystems/win32/win32k/include/desktop.h b/reactos/subsystems/win32/win32k/include/desktop.h index 83ec40ceaf8..12911139223 100644 --- a/reactos/subsystems/win32/win32k/include/desktop.h +++ b/reactos/subsystems/win32/win32k/include/desktop.h @@ -45,7 +45,9 @@ typedef struct _SHELL_HOOK_WINDOW HWND hWnd; } SHELL_HOOK_WINDOW, *PSHELL_HOOK_WINDOW; -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitDesktopImpl(VOID); NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/device.h b/reactos/subsystems/win32/win32k/include/device.h index cdf60d7f80a..2ad19b278a7 100644 --- a/reactos/subsystems/win32/win32k/include/device.h +++ b/reactos/subsystems/win32/win32k/include/device.h @@ -30,7 +30,8 @@ EngpRegisterGraphicsDevice( PUNICODE_STRING pustrDescription, PDEVMODEW pdmDefault); -BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitDeviceImpl(); diff --git a/reactos/subsystems/win32/win32k/include/gdiobj.h b/reactos/subsystems/win32/win32k/include/gdiobj.h index a1a56b7ae24..e736391322e 100644 --- a/reactos/subsystems/win32/win32k/include/gdiobj.h +++ b/reactos/subsystems/win32/win32k/include/gdiobj.h @@ -59,6 +59,8 @@ enum BASEFLAGS 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); @@ -75,6 +77,11 @@ VOID INTERNAL_CALL GDIOBJ_LockMultipleObjs(ULONG ulCount, IN HGDIOBJ* ahObj, OUT PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process); +INIT_FUNCTION +NTSTATUS +NTAPI +InitGdiHandleTable(); + #define GDIOBJ_GetObjectType(Handle) \ GDI_HANDLE_GET_TYPE(Handle) diff --git a/reactos/subsystems/win32/win32k/include/guicheck.h b/reactos/subsystems/win32/win32k/include/guicheck.h index 5e1c5c9c385..8548ab6732c 100644 --- a/reactos/subsystems/win32/win32k/include/guicheck.h +++ b/reactos/subsystems/win32/win32k/include/guicheck.h @@ -4,6 +4,9 @@ BOOL FASTCALL co_IntGraphicsCheck(BOOL Create); BOOL FASTCALL IntCreatePrimarySurface(VOID); VOID FASTCALL IntDestroyPrimarySurface(VOID); -NTSTATUS FASTCALL InitGuiCheckImpl (VOID); +INIT_FUNCTION +NTSTATUS +NTAPI +InitGuiCheckImpl (VOID); /* EOF */ diff --git a/reactos/subsystems/win32/win32k/include/hotkey.h b/reactos/subsystems/win32/win32k/include/hotkey.h index c03e6ebc010..74f19a2b2a7 100644 --- a/reactos/subsystems/win32/win32k/include/hotkey.h +++ b/reactos/subsystems/win32/win32k/include/hotkey.h @@ -13,7 +13,9 @@ typedef struct _HOT_KEY_ITEM UINT vk; } HOT_KEY_ITEM, *PHOT_KEY_ITEM; -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitHotkeyImpl(VOID); //NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/input.h b/reactos/subsystems/win32/win32k/include/input.h index 2a00fe20e9e..60056046d1a 100644 --- a/reactos/subsystems/win32/win32k/include/input.h +++ b/reactos/subsystems/win32/win32k/include/input.h @@ -27,10 +27,16 @@ extern PATTACHINFO gpai; #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); diff --git a/reactos/subsystems/win32/win32k/include/inteng.h b/reactos/subsystems/win32/win32k/include/inteng.h index 9bcfc0ab838..1d8610d2dac 100644 --- a/reactos/subsystems/win32/win32k/include/inteng.h +++ b/reactos/subsystems/win32/win32k/include/inteng.h @@ -82,32 +82,6 @@ IntEngGradientFill(SURFOBJ *psoDest, 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, diff --git a/reactos/subsystems/win32/win32k/include/ldevobj.h b/reactos/subsystems/win32/win32k/include/ldevobj.h index 40070db631c..6bae83ab8a0 100644 --- a/reactos/subsystems/win32/win32k/include/ldevobj.h +++ b/reactos/subsystems/win32/win32k/include/ldevobj.h @@ -63,7 +63,8 @@ LDEVOBJ_pdmiGetModes( PLDEVOBJ pldev, HANDLE hDriver); -BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitLDEVImpl(); diff --git a/reactos/subsystems/win32/win32k/include/menu.h b/reactos/subsystems/win32/win32k/include/menu.h index 6b86b62e8ad..10fe2294fba 100644 --- a/reactos/subsystems/win32/win32k/include/menu.h +++ b/reactos/subsystems/win32/win32k/include/menu.h @@ -104,7 +104,9 @@ IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition, PROSMENUITEMINFO ItemInfo); -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitMenuImpl(VOID); NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/monitor.h b/reactos/subsystems/win32/win32k/include/monitor.h index 6c4282885ca..04a9a3ffc36 100644 --- a/reactos/subsystems/win32/win32k/include/monitor.h +++ b/reactos/subsystems/win32/win32k/include/monitor.h @@ -32,7 +32,10 @@ typedef struct _MONITOR } MONITOR, *PMONITOR; /* functions */ -NTSTATUS InitMonitorImpl(); +INIT_FUNCTION +NTSTATUS +NTAPI +InitMonitorImpl(); NTSTATUS CleanupMonitorImpl(); NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber); diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 569f1028d83..e1c2972622e 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -138,7 +138,9 @@ VOID FASTCALL 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); diff --git a/reactos/subsystems/win32/win32k/include/ntuser.h b/reactos/subsystems/win32/win32k/include/ntuser.h index 58a911d6f82..83b21556862 100644 --- a/reactos/subsystems/win32/win32k/include/ntuser.h +++ b/reactos/subsystems/win32/win32k/include/ntuser.h @@ -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); diff --git a/reactos/subsystems/win32/win32k/include/palette.h b/reactos/subsystems/win32/win32k/include/palette.h index 82fcb3ca05b..3fad906ff45 100644 --- a/reactos/subsystems/win32/win32k/include/palette.h +++ b/reactos/subsystems/win32/win32k/include/palette.h @@ -74,8 +74,7 @@ HPALETTE FASTCALL PALETTE_AllocPaletteIndexedRGB(ULONG NumColors, 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); diff --git a/reactos/subsystems/win32/win32k/include/pdevobj.h b/reactos/subsystems/win32/win32k/include/pdevobj.h index 6a19a1bffec..bece851460a 100644 --- a/reactos/subsystems/win32/win32k/include/pdevobj.h +++ b/reactos/subsystems/win32/win32k/include/pdevobj.h @@ -174,18 +174,11 @@ PDEVOBJ_vGetDeviceCaps( PPDEVOBJ ppdev, PDEVCAPS pDevCaps); -BOOL +INIT_FUNCTION +NTSTATUS NTAPI InitPDEVImpl(); -BOOL -NTAPI -InitLDEVImpl(); - -BOOL -NTAPI -InitDeviceImpl(); - PSIZEL FASTCALL PDEVOBJ_sizl(PPDEVOBJ, PSIZEL); diff --git a/reactos/subsystems/win32/win32k/include/timer.h b/reactos/subsystems/win32/win32k/include/timer.h index 20faa683526..c88da4a987d 100644 --- a/reactos/subsystems/win32/win32k/include/timer.h +++ b/reactos/subsystems/win32/win32k/include/timer.h @@ -26,7 +26,10 @@ typedef struct _TIMER 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); diff --git a/reactos/subsystems/win32/win32k/include/win32kp.h b/reactos/subsystems/win32/win32k/include/win32kp.h index 8bcf046195b..1dc0073bb0f 100644 --- a/reactos/subsystems/win32/win32k/include/win32kp.h +++ b/reactos/subsystems/win32/win32k/include/win32kp.h @@ -11,6 +11,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 diff --git a/reactos/subsystems/win32/win32k/include/window.h b/reactos/subsystems/win32/win32k/include/window.h index 39a55b26e00..0e2073d3df1 100644 --- a/reactos/subsystems/win32/win32k/include/window.h +++ b/reactos/subsystems/win32/win32k/include/window.h @@ -50,7 +50,9 @@ IntIsWindow(HWND hWnd); HWND* FASTCALL IntWinListChildren(PWND Window); -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowImpl (VOID); NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/winsta.h b/reactos/subsystems/win32/win32k/include/winsta.h index da944af3a46..a50a23ed6b7 100644 --- a/reactos/subsystems/win32/win32k/include/winsta.h +++ b/reactos/subsystems/win32/win32k/include/winsta.h @@ -62,7 +62,9 @@ typedef struct _WINSTATION_OBJECT extern WINSTATION_OBJECT *InputWindowStation; extern PPROCESSINFO LogonProcess; -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowStationImpl(VOID); NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/win32k/include/xlateobj.h b/reactos/subsystems/win32/win32k/include/xlateobj.h index 18d2f240012..ea7d32035eb 100644 --- a/reactos/subsystems/win32/win32k/include/xlateobj.h +++ b/reactos/subsystems/win32/win32k/include/xlateobj.h @@ -47,5 +47,9 @@ VOID NTAPI EXLATEOBJ_vInitialize(PEXLATEOBJ pexlo, PALETTE *ppalSrc, PALETTE *pp 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) diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index 3d1c24972e5..dd25b2efefe 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -16,17 +16,12 @@ HANDLE hModuleWin; 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; extern ULONG_PTR Win32kSSDT[]; @@ -315,8 +310,6 @@ CLEANUP: 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 @@ Win32kInitWin32Thread(PETHREAD Thread) 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 @@ DriverEntry ( } /* 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(); diff --git a/reactos/subsystems/win32/win32k/ntuser/accelerator.c b/reactos/subsystems/win32/win32k/ntuser/accelerator.c index a913de1ebfa..cb0eca60d00 100644 --- a/reactos/subsystems/win32/win32k/ntuser/accelerator.c +++ b/reactos/subsystems/win32/win32k/ntuser/accelerator.c @@ -56,7 +56,9 @@ /* FUNCTIONS *****************************************************************/ -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitAcceleratorImpl(VOID) { return(STATUS_SUCCESS); diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index 894245d219b..673fd452ae0 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -170,8 +170,9 @@ IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters) /* PRIVATE FUNCTIONS **********************************************************/ +INIT_FUNCTION NTSTATUS -FASTCALL +NTAPI InitDesktopImpl(VOID) { /* Set Desktop Object Attributes */ diff --git a/reactos/subsystems/win32/win32k/ntuser/guicheck.c b/reactos/subsystems/win32/win32k/ntuser/guicheck.c index e3766d8c4b2..50421737fb9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/guicheck.c +++ b/reactos/subsystems/win32/win32k/ntuser/guicheck.c @@ -130,7 +130,9 @@ IntUserManualGuiCheck(LONG Check) } -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitGuiCheckImpl (VOID) { return STATUS_SUCCESS; diff --git a/reactos/subsystems/win32/win32k/ntuser/hotkey.c b/reactos/subsystems/win32/win32k/ntuser/hotkey.c index adfc6a5c3e1..0b8a68efc84 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hotkey.c +++ b/reactos/subsystems/win32/win32k/ntuser/hotkey.c @@ -51,7 +51,9 @@ LIST_ENTRY gHotkeyList; /* FUNCTIONS *****************************************************************/ -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitHotkeyImpl(VOID) { InitializeListHead(&gHotkeyList); diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 9a4339d1981..8919d57d6ad 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -922,7 +922,9 @@ RawInputThreadMain(PVOID StartContext) DPRINT1("Raw Input Thread Exit!\n"); } -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitInputImpl(VOID) { NTSTATUS Status; diff --git a/reactos/subsystems/win32/win32k/ntuser/keyboard.c b/reactos/subsystems/win32/win32k/ntuser/keyboard.c index 04be007a32d..49a65450be5 100644 --- a/reactos/subsystems/win32/win32k/ntuser/keyboard.c +++ b/reactos/subsystems/win32/win32k/ntuser/keyboard.c @@ -58,7 +58,10 @@ BYTE gQueueKeyStateTable[256]; /* 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; diff --git a/reactos/subsystems/win32/win32k/ntuser/menu.c b/reactos/subsystems/win32/win32k/ntuser/menu.c index 06618296b49..49e643ec596 100644 --- a/reactos/subsystems/win32/win32k/ntuser/menu.c +++ b/reactos/subsystems/win32/win32k/ntuser/menu.c @@ -86,7 +86,9 @@ UserMenuInfo( ( ((r).bottom >= y)) && \ ( ((r).top <= y)) ) -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitMenuImpl(VOID) { return(STATUS_SUCCESS); diff --git a/reactos/subsystems/win32/win32k/ntuser/monitor.c b/reactos/subsystems/win32/win32k/ntuser/monitor.c index e35d36aece1..b766e951da9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/monitor.c +++ b/reactos/subsystems/win32/win32k/ntuser/monitor.c @@ -28,7 +28,9 @@ static PMONITOR gMonitorList = NULL; /* INITALIZATION FUNCTIONS ****************************************************/ +INIT_FUNCTION NTSTATUS +NTAPI InitMonitorImpl() { DPRINT("Initializing monitor implementation...\n"); diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 0f102a1c51d..e3c7361b696 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -140,7 +140,9 @@ MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue) } -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI MsqInitializeImpl(VOID) { /*CurrentFocusMessageQueue = NULL;*/ diff --git a/reactos/subsystems/win32/win32k/ntuser/ntuser.c b/reactos/subsystems/win32/win32k/ntuser/ntuser.c index 1ca06aba1cc..d05b893d0c7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/ntuser.c +++ b/reactos/subsystems/win32/win32k/ntuser/ntuser.c @@ -53,8 +53,10 @@ InitUserAtoms(VOID) /* FUNCTIONS *****************************************************************/ - -NTSTATUS FASTCALL InitUserImpl(VOID) +INIT_FUNCTION +NTSTATUS +NTAPI +InitUserImpl(VOID) { NTSTATUS Status; diff --git a/reactos/subsystems/win32/win32k/ntuser/timer.c b/reactos/subsystems/win32/win32k/ntuser/timer.c index f9d83d6f27f..b3a7fbde3bc 100644 --- a/reactos/subsystems/win32/win32k/ntuser/timer.c +++ b/reactos/subsystems/win32/win32k/ntuser/timer.c @@ -527,7 +527,9 @@ IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer) return pTmr ? TRUE : FALSE; } -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitTimerImpl(VOID) { ULONG BitmapBytes; diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index f6e588fa1d8..e81ab4baef9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -29,7 +29,9 @@ * Initialize windowing implementation. */ -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowImpl(VOID) { return STATUS_SUCCESS; diff --git a/reactos/subsystems/win32/win32k/ntuser/winsta.c b/reactos/subsystems/win32/win32k/ntuser/winsta.c index 09810d2c82a..ca99f797c00 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winsta.c +++ b/reactos/subsystems/win32/win32k/ntuser/winsta.c @@ -56,7 +56,9 @@ static GENERIC_MAPPING IntWindowStationMapping = }; -NTSTATUS FASTCALL +INIT_FUNCTION +NTSTATUS +NTAPI InitWindowStationImpl(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; diff --git a/reactos/subsystems/win32/win32k/objects/dclife.c b/reactos/subsystems/win32/win32k/objects/dclife.c index 75113441b85..589e92c594f 100644 --- a/reactos/subsystems/win32/win32k/objects/dclife.c +++ b/reactos/subsystems/win32/win32k/objects/dclife.c @@ -58,7 +58,9 @@ static const MATRIX gmxWorldToPageDefault = /** Internal functions ********************************************************/ +INIT_FUNCTION NTSTATUS +NTAPI InitDcImpl() { psurfDefaultBitmap = SURFACE_ShareLockSurface(StockObjects[DEFAULT_BITMAP]); diff --git a/reactos/subsystems/win32/win32k/objects/gdiobj.c b/reactos/subsystems/win32/win32k/objects/gdiobj.c index bdc76abf72c..5eb43dd6feb 100644 --- a/reactos/subsystems/win32/win32k/objects/gdiobj.c +++ b/reactos/subsystems/win32/win32k/objects/gdiobj.c @@ -81,6 +81,8 @@ OBJ_TYPE_INFO ObjTypeInfo[BASE_OBJTYPE_COUNT] = }; static LARGE_INTEGER ShortDelay; +PGDI_HANDLE_TABLE GdiHandleTable = NULL; +PSECTION_OBJECT GdiTableSection = NULL; /** INTERNAL FUNCTIONS ********************************************************/ @@ -151,7 +153,9 @@ GDI_CleanupDummy(PVOID ObjectBody) * 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; @@ -221,6 +225,23 @@ GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject) 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) { diff --git a/reactos/subsystems/win32/win32k/objects/palette.c b/reactos/subsystems/win32/win32k/objects/palette.c index 47dbd28eaa6..e930bc116f9 100644 --- a/reactos/subsystems/win32/win32k/objects/palette.c +++ b/reactos/subsystems/win32/win32k/objects/palette.c @@ -57,7 +57,10 @@ unsigned short GetNumberOfBits(unsigned int dwMask) } // Create the system palette -HPALETTE FASTCALL PALETTE_Init(VOID) +INIT_FUNCTION +NTSTATUS +NTAPI +InitPaletteImpl() { int i; HPALETTE hpalette; @@ -68,7 +71,7 @@ HPALETTE FASTCALL PALETTE_Init(VOID) 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 @@ HPALETTE FASTCALL PALETTE_Init(VOID) appalSurfaceDefault[BMF_JPEG] = &gpalRGB; appalSurfaceDefault[BMF_PNG] = &gpalRGB; - return hpalette; + return STATUS_SUCCESS; } VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size)