From cbefdefb0206f30368a940b37e4b476b2f99624c Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Tue, 12 Aug 2003 18:56:54 +0000 Subject: [PATCH] Consolidate all kernel power management functions. Provide prototypes and stubs for missing functions. --- dlls/kernel/Makefile.in | 1 + dlls/kernel/kernel32.spec | 4 +- dlls/kernel/powermgnt.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/kernel/thread.c | 19 --------- include/winbase.h | 2 + include/winnt.h | 7 ++++ win32/newfns.c | 42 +------------------ 7 files changed, 113 insertions(+), 62 deletions(-) create mode 100644 dlls/kernel/powermgnt.c diff --git a/dlls/kernel/Makefile.in b/dlls/kernel/Makefile.in index 9ddddfcba15..ac7449b1cdf 100644 --- a/dlls/kernel/Makefile.in +++ b/dlls/kernel/Makefile.in @@ -34,6 +34,7 @@ C_SRCS = \ 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 6797b4d982e..4dfaeddfb09 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 00000000000..d1f3847e027 --- /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 a8d83df6ebe..d9cafd9df99 100644 --- a/dlls/kernel/thread.c +++ b/dlls/kernel/thread.c @@ -238,25 +238,6 @@ DWORD WINAPI SetThreadIdealProcessor( } -/*********************************************************************** - * 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 365c6a714d4..7298ff6fc15 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1441,6 +1441,7 @@ BOOL WINAPI HeapWalk(HANDLE,LPPROCESS_HEAP_ENTRY); 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 ReleaseMutex(HANDLE); 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 ca3a0f74224..e56fa5b8c02 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -3375,6 +3375,13 @@ typedef enum tagSID_NAME_USE { #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 9c3ac40a32b..9ab2b760273 100644 --- a/win32/newfns.c +++ b/win32/newfns.c @@ -42,7 +42,6 @@ at a later date. */ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(win32); -WINE_DECLARE_DEBUG_CHANNEL(debug); /**************************************************************************** @@ -51,37 +50,7 @@ WINE_DECLARE_DEBUG_CHANNEL(debug); 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 @@ BOOL WINAPI GetQueuedCompletionStatus( 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.@) */ -- 2.11.4.GIT