Hi
Attached patch adds the power management header "pm.h" based on
information from: http://msdn.microsoft.com/en-us/library/aa909892.aspx
All these functions are in coredll
...but the patch has two issues (one show stopper).
1. issue (the show stopper) :
The function SetSystemPowerState is declared in winbase.h which is
correct for win32 systems but not for wince, so I moved the wince
declaration to pm.h and added a "#if (_WIN32_WINNT >= 0x0400)" guard to
winbase.h. Now the problem is that the guard in winbase.h does not work
with arm-mingw32ce-gcc and I get:
error: conflicting types for 'SetSystemPowerState'
As far as I can tell _WIN32_WINNT is not defined anywhere with
arm-mingw32ce-gcc
arm-mingw32ce-gcc -dM -E - < /dev/null |grep WINNT
#define __WINNT 1
#define __WINNT__ 1
#define WINNT 1
so why is the _WIN32_WINNT guard not working? I am missing something?
2. issue (non show stopper):
pm.h are missing some defines e.g POWER_NAME, POWER_FORCE and
POWER_STATE_XYZ but I do not know the correct values and I cannot find
them on MSDN. If anyone can pitch in on the missing definions that would
be very good.
Thanks
Lars Munch
Index: cegcc/src/w32api/include/pm.h
===================================================================
--- cegcc/src/w32api/include/pm.h (revision 0)
+++ cegcc/src/w32api/include/pm.h (revision 0)
@@ -0,0 +1,49 @@
+#ifndef _PM_H
+#define _PM_H
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _WIN32_WCE >= 400
+
+typedef enum _CEDEVICE_POWER_STATE {
+ PwrDeviceUnspecified = -1,
+ D0 = 0,
+ D1,
+ D2,
+ D3,
+ D4,
+ PwrDeviceMaximum
+} CEDEVICE_POWER_STATE, *PCEDEVICE_POWER_STATE;
+
+typedef struct _POWER_CAPABILITIES {
+ UCHAR DeviceDx;
+ UCHAR WakeFromDx;
+ UCHAR InrushDx;
+ DWORD Power[5];
+ DWORD Latency[5];
+ DWORD Flags;
+} POWER_CAPABILITIES, *PPOWER_CAPABILITIES;
+
+DWORD DevicePowerNotify(PVOID,CEDEVICE_POWER_STATE,DWORD);
+DWORD GetDevicePower(PVOID,DWORD,PCEDEVICE_POWER_STATE);
+DWORD GetSystemPowerState(LPWSTR,DWORD,PDWORD);
+HANDLE RegisterPowerRelationship(PVOID,PVOID,PPOWER_CAPABILITIES,DWORD);
+DWORD ReleasePowerRelationship(HANDLE);
+DWORD ReleasePowerRequirement(HANDLE);
+HANDLE RequestPowerNotifications(HANDLE,DWORD);
+DWORD SetDevicePower(PVOID,DWORD,CEDEVICE_POWER_STATE);
+HANDLE SetPowerRequirement(PVOID,CEDEVICE_POWER_STATE,ULONG,PVOID,ULONG);
+DWORD SetSystemPowerState(LPCWSTR,DWORD,DWORD);
+
+#endif /* _WIN32_WCE >= 400 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not _PM_H */
Index: cegcc/src/w32api/include/winbase.h
===================================================================
--- cegcc/src/w32api/include/winbase.h (revision 1205)
+++ cegcc/src/w32api/include/winbase.h (working copy)
@@ -2027,10 +2027,7 @@
WINBASEAPI BOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,BOOL,PACL,BOOL);
WINBASEAPI BOOL WINAPI SetStdHandle(DWORD,HANDLE);
#define SetSwapAreaSize(w) (w)
-#if (_WIN32_WCE >= 0x0400)
-WINBASEAPI DWORD WINAPI SetSystemPowerState(LPCWSTR, DWORD, DWORD);
-#else
-/* Only on Windows Server 2008, Windows Server 2003, or Windows 2000 Server. */
+#if (_WIN32_WINNT >= 0x0400)
WINBASEAPI BOOL WINAPI SetSystemPowerState(BOOL,BOOL);
#endif
WINBASEAPI BOOL WINAPI SetSystemTime(const SYSTEMTIME*);
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel