- Move SetThreadExecutionState to power.c
authorDmitry Chapyshev <dmitry@reactos.org>
Thu, 15 Jan 2009 17:07:01 +0000 (17:07 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Thu, 15 Jan 2009 17:07:01 +0000 (17:07 +0000)
- Implement IsSystemResumeAutomatic
- Implement SetThreadExecutionState

svn path=/trunk/; revision=38772

reactos/dll/win32/kernel32/misc/power.c
reactos/dll/win32/kernel32/misc/stubs.c

index e94588c..be29e3b 100644 (file)
@@ -34,6 +34,19 @@ NtRequestWakeupLatency(
     IN LATENCY_TIME latency
 );
 
+NTSYSAPI
+BOOLEAN
+NTAPI
+NtIsSystemResumeAutomatic(VOID);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+NtSetThreadExecutionState(
+    IN EXECUTION_STATE esFlags,
+    OUT EXECUTION_STATE *PreviousFlags
+);
+
 /* PUBLIC FUNCTIONS ***********************************************************/
 
 /*
@@ -181,8 +194,7 @@ BOOL
 WINAPI
 IsSystemResumeAutomatic(VOID)
 {
-    STUB;
-    return 0;
+    return NtIsSystemResumeAutomatic();
 }
 
 /*
@@ -196,3 +208,24 @@ SetMessageWaitingIndicator(HANDLE hMsgIndicator,
     STUB;
     return 0;
 }
+
+/*
+ * @implemented
+ */
+EXECUTION_STATE
+WINAPI
+SetThreadExecutionState(EXECUTION_STATE esFlags)
+{
+    EXECUTION_STATE OldFlags;
+    NTSTATUS Status;
+
+    Status = NtSetThreadExecutionState(esFlags, &OldFlags);
+
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastErrorByStatus(Status);
+        return 0;
+    }
+
+    return OldFlags;
+}
index 4bd44a5..89f2240 100644 (file)
@@ -561,26 +561,6 @@ RestoreLastError(
     STUB;
 }
 
-/*
- * @unimplemented
- */
-EXECUTION_STATE
-WINAPI
-SetThreadExecutionState(
-    EXECUTION_STATE esFlags
-    )
-{
-    static EXECUTION_STATE current =
-        ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_USER_PRESENT;
-    EXECUTION_STATE old = current;
-
-    DPRINT1("(0x%x): stub, harmless.\n", esFlags);
-
-    if (!(current & ES_CONTINUOUS) || (esFlags & ES_CONTINUOUS))
-        current = esFlags;
-    return old;
-}
-
 /*
  * @implemented
  */