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

commit cd8305494cfb7ee4f75c52c0ec737a98a9297c34
Author:     Hervé Poussineau <[email protected]>
AuthorDate: Sun Jun 5 14:49:47 2022 +0200
Commit:     Hervé Poussineau <[email protected]>
CommitDate: Sun Jun 5 14:49:47 2022 +0200

    [WIN32SS:ENG] Fix handling of Acceleration.Level parameter (was not read 
anymore)
---
 win32ss/gdi/eng/device.c  | 43 +++++++++++++++++++++++++++++++++----------
 win32ss/gdi/eng/device.h  | 11 ++++++++---
 win32ss/gdi/eng/ldevobj.c |  2 +-
 win32ss/gdi/eng/mdevobj.c |  2 ++
 4 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c
index 3bd3827c9e7..7940a059752 100644
--- a/win32ss/gdi/eng/device.c
+++ b/win32ss/gdi/eng/device.c
@@ -167,21 +167,12 @@ EngpGetRegistryHandleFromDeviceMap(
 NTSTATUS
 EngpGetDisplayDriverParameters(
     _In_ PGRAPHICS_DEVICE pGraphicsDevice,
-    _Out_ PDEVMODEW pdm,
-    _Out_opt_ PDWORD pdwAccelerationLevel)
+    _Out_ PDEVMODEW pdm)
 {
     HKEY hKey;
-    DWORD dwDummy;
     NTSTATUS Status;
     RTL_QUERY_REGISTRY_TABLE DisplaySettingsTable[] =
     {
-        {
-            NULL,
-            RTL_QUERY_REGISTRY_DIRECT,
-            L"Acceleration.Level",
-            pdwAccelerationLevel ? pdwAccelerationLevel : &dwDummy,
-            REG_NONE, NULL, 0
-        },
 #define READ(field, str) \
         { \
             NULL, \
@@ -219,6 +210,38 @@ EngpGetDisplayDriverParameters(
     return Status;
 }
 
+DWORD
+EngpGetDisplayDriverAccelerationLevel(
+    _In_ PGRAPHICS_DEVICE pGraphicsDevice)
+{
+    HKEY hKey;
+    DWORD dwAccelerationLevel = 0;
+    RTL_QUERY_REGISTRY_TABLE DisplaySettingsTable[] =
+    {
+        {
+            NULL,
+            RTL_QUERY_REGISTRY_DIRECT,
+            L"Acceleration.Level",
+            &dwAccelerationLevel,
+            REG_NONE, NULL, 0
+        },
+        {0}
+    };
+
+    hKey = EngpGetRegistryHandleFromDeviceMap(pGraphicsDevice);
+    if (!hKey)
+        return 0;
+
+    RtlQueryRegistryValues(RTL_REGISTRY_HANDLE,
+                           (PWSTR)hKey,
+                           DisplaySettingsTable,
+                           NULL,
+                           NULL);
+    ZwClose(hKey);
+
+    return dwAccelerationLevel;
+}
+
 extern VOID
 UserRefreshDisplay(IN PPDEVOBJ ppdev);
 
diff --git a/win32ss/gdi/eng/device.h b/win32ss/gdi/eng/device.h
index 5791e5a5591..a7d352c6bbe 100644
--- a/win32ss/gdi/eng/device.h
+++ b/win32ss/gdi/eng/device.h
@@ -38,15 +38,20 @@ EngpUpdateGraphicsDeviceList(VOID);
 /* Read configuration of a graphics card from registry:
  * - pGraphicsDevice: instance of the graphics card
  * - pdm: on output, contains the values read in registry
- * - pdwAccelerationLevel: acceleration level stored in registry
  * Return value: a STATUS_* value
  * Assume that pdm has already been zero-filled.
  * Note that dmFields is not updated. */
 NTSTATUS
 EngpGetDisplayDriverParameters(
     _In_ PGRAPHICS_DEVICE pGraphicsDevice,
-    _Out_ PDEVMODEW pdm,
-    _Out_opt_ PDWORD pdwAccelerationLevel);
+    _Out_ PDEVMODEW pdm);
+
+/* Read acceleration level of a graphics card from registry
+ * - pGraphicsDevice: instance of the graphics card
+ * - Return value: acceleration level stored in registry */
+DWORD
+EngpGetDisplayDriverAccelerationLevel(
+    _In_ PGRAPHICS_DEVICE pGraphicsDevice);
 
 CODE_SEG("INIT")
 NTSTATUS
diff --git a/win32ss/gdi/eng/ldevobj.c b/win32ss/gdi/eng/ldevobj.c
index b7626f92886..6408c20648f 100644
--- a/win32ss/gdi/eng/ldevobj.c
+++ b/win32ss/gdi/eng/ldevobj.c
@@ -750,7 +750,7 @@ LDEVOBJ_bProbeAndCaptureDevmode(
 
     /* At first, load information from registry */
     RtlZeroMemory(&dmSearch, sizeof(dmSearch));
-    Status = EngpGetDisplayDriverParameters(pGraphicsDevice, &dmSearch, NULL);
+    Status = EngpGetDisplayDriverParameters(pGraphicsDevice, &dmSearch);
     if (!NT_SUCCESS(Status))
     {
         ERR("EngpGetDisplayDriverParameters() failed with status 0x%08x\n", 
Status);
diff --git a/win32ss/gdi/eng/mdevobj.c b/win32ss/gdi/eng/mdevobj.c
index 620e5451f8c..6badcc783bb 100644
--- a/win32ss/gdi/eng/mdevobj.c
+++ b/win32ss/gdi/eng/mdevobj.c
@@ -105,6 +105,8 @@ MDEVOBJ_Create(
             dmDefault.dmSize = sizeof(dmDefault);
         }
 
+        dwAccelerationLevel = 
EngpGetDisplayDriverAccelerationLevel(pGraphicsDevice);
+
         /* Get or create a PDEV for these settings */
         if (LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, pdm ? pdm : 
&dmDefault, &localPdm, !pdm))
         {

Reply via email to