https://git.reactos.org/?p=reactos.git;a=commitdiff;h=63e59e10f30c7f0214599736032deb14eadb23d3

commit 63e59e10f30c7f0214599736032deb14eadb23d3
Author:     Hervé Poussineau <[email protected]>
AuthorDate: Sun May 22 22:43:12 2022 +0200
Commit:     Hervé Poussineau <[email protected]>
CommitDate: Sun May 22 23:42:00 2022 +0200

    Revert "[WIN32SS] Only refresh graphics mode list when iModeNum = 0"
    
    This reverts commit c243133b2c598bd004229242f36d9159a8e45b99.
    
    Without the revert, VirtualBox auto-resize doesn't work on first attempt,
    but only on next ones.
    However, according to documentation, we must only initialize device and
    cache information when iModeNum = 0.
    
    CORE-18189
---
 win32ss/user/ntuser/display.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/win32ss/user/ntuser/display.c b/win32ss/user/ntuser/display.c
index c3751517527..8f15a68e1bf 100644
--- a/win32ss/user/ntuser/display.c
+++ b/win32ss/user/ntuser/display.c
@@ -412,36 +412,27 @@ UserEnumDisplaySettings(
     PGRAPHICS_DEVICE pGraphicsDevice;
     PDEVMODEENTRY pdmentry;
     ULONG i, iFoundMode;
+    PPDEVOBJ ppdev;
 
     TRACE("Enter UserEnumDisplaySettings('%wZ', %lu)\n",
           pustrDevice, iModeNum);
 
     /* Ask GDI for the GRAPHICS_DEVICE */
     pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0);
-    if (!pGraphicsDevice)
+    ppdev = EngpGetPDEV(pustrDevice);
+
+    if (!pGraphicsDevice || !ppdev)
     {
         /* No device found */
         ERR("No device found!\n");
         return STATUS_INVALID_PARAMETER_1;
     }
 
-    if (iModeNum == 0)
-    {
-        PPDEVOBJ ppdev;
-        ppdev = EngpGetPDEV(pustrDevice);
-        if (!ppdev)
-        {
-            /* No device found */
-            ERR("No device found!\n");
-            return STATUS_INVALID_PARAMETER_1;
-        }
-
-        /* Let's politely ask the driver for an updated mode list,
-         * just in case there's something new in there (vbox) */
+    /* let's politely ask the driver for an updated mode list,
+       just in case there's something new in there (vbox) */
 
-        PDEVOBJ_vRefreshModeList(ppdev);
-        PDEVOBJ_vRelease(ppdev);
-    }
+    PDEVOBJ_vRefreshModeList(ppdev);
+    PDEVOBJ_vRelease(ppdev);
 
     iFoundMode = 0;
     for (i = 0; i < pGraphicsDevice->cDevModes; i++)

Reply via email to