Avoid copying invalid data on error.
[wine/wine-kai.git] / dlls / kernel / powermgnt.c
blob05f7566666c4176b8737abdd8755e25c6fe61388
1 /*
2 * Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
3 * Copyright 2003 Dimitrie O. Paun
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <stdarg.h>
22 #include "ntstatus.h"
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(powermgnt);
29 /******************************************************************************
30 * GetDevicePowerState (KERNEL32.@)
32 BOOL WINAPI GetDevicePowerState(HANDLE hDevice, BOOL* pfOn)
34 FIXME("(hDevice %p pfOn %p): stub\n", hDevice, pfOn);
35 return TRUE; /* no information */
38 /***********************************************************************
39 * GetSystemPowerStatus (KERNEL32.@)
41 BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
43 FIXME("(): stub, harmless.\n");
44 return FALSE; /* no power management support */
47 /***********************************************************************
48 * IsSystemResumeAutomatic (KERNEL32.@)
50 BOOL WINAPI IsSystemResumeAutomatic(void)
52 FIXME("(): stub, harmless.\n");
53 return FALSE;
56 /***********************************************************************
57 * RequestWakeupLatency (KERNEL32.@)
59 BOOL WINAPI RequestWakeupLatency(LATENCY_TIME latency)
61 FIXME("(): stub, harmless.\n");
62 return TRUE;
65 /***********************************************************************
66 * SetSystemPowerState (KERNEL32.@)
68 BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
69 BOOL force_flag)
71 FIXME("(): stub, harmless.\n");
72 /* suspend_or_hibernate flag: w95 does not support
73 this feature anyway */
75 for ( ;0; )
77 if ( force_flag )
80 else
84 return TRUE;
87 /***********************************************************************
88 * SetThreadExecutionState (KERNEL32.@)
90 * Informs the system that activity is taking place for
91 * power management purposes.
93 EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE flags)
95 static EXECUTION_STATE current =
96 ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_USER_PRESENT;
97 EXECUTION_STATE old = current;
99 FIXME("(0x%lx): stub, harmless.\n", flags);
101 if (!(current & ES_CONTINUOUS) || (flags & ES_CONTINUOUS))
102 current = flags;
103 return old;