2014-12-27 19:16:05 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Win32k subsystem
|
|
|
|
* PURPOSE: Initialization of GDI
|
|
|
|
* FILE: win32ss/gdi/ntgdi/init.c
|
|
|
|
* PROGRAMER:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <win32k.h>
|
[NTGDI][NTUSER] Load DirectX graphics driver at system startup (#4551)
CORE-18221
Load the DirectX graphics kernel driver (dxg.sys) by win32k at WINSRV
initialization time, in NtUserInitialize(). Keep it always loaded in
memory, as on Windows, instead of loading it only by DirectX dlls.
This fixes the problem of acessing this driver: we need only to call
DxDdEnableDirectDraw() and do other stuff when DirectDraw/Direct3D is
required by anything. In other cases, it is called from win32k PDEV
functions when changing display mode (as in Windows). Since it's used
by other things too, it needs to be always loaded.
Otherwise, if it's not loaded, its APIs are not accessible when needed,
and execution fails.
For example, it fixes display mode change problem in VMWare, when a
new mode fails to be applied. Indeed, when it manages DirectDraw stuff,
it calls DXG routines, and therefore fails if dxg.sys isn't loaded
in memory at this moment.
- Implement InitializeGreCSRSS() initialization routine, that initializes
supplemental NTGDI/GRE data once CSRSS and WINSRV are loaded:
* Call DxDdStartupDxGraphics() inside it, which loads dxg.sys.
* Additionally, move fonts and language ID initialization there, from
win32k!DriverEntry. Confirmed by analysis on Windows.
- Call InitializeGreCSRSS() in NtUserInitialize() main initialization routine
(called by WINSRV initialization).
Moved to NTGDI from previously NTUSER place:
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2022-06-18 18:35:17 +00:00
|
|
|
DBG_DEFAULT_CHANNEL(UserMisc);
|
2014-12-27 19:16:05 +00:00
|
|
|
|
[NTGDI][NTUSER] Load DirectX graphics driver at system startup (#4551)
CORE-18221
Load the DirectX graphics kernel driver (dxg.sys) by win32k at WINSRV
initialization time, in NtUserInitialize(). Keep it always loaded in
memory, as on Windows, instead of loading it only by DirectX dlls.
This fixes the problem of acessing this driver: we need only to call
DxDdEnableDirectDraw() and do other stuff when DirectDraw/Direct3D is
required by anything. In other cases, it is called from win32k PDEV
functions when changing display mode (as in Windows). Since it's used
by other things too, it needs to be always loaded.
Otherwise, if it's not loaded, its APIs are not accessible when needed,
and execution fails.
For example, it fixes display mode change problem in VMWare, when a
new mode fails to be applied. Indeed, when it manages DirectDraw stuff,
it calls DXG routines, and therefore fails if dxg.sys isn't loaded
in memory at this moment.
- Implement InitializeGreCSRSS() initialization routine, that initializes
supplemental NTGDI/GRE data once CSRSS and WINSRV are loaded:
* Call DxDdStartupDxGraphics() inside it, which loads dxg.sys.
* Additionally, move fonts and language ID initialization there, from
win32k!DriverEntry. Confirmed by analysis on Windows.
- Call InitializeGreCSRSS() in NtUserInitialize() main initialization routine
(called by WINSRV initialization).
Moved to NTGDI from previously NTUSER place:
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2022-06-18 18:35:17 +00:00
|
|
|
USHORT gusLanguageID;
|
2014-12-27 19:16:05 +00:00
|
|
|
|
2014-12-28 15:28:00 +00:00
|
|
|
BOOL NTAPI GDI_CleanupForProcess(struct _EPROCESS *Process);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
GdiProcessCreate(PEPROCESS Process)
|
|
|
|
{
|
|
|
|
PPROCESSINFO ppiCurrent = PsGetProcessWin32Process(Process);
|
|
|
|
ASSERT(ppiCurrent);
|
|
|
|
|
|
|
|
InitializeListHead(&ppiCurrent->PrivateFontListHead);
|
2017-04-08 17:32:45 +00:00
|
|
|
InitializeListHead(&ppiCurrent->PrivateMemFontListHead);
|
|
|
|
ppiCurrent->PrivateMemFontHandleCount = 0;
|
2014-12-28 15:28:00 +00:00
|
|
|
ExInitializeFastMutex(&ppiCurrent->PrivateFontListLock);
|
|
|
|
|
|
|
|
InitializeListHead(&ppiCurrent->GDIBrushAttrFreeList);
|
|
|
|
InitializeListHead(&ppiCurrent->GDIDcAttrFreeList);
|
|
|
|
|
|
|
|
/* Map the GDI handle table to user land */
|
|
|
|
Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(Process);
|
|
|
|
Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
|
|
|
|
|
|
|
|
/* Create pools for GDI object attributes */
|
|
|
|
ppiCurrent->pPoolDcAttr = GdiPoolCreate(sizeof(DC_ATTR), 'acdG');
|
|
|
|
ppiCurrent->pPoolBrushAttr = GdiPoolCreate(sizeof(BRUSH_ATTR), 'arbG');
|
|
|
|
ppiCurrent->pPoolRgnAttr = GdiPoolCreate(sizeof(RGN_ATTR), 'agrG');
|
|
|
|
ASSERT(ppiCurrent->pPoolDcAttr);
|
|
|
|
ASSERT(ppiCurrent->pPoolBrushAttr);
|
|
|
|
ASSERT(ppiCurrent->pPoolRgnAttr);
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
GdiProcessDestroy(PEPROCESS Process)
|
|
|
|
{
|
|
|
|
PPROCESSINFO ppiCurrent = PsGetProcessWin32Process(Process);
|
|
|
|
ASSERT(ppiCurrent);
|
|
|
|
ASSERT(ppiCurrent->peProcess == Process);
|
|
|
|
|
2017-04-14 18:22:57 +00:00
|
|
|
IntGdiCleanupPrivateFontsForProcess();
|
|
|
|
|
2014-12-28 15:28:00 +00:00
|
|
|
/* And GDI ones too */
|
|
|
|
GDI_CleanupForProcess(Process);
|
|
|
|
|
|
|
|
/* So we can now free the pools */
|
|
|
|
GdiPoolDestroy(ppiCurrent->pPoolDcAttr);
|
|
|
|
GdiPoolDestroy(ppiCurrent->pPoolBrushAttr);
|
|
|
|
GdiPoolDestroy(ppiCurrent->pPoolRgnAttr);
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
GdiThreadCreate(PETHREAD Thread)
|
|
|
|
{
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
GdiThreadDestroy(PETHREAD Thread)
|
|
|
|
{
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
[NTGDI][NTUSER] Load DirectX graphics driver at system startup (#4551)
CORE-18221
Load the DirectX graphics kernel driver (dxg.sys) by win32k at WINSRV
initialization time, in NtUserInitialize(). Keep it always loaded in
memory, as on Windows, instead of loading it only by DirectX dlls.
This fixes the problem of acessing this driver: we need only to call
DxDdEnableDirectDraw() and do other stuff when DirectDraw/Direct3D is
required by anything. In other cases, it is called from win32k PDEV
functions when changing display mode (as in Windows). Since it's used
by other things too, it needs to be always loaded.
Otherwise, if it's not loaded, its APIs are not accessible when needed,
and execution fails.
For example, it fixes display mode change problem in VMWare, when a
new mode fails to be applied. Indeed, when it manages DirectDraw stuff,
it calls DXG routines, and therefore fails if dxg.sys isn't loaded
in memory at this moment.
- Implement InitializeGreCSRSS() initialization routine, that initializes
supplemental NTGDI/GRE data once CSRSS and WINSRV are loaded:
* Call DxDdStartupDxGraphics() inside it, which loads dxg.sys.
* Additionally, move fonts and language ID initialization there, from
win32k!DriverEntry. Confirmed by analysis on Windows.
- Call InitializeGreCSRSS() in NtUserInitialize() main initialization routine
(called by WINSRV initialization).
Moved to NTGDI from previously NTUSER place:
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2022-06-18 18:35:17 +00:00
|
|
|
BOOL
|
|
|
|
InitializeGreCSRSS(VOID)
|
|
|
|
{
|
|
|
|
/* Initialize DirectX graphics driver */
|
|
|
|
if (DxDdStartupDxGraphics(0, NULL, 0, NULL, NULL, gpepCSRSS) != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("Unable to initialize DirectX graphics\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get global language ID */
|
|
|
|
gusLanguageID = UserGetLanguageID();
|
|
|
|
|
|
|
|
/* Initialize FreeType library */
|
|
|
|
if (!InitFontSupport())
|
|
|
|
{
|
|
|
|
ERR("Unable to initialize font support\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-12-27 19:16:05 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
NtGdiInit(VOID)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|