[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 30 Oct 2010 16:34:52 +0000 (16:34 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 30 Oct 2010 16:34:52 +0000 (16:34 +0000)
Fix a bug in InitVideo: when looping through the adapters, reinitialize the cbValue before querying the registry.
Also handle failure.

svn path=/trunk/; revision=49360

reactos/subsystems/win32/win32k/ntuser/display.c

index 7ab5363..95f4aee 100644 (file)
@@ -206,14 +206,19 @@ InitVideo(
     DPRINT("Found %ld devices\n", ulMaxObjectNumber);
 
     /* Loop through all adapters */
     DPRINT("Found %ld devices\n", ulMaxObjectNumber);
 
     /* Loop through all adapters */
-    cbValue = 256;
     for (iDevNum = 0; iDevNum <= ulMaxObjectNumber; iDevNum++)
     {
         /* Create the adapter's key name */
         swprintf(awcDeviceName, L"\\Device\\Video%lu", iDevNum);
 
         /* Read the reg key name */
     for (iDevNum = 0; iDevNum <= ulMaxObjectNumber; iDevNum++)
     {
         /* Create the adapter's key name */
         swprintf(awcDeviceName, L"\\Device\\Video%lu", iDevNum);
 
         /* Read the reg key name */
+        cbValue = sizeof(awcBuffer);
         Status = RegQueryValue(hkey, awcDeviceName, REG_SZ, awcBuffer, &cbValue);
         Status = RegQueryValue(hkey, awcDeviceName, REG_SZ, awcBuffer, &cbValue);
+        if (!NT_SUCCESS(Status))
+        {
+            DPRINT1("failed to query the registry path:0x%lx\n", Status);
+            continue;
+        }
 
         pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
 
 
         pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);