Consolidate all kernel power management functions.
Provide prototypes and stubs for missing functions.
diff --git a/dlls/kernel/Makefile.in b/dlls/kernel/Makefile.in
index 9ddddfc..ac7449b 100644
--- a/dlls/kernel/Makefile.in
+++ b/dlls/kernel/Makefile.in
@@ -34,6 +34,7 @@
lcformat.c \
local16.c \
locale.c \
+ powermgnt.c \
process.c \
resource.c \
resource16.c \
diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec
index 6797b4d..4dfaedd 100644
--- a/dlls/kernel/kernel32.spec
+++ b/dlls/kernel/kernel32.spec
@@ -573,7 +573,7 @@
@ stdcall IsDBCSLeadByteEx(long long)
@ stub IsLSCallback
@ stub IsSLCallback
-@ stub IsSystemResumeAutomatic
+@ stdcall IsSystemResumeAutomatic()
@ stdcall IsValidCodePage(long)
@ stub IsValidLanguageGroup
@ stdcall IsValidLocale(long long)
@@ -691,7 +691,7 @@
@ stdcall RemoveDirectoryA(str)
@ stdcall RemoveDirectoryW(wstr)
@ stub RequestDeviceWakeup
-@ stub RequestWakeupLatency
+@ stdcall RequestWakeupLatency(long)
@ stdcall ResetEvent(long)
@ stub ResetWriteWatch
@ stdcall ResumeThread(long)
diff --git a/dlls/kernel/powermgnt.c b/dlls/kernel/powermgnt.c
new file mode 100644
index 0000000..d1f3847
--- /dev/null
+++ b/dlls/kernel/powermgnt.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
+ * Copyright 2003 Dimitrie O. Paun
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "winbase.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(powermgnt);
+
+/******************************************************************************
+ * GetDevicePowerState (KERNEL32.@)
+ */
+BOOL WINAPI GetDevicePowerState(HANDLE hDevice, BOOL* pfOn)
+{
+ FIXME("(hDevice %p pfOn %p): stub\n", hDevice, pfOn);
+ return TRUE; /* no information */
+}
+
+/***********************************************************************
+ * GetSystemPowerStatus (KERNEL32.@)
+ */
+BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
+{
+ FIXME("(): stub, harmless.\n");
+ return FALSE; /* no power management support */
+}
+
+/***********************************************************************
+ * IsSystemResumeAutomatic (KERNEL32.@)
+ */
+BOOL WINAPI IsSystemResumeAutomatic(void)
+{
+ FIXME("(): stub, harmless.\n");
+ return FALSE;
+}
+
+/***********************************************************************
+ * RequestWakeupLatency (KERNEL32.@)
+ */
+BOOL WINAPI RequestWakeupLatency(LATENCY_TIME latency)
+{
+ FIXME("(): stub, harmless.\n");
+ return TRUE;
+}
+
+/***********************************************************************
+ * SetSystemPowerState (KERNEL32.@)
+ */
+BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
+ BOOL force_flag)
+{
+ FIXME("(): stub, harmless.\n");
+ /* suspend_or_hibernate flag: w95 does not support
+ this feature anyway */
+
+ for ( ;0; )
+ {
+ if ( force_flag )
+ {
+ }
+ else
+ {
+ }
+ }
+ return TRUE;
+}
+
+/***********************************************************************
+ * SetThreadExecutionState (KERNEL32.@)
+ *
+ * Informs the system that activity is taking place for
+ * power management purposes.
+ */
+EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE flags)
+{
+ static EXECUTION_STATE current =
+ ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_USER_PRESENT;
+ EXECUTION_STATE old = current;
+
+ FIXME("(0x%lx): stub, harmless.\n", flags);
+
+ if (!(current & ES_CONTINUOUS) || (flags & ES_CONTINUOUS))
+ current = flags;
+ return old;
+}
diff --git a/dlls/kernel/thread.c b/dlls/kernel/thread.c
index a8d83df..d9cafd9 100644
--- a/dlls/kernel/thread.c
+++ b/dlls/kernel/thread.c
@@ -238,25 +238,6 @@
}
-/***********************************************************************
- * SetThreadExecutionState (KERNEL32.@)
- *
- * Informs the system that activity is taking place for
- * power management purposes.
- */
-EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE flags)
-{
- static EXECUTION_STATE current =
- ES_SYSTEM_REQUIRED|ES_DISPLAY_REQUIRED|ES_USER_PRESENT;
- EXECUTION_STATE old = current;
-
- if (!(current & ES_CONTINUOUS) || (flags & ES_CONTINUOUS))
- current = flags;
- FIXME("(0x%lx): stub, harmless (power management).\n", flags);
- return old;
-}
-
-
/* callback for QueueUserAPC */
static void CALLBACK call_user_apc( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3 )
{
diff --git a/include/winbase.h b/include/winbase.h
index 365c6a7..7298ff6 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1441,6 +1441,7 @@
DWORD WINAPI InitializeAcl(PACL,DWORD,DWORD);
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
BOOL WINAPI InitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
+BOOL WINAPI IsSystemResumeAutomatic(void);
BOOL WINAPI IsTextUnicode(CONST LPVOID lpBuffer, int cb, LPINT lpi);
BOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
BOOL WINAPI IsValidSid(PSID);
@@ -1514,6 +1515,7 @@
BOOL WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG);
BOOL WINAPI ReportEventA(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCSTR *,LPVOID);
BOOL WINAPI ReportEventW(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCWSTR *,LPVOID);
+BOOL WINAPI RequestWakeupLatency(LATENCY_TIME latency);
#define ReportEvent WINELIB_NAME_AW(ReportEvent)
BOOL WINAPI ResetEvent(HANDLE);
DWORD WINAPI ResumeThread(HANDLE);
diff --git a/include/winnt.h b/include/winnt.h
index ca3a0f7..e56fa5b 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -3375,6 +3375,13 @@
#define REG_QWORD 11 /* QWORD in little endian format */
#define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
+/* ----------------------------- begin power management --------------------- */
+
+typedef enum _LATENCY_TIME {
+ LT_DONT_CARE,
+ LT_LOWEST_LATENCY
+} LATENCY_TIME, *PLATENCY_TIME;
+
/* ----------------------------- begin registry ----------------------------- */
/* Registry security values */
diff --git a/win32/newfns.c b/win32/newfns.c
index 9c3ac40..9ab2b76 100644
--- a/win32/newfns.c
+++ b/win32/newfns.c
@@ -42,7 +42,6 @@
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win32);
-WINE_DECLARE_DEBUG_CHANNEL(debug);
/****************************************************************************
@@ -51,37 +50,7 @@
BOOL WINAPI FlushInstructionCache(HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize)
{
if (GetVersion() & 0x80000000) return TRUE; /* not NT, always TRUE */
- FIXME_(debug)("(0x%08lx,%p,0x%08lx): stub\n",(DWORD)hProcess, lpBaseAddress, dwSize);
- return TRUE;
-}
-
-/***********************************************************************
- * GetSystemPowerStatus (KERNEL32.@)
- */
-BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
-{
- return FALSE; /* no power management support */
-}
-
-
-/***********************************************************************
- * SetSystemPowerState (KERNEL32.@)
- */
-BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
- BOOL force_flag)
-{
- /* suspend_or_hibernate flag: w95 does not support
- this feature anyway */
-
- for ( ;0; )
- {
- if ( force_flag )
- {
- }
- else
- {
- }
- }
+ FIXME("(%p,%p,0x%08lx): stub\n",hProcess, lpBaseAddress, dwSize);
return TRUE;
}
@@ -201,15 +170,6 @@
return FALSE;
}
-/******************************************************************************
- * GetDevicePowerState (KERNEL32.@)
- */
-BOOL WINAPI GetDevicePowerState(HANDLE hDevice, BOOL* pfOn)
-{
- FIXME("(hDevice %p pfOn %p): stub\n", hDevice, pfOn);
- return TRUE; /* no information */
-}
-
/***********************************************************************
* Beep (KERNEL32.@)
*/