https://git.reactos.org/?p=reactos.git;a=commitdiff;h=06e72331349ed1e63a244…
commit 06e72331349ed1e63a244df62cc1c5b82ba3792e
Author:     Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Aug 25 19:49:29 2018 +0200
Commit:     Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Aug 25 19:49:29 2018 +0200
    [NTOSKRNL] IopGetDeviceProperty: Initialize power data struct and convert flags from
device capabilities to power data
---
 ntoskrnl/io/pnpmgr/plugplay.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index 4c65792a4a..83a4cb6000 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -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;
 */
         }
     }