mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 23:55:07 +00:00
Don't crash when starting a 2nd GUI application when booted in console mode
svn path=/trunk/; revision=29955
This commit is contained in:
parent
babcc56c4a
commit
2b88e1ebf0
|
@ -96,8 +96,8 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
||||||
{
|
{
|
||||||
static WCHAR DefaultPath[] = L"\\SystemRoot\\System32\\";
|
static WCHAR DefaultPath[] = L"\\SystemRoot\\System32\\";
|
||||||
static WCHAR DefaultExtension[] = L".DLL";
|
static WCHAR DefaultExtension[] = L".DLL";
|
||||||
|
PGD_ENABLEDRIVER ExistingDriver;
|
||||||
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
||||||
GRAPHICS_DRIVER *Driver = DriverList;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
LPWSTR FullName;
|
LPWSTR FullName;
|
||||||
LPCWSTR p;
|
LPCWSTR p;
|
||||||
|
@ -152,22 +152,26 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First see if the driver hasn't already been loaded */
|
/* First see if the driver hasn't already been loaded */
|
||||||
while (Driver && FullName)
|
ExistingDriver = DRIVER_FindExistingDDIDriver(FullName);
|
||||||
|
if (ExistingDriver)
|
||||||
{
|
{
|
||||||
if (!_wcsicmp( Driver->Name, FullName))
|
ExFreePool(FullName);
|
||||||
{
|
return ExistingDriver;
|
||||||
return Driver->EnableDriver;
|
|
||||||
}
|
|
||||||
Driver = Driver->Next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If not, then load it */
|
/* If not, then load it */
|
||||||
RtlInitUnicodeString (&GdiDriverInfo.DriverName, FullName);
|
RtlInitUnicodeString (&GdiDriverInfo.DriverName, FullName);
|
||||||
Status = ZwSetSystemInformation (SystemLoadGdiDriverInformation, &GdiDriverInfo, sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
Status = ZwSetSystemInformation (SystemLoadGdiDriverInformation, &GdiDriverInfo, sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||||
ExFreePool(FullName);
|
|
||||||
if (!NT_SUCCESS(Status)) return NULL;
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ExFreePool(FullName);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
DRIVER_RegisterDriver( L"DISPLAY", GdiDriverInfo.EntryPoint);
|
DRIVER_RegisterDriver( L"DISPLAY", GdiDriverInfo.EntryPoint);
|
||||||
|
DRIVER_RegisterDriver( FullName, GdiDriverInfo.EntryPoint);
|
||||||
|
ExFreePool(FullName);
|
||||||
return (PGD_ENABLEDRIVER)GdiDriverInfo.EntryPoint;
|
return (PGD_ENABLEDRIVER)GdiDriverInfo.EntryPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,12 +293,11 @@ IntGetWindowStationObject(PWINSTATION_OBJECT Object)
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntInitializeDesktopGraphics(VOID)
|
co_IntInitializeDesktopGraphics(VOID)
|
||||||
{
|
{
|
||||||
UNICODE_STRING DriverName;
|
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
|
||||||
if (! IntCreatePrimarySurface())
|
if (! IntCreatePrimarySurface())
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
RtlInitUnicodeString(&DriverName, L"DISPLAY");
|
|
||||||
ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
|
ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
|
||||||
if (NULL == ScreenDeviceContext)
|
if (NULL == ScreenDeviceContext)
|
||||||
{
|
{
|
||||||
|
|
|
@ -530,17 +530,18 @@ IntPrepareDriver()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlFreeUnicodeString(&DriverFileNames);
|
|
||||||
|
|
||||||
if (!GotDriver)
|
if (!GotDriver)
|
||||||
{
|
{
|
||||||
ObDereferenceObject(PrimarySurface.VideoFileObject);
|
ObDereferenceObject(PrimarySurface.VideoFileObject);
|
||||||
|
RtlFreeUnicodeString(&DriverFileNames);
|
||||||
DPRINT1("No suitable DDI driver found\n");
|
DPRINT1("No suitable DDI driver found\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Display driver %S loaded\n", CurrentName);
|
DPRINT("Display driver %S loaded\n", CurrentName);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&DriverFileNames);
|
||||||
|
|
||||||
DPRINT("Building DDI Functions\n");
|
DPRINT("Building DDI Functions\n");
|
||||||
|
|
||||||
/* Construct DDI driver function dispatch table */
|
/* Construct DDI driver function dispatch table */
|
||||||
|
@ -800,6 +801,8 @@ IntDestroyPrimarySurface()
|
||||||
PrimarySurface.DriverFunctions.DisableSurface(PrimarySurface.PDev);
|
PrimarySurface.DriverFunctions.DisableSurface(PrimarySurface.PDev);
|
||||||
PrimarySurface.DriverFunctions.DisablePDEV(PrimarySurface.PDev);
|
PrimarySurface.DriverFunctions.DisablePDEV(PrimarySurface.PDev);
|
||||||
PrimarySurface.PreparedDriver = FALSE;
|
PrimarySurface.PreparedDriver = FALSE;
|
||||||
|
KeSetEvent(&VideoDriverNeedsPreparation, 1, FALSE);
|
||||||
|
KeResetEvent(&VideoDriverPrepared);
|
||||||
|
|
||||||
DceEmptyCache();
|
DceEmptyCache();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue