Author: dchapyshev
Date: Thu Jan 15 10:09:03 2009
New Revision: 38770
URL:
http://svn.reactos.org/svn/reactos?rev=38770&view=rev
Log:
- Implement GetDevicePowerState
- Implement RequestWakeupLatency
- Add prototypes for GetDevicePowerState and RequestWakeupLatency to pofuncs.h
Modified:
trunk/reactos/dll/win32/kernel32/misc/power.c
trunk/reactos/include/ndk/pofuncs.h
Modified: trunk/reactos/dll/win32/kernel32/misc/power.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/po…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/power.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/power.c [iso-8859-1] Thu Jan 15 10:09:03 2009
@@ -91,14 +91,30 @@
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL
WINAPI
GetDevicePowerState(HANDLE hDevice, BOOL *pfOn)
{
- STUB;
- return 0;
+ DEVICE_POWER_STATE DevicePowerState;
+ NTSTATUS Status;
+
+ Status = NtGetDevicePowerState(hDevice, &DevicePowerState);
+
+ if (NT_SUCCESS(Status))
+ {
+ if ((DevicePowerState != PowerDeviceUnspecified) &&
+ (DevicePowerState != PowerDeviceD0))
+ *pfOn = FALSE;
+ else
+ *pfOn = TRUE;
+
+ return TRUE;
+ }
+
+ SetLastErrorByStatus(Status);
+ return FALSE;
}
/*
@@ -113,14 +129,23 @@
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL
WINAPI
RequestWakeupLatency(LATENCY_TIME latency)
{
- STUB;
- return 0;
+ NTSTATUS Status;
+
+ Status = NtRequestWakeupLatency(latency);
+
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
}
/*
Modified: trunk/reactos/include/ndk/pofuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/pofuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/pofuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/pofuncs.h [iso-8859-1] Thu Jan 15 10:09:03 2009
@@ -86,4 +86,20 @@
IN SYSTEM_POWER_STATE MinSystemState,
IN ULONG Flags
);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+NtGetDevicePowerState(
+ IN HANDLE Device,
+ IN PDEVICE_POWER_STATE PowerState
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+NtRequestWakeupLatency(
+ IN LATENCY_TIME latency
+);
+
#endif