[NTOSKRNL] IopGetDeviceProperty: Initialize power data struct and convert flags from...
authorEric Kohl <eric.kohl@reactos.org>
Sat, 25 Aug 2018 17:49:29 +0000 (19:49 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 25 Aug 2018 17:49:29 +0000 (19:49 +0200)
ntoskrnl/io/pnpmgr/plugplay.c

index 4c65792..83a4cb6 100644 (file)
@@ -365,15 +365,33 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
 //            Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities);
 
             PowerData = (PCM_POWER_DATA)Buffer;
+
+            RtlZeroMemory(PowerData, sizeof(CM_POWER_DATA));
             PowerData->PD_Size = sizeof(CM_POWER_DATA);
+//            PowerData->PD_MostRecentPowerState;
+            PowerData->PD_Capabilities = PDCAP_D0_SUPPORTED | PDCAP_D3_SUPPORTED;
 /*
-            PowerData->PD_MostRecentPowerState;
-            PowerData->PD_Capabilities;
-            PowerData->PD_D1Latency;
-            PowerData->PD_D2Latency;
-            PowerData->PD_D3Latency;
-            PowerData->PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM];
-            PowerData->PD_DeepestSystemWake;
+            if (DeviceCapabilities.DeviceD1)
+                PowerData->PD_Capabilities |= PDCAP_D1_SUPPORTED;
+            if (DeviceCapabilities.DeviceD2)
+                PowerData->PD_Capabilities |= PDCAP_D2_SUPPORTED;
+            if (DeviceCapabilities.WakeFromD0)
+                PowerData->PD_Capabilities |= PDCAP_WAKE_FROM_D0_SUPPORTED;
+            if (DeviceCapabilities.WakeFromD1)
+                PowerData->PD_Capabilities |= PDCAP_WAKE_FROM_D1_SUPPORTED;
+            if (DeviceCapabilities.WakeFromD2)
+                PowerData->PD_Capabilities |= PDCAP_WAKE_FROM_D2_SUPPORTED;
+            if (DeviceCapabilities.WakeFromD3)
+                PowerData->PD_Capabilities |= PDCAP_WAKE_FROM_D3_SUPPORTED;
+            if (DeviceCapabilities.WarmEjectSupported)
+                PowerData->PD_Capabilities |= PDCAP_WARM_EJECT_SUPPORTED;
+            PowerData->PD_D1Latency = DeviceCapabilities.D1Latency;
+            PowerData->PD_D2Latency = DeviceCapabilities.D2Latency;
+            PowerData->PD_D3Latency = DeviceCapabilities.D3Latency;
+            RtlCopyMemory(&PowerData->PD_PowerStateMapping,
+                          &DeviceCapabilities.DeviceState,
+                          sizeof(DeviceCapabilities.DeviceState));
+            PowerData->PD_DeepestSystemWake = DeviceCapabilities.SystemWake;
 */
         }
     }