[WIN32SS] Remove now unused code

Initialization of device mode list will be done later, just before switching to graphics mode.

If no graphic display is available, we will now fail when starting first GUI application in
co_IntGraphicsCheck(). Add a bugcheck here to prevent frozen screen.
This commit is contained in:
Hervé Poussineau 2022-03-20 17:56:23 +01:00 committed by hpoussin
parent 2d2824f1b9
commit 494de7c2df
5 changed files with 6 additions and 68 deletions

View file

@ -124,48 +124,6 @@ EngpUpdateGraphicsDeviceList(VOID)
return STATUS_SUCCESS;
}
BOOLEAN
EngpPopulateDeviceModeList(
_Inout_ PGRAPHICS_DEVICE pGraphicsDevice,
_In_ PDEVMODEW pdmDefault)
{
PDEVMODEINFO pdminfo;
PDEVMODEW pdm, pdmSelected;
ULONG i;
ASSERT(pGraphicsDevice->pdevmodeInfo == NULL);
ASSERT(pGraphicsDevice->pDevModeList == NULL);
if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, pdmDefault, &pdmSelected, TRUE))
{
ERR("LDEVOBJ_bProbeAndCaptureDevmode() failed\n");
return FALSE;
}
/* Loop through all DEVMODEINFOs */
for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0;
pdminfo;
pdminfo = pdminfo->pdmiNext)
{
/* Loop through the DEVMODEs */
for (i = 0; i < pGraphicsDevice->cDevModes; i++)
{
pdm = pGraphicsDevice->pDevModeList[i].pdm;
/* Compare with the selected entry */
if (pdm->dmSize == pdmSelected->dmSize &&
RtlCompareMemory(pdm, pdmSelected, pdm->dmSize) == pdm->dmSize)
{
pGraphicsDevice->iDefaultMode = i;
pGraphicsDevice->iCurrentMode = i;
TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
break;
}
}
}
return TRUE;
}
extern VOID
UserRefreshDisplay(IN PPDEVOBJ ppdev);
@ -235,8 +193,7 @@ NTAPI
EngpRegisterGraphicsDevice(
_In_ PUNICODE_STRING pustrDeviceName,
_In_ PUNICODE_STRING pustrDiplayDrivers,
_In_ PUNICODE_STRING pustrDescription,
_In_ PDEVMODEW pdmDefault)
_In_ PUNICODE_STRING pustrDescription)
{
PGRAPHICS_DEVICE pGraphicsDevice;
PDEVICE_OBJECT pDeviceObject;
@ -335,21 +292,14 @@ EngpRegisterGraphicsDevice(
pustrDescription->Length);
pGraphicsDevice->pwszDescription[pustrDescription->Length/sizeof(WCHAR)] = 0;
/* Initialize the pdevmodeInfo list and default index */
/* Initialize the pdevmodeInfo list */
pGraphicsDevice->pdevmodeInfo = NULL;
pGraphicsDevice->iDefaultMode = 0;
pGraphicsDevice->iCurrentMode = 0;
// FIXME: initialize state flags
pGraphicsDevice->StateFlags = 0;
/* Create the mode list */
pGraphicsDevice->pDevModeList = NULL;
if (!EngpPopulateDeviceModeList(pGraphicsDevice, pdmDefault))
{
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
/* Lock loader */
EngAcquireSemaphore(ghsemGraphicsDeviceList);

View file

@ -30,13 +30,7 @@ NTAPI
EngpRegisterGraphicsDevice(
_In_ PUNICODE_STRING pustrDeviceName,
_In_ PUNICODE_STRING pustrDiplayDrivers,
_In_ PUNICODE_STRING pustrDescription,
_In_ PDEVMODEW pdmDefault);
BOOLEAN
EngpPopulateDeviceModeList(
_Inout_ PGRAPHICS_DEVICE pGraphicsDevice,
_In_ PDEVMODEW pdmDefault);
_In_ PUNICODE_STRING pustrDescription);
NTSTATUS
EngpUpdateGraphicsDeviceList(VOID);

View file

@ -74,8 +74,6 @@ typedef struct _GRAPHICS_DEVICE
PVOID pUnknown;
PFILE_OBJECT FileObject;
DWORD ProtocolType;
ULONG iDefaultMode;
ULONG iCurrentMode;
} GRAPHICS_DEVICE, *PGRAPHICS_DEVICE;
typedef struct _PDEVOBJ

View file

@ -73,7 +73,6 @@ InitDisplayDriver(
WCHAR awcBuffer[128];
ULONG cbSize;
HKEY hkey;
DEVMODEW dmDefault;
DWORD dwVga;
TRACE("InitDisplayDriver(%S, %S);\n",
@ -126,9 +125,6 @@ InitDisplayDriver(
RtlInitUnicodeString(&ustrDescription, L"<unknown>");
}
/* Query the default settings */
RegReadDisplaySettings(hkey, &dmDefault);
/* Query if this is a VGA compatible driver */
cbSize = sizeof(DWORD);
Status = RegQueryValue(hkey, L"VgaCompatible", REG_DWORD, &dwVga, &cbSize);
@ -141,8 +137,7 @@ InitDisplayDriver(
RtlInitUnicodeString(&ustrDeviceName, pwszDeviceName);
pGraphicsDevice = EngpRegisterGraphicsDevice(&ustrDeviceName,
&ustrDisplayDrivers,
&ustrDescription,
&dmDefault);
&ustrDescription);
if (pGraphicsDevice && dwVga)
{
pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_VGA_COMPATIBLE;

View file

@ -41,7 +41,8 @@ DceCreateDisplayDC(VOID)
{
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
co_IntGraphicsCheck(TRUE);
if (!co_IntGraphicsCheck(TRUE))
KeBugCheckEx(VIDEO_DRIVER_INIT_FAILURE, 0, 0, 0, USER_VERSION);
return IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
}