https://git.reactos.org/?p=reactos.git;a=commitdiff;h=494de7c2dff1197fe4dfffa8f2b53a72581a1964

commit 494de7c2dff1197fe4dfffa8f2b53a72581a1964
Author:     Hervé Poussineau <[email protected]>
AuthorDate: Sun Mar 20 17:56:23 2022 +0100
Commit:     hpoussin <[email protected]>
CommitDate: Fri Apr 15 23:09:16 2022 +0200

    [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.
---
 win32ss/gdi/eng/device.c      | 54 ++-----------------------------------------
 win32ss/gdi/eng/device.h      |  8 +------
 win32ss/gdi/eng/pdevobj.h     |  2 --
 win32ss/user/ntuser/display.c |  7 +-----
 win32ss/user/ntuser/windc.c   |  3 ++-
 5 files changed, 6 insertions(+), 68 deletions(-)

diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c
index d6c38b4c6d4..037b0261a47 100644
--- a/win32ss/gdi/eng/device.c
+++ b/win32ss/gdi/eng/device.c
@@ -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);
diff --git a/win32ss/gdi/eng/device.h b/win32ss/gdi/eng/device.h
index 43a0dd6ebb3..cb211d4c055 100644
--- a/win32ss/gdi/eng/device.h
+++ b/win32ss/gdi/eng/device.h
@@ -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);
diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h
index c5b63b56e7d..c39717db0bf 100644
--- a/win32ss/gdi/eng/pdevobj.h
+++ b/win32ss/gdi/eng/pdevobj.h
@@ -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
diff --git a/win32ss/user/ntuser/display.c b/win32ss/user/ntuser/display.c
index eb3365f0d33..8f15a68e1bf 100644
--- a/win32ss/user/ntuser/display.c
+++ b/win32ss/user/ntuser/display.c
@@ -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;
diff --git a/win32ss/user/ntuser/windc.c b/win32ss/user/ntuser/windc.c
index 8b865dcb908..7f677b89c1f 100644
--- a/win32ss/user/ntuser/windc.c
+++ b/win32ss/user/ntuser/windc.c
@@ -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);
 }

Reply via email to