Power Management Consolidation

Dimitrie O. Paun dpaun at rogers.com
Mon Aug 11 22:39:01 CDT 2003


ChangeLog
  Consolidate all kernel power management functions.
  Provide prototypes and stubs for missing functions.

Index: include/winbase.h
===================================================================
RCS file: /var/cvs/wine/include/winbase.h,v
retrieving revision 1.188
diff -u -r1.188 winbase.h
--- include/winbase.h	26 Jul 2003 20:29:06 -0000	1.188
+++ include/winbase.h	11 Aug 2003 15:32:51 -0000
@@ -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);
Index: include/winnt.h
===================================================================
RCS file: /var/cvs/wine/include/winnt.h,v
retrieving revision 1.162
diff -u -r1.162 winnt.h
--- include/winnt.h	19 Jul 2003 03:01:04 -0000	1.162
+++ include/winnt.h	11 Aug 2003 15:23:27 -0000
@@ -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 */
Index: dlls/kernel/thread.c
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/thread.c,v
retrieving revision 1.2
diff -u -r1.2 thread.c
--- dlls/kernel/thread.c	9 Jul 2003 02:57:57 -0000	1.2
+++ dlls/kernel/thread.c	11 Aug 2003 15:07:07 -0000
@@ -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 )
 {
Index: win32/newfns.c
===================================================================
RCS file: /var/cvs/wine/win32/newfns.c,v
retrieving revision 1.48
diff -u -r1.48 newfns.c
--- win32/newfns.c	28 Jul 2003 19:12:33 -0000	1.48
+++ win32/newfns.c	11 Aug 2003 15:05:17 -0000
@@ -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("(0x%08lx,%p,0x%08lx): stub\n",(DWORD)hProcess, lpBaseAddress, dwSize);
     return TRUE;
 }
 
@@ -199,15 +168,6 @@
     FIXME("(%p,%p,%p,%p,%ld), stub!\n",CompletionPort,lpNumberOfBytesTransferred,lpCompletionKey,lpOverlapped,dwMilliseconds);
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
-}
-
-/******************************************************************************
- *           GetDevicePowerState   (KERNEL32.@)
- */
-BOOL WINAPI GetDevicePowerState(HANDLE hDevice, BOOL* pfOn)
-{
-    FIXME("(hDevice %p pfOn %p): stub\n", hDevice, pfOn);
-    return TRUE; /* no information */
 }
 
 /***********************************************************************
Index: dlls/kernel/kernel32.spec
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/kernel32.spec,v
retrieving revision 1.103
diff -u -r1.103 kernel32.spec
--- dlls/kernel/kernel32.spec	21 Jun 2003 02:07:10 -0000	1.103
+++ dlls/kernel/kernel32.spec	11 Aug 2003 15:12:19 -0000
@@ -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)
Index: dlls/kernel/Makefile.in
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/Makefile.in,v
retrieving revision 1.74
diff -u -r1.74 Makefile.in
--- dlls/kernel/Makefile.in	27 Jun 2003 19:02:23 -0000	1.74
+++ dlls/kernel/Makefile.in	11 Aug 2003 15:35:06 -0000
@@ -34,6 +34,7 @@
 	lcformat.c \
 	local16.c \
 	locale.c \
+	powermgnt.c \
 	process.c \
 	resource.c \
 	resource16.c \
--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ dlls/kernel/powermgnt.c	2003-08-11 12:05:39.000000000 -0400
@@ -0,0 +1,101 @@
+/*
+ * Copyright 1995 Thomas Sandford (tdgsandf at 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;
+}
+


-- 
Dimi.




More information about the wine-patches mailing list